This should fix the emote edge cases for emotes of any length

This commit is contained in:
pendo324 2015-12-03 12:04:28 -05:00
parent 10aa237f29
commit 9df32d3b5e
2 changed files with 9 additions and 5 deletions

View File

@ -416,7 +416,8 @@ EmoteModule.prototype.injectEmote = function(node) {
if(emotesTwitch.emotes.hasOwnProperty(word)) { if(emotesTwitch.emotes.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) { 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 + '" />'); var len = Math.round(word.length/4);
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + 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 + '" />');
return; return;
} }
else { else {
@ -428,7 +429,8 @@ EmoteModule.prototype.injectEmote = function(node) {
if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) { if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
if(emotesFfz.hasOwnProperty(word)) { if(emotesFfz.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) { 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 + '" />'); var len = Math.round(word.length/4);
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len*2, len) + "\uFDD9" + word.substr(len*3) + '" src="' + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + '" />');
return; return;
} }
else { else {
@ -441,7 +443,8 @@ EmoteModule.prototype.injectEmote = function(node) {
if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) { if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
if(emotesBTTV.hasOwnProperty(word)) { if(emotesBTTV.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) { 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] + '" />'); var len = Math.round(word.length/4);
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len*2, len) + "\uFDD9" + word.substr(len*3) + '" src="' + emotesBTTV[word] + '" />');
return; return;
} }
else { else {
@ -453,7 +456,8 @@ EmoteModule.prototype.injectEmote = function(node) {
if (subEmotesTwitch.hasOwnProperty(word)) { if (subEmotesTwitch.hasOwnProperty(word)) {
if (settingsCookie["bda-es-6"]) { 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 + '" />'); var len = Math.round(word.length/4);
parentInnerHTML = parentInnerHTML.replace(word, '<img title="' + word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len*2, len) + "\uFDD9" + word.substr(len*3) + '" src="' + twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd + '" />');
return; return;
} }
else { else {

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long