refactor&version
This commit is contained in:
parent
bd15f51b33
commit
62a6884bc6
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var settingsPanel, emoteModule, utils, quickEmoteMenu;
|
var settingsPanel, emoteModule, utils, quickEmoteMenu;
|
||||||
var jsVersion = 1.2;
|
var jsVersion = 1.3;
|
||||||
|
|
||||||
var mainObserver;
|
var mainObserver;
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@ var ffzEmoteUrlEnd = "/1";
|
||||||
var bttvEmoteUrlStart = "";
|
var bttvEmoteUrlStart = "";
|
||||||
var bttvEmoteUrlEnd = "";
|
var bttvEmoteUrlEnd = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented":false },
|
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented":false },
|
||||||
"Public Servers": { "id": "bda-gs-1", "info": "Display public servers", "implemented":false},
|
"Public Servers": { "id": "bda-gs-1", "info": "Display public servers", "implemented":false},
|
||||||
|
@ -33,8 +31,6 @@ var settings = {
|
||||||
"Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented":false }
|
"Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented":false }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var defaultCookie = {
|
var defaultCookie = {
|
||||||
"version":jsVersion,
|
"version":jsVersion,
|
||||||
"bda-gs-0":false,
|
"bda-gs-0":false,
|
||||||
|
@ -55,7 +51,6 @@ function Core() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Core.prototype.init = function() {
|
Core.prototype.init = function() {
|
||||||
utils = new Utils();
|
utils = new Utils();
|
||||||
emoteModule = new EmoteModule();
|
emoteModule = new EmoteModule();
|
||||||
|
@ -201,27 +196,37 @@ EmoteModule.prototype.injectEmote = function(node) {
|
||||||
|
|
||||||
words.some(function(word) {
|
words.some(function(word) {
|
||||||
|
|
||||||
|
var replaced = false;
|
||||||
|
|
||||||
//Let's see how slow this is
|
if(emotesTwitch.emotes.hasOwnProperty(word)) {
|
||||||
$.each(subEmotesTwitch.channels, function() {
|
replaced = true;
|
||||||
$.each(this.emotes, function() {
|
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd + " ><\/img>");
|
||||||
if(this.code == word) {
|
}
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + this.image_id + twitchEmoteUrlEnd + " ><\/img>");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (emotesTwitch.emotes.hasOwnProperty(word)) {
|
if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"] && !replaced) {
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd + " ><\/img>");
|
if(emotesFfz.hasOwnProperty(word)) {
|
||||||
} else if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
|
replaced = true;
|
||||||
if(emotesFfz.hasOwnProperty(word)) {
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + " ><\/img>");
|
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + " ><\/img>");
|
||||||
} else if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
|
}
|
||||||
if(emotesBTTV.hasOwnProperty(word)) {
|
}
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + bttvEmoteUrlStart + emotesBTTV[word] + bttvEmoteUrlEnd + " ><\/img>");
|
|
||||||
}
|
if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"] && !replaced) {
|
||||||
|
if(emotesBTTV.hasOwnProperty(word)) {
|
||||||
|
replaced = true;
|
||||||
|
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + bttvEmoteUrlStart + emotesBTTV[word] + bttvEmoteUrlEnd + " ><\/img>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!replaced) {
|
||||||
|
$.each(subEmotesTwitch.channels, function() {
|
||||||
|
$.each(this.emotes, function() {
|
||||||
|
if(this.code == word) {
|
||||||
|
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + this.image_id + twitchEmoteUrlEnd + " ><\/img>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var oldHeight = parent.parentElement.offsetHeight;
|
var oldHeight = parent.parentElement.offsetHeight;
|
||||||
|
|
Loading…
Reference in New Issue