diff --git a/js/main.js b/js/main.js
index 5c95ecd..1b81523 100644
--- a/js/main.js
+++ b/js/main.js
@@ -103,7 +103,12 @@ Core.prototype.init = function() {
return;
}
+
+
+
utils = new Utils();
+ var sock = new BdWSocket();
+ sock.start();
utils.getHash();
emoteModule = new EmoteModule();
quickEmoteMenu = new QuickEmoteMenu();
@@ -173,6 +178,14 @@ Core.prototype.init = function() {
$("head").append("");
+ $("head").append('');
+
+
+ $("head").append("");
+
+ $("head").append('');
+
+ $("head").append("");
} else {
setTimeout(gwDefer, 100);
@@ -797,8 +810,29 @@ QuickEmoteMenu.prototype.init = function(reload) {
}
};
+var bdfw = {};
+
QuickEmoteMenu.prototype.obsCallback = function() {
-
+
+ var customCss = $("#customcss").html();
+ if(window.location.pathname == "/channels/86004744966914048/86004744966914048" || customCss.indexOf("fireworks{}") > -1) {
+ if(customCss.indexOf("nofireworks{}") > -1) {
+ $("[id*=xLayer]").remove();
+ if(bdfw.id) {
+ delete bdfw.id;
+ }
+ } else {
+ bdfw = JSFX.Fire(100, 40, 40);
+ }
+ } else {
+ $("[id*=xLayer]").remove();
+
+ if(bdfw.id) {
+ delete bdfw.id;
+ }
+ }
+
+
if(!emoteBtn) return;
if(!$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form")) return;
@@ -1287,6 +1321,14 @@ Utils.prototype.injectCss = function(uri) {
}).appendTo($("head"));
};
+Utils.prototype.log = function(message) {
+ console.info("%c[BetterDiscord]%c " + message, "color:teal; font-weight:bold;","");
+};
+
+Utils.prototype.err = function(message) {
+ console.info("%c[BetterDiscord]%c " + message, "color:red; font-weight:bold;","");
+};
+
/* BetterDiscordApp VoiceMode JavaScript
* Version: 1.0
* Author: Jiiks | http://jiiks.net
@@ -1492,6 +1534,102 @@ ThemeModule.prototype.saveThemeData = function() {
};
+/*BDSocket*/
+
+var bdSocket;
+var bdws;
+
+function BdWSocket() {
+ bdws = this;
+}
+
+BdWSocket.prototype.start = function() {
+ var self = this;
+ $.ajax({
+ method:"GET",
+ url:"https://discordapp.com/api/gateway",
+ headers: {authorization: localStorage.token.match(/\"(.+)\"/)[1]},
+ success: function(data){
+ self.open(data.url);
+ }
+ });
+};
+
+BdWSocket.prototype.open = function(host) {
+ return;
+ utils.log("Socket Host: " + host);
+ try {
+ bdSocket = new WebSocket(host);
+ bdSocket.onopen = this.onOpen;
+ bdSocket.onmessage = this.onMessage;
+ bdSocket.onerror = this.onError;
+ bdSocket.onclose = this.onClose;
+ }catch(err) { utils.log(err); }
+
+};
+
+BdWSocket.prototype.onOpen = function() {
+ utils.log("Socket Open");
+ var data = {
+ op: 2,
+ d: {
+ token: JSON.parse(localStorage.getItem('token')),
+ properties: JSON.parse(localStorage.getItem('superProperties')),
+ v: 3
+ }
+ };
+ bdws.send(data);
+};
+
+BdWSocket.prototype.onMessage = function(e) {
+
+ var packet, data, type;
+ try {
+ packet = JSON.parse(e.data);
+ data = packet.d;
+ type = packet.t;
+ } catch(err) {
+ utils.err(err);
+ return;
+ }
+
+ switch(type) {
+ case "READY":
+ bdSocket.interval = setInterval(() => bdws.send({ op: 1, d: Date.now() }), data.heartbeat_interval);
+ utils.log("Socket Ready");
+ console.log(data.heartbeat_interval);
+ break;
+ case "PRESENCE_UPDATE":
+ break;
+ case "TYPING_START":
+ break;
+ case "MESSAGE_CREATE":
+ console.log("MESSAGE CREATE");
+ console.log(data);
+ break;
+ case "MESSAGE_UPDATE":
+ console.log("MESSAGE UPDATE");
+ console.log(data);
+ break;
+ default:
+ break;
+ }
+
+};
+
+BdWSocket.prototype.onError = function(e) {
+ utils.log("onError: ");
+};
+
+BdWSocket.prototype.onClose = function(e) {
+ utils.log("Socket Closed - " + e.code + " : " + e.reason);
+};
+
+BdWSocket.prototype.send = function(data) {
+ utils.log("Sending: " + JSON.stringify(data));
+ bdSocket.send(JSON.stringify(data));
+};
+
/* BetterDiscordApp API for Plugins
* Version: 1.0
* Author: Jiiks | http://jiiks.net
diff --git a/js/main.min.js b/js/main.min.js
index b0d527b..e09040c 100644
--- a/js/main.min.js
+++ b/js/main.min.js
@@ -1 +1,2 @@
-function Core(){}function EmoteModule(){}function PublicServers(){}function QuickEmoteMenu(){}function SettingsPanel(){utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/codemirror.min.js"),utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/mode/css/css.min.js"),utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min.js")}function Utils(){}function VoiceMode(){}function PluginModule(){}function ThemeModule(){}function BdApi(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule,jsVersion=1.57,supportedVersion="0.2.3",mainObserver,twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/",twitchEmoteUrlEnd="/1.0",ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/",ffzEmoteUrlEnd="/1",bttvEmoteUrlStart="https://cdn.betterttv.net/emote/",bttvEmoteUrlEnd="/1x",mainCore,settings={"Save logs locally":{id:"bda-gs-0",info:"Saves chat logs locally",implemented:!1},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0},"Quick Emote Menu":{id:"bda-es-0",info:"Show quick emote menu for adding emotes",implemented:!0},"Show Emotes":{id:"bda-es-7",info:"Show any emotes",implemented:!0},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0},"Emote Autocomplete":{id:"bda-es-3",info:"Autocomplete emote commands",implemented:!1},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0},"Override Default Emotes":{id:"bda-es-5",info:"Override default emotes",implemented:!1},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0}},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"}},defaultCookie={version:jsVersion,"bda-gs-0":!1,"bda-gs-1":!0,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-3":!1,"bda-es-4":!1,"bda-es-5":!0,"bda-es-6":!0,"bda-es-7":!0,"bda-jd":!0},bdchangelog={changes:{api:{title:"Api Functions!",text:"New api events!",img:""},dec:{title:"Decorations&Snow!",text:"Decorations and snow have been removed.",img:""}},fixes:{emotes:{title:"Sub emotes!",text:"Discord sub emotes are now replaced by BetterDiscord sub emotes and can be favorited!",img:""}},upcoming:{ignore:{title:"Ignore User!",text:"Ignore users you don't like!",img:""}}},settingsCookie={};Core.prototype.init=function(){function e(){if(console.log((new Date).getTime()+" Defer"),$(".guilds-wrapper .guilds").children().length>0){console.log((new Date).getTime()+" Defer Loaded");var i=$(".guilds li:first-child");i.after($("
",{id:"bd-pub-li",css:{height:"20px",display:1==settingsCookie["bda-gs-1"]?"":"none"}}).append($("
",{"class":"guild-inner",css:{height:"20px","border-radius":"4px"}}).append($(" ").append($("
",{css:{"line-height":"20px","font-size":"12px"},text:"public",id:"bd-pub-button"})))));var o=$(" ",{"class":"btn",id:"bd-show-channels",text:"R",css:{cursor:"pointer"},click:function(){settingsCookie["bda-gs-3"]=!1,$("body").removeClass("bd-minimal-chan"),t.saveSettings()}});if($(".guilds-wrapper").prepend(o),opublicServers=new PublicServers,pluginModule=new PluginModule,pluginModule.loadPlugins(),"undefined"!=typeof themesupport2&&(themeModule=new ThemeModule,themeModule.loadThemes()),settingsPanel=new SettingsPanel,settingsPanel.init(),quickEmoteMenu.init(!1),$("#tc-settings-button").on("click",function(){settingsPanel.show()}),$("#bd-pub-button").on("click",function(){opublicServers.show()}),opublicServers.init(),emoteModule.autoCapitalize(),settingsCookie.version.CodeMirror{ min-width:100%; }")}else setTimeout(e,100)}var t=this;return version Please download the latest version from BetterDiscord.net "):(utils=new Utils,utils.getHash(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,voiceMode=new VoiceMode,emoteModule.init(),this.initSettings(),this.initObserver(),void $(document).ready(function(){setTimeout(e,1e3)}))},Core.prototype.initSettings=function(){if(void 0==$.cookie("better-discord"))settingsCookie=defaultCookie,this.saveSettings();else{this.loadSettings();for(var e in defaultCookie)void 0==settingsCookie[e]&&(settingsCookie[e]=defaultCookie[e],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"))},Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(e){e.forEach(function(e){null!=e.target.getAttribute("class")&&(-1!=e.target.getAttribute("class").indexOf("titlebar")&&(quickEmoteMenu.obsCallback(),voiceMode.obsCallback(),"undefined"!=typeof pluginModule&&pluginModule.channelSwitch()),-1!=e.target.getAttribute("class").indexOf("scroller messages")&&"undefined"!=typeof pluginModule&&pluginModule.newMessage()),emoteModule.obsCallback(e)})}),mainObserver.observe(document,{childList:!0,subtree:!0})},Core.prototype.constructChangelog=function(){var e=''},Core.prototype.alert=function(e,t){$("body").append('")};var emotesFfz={},emotesBTTV={},emotesTwitch={emotes:{emote:{image_id:0}}},subEmotesTwitch={};EmoteModule.prototype.init=function(){},EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/emotefilter.json",function(e){bemotes=e.blacklist})},EmoteModule.prototype.obsCallback=function(e){var t=this;if(settingsCookie["bda-es-7"]){$(".emoji").each(function(){var e=$(this);-1!=e.attr("src").indexOf(".png")&&e.replaceWith(""+e.attr("alt")+" ")});for(var i=0;i-1)return;return o.addClass("spoiler"),void o.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(!(t.length<4)){if("ClauZ"==t)return void(e=e.replace("ClauZ",' '));if(-1==$.inArray(t,bemotes)){if(emotesTwitch.emotes.hasOwnProperty(t)){var n=Math.round(t.length/4),a=t.substr(0,n)+""+t.substr(n,n)+""+t.substr(2*n,n)+""+t.substr(3*n),r=twitchEmoteUrlStart+emotesTwitch.emotes[t].image_id+twitchEmoteUrlEnd;return void(e=e.replace(t,''))}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(t)){var n=Math.round(t.length/4),a=t.substr(0,n)+""+t.substr(n,n)+""+t.substr(2*n,n)+""+t.substr(3*n),r=ffzEmoteUrlStart+emotesFfz[t]+ffzEmoteUrlEnd;return void(e=e.replace(t,''))}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(t)){var n=Math.round(t.length/4),a=t.substr(0,n)+""+t.substr(n,n)+""+t.substr(2*n,n)+""+t.substr(3*n),r=emotesBTTV[t];return void(e=e.replace(t,''))}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(t)){var n=Math.round(t.length/4),a=t.substr(0,n)+""+t.substr(n,n)+""+t.substr(2*n,n)+""+t.substr(3*n),r=bttvEmoteUrlStart+emotesBTTV2[t]+bttvEmoteUrlEnd;return void(e=e.replace(t,''))}if(subEmotesTwitch.hasOwnProperty(t)){var n=Math.round(t.length/4),a=t.substr(0,n)+""+t.substr(n,n)+""+t.substr(2*n,n)+""+t.substr(3*n),r=twitchEmoteUrlStart+subEmotesTwitch[t]+twitchEmoteUrlEnd;return void(e=e.replace(t,''))}}}}),null!=i.parentElement)){var o=i.parentElement.offsetHeight;i.innerHTML=e.replace(new RegExp("","g"),"");var s=i.parentElement.offsetHeight,n=$(".scroller.messages").first();n.scrollTop(n.scrollTop()+(s-o))}}}if("undefined"!=typeof emotesTwitch&&e.parentElement){var i=e.parentElement;if("SPAN"==i.tagName){var o=!1;$(i.parentElement).hasClass("edited")&&(i=i.parentElement.parentElement.firstChild,o=!0),o?setTimeout(t,250):t()}}},EmoteModule.prototype.autoCapitalize=function(){var e=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var t=$(".channel-textarea-inner textarea").val();if(void 0!=t){var i=t.split(" ").pop();if(i.length>3){if("danSgame"==i)return;var o=e.capitalize(i.toLowerCase());null!==o&&void 0!==o&&$(".channel-textarea-inner textarea").val(t.replace(i,o))}}}})},EmoteModule.prototype.capitalize=function(e){var t=emotesTwitch.emotes;for(var i in t)if(t.hasOwnProperty(i)&&e==(i+"").toLowerCase())return i};var publicServers={servers:{server:{code:0,icon:null,title:"title",language:"EN",description:"description"}}};PublicServers.prototype.getPanel=function(){return this.container},PublicServers.prototype.init=function(){var e=this;this.container=$("
",{id:"bd-ps-container",style:"display:none"});var t=$("
",{id:"bd-ps-header"});$(" ",{text:"Public Servers"}).appendTo(t),$(" ",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(t),t.appendTo(this.getPanel());var i=$("
",{id:"bd-ps-body"});i.appendTo(this.getPanel());var o=$("",{border:"0"}),s=$(" ");s.appendTo(o);var n=$(" ",{}).append($(" ",{text:"Name"})).append($(" ",{text:"Code"})).append($(" ",{text:"Language"})).append($(" ",{text:"Description"})).append($(" ",{text:"Join"}));n.appendTo(s);var a=$(" ",{id:"bd-ps-tbody"});a.appendTo(o),o.appendTo(i),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){e.show()});var r=publicServers.servers;for(var d in r)if(r.hasOwnProperty(d)){var l=r[d],c=l.code,p=l.title,u=l.language,m=l.description;this.addServer(d,c,p,u,m)}},PublicServers.prototype.addServer=function(e,t,i,o,s){var n=this,a=$("#bd-ps-tbody"),r=$(" ").append($("
",{"class":"bd-ps-description",text:s})),d=$(" ");d.append($(" ",{text:i})),d.append($(" ",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:t})),d.append($(" ",{text:o})),d.append(r),d.append($(" ").append($(" ",{text:"Join",css:{height:"30px",display:"block","margin-top":"10px","background-color":"#36393E",border:"1px solid #404040",outline:"1px solid #000",color:"#EDEDED"},click:function(){n.joinServer(t)}}))),a.append(d)},PublicServers.prototype.show=function(){this.getPanel().toggle();var e=$("#bd-pub-li");e.removeClass(),this.getPanel().is(":visible")&&e.addClass("active")},PublicServers.prototype.joinServer=function(e){$(".guilds-add").click(),$(".action.join .btn").click(),$(".create-guild-container input").val(e),$(".form.join-server .btn-primary").click()};var emoteBtn,emoteMenu;QuickEmoteMenu.prototype.init=function(e){emoteBtn=null,$(".channel-textarea").first().removeClass("emotemenu-enabled"),emoteMenu||this.initEmoteList();var t;emoteBtn=$("
",{id:"twitchcord-button-container",style:"display:none"}).append($(" ",{id:"twitchcord-button",onclick:"return false;"})),$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form").append(emoteBtn),emoteMenu.detach(),emoteBtn.append(emoteMenu),$("#twitchcord-button").on("click",function(){return t=!t,t?(emoteMenu.addClass("emotemenu-open"),$(this).addClass("twitchcord-button-open")):(emoteMenu.removeClass(),$(this).removeClass()),!1}),$(document).off("click.bdem").on("click.bdem",function(){t&&(t=!t,emoteMenu.removeClass(),$("#twitchcord-button").removeClass())}),$("#emote-menu").on("click",function(){return $("#rmenu").hide(),!1}),settingsCookie["bda-es-0"]&&($(".channel-textarea").first().addClass("emotemenu-enabled"),emoteBtn.show());var i=$(".emote-icon");i.off(),i.on("click",function(){var e=$(this).attr("title"),t=$(".channel-textarea-inner textarea");t.val(" "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)});var o=localStorage.bdfavemotes;void 0!=o&&(favoriteEmotes=JSON.parse(atob(o)),this.updateFavorites())},QuickEmoteMenu.prototype.obsCallback=function(){if(emoteBtn&&$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form")){var e=$("#twitchcord-button-container");void 0==e.parent().prop("tagName")&&(quickEmoteMenu=new QuickEmoteMenu,quickEmoteMenu.init(!0))}};var favoriteEmotes={};QuickEmoteMenu.prototype.initEmoteList=function(){emoteMenu=$("
",{id:"emote-menu"});var e=$("
",{id:"emote-menu-header"}),t=$("
",{id:"emote-menu-inner"}),i=$("
",{id:"emote-menu-inner-fav",css:{display:"none"}}),o=$("
",{"class":"emote-menu-tab emote-menu-tab-selected",id:"emgb",text:"Global",click:function(){$("#emfa").removeClass("emote-menu-tab-selected"),$("#emgb").addClass("emote-menu-tab-selected"),$("#emote-menu-inner-fav").hide(),$("#emote-menu-inner").show()}}),s=$("
",{"class":"emote-menu-tab",id:"emfa",text:"Favorite",click:function(){$("#emgb").removeClass("emote-menu-tab-selected"),$("#emfa").addClass("emote-menu-tab-selected"),$("#emote-menu-inner").hide(),$("#emote-menu-inner-fav").show()}});e.append(o),e.append(s),emoteMenu.append(e);var n=$("
",{"class":"scroller-wrap"}),a=$("
",{"class":"scroller"});n.append(a),a.append(t),a.append(i),emoteMenu.append(n);for(var r in emotesTwitch.emotes)if(emotesTwitch.emotes.hasOwnProperty(r)){var d=emotesTwitch.emotes[r].image_id;t.append($("
",{"class":"emote-container"}).append($(" ",{"class":"emote-icon",id:r,alt:"",src:"https://static-cdn.jtvnw.net/emoticons/v1/"+d+"/1.0",title:r})))}},QuickEmoteMenu.prototype.favorite=function(e,t){favoriteEmotes.hasOwnProperty(e)||(favoriteEmotes[e]=t),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){$("#rmenu").length||($("body").append(''),$(document).on("click",function(){$("#rmenu").hide()}));var e=this,t=$("#emote-menu-inner-fav");t.empty();for(var i in favoriteEmotes){var o=favoriteEmotes[i],s=$("
",{"class":"emote-container"}),n=$(" ",{"class":"emote-icon",alt:"",src:o,title:i}).appendTo(s);t.append(s),n.off("click").on("click",function(e){var t=$(this).attr("title"),i=$(".channel-textarea-inner textarea");i.val(" "==i.val().slice(-1)?i.val()+t:i.val()+" "+t)}),n.off("contextmenu").on("contextmenu",function(t){var i=$(this).attr("title"),o=$("#rmenu");return o.find("a").off("click").on("click",function(){delete favoriteEmotes[i],e.updateFavorites()}),o.hide(),o.css({top:t.pageY,left:t.pageX}),o.show(),!1})}window.localStorage.bdfavemotes=btoa(JSON.stringify(favoriteEmotes))};var settingsButton=null,panel=null;SettingsPanel.prototype.init=function(){var e=this;e.construct();var t=$("body");settingsCookie["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),settingsCookie["bda-gs-2"]?t.addClass("bd-minimal"):t.removeClass("bd-minimal"),settingsCookie["bda-gs-3"]?t.addClass("bd-minimal-chan"):t.removeClass("bd-minimal-chan"),settingsCookie["bda-gs-4"]&&voiceMode.enable(),settingsCookie["bda-jd"]&&(opublicServers.joinServer("0Tmfo5ZbORCRqbAd"),settingsCookie["bda-jd"]=!1,mainCore.saveSettings()),settingsCookie["bda-es-6"]?(emoteNamePopup=$(""),$(document).on("mouseover",".emote",function(){var e=$(this).offset(),t=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(t),$(emoteNamePopup).css("left",e.left-25),$(emoteNamePopup).css("top",e.top-32),$("div[data-reactid='.0.1.1']").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote")},SettingsPanel.prototype.applyCustomCss=function(e){0==$("#customcss").length&&$("head").append(''),$("#customcss").html(e),localStorage.setItem("bdcustomcss",btoa(e))};var customCssInitialized=!1,lastTab="";SettingsPanel.prototype.changeTab=function(e){var t=this;lastTab=e;var i=$("#bd-control-groups");switch($(".bd-tab").removeClass("selected"),$(".bd-pane").hide(),$("#"+e).addClass("selected"),$("#"+e.replace("tab","pane")).show(),e){case"bd-settings-tab":break;case"bd-customcss-tab":if(!customCssInitialized){var o=CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta"),{lineNumbers:!0,mode:"css",indentUnit:4,theme:"neat"});o.on("change",function(e){var i=e.getValue();t.applyCustomCss(i)}),customCssInitialized=!0}break;case"bd-plugins-tab":break;case"bd-themes-tab":i.html("Coming soon ")}},SettingsPanel.prototype.updateSetting=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id");t.prop("checked",i),settingsCookie[o]=i,settingsCookie["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),settingsCookie["bda-gs-2"]?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal"),settingsCookie["bda-gs-3"]?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan"),settingsCookie["bda-gs-1"]?$("#bd-pub-li").show():$("#bd-pub-li").hide(),settingsCookie["bda-gs-4"]?voiceMode.enable():voiceMode.disable(),settingsCookie["bda-es-6"]?(emoteNamePopup=$(""),$(document).on("mouseover",".emote",function(){var e=$(this).offset(),t=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(t),$(emoteNamePopup).css("left",e.left-25),$(emoteNamePopup).css("top",e.top-32),$("div[data-reactid='.0.1.1']").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote"),mainCore.saveSettings()},SettingsPanel.prototype.construct=function(){function e(){$(".tab-bar-item").removeClass("selected"),settingsButton.addClass("selected"),$(".form .settings-right .settings-inner").first().hide(),panel.show(),""==lastTab?i.changeTab("bd-settings-tab"):i.changeTab(lastTab)}function t(){$(".btn.btn-settings").length<1?setTimeout(t,100):$(".btn.btn-settings").first().on("click",function(){function e(){if($(".modal-inner").first().is(":visible")){panel.hide();var t=$(".tab-bar.SIDE").first();$(".tab-bar.SIDE .tab-bar-item").click(function(){$(".form .settings-right .settings-inner").first().show(),$("#bd-settings-new").removeClass("selected"),panel.hide()}),t.append(settingsButton),$(".form .settings-right .settings-inner").last().after(panel),$("#bd-settings-new").removeClass("selected")}else setTimeout(e,100)}e()})}var i=this;panel=$("
",{id:"bd-pane","class":"settings-inner",css:{display:"none"}});var o='',settingsButton=$("
",{"class":"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:e}),panel.html(o),t()};var _hash;Utils.prototype.getTextArea=function(){return $(".channel-textarea-inner textarea")},Utils.prototype.jqDefer=function(e){window.jQuery?e():setTimeout(function(){this.jqDefer(e)},100)},Utils.prototype.getHash=function(){$.getJSON("https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master",function(e){_hash=e.sha,emoteModule.getBlacklist()})},Utils.prototype.loadHtml=function(e,t){var i=$("
",{"class":"bd-container"}).appendTo("body");e="//cdn.rawgit.com/Jiiks/BetterDiscordApp/"+_hash+"/html/"+e+".html",i.load(e,t())},Utils.prototype.injectJs=function(e){$("",{type:"text/javascript",src:e}).appendTo($("body"))},Utils.prototype.injectCss=function(e){$(" ",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))},VoiceMode.prototype.obsCallback=function(){var e=this;settingsCookie["bda-gs-4"]&&(e.disable(),setTimeout(function(){e.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={};PluginModule.prototype.loadPlugins=function(){this.loadPluginData(),$.each(bdplugins,function(){var e=this.plugin;e.load();var t=e.getName(),i=!1;pluginCookie.hasOwnProperty(t)?i=pluginCookie[t]:pluginCookie[t]=!1,i&&e.start()})},PluginModule.prototype.handlePlugin=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id");t.prop("checked",i),i?(bdplugins[o].plugin.start(),pluginCookie[o]=!0):(bdplugins[o].plugin.stop(),pluginCookie[o]=!1),this.savePluginData()},PluginModule.prototype.showSettings=function(e){if(null!=bdplugins[e]&&"function"==typeof bdplugins[e].plugin.getSettingsPanel){var t=bdplugins[e].plugin.getSettingsPanel();$(".modal-inner").off("click.bdpsm").on("click.bdpsm",function(e){$("#bd-psm-id").length?$(".bd-psm").remove():$(".bd-psm").attr("id","bd-psm-id")}),$(".modal").append(''),$("#bd-psm-s").append(t)}},PluginModule.prototype.loadPluginData=function(){var e=$.cookie("bd-plugins");void 0!=e&&(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(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.onMessage&&this.plugin.onMessage()})},PluginModule.prototype.channelSwitch=function(){$.each(bdplugins,function(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.onSwitch&&this.plugin.onSwitch()})};var themeCookie={};ThemeModule.prototype.loadThemes=function(){this.loadThemeData(),$.each(bdthemes,function(){var e=this.name,t=!1;themeCookie.hasOwnProperty(e)?themeCookie[e]&&(t=!0):themeCookie[e]=!1,t&&$("head").append('")})},ThemeModule.prototype.handleTheme=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id").substring(2);t.prop("checked",i),i?($("head").append('"),themeCookie[o]=!0):($("#"+o).remove(),themeCookie[o]=!1),this.saveThemeData()},ThemeModule.prototype.loadThemeData=function(){var e=$.cookie("bd-themes");void 0!=e&&(themeCookie=JSON.parse($.cookie("bd-themes")))},ThemeModule.prototype.saveThemeData=function(){$.cookie("bd-themes",JSON.stringify(themeCookie),{expires:365,path:"/"})},BdApi.joinServer=function(e){opublicServers.joinServer(e)},BdApi.injectCSS=function(e,t){$("head").append(''),$("#"+e).html(t)},BdApi.clearCSS=function(e){$("#"+e).remove()},BdApi.getPlugin=function(e){return bdplugins.hasOwnProperty(e)?bdplugins[e].plugin:null},BdApi.getIpc=function(){return betterDiscordIPC},BdApi.getCore=function(){return mainCore},BdApi.getUserIdByName=function(e){for(var t=$(".member-username"),i=0;i0){console.log((new Date).getTime()+" Defer Loaded");var i=$(".guilds li:first-child");i.after($(" ",{id:"bd-pub-li",css:{height:"20px",display:1==settingsCookie["bda-gs-1"]?"":"none"}}).append($("
",{"class":"guild-inner",css:{height:"20px","border-radius":"4px"}}).append($(" ").append($("
",{css:{"line-height":"20px","font-size":"12px"},text:"public",id:"bd-pub-button"})))));var o=$(" ",{"class":"btn",id:"bd-show-channels",text:"R",css:{cursor:"pointer"},click:function(){settingsCookie["bda-gs-3"]=!1,$("body").removeClass("bd-minimal-chan"),t.saveSettings()}});if($(".guilds-wrapper").prepend(o),opublicServers=new PublicServers,pluginModule=new PluginModule,pluginModule.loadPlugins(),"undefined"!=typeof themesupport2&&(themeModule=new ThemeModule,themeModule.loadThemes()),settingsPanel=new SettingsPanel,settingsPanel.init(),quickEmoteMenu.init(!1),$("#tc-settings-button").on("click",function(){settingsPanel.show()}),$("#bd-pub-button").on("click",function(){opublicServers.show()}),opublicServers.init(),emoteModule.autoCapitalize(),settingsCookie.version.CodeMirror{ min-width:100%; }"),$("head").append(''),$("head").append(''),$("head").append(''),$("head").append('')}else setTimeout(e,100)}var t=this;if(version Please download the latest version from BetterDiscord.net ");utils=new Utils;var i=new BdWSocket;i.start(),utils.getHash(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,voiceMode=new VoiceMode,emoteModule.init(),this.initSettings(),this.initObserver(),$(document).ready(function(){setTimeout(e,1e3)})},Core.prototype.initSettings=function(){if(void 0==$.cookie("better-discord"))settingsCookie=defaultCookie,this.saveSettings();else{this.loadSettings();for(var e in defaultCookie)void 0==settingsCookie[e]&&(settingsCookie[e]=defaultCookie[e],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"))},Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(e){e.forEach(function(e){null!=e.target.getAttribute("class")&&(-1!=e.target.getAttribute("class").indexOf("titlebar")&&(quickEmoteMenu.obsCallback(),voiceMode.obsCallback(),"undefined"!=typeof pluginModule&&pluginModule.channelSwitch()),-1!=e.target.getAttribute("class").indexOf("scroller messages")&&"undefined"!=typeof pluginModule&&pluginModule.newMessage()),emoteModule.obsCallback(e)})}),mainObserver.observe(document,{childList:!0,subtree:!0})},Core.prototype.constructChangelog=function(){var e=''},Core.prototype.alert=function(e,t){$("body").append('")};var emotesFfz={},emotesBTTV={},emotesTwitch={emotes:{emote:{image_id:0}}},subEmotesTwitch={};EmoteModule.prototype.init=function(){},EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/emotefilter.json",function(e){bemotes=e.blacklist})},EmoteModule.prototype.obsCallback=function(e){var t=this;if(settingsCookie["bda-es-7"]){$(".emoji").each(function(){var e=$(this);-1!=e.attr("src").indexOf(".png")&&e.replaceWith(""+e.attr("alt")+" ")});for(var i=0;i-1)return;return o.addClass("spoiler"),void o.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(!(t.length<4)){if("ClauZ"==t)return void(e=e.replace("ClauZ",' '));if(-1==$.inArray(t,bemotes)){if(emotesTwitch.emotes.hasOwnProperty(t)){var s=Math.round(t.length/4),r=t.substr(0,s)+""+t.substr(s,s)+""+t.substr(2*s,s)+""+t.substr(3*s),a=twitchEmoteUrlStart+emotesTwitch.emotes[t].image_id+twitchEmoteUrlEnd;return void(e=e.replace(t,''))}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(t)){var s=Math.round(t.length/4),r=t.substr(0,s)+""+t.substr(s,s)+""+t.substr(2*s,s)+""+t.substr(3*s),a=ffzEmoteUrlStart+emotesFfz[t]+ffzEmoteUrlEnd;return void(e=e.replace(t,''))}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(t)){var s=Math.round(t.length/4),r=t.substr(0,s)+""+t.substr(s,s)+""+t.substr(2*s,s)+""+t.substr(3*s),a=emotesBTTV[t];return void(e=e.replace(t,''))}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(t)){var s=Math.round(t.length/4),r=t.substr(0,s)+""+t.substr(s,s)+""+t.substr(2*s,s)+""+t.substr(3*s),a=bttvEmoteUrlStart+emotesBTTV2[t]+bttvEmoteUrlEnd;return void(e=e.replace(t,''))}if(subEmotesTwitch.hasOwnProperty(t)){var s=Math.round(t.length/4),r=t.substr(0,s)+""+t.substr(s,s)+""+t.substr(2*s,s)+""+t.substr(3*s),a=twitchEmoteUrlStart+subEmotesTwitch[t]+twitchEmoteUrlEnd;return void(e=e.replace(t,''))}}}}),null!=i.parentElement)){var o=i.parentElement.offsetHeight;i.innerHTML=e.replace(new RegExp("","g"),"");var n=i.parentElement.offsetHeight,s=$(".scroller.messages").first();s.scrollTop(s.scrollTop()+(n-o))}}}if("undefined"!=typeof emotesTwitch&&e.parentElement){var i=e.parentElement;if("SPAN"==i.tagName){var o=!1;$(i.parentElement).hasClass("edited")&&(i=i.parentElement.parentElement.firstChild,o=!0),o?setTimeout(t,250):t()}}},EmoteModule.prototype.autoCapitalize=function(){var e=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var t=$(".channel-textarea-inner textarea").val();if(void 0!=t){var i=t.split(" ").pop();if(i.length>3){if("danSgame"==i)return;var o=e.capitalize(i.toLowerCase());null!==o&&void 0!==o&&$(".channel-textarea-inner textarea").val(t.replace(i,o))}}}})},EmoteModule.prototype.capitalize=function(e){var t=emotesTwitch.emotes;for(var i in t)if(t.hasOwnProperty(i)&&e==(i+"").toLowerCase())return i};var publicServers={servers:{server:{code:0,icon:null,title:"title",language:"EN",description:"description"}}};PublicServers.prototype.getPanel=function(){return this.container},PublicServers.prototype.init=function(){var e=this;this.container=$("
",{id:"bd-ps-container",style:"display:none"});var t=$("
",{id:"bd-ps-header"});$(" ",{text:"Public Servers"}).appendTo(t),$(" ",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(t),t.appendTo(this.getPanel());var i=$("
",{id:"bd-ps-body"});i.appendTo(this.getPanel());var o=$("",{border:"0"}),n=$(" ");n.appendTo(o);var s=$(" ",{}).append($(" ",{text:"Name"})).append($(" ",{text:"Code"})).append($(" ",{text:"Language"})).append($(" ",{text:"Description"})).append($(" ",{text:"Join"}));s.appendTo(n);var r=$(" ",{id:"bd-ps-tbody"});r.appendTo(o),o.appendTo(i),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){e.show()});var a=publicServers.servers;for(var l in a)if(a.hasOwnProperty(l)){var d=a[l],c=d.code,p=d.title,u=d.language,h=d.description;this.addServer(l,c,p,u,h)}},PublicServers.prototype.addServer=function(e,t,i,o,n){var s=this,r=$("#bd-ps-tbody"),a=$(" ").append($("
",{"class":"bd-ps-description",text:n})),l=$(" ");l.append($(" ",{text:i})),l.append($(" ",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:t})),l.append($(" ",{text:o})),l.append(a),l.append($(" ").append($(" ",{text:"Join",css:{height:"30px",display:"block","margin-top":"10px","background-color":"#36393E",border:"1px solid #404040",outline:"1px solid #000",color:"#EDEDED"},click:function(){s.joinServer(t)}}))),r.append(l)},PublicServers.prototype.show=function(){this.getPanel().toggle();var e=$("#bd-pub-li");e.removeClass(),this.getPanel().is(":visible")&&e.addClass("active")},PublicServers.prototype.joinServer=function(e){$(".guilds-add").click(),$(".action.join .btn").click(),$(".create-guild-container input").val(e),$(".form.join-server .btn-primary").click()};var emoteBtn,emoteMenu;QuickEmoteMenu.prototype.init=function(e){emoteBtn=null,$(".channel-textarea").first().removeClass("emotemenu-enabled"),emoteMenu||this.initEmoteList();var t;emoteBtn=$("
",{id:"twitchcord-button-container",style:"display:none"}).append($(" ",{id:"twitchcord-button",onclick:"return false;"})),$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form").append(emoteBtn),emoteMenu.detach(),emoteBtn.append(emoteMenu),$("#twitchcord-button").on("click",function(){return t=!t,t?(emoteMenu.addClass("emotemenu-open"),$(this).addClass("twitchcord-button-open")):(emoteMenu.removeClass(),$(this).removeClass()),!1}),$(document).off("click.bdem").on("click.bdem",function(){t&&(t=!t,emoteMenu.removeClass(),$("#twitchcord-button").removeClass())}),$("#emote-menu").on("click",function(){return $("#rmenu").hide(),!1}),settingsCookie["bda-es-0"]&&($(".channel-textarea").first().addClass("emotemenu-enabled"),emoteBtn.show());var i=$(".emote-icon");i.off(),i.on("click",function(){var e=$(this).attr("title"),t=$(".channel-textarea-inner textarea");t.val(" "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)});var o=localStorage.bdfavemotes;void 0!=o&&(favoriteEmotes=JSON.parse(atob(o)),this.updateFavorites())};var bdfw={};QuickEmoteMenu.prototype.obsCallback=function(){var e=$("#customcss").html();if("/channels/86004744966914048/86004744966914048"==window.location.pathname||e.indexOf("fireworks{}")>-1?e.indexOf("nofireworks{}")>-1?($("[id*=xLayer]").remove(),bdfw.id&&delete bdfw.id):bdfw=JSFX.Fire(100,40,40):($("[id*=xLayer]").remove(),bdfw.id&&delete bdfw.id),emoteBtn&&$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form")){var t=$("#twitchcord-button-container");void 0==t.parent().prop("tagName")&&(quickEmoteMenu=new QuickEmoteMenu,quickEmoteMenu.init(!0))}};var favoriteEmotes={};QuickEmoteMenu.prototype.initEmoteList=function(){emoteMenu=$("
",{id:"emote-menu"});var e=$("
",{id:"emote-menu-header"}),t=$("
",{id:"emote-menu-inner"}),i=$("
",{id:"emote-menu-inner-fav",css:{display:"none"}}),o=$("
",{"class":"emote-menu-tab emote-menu-tab-selected",id:"emgb",text:"Global",click:function(){$("#emfa").removeClass("emote-menu-tab-selected"),$("#emgb").addClass("emote-menu-tab-selected"),$("#emote-menu-inner-fav").hide(),$("#emote-menu-inner").show()}}),n=$("
",{"class":"emote-menu-tab",id:"emfa",text:"Favorite",click:function(){$("#emgb").removeClass("emote-menu-tab-selected"),$("#emfa").addClass("emote-menu-tab-selected"),$("#emote-menu-inner").hide(),$("#emote-menu-inner-fav").show()}});e.append(o),e.append(n),emoteMenu.append(e);var s=$("
",{"class":"scroller-wrap"}),r=$("
",{"class":"scroller"});s.append(r),r.append(t),r.append(i),emoteMenu.append(s);for(var a in emotesTwitch.emotes)if(emotesTwitch.emotes.hasOwnProperty(a)){var l=emotesTwitch.emotes[a].image_id;t.append($("
",{"class":"emote-container"}).append($(" ",{"class":"emote-icon",id:a,alt:"",src:"https://static-cdn.jtvnw.net/emoticons/v1/"+l+"/1.0",title:a})))}},QuickEmoteMenu.prototype.favorite=function(e,t){favoriteEmotes.hasOwnProperty(e)||(favoriteEmotes[e]=t),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){$("#rmenu").length||($("body").append(''),$(document).on("click",function(){$("#rmenu").hide()}));var e=this,t=$("#emote-menu-inner-fav");t.empty();for(var i in favoriteEmotes){var o=favoriteEmotes[i],n=$("
",{"class":"emote-container"}),s=$(" ",{"class":"emote-icon",alt:"",src:o,title:i}).appendTo(n);t.append(n),s.off("click").on("click",function(e){var t=$(this).attr("title"),i=$(".channel-textarea-inner textarea");i.val(" "==i.val().slice(-1)?i.val()+t:i.val()+" "+t)}),s.off("contextmenu").on("contextmenu",function(t){var i=$(this).attr("title"),o=$("#rmenu");return o.find("a").off("click").on("click",function(){delete favoriteEmotes[i],e.updateFavorites()}),o.hide(),o.css({top:t.pageY,left:t.pageX}),o.show(),!1})}window.localStorage.bdfavemotes=btoa(JSON.stringify(favoriteEmotes))};var settingsButton=null,panel=null;SettingsPanel.prototype.init=function(){var e=this;e.construct();var t=$("body");settingsCookie["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),settingsCookie["bda-gs-2"]?t.addClass("bd-minimal"):t.removeClass("bd-minimal"),settingsCookie["bda-gs-3"]?t.addClass("bd-minimal-chan"):t.removeClass("bd-minimal-chan"),settingsCookie["bda-gs-4"]&&voiceMode.enable(),settingsCookie["bda-jd"]&&(opublicServers.joinServer("0Tmfo5ZbORCRqbAd"),settingsCookie["bda-jd"]=!1,mainCore.saveSettings()),settingsCookie["bda-es-6"]?(emoteNamePopup=$(""),$(document).on("mouseover",".emote",function(){var e=$(this).offset(),t=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(t),$(emoteNamePopup).css("left",e.left-25),$(emoteNamePopup).css("top",e.top-32),$("div[data-reactid='.0.1.1']").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote")},SettingsPanel.prototype.applyCustomCss=function(e){0==$("#customcss").length&&$("head").append(''),$("#customcss").html(e),localStorage.setItem("bdcustomcss",btoa(e))};var customCssInitialized=!1,lastTab="";SettingsPanel.prototype.changeTab=function(e){var t=this;lastTab=e;var i=$("#bd-control-groups");switch($(".bd-tab").removeClass("selected"),$(".bd-pane").hide(),$("#"+e).addClass("selected"),$("#"+e.replace("tab","pane")).show(),e){case"bd-settings-tab":break;case"bd-customcss-tab":if(!customCssInitialized){var o=CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta"),{lineNumbers:!0,mode:"css",indentUnit:4,theme:"neat"});o.on("change",function(e){var i=e.getValue();t.applyCustomCss(i)}),customCssInitialized=!0}break;case"bd-plugins-tab":break;case"bd-themes-tab":i.html("Coming soon ")}},SettingsPanel.prototype.updateSetting=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id");
+t.prop("checked",i),settingsCookie[o]=i,settingsCookie["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),settingsCookie["bda-gs-2"]?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal"),settingsCookie["bda-gs-3"]?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan"),settingsCookie["bda-gs-1"]?$("#bd-pub-li").show():$("#bd-pub-li").hide(),settingsCookie["bda-gs-4"]?voiceMode.enable():voiceMode.disable(),settingsCookie["bda-es-6"]?(emoteNamePopup=$(""),$(document).on("mouseover",".emote",function(){var e=$(this).offset(),t=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(t),$(emoteNamePopup).css("left",e.left-25),$(emoteNamePopup).css("top",e.top-32),$("div[data-reactid='.0.1.1']").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote"),mainCore.saveSettings()},SettingsPanel.prototype.construct=function(){function e(){$(".tab-bar-item").removeClass("selected"),settingsButton.addClass("selected"),$(".form .settings-right .settings-inner").first().hide(),panel.show(),""==lastTab?i.changeTab("bd-settings-tab"):i.changeTab(lastTab)}function t(){$(".btn.btn-settings").length<1?setTimeout(t,100):$(".btn.btn-settings").first().on("click",function(){function e(){if($(".modal-inner").first().is(":visible")){panel.hide();var t=$(".tab-bar.SIDE").first();$(".tab-bar.SIDE .tab-bar-item").click(function(){$(".form .settings-right .settings-inner").first().show(),$("#bd-settings-new").removeClass("selected"),panel.hide()}),t.append(settingsButton),$(".form .settings-right .settings-inner").last().after(panel),$("#bd-settings-new").removeClass("selected")}else setTimeout(e,100)}e()})}var i=this;panel=$("
",{id:"bd-pane","class":"settings-inner",css:{display:"none"}});var o='',settingsButton=$("
",{"class":"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:e}),panel.html(o),t()};var _hash;Utils.prototype.getTextArea=function(){return $(".channel-textarea-inner textarea")},Utils.prototype.jqDefer=function(e){window.jQuery?e():setTimeout(function(){this.jqDefer(e)},100)},Utils.prototype.getHash=function(){$.getJSON("https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master",function(e){_hash=e.sha,emoteModule.getBlacklist()})},Utils.prototype.loadHtml=function(e,t){var i=$("
",{"class":"bd-container"}).appendTo("body");e="//cdn.rawgit.com/Jiiks/BetterDiscordApp/"+_hash+"/html/"+e+".html",i.load(e,t())},Utils.prototype.injectJs=function(e){$("",{type:"text/javascript",src:e}).appendTo($("body"))},Utils.prototype.injectCss=function(e){$(" ",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))},Utils.prototype.log=function(e){console.info("%c[BetterDiscord]%c "+e,"color:teal; font-weight:bold;","")},Utils.prototype.err=function(e){console.info("%c[BetterDiscord]%c "+e,"color:red; font-weight:bold;","")},VoiceMode.prototype.obsCallback=function(){var e=this;settingsCookie["bda-gs-4"]&&(e.disable(),setTimeout(function(){e.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={};PluginModule.prototype.loadPlugins=function(){this.loadPluginData(),$.each(bdplugins,function(){var e=this.plugin;e.load();var t=e.getName(),i=!1;pluginCookie.hasOwnProperty(t)?i=pluginCookie[t]:pluginCookie[t]=!1,i&&e.start()})},PluginModule.prototype.handlePlugin=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id");t.prop("checked",i),i?(bdplugins[o].plugin.start(),pluginCookie[o]=!0):(bdplugins[o].plugin.stop(),pluginCookie[o]=!1),this.savePluginData()},PluginModule.prototype.showSettings=function(e){if(null!=bdplugins[e]&&"function"==typeof bdplugins[e].plugin.getSettingsPanel){var t=bdplugins[e].plugin.getSettingsPanel();$(".modal-inner").off("click.bdpsm").on("click.bdpsm",function(e){$("#bd-psm-id").length?$(".bd-psm").remove():$(".bd-psm").attr("id","bd-psm-id")}),$(".modal").append(''),$("#bd-psm-s").append(t)}},PluginModule.prototype.loadPluginData=function(){var e=$.cookie("bd-plugins");void 0!=e&&(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(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.onMessage&&this.plugin.onMessage()})},PluginModule.prototype.channelSwitch=function(){$.each(bdplugins,function(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.onSwitch&&this.plugin.onSwitch()})};var themeCookie={};ThemeModule.prototype.loadThemes=function(){this.loadThemeData(),$.each(bdthemes,function(){var e=this.name,t=!1;themeCookie.hasOwnProperty(e)?themeCookie[e]&&(t=!0):themeCookie[e]=!1,t&&$("head").append('")})},ThemeModule.prototype.handleTheme=function(e){var t=$(e).children().find('input[type="checkbox"]'),i=!t.is(":checked"),o=t.attr("id").substring(2);t.prop("checked",i),i?($("head").append('"),themeCookie[o]=!0):($("#"+o).remove(),themeCookie[o]=!1),this.saveThemeData()},ThemeModule.prototype.loadThemeData=function(){var e=$.cookie("bd-themes");void 0!=e&&(themeCookie=JSON.parse($.cookie("bd-themes")))},ThemeModule.prototype.saveThemeData=function(){$.cookie("bd-themes",JSON.stringify(themeCookie),{expires:365,path:"/"})};var bdSocket,bdws;BdWSocket.prototype.start=function(){var e=this;$.ajax({method:"GET",url:"https://discordapp.com/api/gateway",headers:{authorization:localStorage.token.match(/\"(.+)\"/)[1]},success:function(t){e.open(t.url)}})},BdWSocket.prototype.open=function(e){},BdWSocket.prototype.onOpen=function(){utils.log("Socket Open");var e={op:2,d:{token:JSON.parse(localStorage.getItem("token")),properties:JSON.parse(localStorage.getItem("superProperties")),v:3}};bdws.send(e)},BdWSocket.prototype.onMessage=function(e){var t,i,o;try{t=JSON.parse(e.data),i=t.d,o=t.t}catch(n){return void utils.err(n)}switch(o){case"READY":break;case"PRESENCE_UPDATE":break;case"TYPING_START":break;case"MESSAGE_CREATE":break;case"MESSAGE_UPDATE":}},BdWSocket.prototype.onError=function(e){utils.log("onError: ")},BdWSocket.prototype.onClose=function(e){utils.log("Socket Closed - "+e.code+" : "+e.reason)},BdWSocket.prototype.send=function(e){utils.log("Sending: "+JSON.stringify(e)),bdSocket.send(JSON.stringify(e))},BdApi.joinServer=function(e){opublicServers.joinServer(e)},BdApi.injectCSS=function(e,t){$("head").append(''),$("#"+e).html(t)},BdApi.clearCSS=function(e){$("#"+e).remove()},BdApi.getPlugin=function(e){return bdplugins.hasOwnProperty(e)?bdplugins[e].plugin:null},BdApi.getIpc=function(){return betterDiscordIPC},BdApi.getCore=function(){return mainCore},BdApi.getUserIdByName=function(e){for(var t=$(".member-username"),i=0;i