Microoptimization
Move word length check before banned emotes check
This commit is contained in:
parent
6e621098e3
commit
97daae9090
|
@ -367,7 +367,7 @@ EmoteModule.prototype.getNodes = function(node) {
|
|||
var bemotes = [];
|
||||
var spoilered = [];
|
||||
|
||||
//TODO Functional titles
|
||||
//TODO Edited emotes
|
||||
EmoteModule.prototype.injectEmote = function(node) {
|
||||
|
||||
if(typeof emotesTwitch === 'undefined') return;
|
||||
|
@ -406,13 +406,13 @@ EmoteModule.prototype.injectEmote = function(node) {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
if($.inArray(word, bemotes) != -1) return;
|
||||
|
||||
|
||||
if(word.length < 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($.inArray(word, bemotes) != -1) return;
|
||||
|
||||
if (emotesTwitch.emotes.hasOwnProperty(word)) {
|
||||
var len = Math.round(word.length / 4);
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<img class="emote" alt="' + word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3) + '" src="' + twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd + '" />' );
|
||||
|
|
Loading…
Reference in New Issue