Fixed emotes, emote edits, new changelog and versioning
This commit is contained in:
Jiiks 2016-05-20 05:30:54 +03:00
parent 596b0e8490
commit b742f86ee0
2 changed files with 41 additions and 49 deletions

View File

@ -6,7 +6,7 @@
* https://github.com/Jiiks/BetterDiscordApp
*/
var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor;
var jsVersion = 1.70;
var jsVersion = 1.71;
var supportedVersion = "0.2.5";
var mainObserver;
@ -32,16 +32,16 @@ var settings = {
"Custom css live update": { "id": "bda-css-0", "info": "", "implemented": true, "hidden": true, "cat": "core"},
"Custom css auto udpate": { "id": "bda-css-1", "info": "", "implemented": true, "hidden": true, "cat": "core"},
"24 Hour Timestamps": { "id": "bda-gs-6", "info": "Replace 12hr timestamps with proper ones", "implemented": true, "hidden": false, "cat": "core"},
"Coloured Text": { "id": "bda-gs-7", "info": "Make text colour the same as role colour", "implemented": true, "hidden": false, "cat": "core"},
"Coloured Text": { "id": "bda-gs-7", "info": "Make text colour the same as role colour", "implemented": true, "hidden": false, "cat": "core"},
"Show Emotes": { "id": "bda-es-7", "info": "Show any emotes", "implemented": true, "hidden": false, "cat": "emote"},
"Twitch Emotes": { "id": "bda-es-7", "info": "Show Twitch emotes", "implemented": true, "hidden": false, "cat": "emote"},
"FrankerFaceZ Emotes": { "id": "bda-es-1", "info": "Show FrankerFaceZ Emotes", "implemented": true, "hidden": false, "cat": "emote"},
"BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented": true, "hidden": false, "cat": "emote"},
"Emote Menu": { "id": "bda-es-0", "info": "Show Twitch/Favourite emotes in emote menu", "implemented": true, "hidden": false, "cat": "emote"},
"Emoji Menu": { "id": "bda-es-9", "info": "Show Discord emoji menu", "implemented": true, "hidden": false, "cat": "emote"},
"Emote Autocomplete": { "id": "bda-es-3", "info": "Autocomplete emote commands", "implemented": false, "hidden": false, "cat": "emote"},
"Emote Auto Capitalization": { "id": "bda-es-4", "info": "Autocapitalize emote commands", "implemented": true, "hidden": false, "cat": "emote"},
"Show Names": { "id": "bda-es-6", "info": "Show emote names trueon hover", "implemented": true, "hidden": false, "cat": "emote"},
"Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true, "hidden": false, "cat": "emote"},
"Show emote modifiers": { "id": "bda-es-8", "info": "Enable emote mods", "implemented": true, "hidden": false, "cat": "emote"},
};
@ -80,6 +80,16 @@ var defaultCookie = {
var bdchangelog = {
"changes": {
"ttv": {
"title": "v1.71 : Hide Twitch emotes",
"text": "Hide all emotes option now toggles Twitch emotes instead!",
"img": ""
},
"bttv": {
"title": "v1.71 : Override FFZ emote",
"text": "Use the <code class=\"inline\">:bttv</code> emote modifier to override a FFZ emote with a BTTV one!",
"img": ""
},
"028s": {
"title": "v1.70 : 0.2.8 Support",
"text": "Added support for Core version 0.2.8.",
@ -107,6 +117,16 @@ var bdchangelog = {
}
},
"fixes": {
"emotes": {
"title": "v1.71 : Fixed emotes and edit",
"text": "Emotes work again! So does editing emotes!",
"img": ""
},
"spoiler": {
"title": "Spoilers are currently broken :(",
"text": "Ps. I know this in the fixes section :o",
"img": ""
},
"pserver": {
"title": "v1.64 : Public Server Owner",
"text": "Removed undefined server owner property",
@ -464,7 +484,7 @@ EmoteModule.prototype.getBlacklist = function () {
EmoteModule.prototype.obsCallback = function (mutation) {
var self = this;
if (!settingsCookie["bda-es-7"]) return;
//if (!settingsCookie["bda-es-7"]) return;
$(".emoji").each(function() {
var t = $(this);
@ -473,27 +493,6 @@ EmoteModule.prototype.obsCallback = function (mutation) {
}
});
/* $(".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) {
@ -537,11 +536,6 @@ EmoteModule.prototype.injectEmote = function (node) {
var edited = false;
/*if ($(parent.parentElement).hasClass("edited")) {
parent = parent.parentElement.parentElement.firstChild;
edited = true;
}*/
function inject() {
var p = $(parent);
var parentInnerHTML = p.html();
@ -605,7 +599,7 @@ EmoteModule.prototype.injectEmote = function (node) {
}
if ($.inArray(sWord, bemotes) != -1) return;
if (emotesTwitch.emotes.hasOwnProperty(sWord)) {
if (emotesTwitch.emotes.hasOwnProperty(sWord) && settingsCookie["bda-es-7"]) {
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;
@ -1353,7 +1347,7 @@ SettingsPanel.prototype.init = function () {
$(emoteNamePopup).find(".tipsy-inner").text(title);
$(emoteNamePopup).css('left', x.left - 25);
$(emoteNamePopup).css('top', x.top - 32);
$("div[data-reactid='.0.1.1']").append($(emoteNamePopup));
$(".app").append($(emoteNamePopup));
});
$(document).on("mouseleave", ".emote", function () {
$(".tipsy").remove();

30
js/main.min.js vendored
View File

@ -1,4 +1,4 @@
var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule,customCssEditor;var jsVersion=1.70;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,"hidden":false,"cat":"core"},"Public Servers":{"id":"bda-gs-1","info":"Display public servers button","implemented":true,"hidden":false,"cat":"core"},"Minimal Mode":{"id":"bda-gs-2","info":"Hide elements and reduce the size of elements.","implemented":true,"hidden":false,"cat":"core"},"Voice Mode":{"id":"bda-gs-4","info":"Only show voice chat","implemented":true,"hidden":false,"cat":"core"},"Hide Channels":{"id":"bda-gs-3","info":"Hide channels in minimal mode","implemented":true,"hidden":false,"cat":"core"},"Dark Mode":{"id":"bda-gs-5","info":"Make certain elements dark by default(wip)","implemented":true,"hidden":false,"cat":"core"},"Override Default Emotes":{"id":"bda-es-5","info":"Override default emotes","implemented":false,"hidden":false,"cat":"core"},"Voice Disconnect":{"id":"bda-dc-0","info":"Disconnect from voice server when closing Discord","implemented":true,"hidden":false,"cat":"core"},"Custom css live update":{"id":"bda-css-0","info":"","implemented":true,"hidden":true,"cat":"core"},"Custom css auto udpate":{"id":"bda-css-1","info":"","implemented":true,"hidden":true,"cat":"core"},"24 Hour Timestamps":{"id":"bda-gs-6","info":"Replace 12hr timestamps with proper ones","implemented":true,"hidden":false,"cat":"core"},"Coloured Text":{"id":"bda-gs-7","info":"Make text colour the same as role colour","implemented":true,"hidden":false,"cat":"core"},"Show Emotes":{"id":"bda-es-7","info":"Show any emotes","implemented":true,"hidden":false,"cat":"emote"},"FrankerFaceZ Emotes":{"id":"bda-es-1","info":"Show FrankerFaceZ Emotes","implemented":true,"hidden":false,"cat":"emote"},"BetterTTV Emotes":{"id":"bda-es-2","info":"Show BetterTTV Emotes","implemented":true,"hidden":false,"cat":"emote"},"Emote Menu":{"id":"bda-es-0","info":"Show Twitch/Favourite emotes in emote menu","implemented":true,"hidden":false,"cat":"emote"},"Emoji Menu":{"id":"bda-es-9","info":"Show Discord emoji menu","implemented":true,"hidden":false,"cat":"emote"},"Emote Autocomplete":{"id":"bda-es-3","info":"Autocomplete emote commands","implemented":false,"hidden":false,"cat":"emote"},"Emote Auto Capitalization":{"id":"bda-es-4","info":"Autocapitalize emote commands","implemented":true,"hidden":false,"cat":"emote"},"Show Names":{"id":"bda-es-6","info":"Show emote names trueon hover","implemented":true,"hidden":false,"cat":"emote"},"Show emote modifiers":{"id":"bda-es-8","info":"Enable emote mods","implemented":true,"hidden":false,"cat":"emote"},};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-gs-5":true,"bda-gs-6":false,"bda-gs-7":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,"bda-es-8":true,"bda-dc-0":false,"bda-css-0":false,"bda-css-1":false,"bda-es-9":true};var bdchangelog={"changes":{"028s":{"title":"v1.70 : 0.2.8 Support","text":"Added support for Core version 0.2.8.","img":""},"importexport":{"title":"v1.70 : Setting Import/Export","text":"You can now import and export your settings!","img":""},"infscroll":{"title":"v1.70 : Public Server List Infinite Scroll","text":"Public server list now has the ability to load more than 20 servers.","img":""},"tstamps":{"title":"v1.70 : 24 hour timestamps","text":"Replace 12 hour timestamp with 24 hour timestamps!","img":""},"ctext":{"title":"v1.70 : Coloured text","text":"Make text colour the same as role colour!","img":""}},"fixes":{"pserver":{"title":"v1.64 : Public Server Owner","text":"Removed undefined server owner property","imt":""}}};var settingsCookie={};function Core(){}
var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule,customCssEditor;var jsVersion=1.71;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,"hidden":false,"cat":"core"},"Public Servers":{"id":"bda-gs-1","info":"Display public servers button","implemented":true,"hidden":false,"cat":"core"},"Minimal Mode":{"id":"bda-gs-2","info":"Hide elements and reduce the size of elements.","implemented":true,"hidden":false,"cat":"core"},"Voice Mode":{"id":"bda-gs-4","info":"Only show voice chat","implemented":true,"hidden":false,"cat":"core"},"Hide Channels":{"id":"bda-gs-3","info":"Hide channels in minimal mode","implemented":true,"hidden":false,"cat":"core"},"Dark Mode":{"id":"bda-gs-5","info":"Make certain elements dark by default(wip)","implemented":true,"hidden":false,"cat":"core"},"Override Default Emotes":{"id":"bda-es-5","info":"Override default emotes","implemented":false,"hidden":false,"cat":"core"},"Voice Disconnect":{"id":"bda-dc-0","info":"Disconnect from voice server when closing Discord","implemented":true,"hidden":false,"cat":"core"},"Custom css live update":{"id":"bda-css-0","info":"","implemented":true,"hidden":true,"cat":"core"},"Custom css auto udpate":{"id":"bda-css-1","info":"","implemented":true,"hidden":true,"cat":"core"},"24 Hour Timestamps":{"id":"bda-gs-6","info":"Replace 12hr timestamps with proper ones","implemented":true,"hidden":false,"cat":"core"},"Coloured Text":{"id":"bda-gs-7","info":"Make text colour the same as role colour","implemented":true,"hidden":false,"cat":"core"},"Twitch Emotes":{"id":"bda-es-7","info":"Show Twitch emotes","implemented":true,"hidden":false,"cat":"emote"},"FrankerFaceZ Emotes":{"id":"bda-es-1","info":"Show FrankerFaceZ Emotes","implemented":true,"hidden":false,"cat":"emote"},"BetterTTV Emotes":{"id":"bda-es-2","info":"Show BetterTTV Emotes","implemented":true,"hidden":false,"cat":"emote"},"Emote Menu":{"id":"bda-es-0","info":"Show Twitch/Favourite emotes in emote menu","implemented":true,"hidden":false,"cat":"emote"},"Emoji Menu":{"id":"bda-es-9","info":"Show Discord emoji menu","implemented":true,"hidden":false,"cat":"emote"},"Emote Autocomplete":{"id":"bda-es-3","info":"Autocomplete emote commands","implemented":false,"hidden":false,"cat":"emote"},"Emote Auto Capitalization":{"id":"bda-es-4","info":"Autocapitalize emote commands","implemented":true,"hidden":false,"cat":"emote"},"Show Names":{"id":"bda-es-6","info":"Show emote names on hover","implemented":true,"hidden":false,"cat":"emote"},"Show emote modifiers":{"id":"bda-es-8","info":"Enable emote mods","implemented":true,"hidden":false,"cat":"emote"},};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-gs-5":true,"bda-gs-6":false,"bda-gs-7":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,"bda-es-8":true,"bda-dc-0":false,"bda-css-0":false,"bda-css-1":false,"bda-es-9":true};var bdchangelog={"changes":{"ttv":{"title":"v1.71 : Hide Twitch emotes","text":"Hide all emotes option now toggles Twitch emotes instead!","img":""},"bttv":{"title":"v1.71 : Override FFZ emote","text":"Use the <code class=\"inline\">:bttv</code> emote modifier to override a FFZ emote with a BTTV one!","img":""},"028s":{"title":"v1.70 : 0.2.8 Support","text":"Added support for Core version 0.2.8.","img":""},"importexport":{"title":"v1.70 : Setting Import/Export","text":"You can now import and export your settings!","img":""},"infscroll":{"title":"v1.70 : Public Server List Infinite Scroll","text":"Public server list now has the ability to load more than 20 servers.","img":""},"tstamps":{"title":"v1.70 : 24 hour timestamps","text":"Replace 12 hour timestamp with 24 hour timestamps!","img":""},"ctext":{"title":"v1.70 : Coloured text","text":"Make text colour the same as role colour!","img":""}},"fixes":{"emotes":{"title":"v1.71 : Fixed emotes and edit","text":"Emotes work again! So does editing emotes!","img":""},"spoiler":{"title":"Spoilers are currently broken :(","text":"Ps. I know this in the fixes section :o","img":""},"pserver":{"title":"v1.64 : Public Server Owner","text":"Removed undefined server owner property","imt":""}}};var settingsCookie={};function Core(){}
Core.prototype.init=function(){var self=this;var lVersion=(typeof(version)==="undefined")?bdVersion:version;if(lVersion<supportedVersion){this.alert("Not Supported","BetterDiscord v"+lVersion+"(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");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();customCssEditor=new CustomCssEditor();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();});window.addEventListener("beforeunload",function(){if(settingsCookie["bda-dc-0"]){$('.btn.btn-disconnect').click();}});$(document).on("mousedown",function(e){});opublicServers.init();emoteModule.autoCapitalize();if(settingsCookie["version"]<jsVersion){var cl=self.constructChangelog();$("body").append(cl);settingsCookie["version"]=jsVersion;self.saveSettings();}
@ -17,21 +17,19 @@ if(bdchangelog.upcoming!=null){changeLog+=''+'<h1 class="changelog-in-progress">
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){var id='';for(var i=0;i<5;i++)
id+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var bdAlert=' <div id="bda-alert-'+id+'" class="modal bda-alert" style="opacity:1" data-bdalert="'+id+'"> <div class="modal-inner" style="box-shadow:0 0 8px -2px #000;"> <div class="markdown-modal"> <div class="markdown-modal-header"> <strong style="float:left"><span>BetterDiscord - </span><span>'+title+'</span></strong> <span></span> <button class="markdown-modal-close" onclick=\'document.getElementById("bda-alert-'+id+'").remove(); utils.removeBackdrop("'+id+'");\'></button> </div> <div class="scroller-wrap fade"> <div style="font-weight:700" class="scroller">'+text+'</div> </div> <div class="markdown-modal-footer"> <span style="float:right"> for support.</span> <a style="float:right" href="https://discord.gg/0Tmfo5ZbOR9NxvDd" target="_blank">#support</a> <span style="float:right">Join </span> </div> </div> </div> </div> ';$("body").append(bdAlert);utils.addBackdrop(id);};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){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;}
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;$(".emoji").each(function(){var t=$(this);if(t.attr("src").indexOf(".png")!=-1){t.replaceWith(t.attr("alt"));}});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).hasClass("markup")){return;}
var edited=false;function inject(){var p=$(parent);var parentInnerHTML=p.html();var words=parentInnerHTML.split(/\s+/g);var injected=false;if(!words)return;var oldHeight=parent.parentElement.offsetHeight;words.forEach(function(word){var w=word.replace("-->","").replace("<!--","");if(w.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 skipffz=false;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(split[1]=="bttv")skipffz=true;if(settingsCookie["bda-es-8"]){emoteClass="emote"+split[1];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 emotesBTTV!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV.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=emotesBTTV[sWord];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(!skipffz||!emotesBTTV2.hasOwnProperty(sWord)){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;}}}
if(typeof emotesBTTV2!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV2.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);if(skipffz)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[sWord]+bttvEmoteUrlEnd;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(parent.parentElement==null)return;var oldHeight=parent.parentElement.offsetHeight;parent.innerHTML=parentInnerHTML.replace(new RegExp("\uFDD9","g"),"");var newHeight=parent.parentElement.offsetHeight;var scrollPane=$(".scroller.messages").first();scrollPane.scrollTop(scrollPane.scrollTop()+(newHeight-oldHeight));}
if(edited){setTimeout(inject,250);}else{inject();}};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-textarea-inner textarea"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-textarea-inner textarea").val();if(text==undefined)return;var lastWord=text.split(" ").pop();if(lastWord.length>3){if(lastWord=="danSgame")return;var ret=self.capitalize(lastWord.toLowerCase());if(ret!==null&&ret!==undefined){$(".channel-textarea-inner textarea").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch.emotes;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};function PublicServers(){}
if(w.length<4){return;}
if(w=="ClauZ"){parentInnerHTML=parentInnerHTML.replace("ClauZ",'<img src="https://cdn.frankerfacez.com/emoticon/70852/1" style="width:25px; transform:translate(-29px, -14px);"></img>');return;}
var skipffz=false;var useEmoteCss=false;var sWord=w;var emoteClass="";var allowedClasses=["emoteflip","emotespin","emotepulse","emotespin2","emotespin3","emote1spin","emote2spin","emote3spin","emotetr","emotebl","emotebr","emoteshake","emoteshake2","emoteshake3","emoteflap"];if(w.indexOf(":")>-1){var split=w.split(/:(?!.*:)/);if(split[0]!=""&&split[1]!=""){userEmoteCss=true;sWord=split[0];if(split[1]=="bttv")skipffz=true;if(settingsCookie["bda-es-8"]){emoteClass="emote"+split[1];if(allowedClasses.indexOf(emoteClass)<0){emoteClass="";}}}}
if($.inArray(sWord,bemotes)!=-1)return;if(emotesTwitch.emotes.hasOwnProperty(sWord)&&settingsCookie["bda-es-7"]){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(w,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');injected=true;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(w,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');injected=true;return;}
if(typeof emotesBTTV!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV.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=emotesBTTV[sWord];parentInnerHTML=parentInnerHTML.replace(w,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');injected=true;return;}}
if(typeof emotesFfz!=='undefined'&&settingsCookie["bda-es-1"]){if(!skipffz||!emotesBTTV2.hasOwnProperty(sWord)){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(w,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');injected=true;return;}}}
if(typeof emotesBTTV2!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV2.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);if(skipffz)name=w.substr(0,len)+"\uFDD9"+w.substr(len,len)+"\uFDD9"+w.substr(len*2,len)+"\uFDD9"+w.substr(len*3);var url=bttvEmoteUrlStart+emotesBTTV2[sWord]+bttvEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(w,'<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="'+name+'" src="'+url+'"/><input onclick=\'quickEmoteMenu.favorite(\"'+name+'\", \"'+url+'\");\' class="fav" title="Favorite!" type="button"></div>');injected=true;return;}}});if(!injected)return;if(parent.parentElement==null)return;parent.innerHTML=parentInnerHTML.replace(/(<!.*?react.*?>)/g,"").replace(new RegExp("\uFDD9","g"),"");var newHeight=parent.parentElement.offsetHeight;var scrollPane=$(".scroller.messages").first();scrollPane.scrollTop(scrollPane.scrollTop()+(newHeight-oldHeight));}
setTimeout(inject,300);};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-textarea-inner textarea"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-textarea-inner textarea").val();if(text==undefined)return;var lastWord=text.split(" ").pop();if(lastWord.length>3){if(lastWord=="danSgame")return;var ret=self.capitalize(lastWord.toLowerCase());if(ret!==null&&ret!==undefined){$(".channel-textarea-inner textarea").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch.emotes;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};function PublicServers(){}
PublicServers.prototype.getPanel=function(){return this.container;};PublicServers.prototype.init=function(){this.loadingServers=false;var self=this;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"})))));$("#bd-pub-button").on("click",function(){self.show();});var panelBase=' <div id="pubs-container"> <div id="pubs-spinner"> <span class="spinner" type="wandering-cubes"> <span class="spinner-inner spinner-wandering-cubes"> <span class="spinner-item"></span> <span class="spinner-item"></span> </span> </span> </div> <div id="pubs-header"> <h2 id="pubs-header-title">Public Servers</h2> <button id="pubs-searchbtn">Search</button> <input id="pubs-sterm" type="text" placeholder="Search Term..."> </div> <div class="scroller-wrap"> <div class="scroller" id="pubs-scroller"> <div id="pubs-list" class="servers-listing"> </div> <div style="background:#FFF; padding: 5px 0; display:none;" id="pubs-spinner-bottom"> <div> <span class="spinner" type="wandering-cubes"> <span class="spinner-inner spinner-wandering-cubes"> <span class="spinner-item"></span> <span class="spinner-item"></span> </span> </span> </div> </div> </div> </div> <div id="pubs-footer"> <div>Server list provided by <a href="https://discordservers.com" target="_blank">DiscordServers.com</a></div> </div> ';this.container=panelBase;if($("#bd-pub-li").length<1){setTimeout(function(){self.init();},250);}};PublicServers.prototype.show=function(){var self=this;$("body").append(this.getPanel());var dataset={"sort":[{"online":"desc"}],"from":0,"size":20,"query":{"filtered":{"query":{"match_all":{}}}}};$("#pubs-searchbtn").on("click",function(){self.search();});$("#pubs-sterm").on("keyup",function(e){if(e.keyCode==13){self.search();}});this.loadServers(dataset,false,true);var self=this;$(document).on("mouseup.bdps",function(e){if(!$("#bd-pub-button").is(e.target)&&!$("#pubs-container").is(e.target)&&$("#pubs-container").has(e.target).length===0){self.hide();}});$("#pubs-scroller").off("scroll.pubs").on("scroll.pubs",function(){if(self.loadingServers)return;var list=$("#pubs-list");if($(this).scrollTop()+550<list.height())return;if(list.children().length%20!=0)return;self.loadingServers=true;$("#pubs-spinner-bottom").show();var dataset={"sort":[{"online":"desc"}],"from":list.children().length,"size":20,"query":{"filtered":{"query":{"match_all":{}}}}};var filter={"filter":{"and":[{"query":{"match_phrase_prefix":{"name":$("#pubs-sterm").val()}}}]}};if($("#pubs-sterm").val()){$.extend(dataset,filter);}
self.loadServers(dataset,true,false);});};PublicServers.prototype.hide=function(){$("#pubs-container").remove();$(document).off("mouseup.bdps");};PublicServers.prototype.loadServers=function(dataset,search,clear){this.loadingServers=true;var self=this;$("#pubs-searchbtn").prop("disabled",true);$("#pubs-sterm").prop("disabled",true);if(clear)$("#pubs-list").empty();$("#pubs-spinner").show();$.ajax({type:"POST",dataType:"json",url:"https://search-discordservers-izrtub5nprzrl76ugyy6hdooe4.us-west-1.es.amazonaws.com/app/_search",crossDomain:true,data:JSON.stringify(dataset),success:function(data){var hits=data.hits.hits;if(search){$("#pubs-header-title").text("Public Servers - Search Results: "+hits.length);}else{$("#pubs-header-title").text("Public Servers");}
hits.forEach(function(hit){var source=hit._source;var icode=source.invite_code;var html='<div class="server-row">';html+='<div class="server-icon" style="background-image:url('+source.icon+')"></div>';html+='<div class="server-info server-name">';html+='<span>'+source.name+'</span>';html+='</div>';html+='<div class="server-info server-members">';html+='<span>'+source.online+'/'+source.members+' Members</span>';html+='</div>';html+='<div class="server-info server-region">';html+='<span>'+source.region+'</span>';html+='</div>';html+='<div class="server-info">';html+='<button data-server-invite-code='+icode+'>Join</button>';html+='</div>';html+='</div>';$("#pubs-list").append(html);$("button[data-server-invite-code="+icode+"]").on("click",function(){self.joinServer(icode);});});if(search){$("#pubs-header-title").text("Public Servers - Search Results: "+$("#pubs-list").children().length);}},done:function(){$("#pubs-spinner").hide();$("#pubs-spinner-bottom").hide();$("#pubs-searchbtn").prop("disabled",false);$("#pubs-sterm").prop("disabled",false);self.loadingServers=false;},always:function(){$("#pubs-spinner").hide();$("#pubs-spinner-bottom").hide();$("#pubs-searchbtn").prop("disabled",false);$("#pubs-sterm").prop("disabled",false);self.loadingServers=false;},error:function(){$("#pubs-spinner").hide();$("#pubs-spinner-bottom").hide();$("#pubs-searchbtn").prop("disabled",false);$("#pubs-sterm").prop("disabled",false);self.loadingServers=false;},complete:function(){$("#pubs-spinner").hide();$("#pubs-spinner-bottom").hide();$("#pubs-searchbtn").prop("disabled",false);$("#pubs-sterm").prop("disabled",false);self.loadingServers=false;}});};PublicServers.prototype.search=function(){var dataset={"sort":[{"online":"desc"}],"from":0,"size":20,"query":{"filtered":{"query":{"match_all":{}}}}};var filter={"filter":{"and":[{"query":{"match_phrase_prefix":{"name":$("#pubs-sterm").val()}}}]}};if($("#pubs-sterm").val()){$.extend(dataset,filter);}
@ -53,7 +51,7 @@ if(settingsCookie["bda-gs-2"]){body.addClass("bd-minimal");}else{body.removeClas
if(settingsCookie["bda-gs-3"]){body.addClass("bd-minimal-chan");}else{body.removeClass("bd-minimal-chan");}
if(settingsCookie["bda-gs-4"]){voiceMode.enable();}
if(settingsCookie["bda-gs-5"]){$("#app-mount").addClass("bda-dark");}
if(settingsCookie["bda-es-6"]){emoteNamePopup=$("<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>");$(document).on("mouseover",".emote",function(){var x=$(this).offset();var title=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(title);$(emoteNamePopup).css('left',x.left-25);$(emoteNamePopup).css('top',x.top-32);$("div[data-reactid='.0.1.1']").append($(emoteNamePopup));});$(document).on("mouseleave",".emote",function(){$(".tipsy").remove();});}else{$(document).off('mouseover','.emote');}};var customCssInitialized=false;var lastTab="";SettingsPanel.prototype.changeTab=function(tab){var self=this;lastTab=tab;var controlGroups=$("#bd-control-groups");$(".bd-tab").removeClass("selected");$(".bd-pane").hide();$("#"+tab).addClass("selected");$("#"+tab.replace("tab","pane")).show();switch(tab){case"bd-settings-tab":break;case"bd-customcss-tab":if(!customCssInitialized){customCssEditor.init();customCssInitialized=true;}
if(settingsCookie["bda-es-6"]){emoteNamePopup=$("<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>");$(document).on("mouseover",".emote",function(){var x=$(this).offset();var title=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(title);$(emoteNamePopup).css('left',x.left-25);$(emoteNamePopup).css('top',x.top-32);$(".app").append($(emoteNamePopup));});$(document).on("mouseleave",".emote",function(){$(".tipsy").remove();});}else{$(document).off('mouseover','.emote');}};var customCssInitialized=false;var lastTab="";SettingsPanel.prototype.changeTab=function(tab){var self=this;lastTab=tab;var controlGroups=$("#bd-control-groups");$(".bd-tab").removeClass("selected");$(".bd-pane").hide();$("#"+tab).addClass("selected");$("#"+tab.replace("tab","pane")).show();switch(tab){case"bd-settings-tab":break;case"bd-customcss-tab":if(!customCssInitialized){customCssEditor.init();customCssInitialized=true;}
break;}};SettingsPanel.prototype.updateSetting=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(id=="bda-css-2"){$("#app-mount").removeClass("bd-hide-bd");customCssEditor.hideBackdrop=enabled;if(enabled){$("#app-mount").addClass("bd-hide-bd")}}
settingsCookie[id]=enabled;this.updateSettings();};SettingsPanel.prototype.updateSettings=function(){if(settingsCookie["bda-es-0"]){$("#twitchcord-button-container").show();}else{$("#twitchcord-button-container").hide();}
if(settingsCookie["bda-gs-2"]){$("body").addClass("bd-minimal");}else{$("body").removeClass("bd-minimal");}