Merge pull request #37 from pendo324/master

Added a feature and menu option for it
This commit is contained in:
Jiiks 2015-11-19 13:43:14 +02:00
commit 9f93c813d5
2 changed files with 54 additions and 27 deletions

View File

@ -40,7 +40,8 @@ var settings = {
"BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented":true },
"Emote Autocomplete": { "id": "bda-es-3", "info": "Autocomplete emote commands", "implemented":false },
"Emote Auto Capitalization": { "id": "bda-es-4", "info": "Autocapitalize emote commands", "implemented":true },
"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 },
"Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true}
};
var defaultCookie = {
@ -55,7 +56,8 @@ var defaultCookie = {
"bda-es-2":false,
"bda-es-3":false,
"bda-es-4":false,
"bda-es-5":true
"bda-es-5":true,
"bda-es-6":true
};
var settingsCookie = {};
@ -245,33 +247,58 @@ EmoteModule.prototype.injectEmote = function(node) {
}
if(emotesTwitch.emotes.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) {
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, word.length/2) + "\uFDD9" + word.substr(word.length/2) + '" src="' + twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd + '" />');
return;
}
else {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd + " ><\/img>");
return;
}
}
if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
if(emotesFfz.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) {
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, word.length/2) + "\uFDD9" + word.substr(word.length/2) + '" src="' + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + '" />');
return;
}
else {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + " ><\/img>");
return;
}
}
}
if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
if(emotesBTTV.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) {
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, word.length/2) + "\uFDD9" + word.substr(word.length/2) + '" src="' + emotesBTTV[word] + '" />');
return;
}
else {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + emotesBTTV[word] + " ><\/img>");
return;
}
}
}
if (subEmotesTwitch.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) {
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, word.length/2) + "\uFDD9" + word.substr(word.length/2) + '" src="' + twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd + '" />');
return;
}
else {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd + " ><\/img>");
return;
}
}
});
if(parent.parentElement == null) return;
var oldHeight = parent.parentElement.offsetHeight;
parent.innerHTML = parentInnerHTML;
parent.innerHTML = parentInnerHTML.replace(new RegExp("\uFDD9", "g"), "");
var newHeight = parent.parentElement.offsetHeight;
//Scrollfix

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long