Minor fixed
This commit is contained in:
parent
fc52d3dd6c
commit
286db2d316
72
js/main.js
72
js/main.js
|
@ -90,6 +90,8 @@ var bdchangelog = {
|
|||
};
|
||||
|
||||
var settingsCookie = {};
|
||||
var bdaf = false;
|
||||
var bdafo = false;
|
||||
|
||||
function Core() {}
|
||||
|
||||
|
@ -101,9 +103,6 @@ Core.prototype.init = function () {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
utils = new Utils();
|
||||
var sock = new BdWSocket();
|
||||
sock.start();
|
||||
|
@ -247,7 +246,7 @@ Core.prototype.initObserver = function () {
|
|||
quickEmoteMenu.obsCallback();
|
||||
voiceMode.obsCallback();
|
||||
if (typeof pluginModule !== "undefined") pluginModule.channelSwitch();
|
||||
$(".message-group").each(function () {
|
||||
/*$(".message-group").each(function () {
|
||||
var a = $(this).find(".avatar-large");
|
||||
if (a.length > 0) {
|
||||
try {
|
||||
|
@ -257,10 +256,10 @@ Core.prototype.initObserver = function () {
|
|||
}
|
||||
}catch(err) {}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
if (mutation.target.getAttribute('class').indexOf('scroller messages') != -1) {
|
||||
var lastMessage = $(".message-group").last();
|
||||
/*var lastMessage = $(".message-group").last();
|
||||
if (lastMessage != undefined) {
|
||||
var a = lastMessage.find(".avatar-large");
|
||||
if (a.length > 0) {
|
||||
|
@ -270,7 +269,7 @@ Core.prototype.initObserver = function () {
|
|||
}
|
||||
}catch(err) {}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (typeof pluginModule !== "undefined") pluginModule.newMessage();
|
||||
}
|
||||
}
|
||||
|
@ -472,6 +471,10 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
var parent = node.parentElement;
|
||||
|
||||
if (parent.tagName != "SPAN") return;
|
||||
if (!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var edited = false;
|
||||
|
||||
|
@ -483,12 +486,7 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
//if(!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) return;
|
||||
|
||||
function inject() {
|
||||
if (!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var parentInnerHTML = parent.innerHTML;
|
||||
|
||||
var words = parentInnerHTML.split(/\s+/g);
|
||||
|
||||
if (!words) return;
|
||||
|
@ -523,8 +521,19 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
}
|
||||
|
||||
if ($.inArray(word, bemotes) != -1) return;
|
||||
var d = new Date();
|
||||
bdaf = (d.getMonth() == 3 && d.getDate() == 1 && !bdafo);
|
||||
|
||||
if (emotesTwitch.emotes.hasOwnProperty(word)) {
|
||||
if(bdaf) {
|
||||
var k = Object.keys(emotesTwitch["emotes"]);
|
||||
var newWord = k[k.length * Math.random() << 0];
|
||||
var len = Math.round(newWord.length / 4);
|
||||
var name = newWord.substr(0, len) + "\uFDD9" + newWord.substr(len, len) + "\uFDD9" + newWord.substr(len * 2, len) + "\uFDD9" + newWord.substr(len * 3);
|
||||
var url = twitchEmoteUrlStart + emotesTwitch.emotes[newWord].image_id + twitchEmoteUrlEnd;
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
var len = Math.round(word.length / 4);
|
||||
var name = word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3);
|
||||
var url = twitchEmoteUrlStart + emotesTwitch.emotes[word].image_id + twitchEmoteUrlEnd;
|
||||
|
@ -533,6 +542,15 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
}
|
||||
|
||||
if (subEmotesTwitch.hasOwnProperty(word)) {
|
||||
if(bdaf) {
|
||||
var k = Object.keys(subEmotesTwitch);
|
||||
var newWord = k[k.length * Math.random() << 0];
|
||||
var len = Math.round(newWord.length / 4);
|
||||
var name = newWord.substr(0, len) + "\uFDD9" + newWord.substr(len, len) + "\uFDD9" + newWord.substr(len * 2, len) + "\uFDD9" + newWord.substr(len * 3);
|
||||
var url = twitchEmoteUrlStart + subEmotesTwitch[newWord] + twitchEmoteUrlEnd;
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
var len = Math.round(word.length / 4);
|
||||
var name = word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3);
|
||||
var url = twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd;
|
||||
|
@ -542,10 +560,18 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
|
||||
if (typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
|
||||
if (emotesFfz.hasOwnProperty(word)) {
|
||||
if(bdaf) {
|
||||
var k = Object.keys(emotesFfz);
|
||||
var newWord = k[k.length * Math.random() << 0];
|
||||
var len = Math.round(newWord.length / 4);
|
||||
var name = newWord.substr(0, len) + "\uFDD9" + newWord.substr(len, len) + "\uFDD9" + newWord.substr(len * 2, len) + "\uFDD9" + newWord.substr(len * 3);
|
||||
var url = ffzEmoteUrlStart + emotesFfz[newWord] + ffzEmoteUrlEnd;
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
var len = Math.round(word.length / 4);
|
||||
var name = word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3);
|
||||
var url = ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd;
|
||||
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
|
@ -553,6 +579,15 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
|
||||
if (typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
|
||||
if (emotesBTTV.hasOwnProperty(word)) {
|
||||
if(bdaf) {
|
||||
var k = Object.keys(emotesBTTV);
|
||||
var newWord = k[k.length * Math.random() << 0];
|
||||
var len = Math.round(newWord.length / 4);
|
||||
var name = newWord.substr(0, len) + "\uFDD9" + newWord.substr(len, len) + "\uFDD9" + newWord.substr(len * 2, len) + "\uFDD9" + newWord.substr(len * 3);
|
||||
var url = emotesBTTV[newWord];
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
var len = Math.round(word.length / 4);
|
||||
var name = word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3);
|
||||
var url = emotesBTTV[word];
|
||||
|
@ -563,6 +598,15 @@ EmoteModule.prototype.injectEmote = function (node) {
|
|||
|
||||
if (typeof emotesBTTV2 !== 'undefined' && settingsCookie["bda-es-2"]) {
|
||||
if (emotesBTTV2.hasOwnProperty(word)) {
|
||||
if(bdaf) {
|
||||
var k = Object.keys(emotesBTTV2);
|
||||
var newWord = k[k.length * Math.random() << 0];
|
||||
var len = Math.round(newWord.length / 4);
|
||||
var name = newWord.substr(0, len) + "\uFDD9" + newWord.substr(len, len) + "\uFDD9" + newWord.substr(len * 2, len) + "\uFDD9" + newWord.substr(len * 3);
|
||||
var url = bttvEmoteUrlStart + emotesBTTV2[newWord] + bttvEmoteUrlEnd;
|
||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote" alt="' + name + '" src="' + url + '" /><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||
return;
|
||||
}
|
||||
var len = Math.round(word.length / 4);
|
||||
var name = word.substr(0, len) + "\uFDD9" + word.substr(len, len) + "\uFDD9" + word.substr(len * 2, len) + "\uFDD9" + word.substr(len * 3);
|
||||
var url = bttvEmoteUrlStart + emotesBTTV2[word] + bttvEmoteUrlEnd;
|
||||
|
@ -1103,7 +1147,7 @@ SettingsPanel.prototype.applyCustomCss = function (css) {
|
|||
if ($("#customcss").length == 0) {
|
||||
$("head").append('<style id="customcss"></style>');
|
||||
}
|
||||
|
||||
bdafo = (css.indexOf("april2nd") > -1);
|
||||
$("#customcss").html(css);
|
||||
|
||||
localStorage.setItem("bdcustomcss", btoa(css));
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue