Plugin MutationObserver callback, new emote mods, minimal mode css, sub
emote mods https://github.com/Jiiks/BetterDiscordApp/pull/260
This commit is contained in:
Jiiks 2016-04-04 17:22:53 +03:00
parent 028d279cae
commit 6c496b1898
4 changed files with 96 additions and 49 deletions

View File

@ -184,6 +184,30 @@
.emoteshake {
animation: 1s emote-shake infinite linear;
}
.emoteflap {
transform:scaleY(-1) !important;
}
.emoteshake2 {
animation: emote-shake2 0.3s linear infinite;
}
.emoteshake3 {
animation: emote-shake3 0.1s linear infinite;
}
@keyframes emote-shake2 {
25% { transform:translate(-1px, -1px) }
50% { transform:translate(-1px, 1px) }
75% { transform:translate(1px, 1px) }
75% { transform:translate(1px, -1px) }
}
@keyframes emote-shake3 {
25% { transform:translate(-1px, -1px) }
50% { transform:translate(-1px, 1px) }
75% { transform:translate(1px, 1px) }
75% { transform:translate(1px, -1px) }
}
@keyframes emote-spin {
from { transform: rotate(0deg); }
@ -415,11 +439,6 @@
padding:2px;
}
.bd-minimal .embed img {
max-height: 120px;
max-width:160px;
}
.bd-minimal .channel-members .avatar-small{
max-width:15px;
max-height:15px;

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
* https://github.com/Jiiks/BetterDiscordApp
*/
var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule;
var jsVersion = 1.58;
var jsVersion = 1.59;
var supportedVersion = "0.2.5";
var mainObserver;
@ -65,8 +65,30 @@ var defaultCookie = {
var bdchangelog = {
"changes": {
"api": {
"title": "Emote modifiers!",
"text": "You can use the following modifiers to modify emotes: <br> <strong>spin</strong>, <strong>spin2</strong>, <strong>spin3</strong>, <strong>flip</strong>, <strong>pulse</strong>, <strong>spinflip</strong>. <br> Example usage: Kappa:spin",
"title": "New plugin api callback",
"text": "Use the `observer(e)` callback instead of creating your own MutationObserver",
"img": ""
},
"emotemods": {
"title": "New emote mods!",
"text": "The following emote mods have been added: :shake2, :shake3, :flap",
"img": ""
},
"minmode": {
"title": "Minimal mode",
"text": "Minimal mode embed fixed size has been removed",
"img": ""
}
},
"fixes": {
"emotes": {
"title": "Native sub emote mods",
"text": "Emote mods now work with native sub emotes!",
"img": ""
},
"emotes2": {
"title": "Emote mods and custom emotes",
"text": "Emote mods will no longer interfere with custom emotes using :",
"img": ""
}
}
@ -223,41 +245,19 @@ var botlist = ["119598467310944259"]; //Temp
Core.prototype.initObserver = function () {
mainObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (typeof pluginModule !== "undefined") pluginModule.rawObserver(mutation);
if (mutation.target.getAttribute('class') != null) {
//console.log(mutation.target)
if(mutation.target.classList.contains('title-wrap') || mutation.target.classList.contains('chat')){
quickEmoteMenu.obsCallback();
voiceMode.obsCallback();
if (typeof pluginModule !== "undefined") pluginModule.channelSwitch();
/*$(".message-group").each(function () {
var a = $(this).find(".avatar-large");
if (a.length > 0) {
try {
var b = a.css("background-image").match(/\d+/).toString();
if (botlist.indexOf(a) > -1) {
$(this).find(".user-name").addClass("boticon");
}
}catch(err) {}
}
});*/
}
if (mutation.target.getAttribute('class').indexOf('scroller messages') != -1) {
/*var lastMessage = $(".message-group").last();
if (lastMessage != undefined) {
var a = lastMessage.find(".avatar-large");
if (a.length > 0) {
try {
if (botlist.indexOf(a.css("background-image").match(/\d+/).toString()) > -1) {
lastMessage.find(".user-name").addClass("boticon");
}
}catch(err) {}
}
}*/
if (typeof pluginModule !== "undefined") pluginModule.newMessage();
}
}
emoteModule.obsCallback(mutation);
});
});
@ -411,7 +411,21 @@ EmoteModule.prototype.obsCallback = function (mutation) {
$(".emoji").each(function () {
var t = $(this);
if (t.attr("src").indexOf(".png") != -1) {
t.replaceWith("<span>" + t.attr("alt") + "</span>");
var next = t.next();
var newText = t.attr("alt");
if(next.size() > 0) {
if(next.prop("tagName") == "SPAN") {
newText += next.text();
next.remove();
}
}
if(t.parent().prop("tagName") != "SPAN") {
t.replaceWith("<span>" + newText + "</span>");
} else {
t.replaceWith(newText);
}
}
});
@ -458,16 +472,13 @@ EmoteModule.prototype.injectEmote = function (node) {
return;
}
var edited = false;
if ($(parent.parentElement).hasClass("edited")) {
parent = parent.parentElement.parentElement.firstChild; //:D
parent = parent.parentElement.parentElement.firstChild;
edited = true;
}
//if(!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) return;
function inject() {
var parentInnerHTML = parent.innerHTML;
var words = parentInnerHTML.split(/\s+/g);
@ -506,14 +517,21 @@ EmoteModule.prototype.injectEmote = function (node) {
var useEmoteCss = false;
var sWord = word;
var emoteClass = "";
var allowedClasses = ["emoteflip", "emotespin", "emotepulse", "emotespin2", "emotespin3", "emote1spin", "emote2spin", "emote3spin", "emotetr", "emotebl", "emotebr", "emoteshake"];
var allowedClasses = ["emoteflip", "emotespin", "emotepulse", "emotespin2", "emotespin3", "emote1spin", "emote2spin", "emote3spin", "emotetr", "emotebl", "emotebr", "emoteshake", "emoteshake2", "emoteshake3", "emoteflap"];
if(word.indexOf(":") > -1) {
userEmoteCss = true;
sWord = word.split(":")[0];
if(settingsCookie["bda-es-8"]) {
emoteClass = "emote" + word.split(":")[1];
if(allowedClasses.indexOf(emoteClass) < 0) {
emoteClass = "";
// userEmoteCss = true;
//sWord = word.split(":")[0];
var split = word.split(/:(?!.*:)/);
if (split[0] != "" && split[1] != "") {
userEmoteCss = true;
sWord = split[0];
if(settingsCookie["bda-es-8"]) {
// emoteClass = "emote" + word.split(":")[1];
emoteClass = "emote" + split[1];
console.log("gg");
if(allowedClasses.indexOf(emoteClass) < 0) {
emoteClass = "";
}
}
}
}
@ -1607,6 +1625,15 @@ PluginModule.prototype.socketEvent = function (e, data) {
});
};
PluginModule.prototype.rawObserver = function(e) {
$.each(bdplugins, function() {
if (!pluginCookie[this.plugin.getName()]) return;
if(typeof this.plugin.observer === "function") {
this.plugin.observer(e);
}
});
};
/* BetterDiscordApp ThemeModule JavaScript
* Version: 1.0

11
js/main.min.js vendored
View File

@ -1,9 +1,9 @@
var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule;var jsVersion=1.58;var supportedVersion="0.2.5";var mainObserver;var twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/";var twitchEmoteUrlEnd="/1.0";var ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/";var ffzEmoteUrlEnd="/1";var bttvEmoteUrlStart="https://cdn.betterttv.net/emote/";var bttvEmoteUrlEnd="/1x";var mainCore;var settings={"Save logs locally":{"id":"bda-gs-0","info":"Saves chat logs locally","implemented":false},"Public Servers":{"id":"bda-gs-1","info":"Display public servers button","implemented":true},"Minimal Mode":{"id":"bda-gs-2","info":"Hide elements and reduce the size of elements.","implemented":true},"Voice Mode":{"id":"bda-gs-4","info":"Only show voice chat","implemented":true},"Hide Channels":{"id":"bda-gs-3","info":"Hide channels in minimal mode","implemented":true},"Quick Emote Menu":{"id":"bda-es-0","info":"Show quick emote menu for adding emotes","implemented":true},"Show Emotes":{"id":"bda-es-7","info":"Show any emotes","implemented":true},"FrankerFaceZ Emotes":{"id":"bda-es-1","info":"Show FrankerFaceZ Emotes","implemented":true},"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},"Show Names":{"id":"bda-es-6","info":"Show emote names on hover","implemented":true},"Show emote modifiers":{"id":"bda-es-8","info":"Enable/Disable emote mods","implemented":true}};var links={"Jiiks.net":{"text":"Jiiks.net","href":"http://jiiks.net","target":"_blank"},"twitter":{"text":"Twitter","href":"http://twitter.com/jiiksi","target":"_blank"},"github":{"text":"Github","href":"http://github.com/jiiks","target":"_blank"}};var defaultCookie={"version":jsVersion,"bda-gs-0":false,"bda-gs-1":true,"bda-gs-2":false,"bda-gs-3":false,"bda-gs-4":false,"bda-es-0":true,"bda-es-1":true,"bda-es-2":true,"bda-es-3":false,"bda-es-4":false,"bda-es-5":true,"bda-es-6":true,"bda-es-7":true,"bda-es-8":true,"bda-jd":true};var bdchangelog={"changes":{"api":{"title":"Emote modifiers!","text":"You can use the following modifiers to modify emotes: <br> <strong>spin</strong>, <strong>spin2</strong>, <strong>spin3</strong>, <strong>flip</strong>, <strong>pulse</strong>, <strong>spinflip</strong>. <br> Example usage: Kappa:spin","img":""}}};var settingsCookie={};var bdaf=false;var bdafo=false;function Core(){}
var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule;var jsVersion=1.59;var supportedVersion="0.2.5";var mainObserver;var twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/";var twitchEmoteUrlEnd="/1.0";var ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/";var ffzEmoteUrlEnd="/1";var bttvEmoteUrlStart="https://cdn.betterttv.net/emote/";var bttvEmoteUrlEnd="/1x";var mainCore;var settings={"Save logs locally":{"id":"bda-gs-0","info":"Saves chat logs locally","implemented":false},"Public Servers":{"id":"bda-gs-1","info":"Display public servers button","implemented":true},"Minimal Mode":{"id":"bda-gs-2","info":"Hide elements and reduce the size of elements.","implemented":true},"Voice Mode":{"id":"bda-gs-4","info":"Only show voice chat","implemented":true},"Hide Channels":{"id":"bda-gs-3","info":"Hide channels in minimal mode","implemented":true},"Quick Emote Menu":{"id":"bda-es-0","info":"Show quick emote menu for adding emotes","implemented":true},"Show Emotes":{"id":"bda-es-7","info":"Show any emotes","implemented":true},"FrankerFaceZ Emotes":{"id":"bda-es-1","info":"Show FrankerFaceZ Emotes","implemented":true},"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},"Show Names":{"id":"bda-es-6","info":"Show emote names on hover","implemented":true},"Show emote modifiers":{"id":"bda-es-8","info":"Enable/Disable emote mods","implemented":true}};var links={"Jiiks.net":{"text":"Jiiks.net","href":"http://jiiks.net","target":"_blank"},"twitter":{"text":"Twitter","href":"http://twitter.com/jiiksi","target":"_blank"},"github":{"text":"Github","href":"http://github.com/jiiks","target":"_blank"}};var defaultCookie={"version":jsVersion,"bda-gs-0":false,"bda-gs-1":true,"bda-gs-2":false,"bda-gs-3":false,"bda-gs-4":false,"bda-es-0":true,"bda-es-1":true,"bda-es-2":true,"bda-es-3":false,"bda-es-4":false,"bda-es-5":true,"bda-es-6":true,"bda-es-7":true,"bda-es-8":true,"bda-jd":true};var bdchangelog={"changes":{"api":{"title":"New plugin api callback","text":"Use the `observer(e)` callback instead of creating your own MutationObserver","img":""},"emotemods":{"title":"New emote mods!","text":"The following emote mods have been added: :shake2, :shake3, :flap","img":""},"minmode":{"title":"Minimal mode","text":"Minimal mode embed fixed size has been removed","img":""}},"fixes":{"emotes":{"title":"Native sub emote mods","text":"Emote mods now work with native sub emotes!","img":""},"emotes2":{"title":"Emote mods and custom emotes","text":"Emote mods will no longer interfere with custom emotes using :","img":""}}};var settingsCookie={};var bdaf=false;var bdafo=false;function Core(){}
Core.prototype.init=function(){var self=this;if(version<supportedVersion){this.alert("Not Supported","BetterDiscord v"+version+"(your version)"+" is not supported by the latest js("+jsVersion+").<br><br> Please download the latest version from <a href='https://betterdiscord.net' target='_blank'>BetterDiscord.net</a>");return;}
utils=new Utils();var sock=new BdWSocket();sock.start();utils.getHash();emoteModule=new EmoteModule();quickEmoteMenu=new QuickEmoteMenu();voiceMode=new VoiceMode();emoteModule.init();this.initSettings();this.initObserver();function gwDefer(){console.log(new Date().getTime()+" Defer");if($(".guilds-wrapper .guilds").children().length>0){console.log(new Date().getTime()+" Defer Loaded");var guilds=$(".guilds>li:first-child");guilds.after($("<li></li>",{id:"bd-pub-li",css:{"height":"20px","display":settingsCookie["bda-gs-1"]==true?"":"none"}}).append($("<div/>",{class:"guild-inner",css:{"height":"20px","border-radius":"4px"}}).append($("<a/>").append($("<div/>",{css:{"line-height":"20px","font-size":"12px"},text:"public",id:"bd-pub-button"})))));var showChannelsButton=$("<button/>",{class:"btn",id:"bd-show-channels",text:"R",css:{"cursor":"pointer"},click:function(){settingsCookie["bda-gs-3"]=false;$("body").removeClass("bd-minimal-chan");self.saveSettings();}});$(".guilds-wrapper").prepend(showChannelsButton);opublicServers=new PublicServers();pluginModule=new PluginModule();pluginModule.loadPlugins();if(typeof(themesupport2)!=="undefined"){themeModule=new ThemeModule();themeModule.loadThemes();}
settingsPanel=new SettingsPanel();settingsPanel.init();quickEmoteMenu.init(false);$("#tc-settings-button").on("click",function(){settingsPanel.show();});$("#bd-pub-button").on("click",function(){opublicServers.show();});opublicServers.init();emoteModule.autoCapitalize();if(settingsCookie["version"]<jsVersion){var cl=self.constructChangelog();$("body").append(cl);settingsCookie["version"]=jsVersion;self.saveSettings();}
$("head").append("<style>.CodeMirror{ min-width:100%; }</style>");$("head").append('<style id="bdemotemenustyle"></style>');}else{setTimeout(gwDefer,100);}}
$(document).ready(function(){setTimeout(gwDefer,1000);});};Core.prototype.initSettings=function(){if($.cookie("better-discord")==undefined){settingsCookie=defaultCookie;this.saveSettings();}else{this.loadSettings();for(var setting in defaultCookie){if(settingsCookie[setting]==undefined){settingsCookie[setting]=defaultCookie[setting];this.saveSettings();}}}};Core.prototype.saveSettings=function(){$.cookie("better-discord",JSON.stringify(settingsCookie),{expires:365,path:'/'});};Core.prototype.loadSettings=function(){settingsCookie=JSON.parse($.cookie("better-discord"));};var botlist=["119598467310944259"];Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(mutation.target.getAttribute('class')!=null){if(mutation.target.classList.contains('title-wrap')||mutation.target.classList.contains('chat')){quickEmoteMenu.obsCallback();voiceMode.obsCallback();if(typeof pluginModule!=="undefined")pluginModule.channelSwitch();}
$(document).ready(function(){setTimeout(gwDefer,1000);});};Core.prototype.initSettings=function(){if($.cookie("better-discord")==undefined){settingsCookie=defaultCookie;this.saveSettings();}else{this.loadSettings();for(var setting in defaultCookie){if(settingsCookie[setting]==undefined){settingsCookie[setting]=defaultCookie[setting];this.saveSettings();}}}};Core.prototype.saveSettings=function(){$.cookie("better-discord",JSON.stringify(settingsCookie),{expires:365,path:'/'});};Core.prototype.loadSettings=function(){settingsCookie=JSON.parse($.cookie("better-discord"));};var botlist=["119598467310944259"];Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(typeof pluginModule!=="undefined")pluginModule.rawObserver(mutation);if(mutation.target.getAttribute('class')!=null){if(mutation.target.classList.contains('title-wrap')||mutation.target.classList.contains('chat')){quickEmoteMenu.obsCallback();voiceMode.obsCallback();if(typeof pluginModule!=="undefined")pluginModule.channelSwitch();}
if(mutation.target.getAttribute('class').indexOf('scroller messages')!=-1){if(typeof pluginModule!=="undefined")pluginModule.newMessage();}}
emoteModule.obsCallback(mutation);});});mainObserver.observe(document,{childList:true,subtree:true});};Core.prototype.constructChangelog=function(){var changeLog=''+'<div id="bd-wn-modal" class="modal" style="opacity:1;">'+' <div class="modal-inner">'+' <div id="bdcl" class="change-log"> '+' <div class="header">'+' <strong>What\'s new in BetterDiscord JS'+jsVersion+'</strong>'+' <button class="close" onclick=\'$("#bd-wn-modal").remove();\'></button>'+' </div><!--header-->'+' <div class="scroller-wrap">'+' <div class="scroller">';if(bdchangelog.changes!=null){changeLog+=''+'<h1 class="changelog-added">'+' <span>New Stuff</span>'+'</h1>'+'<ul>';for(var change in bdchangelog.changes){change=bdchangelog.changes[change];changeLog+=''+'<li>'+' <strong>'+change.title+'</strong>'+' <div>'+change.text+'</div>'+'</li>';}
changeLog+='</ul>';}
@ -12,14 +12,15 @@ changeLog+='</ul>';}
if(bdchangelog.upcoming!=null){changeLog+=''+'<h1 class="changelog-in-progress">'+' <span>Coming Soon</span>'+'</h1>'+'<ul>';for(var upc in bdchangelog.upcoming){upc=bdchangelog.upcoming[upc];changeLog+=''+'<li>'+' <strong>'+upc.title+'</strong>'+' <div>'+upc.text+'</div>'+'</li>';}
changeLog+='</ul>';}
changeLog+=''+' </div><!--scoller-->'+' </div><!--scroller-wrap-->'+' <div class="footer">'+' </div><!--footer-->'+' </div><!--change-log-->'+' </div><!--modal-inner-->'+'</div><!--modal-->';return changeLog;};Core.prototype.alert=function(title,text){$("body").append(''+'<div class="bd-alert">'+' <div class="bd-alert-header">'+' <span>'+title+'</span>'+' <div class="bd-alert-closebtn" onclick="$(this).parent().parent().remove();">×</div>'+' </div>'+' <div class="bd-alert-body">'+' <div class="scroller-wrap dark fade">'+' <div class="scroller">'+text+'</div>'+' </div>'+' </div>'+'</div>');};var emotesFfz={};var emotesBTTV={};var emotesTwitch={"emotes":{"emote":{"image_id":0}}};var subEmotesTwitch={};function EmoteModule(){}
EmoteModule.prototype.init=function(){};EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/data/emotefilter.json",function(data){bemotes=data.blacklist;});};EmoteModule.prototype.obsCallback=function(mutation){var self=this;if(!settingsCookie["bda-es-7"])return;$(".emoji").each(function(){var t=$(this);if(t.attr("src").indexOf(".png")!=-1){t.replaceWith("<span>"+t.attr("alt")+"</span>");}});for(var i=0;i<mutation.addedNodes.length;++i){var next=mutation.addedNodes.item(i);if(next){var nodes=self.getNodes(next);for(var node in nodes){if(nodes.hasOwnProperty(node)){self.injectEmote(nodes[node]);}}}}};EmoteModule.prototype.getNodes=function(node){var next;var nodes=[];var treeWalker=document.createTreeWalker(node,NodeFilter.SHOW_TEXT,null,false);while(next=treeWalker.nextNode()){nodes.push(next);}
EmoteModule.prototype.init=function(){};EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/data/emotefilter.json",function(data){bemotes=data.blacklist;});};EmoteModule.prototype.obsCallback=function(mutation){var self=this;if(!settingsCookie["bda-es-7"])return;$(".emoji").each(function(){var t=$(this);if(t.attr("src").indexOf(".png")!=-1){var next=t.next();var newText=t.attr("alt");if(next.size()>0){if(next.prop("tagName")=="SPAN"){newText+=next.text();next.remove();}}
if(t.parent().prop("tagName")!="SPAN"){t.replaceWith("<span>"+newText+"</span>");}else{t.replaceWith(newText);}}});for(var i=0;i<mutation.addedNodes.length;++i){var next=mutation.addedNodes.item(i);if(next){var nodes=self.getNodes(next);for(var node in nodes){if(nodes.hasOwnProperty(node)){self.injectEmote(nodes[node]);}}}}};EmoteModule.prototype.getNodes=function(node){var next;var nodes=[];var treeWalker=document.createTreeWalker(node,NodeFilter.SHOW_TEXT,null,false);while(next=treeWalker.nextNode()){nodes.push(next);}
return nodes;};var bemotes=[];var spoilered=[];EmoteModule.prototype.injectEmote=function(node){if(typeof emotesTwitch==='undefined')return;if(!node.parentElement)return;var parent=node.parentElement;if(parent.tagName!="SPAN")return;if(!$(parent.parentElement).hasClass("markup")&&!$(parent.parentElement).hasClass("message-content")){return;}
var edited=false;if($(parent.parentElement).hasClass("edited")){parent=parent.parentElement.parentElement.firstChild;edited=true;}
function inject(){var parentInnerHTML=parent.innerHTML;var words=parentInnerHTML.split(/\s+/g);if(!words)return;words.some(function(word){if(word.slice(0,4)=="[!s]"){parentInnerHTML=parentInnerHTML.replace("[!s]","");var markup=$(parent).parent();var reactId=markup.attr("data-reactid");if(spoilered.indexOf(reactId)>-1){return;}
markup.addClass("spoiler");markup.on("click",function(){$(this).removeClass("spoiler");spoilered.push($(this).attr("data-reactid"));});return;}
if(word.length<4){return;}
if(word=="ClauZ"){parentInnerHTML=parentInnerHTML.replace("ClauZ",'<img src="https://cdn.frankerfacez.com/emoticon/70852/1" style="width:25px; transform:translate(-29px, -14px);"></img>');return;}
var useEmoteCss=false;var sWord=word;var emoteClass="";var allowedClasses=["emoteflip","emotespin","emotepulse","emotespin2","emotespin3","emote1spin","emote2spin","emote3spin","emotetr","emotebl","emotebr","emoteshake"];if(word.indexOf(":")>-1){userEmoteCss=true;sWord=word.split(":")[0];if(settingsCookie["bda-es-8"]){emoteClass="emote"+word.split(":")[1];if(allowedClasses.indexOf(emoteClass)<0){emoteClass="";}}}
var useEmoteCss=false;var sWord=word;var emoteClass="";var allowedClasses=["emoteflip","emotespin","emotepulse","emotespin2","emotespin3","emote1spin","emote2spin","emote3spin","emotetr","emotebl","emotebr","emoteshake","emoteshake2","emoteshake3","emoteflap"];if(word.indexOf(":")>-1){var split=word.split(/:(?!.*:)/);if(split[0]!=""&&split[1]!=""){userEmoteCss=true;sWord=split[0];if(settingsCookie["bda-es-8"]){emoteClass="emote"+split[1];console.log("gg");if(allowedClasses.indexOf(emoteClass)<0){emoteClass="";}}}}
if($.inArray(sWord,bemotes)!=-1)return;if(emotesTwitch.emotes.hasOwnProperty(sWord)){var len=Math.round(sWord.length / 4);var name=sWord.substr(0,len)+"\uFDD9"+sWord.substr(len,len)+"\uFDD9"+sWord.substr(len*2,len)+"\uFDD9"+sWord.substr(len*3);var url=twitchEmoteUrlStart+emotesTwitch.emotes[sWord].image_id+twitchEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(word,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');return;}
if(subEmotesTwitch.hasOwnProperty(sWord)){var len=Math.round(sWord.length / 4);var name=sWord.substr(0,len)+"\uFDD9"+sWord.substr(len,len)+"\uFDD9"+sWord.substr(len*2,len)+"\uFDD9"+sWord.substr(len*3);var url=twitchEmoteUrlStart+subEmotesTwitch[sWord]+twitchEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(word,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');return;}
if(typeof emotesFfz!=='undefined'&&settingsCookie["bda-es-1"]){if(emotesFfz.hasOwnProperty(sWord)){var len=Math.round(sWord.length / 4);var name=sWord.substr(0,len)+"\uFDD9"+sWord.substr(len,len)+"\uFDD9"+sWord.substr(len*2,len)+"\uFDD9"+sWord.substr(len*3);var url=ffzEmoteUrlStart+emotesFfz[sWord]+ffzEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(word,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');return;}}
@ -56,7 +57,7 @@ Utils.prototype.getTextArea=function(){return $(".channel-textarea-inner textare
VoiceMode.prototype.obsCallback=function(){var self=this;if(settingsCookie["bda-gs-4"]){self.disable();setTimeout(function(){self.enable();},300);}};VoiceMode.prototype.enable=function(){$(".scroller.guild-channels ul").first().css("display","none");$(".scroller.guild-channels header").first().css("display","none");$(".app.flex-vertical").first().css("overflow","hidden");$(".chat.flex-vertical.flex-spacer").first().css("visibility","hidden").css("min-width","0px");$(".flex-vertical.channels-wrap").first().css("flex-grow","100000");$(".guild-header .btn.btn-hamburger").first().css("visibility","hidden");};VoiceMode.prototype.disable=function(){$(".scroller.guild-channels ul").first().css("display","");$(".scroller.guild-channels header").first().css("display","");$(".app.flex-vertical").first().css("overflow","");$(".chat.flex-vertical.flex-spacer").first().css("visibility","").css("min-width","");$(".flex-vertical.channels-wrap").first().css("flex-grow","");$(".guild-header .btn.btn-hamburger").first().css("visibility","");};var pluginCookie={};function PluginModule(){}
PluginModule.prototype.loadPlugins=function(){this.loadPluginData();$.each(bdplugins,function(){var plugin=this["plugin"];plugin.load();var name=plugin.getName();var enabled=false;if(pluginCookie.hasOwnProperty(name)){enabled=pluginCookie[name];}else{pluginCookie[name]=false;}
if(enabled){plugin.start();}});};PluginModule.prototype.handlePlugin=function(checkbox){var cb=$(checkbox).children().find('input[type="checkbox"]');var enabled=!cb.is(":checked");var id=cb.attr("id");cb.prop("checked",enabled);if(enabled){bdplugins[id]["plugin"].start();pluginCookie[id]=true;}else{bdplugins[id]["plugin"].stop();pluginCookie[id]=false;}
this.savePluginData();};PluginModule.prototype.showSettings=function(plugin){if(bdplugins[plugin]!=null){if(typeof bdplugins[plugin].plugin.getSettingsPanel==="function"){var panel=bdplugins[plugin].plugin.getSettingsPanel();$(".modal-inner").off("click.bdpsm").on("click.bdpsm",function(e){if($("#bd-psm-id").length){$(".bd-psm").remove();}else{$(".bd-psm").attr("id","bd-psm-id");}});$(".modal").append('<div class="bd-psm"><div class="scroller-wrap" style="height:100%"><div id="bd-psm-s" class="scroller" style="padding:10px;"></div></div></div>');$("#bd-psm-s").append(panel);}}};PluginModule.prototype.loadPluginData=function(){var cookie=$.cookie("bd-plugins");if(cookie!=undefined){pluginCookie=JSON.parse($.cookie("bd-plugins"));}};PluginModule.prototype.savePluginData=function(){$.cookie("bd-plugins",JSON.stringify(pluginCookie),{expires:365,path:'/'});};PluginModule.prototype.newMessage=function(){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.onMessage==="function"){this.plugin.onMessage();}});};PluginModule.prototype.channelSwitch=function(){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.onSwitch==="function"){this.plugin.onSwitch();}});};PluginModule.prototype.socketEvent=function(e,data){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.socketEvent==="function"){this.plugin.socketEvent(data);}});};var themeCookie={};function ThemeModule(){}
this.savePluginData();};PluginModule.prototype.showSettings=function(plugin){if(bdplugins[plugin]!=null){if(typeof bdplugins[plugin].plugin.getSettingsPanel==="function"){var panel=bdplugins[plugin].plugin.getSettingsPanel();$(".modal-inner").off("click.bdpsm").on("click.bdpsm",function(e){if($("#bd-psm-id").length){$(".bd-psm").remove();}else{$(".bd-psm").attr("id","bd-psm-id");}});$(".modal").append('<div class="bd-psm"><div class="scroller-wrap" style="height:100%"><div id="bd-psm-s" class="scroller" style="padding:10px;"></div></div></div>');$("#bd-psm-s").append(panel);}}};PluginModule.prototype.loadPluginData=function(){var cookie=$.cookie("bd-plugins");if(cookie!=undefined){pluginCookie=JSON.parse($.cookie("bd-plugins"));}};PluginModule.prototype.savePluginData=function(){$.cookie("bd-plugins",JSON.stringify(pluginCookie),{expires:365,path:'/'});};PluginModule.prototype.newMessage=function(){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.onMessage==="function"){this.plugin.onMessage();}});};PluginModule.prototype.channelSwitch=function(){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.onSwitch==="function"){this.plugin.onSwitch();}});};PluginModule.prototype.socketEvent=function(e,data){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.socketEvent==="function"){this.plugin.socketEvent(data);}});};PluginModule.prototype.rawObserver=function(e){$.each(bdplugins,function(){if(!pluginCookie[this.plugin.getName()])return;if(typeof this.plugin.observer==="function"){this.plugin.observer(e);}});};var themeCookie={};function ThemeModule(){}
ThemeModule.prototype.loadThemes=function(){this.loadThemeData();$.each(bdthemes,function(){var name=this["name"];var enabled=false;if(themeCookie.hasOwnProperty(name)){if(themeCookie[name]){enabled=true;}}else{themeCookie[name]=false;}
if(enabled){$("head").append('<style id="'+name+'">'+unescape(bdthemes[name]["css"])+'</style>');}});};ThemeModule.prototype.handleTheme=function(checkbox){var cb=$(checkbox).children().find('input[type="checkbox"]');var enabled=!cb.is(":checked");var id=cb.attr("id").substring(2);cb.prop("checked",enabled);if(enabled){$("head").append('<style id="'+id+'">'+unescape(bdthemes[id]["css"])+'</style>');themeCookie[id]=true;}else{$("#"+id).remove();themeCookie[id]=false;}
this.saveThemeData();};ThemeModule.prototype.loadThemeData=function(){var cookie=$.cookie("bd-themes");if(cookie!=undefined){themeCookie=JSON.parse($.cookie("bd-themes"));}};ThemeModule.prototype.saveThemeData=function(){$.cookie("bd-themes",JSON.stringify(themeCookie),{expires:365,path:'/'});};var bdSocket;var bdws;function BdWSocket(){bdws=this;}