BetterDiscordApp-v1/js/main.min.js

2 lines
42 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function Core(){}function EmoteModule(){}function PublicServers(){}function QuickEmoteMenu(){}function CustomCssEditor(){}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 BdWSocket(){bdws=this}function BdApi(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule,customCssEditor,jsVersion=1.63,supportedVersion="0.2.5",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,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core"},"Override Default Emotes":{id:"bda-es-5",info:"Override default emotes",implemented:!1,hidden:!1,cat:"core"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core"},"Custom css live update":{id:"bda-css-0",info:"",implemented:!0,hidden:!0,cat:"core"},"Custom css auto udpate":{id:"bda-css-1",info:"",implemented:!0,hidden:!0,cat:"core"},"Show Emotes":{id:"bda-es-7",info:"Show any emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Autocomplete":{id:"bda-es-3",info:"Autocomplete emote commands",implemented:!1,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods",implemented:!0,hidden:!1,cat:"emote"}},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-gs-5":!0,"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-es-8":!0,"bda-jd":!0,"bda-es-8":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0},bdchangelog={changes:{darkmode:{title:"v1.63 : Dark Mode",text:"Dark mode makes certain elements dark by default(currently only applies to emote menu)",img:""},emotemenu:{title:"v1.62 : Brand new emote menu that fits in Discord emoji menu!",text:"The emote menu has been replaced by a new one that injects itself in the Discord emoji menu!",img:""},cccss:{title:"v1.61 : New custom CSS editor",text:"The custom CSS editor now has options and can be detached!",img:""},vdc:{title:"v1.61 : Voice Disconnect",text:"Disconnect from voice server when closing Discord!",img:""},pslist:{title:"v1.60 : New public server list!",text:'New and shiny public server list powered by <a href="https://www.discordservers.com/" target="_blank">DiscordServers.com</a>!',img:""},api:{title:"v1.59 : New plugin api callback",text:"Use the `observer(e)` callback instead of creating your own MutationObserver",img:""},emotemods:{title:"v1.59 : New emote mods!",text:"The following emote mods have been added: :shake2, :shake3, :flap",img:""},minmode:{title:"v1.59: Minimal mode",text:"Minimal mode embed fixed size has been removed",img:""}},fixes:{modal:{title:"v1.62 : Fixed modals",text:"Fixed broken modal introduced by 0.0.287",imt:""},emotes:{title:"v1.59 : Native sub emote mods",text:"Emote mods now work with native sub emotes!",img:""},emotes2:{title:"v1.59 : Emote mods and custom emotes",text:"Emote mods will no longer interfere with custom emotes using :",img:""}}},settingsCookie={};Core.prototype.init=function(){function a(){if(console.log((new Date).getTime()+" Defer"),$(".guilds-wrapper .guilds").children().length>0){console.log((new Date).getTime()+" Defer Loaded");var c=($(".guilds>li:first-child"),$("<button/>",{class:"btn",id:"bd-show-channels",text:"R",css:{cursor:"pointer"},click:function(){settingsCookie["bda-gs-3"]=!1,$("body").removeClass("bd-minimal-chan"),b.saveSettings()}}));if($(".guilds-wrapper").prepend(c),opublicServers=new PublicServers,customCssEditor=new CustomCssEditor,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()}),window.addEventListener("beforeunload",function(){settingsCookie["bda-dc-0"]&&$(".btn.btn-disconnect").click()}),opublicServers.init(),emoteModule.autoCapitalize(),settingsCookie.version<jsVersion){var d=b.constructChangelog();$("body").append(d),settingsCookie.version=jsVersion,b.saveSettings()}$("head").append("<style>.CodeMirror{ min-width:100%; }</style>"),$("head").append('<style id="bdemotemenustyle"></style>')}else setTimeout(a,100)}var b=this;if(version<supportedVersion)return void 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>");utils=new Utils;var c=new BdWSocket;c.start(),utils.getHash(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,voiceMode=new VoiceMode,emoteModule.init(),this.initSettings(),this.initObserver(),$(document).ready(function(){setTimeout(a,1e3)})},Core.prototype.initSettings=function(){if(void 0==$.cookie("better-discord"))settingsCookie=defaultCookie,this.saveSettings();else{this.loadSettings();for(var a in defaultCookie)void 0==settingsCookie[a]&&(settingsCookie[a]=defaultCookie[a],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(a){a.forEach(function(a){if($(a.target).find(".emoji-picker").length){var b=a.target.firstChild;b.classList.contains("popout")&&quickEmoteMenu.obsCallback($(b))}"undefined"!=typeof pluginModule&&pluginModule.rawObserver(a),null!=a.target.getAttribute("class")&&((a.target.classList.contains("title-wrap")||a.target.classList.contains("chat"))&&(voiceMode.obsCallback(),"undefined"!=typeof pluginModule&&pluginModule.channelSwitch()),-1!=a.target.getAttribute("class").indexOf("scroller messages")&&"undefined"!=typeof pluginModule&&pluginModule.newMessage()),emoteModule.obsCallback(a)})}),mainObserver.observe(document,{childList:!0,subtree:!0})},Core.prototype.constructChangelog=function(){var a='<div id="bd-wn-modal" class="modal" style="opacity:1;"> <div class="modal-inner"> <div id="bdcl" class="markdown-modal change-log"> <div class="markdown-modal-header"> <strong>What\'s new in BetterDiscord JS'+jsVersion+'</strong> <button class="markdown-modal-close" onclick=\'$("#bd-wn-modal").remove();\'></button> </div><!--header--> <div class="scroller-wrap"> <div class="scroller">';if(null!=bdchangelog.changes){a+='<h1 class="changelog-added"> <span>New Stuff</span></h1><ul>';for(var b in bdchangelog.changes)b=bdchangelog.changes[b],a+="<li> <strong>"+b.title+"</strong> <div>"+b.text+"</div></li>";a+="</ul>"}if(null!=bdchangelog.fixes){a+='<h1 class="changelog-fixed"> <span>Fixed</span></h1><ul>';for(var c in bdchangelog.fixes)c=bdchangelog.fixes[c],a+="<li> <strong>"+c.title+"</strong> <div>"+c.text+"</div></li>";a+="</ul>"}if(null!=bdchangelog.upcoming){a+='<h1 class="changelog-in-progress"> <span>Coming Soon</span></h1><ul>';for(var d in bdchangelog.upcoming)d=bdchangelog.upcoming[d],a+="<li> <strong>"+d.title+"</strong> <div>"+d.text+"</div></li>";a+="</ul>"}return a+=' </div><!--scoller--> </div><!--scroller-wrap--> <div class="footer"> </div><!--footer--> </div><!--change-log--> </div><!--modal-inner--></div><!--modal-->'},Core.prototype.alert=function(a,b){$("body").append('<div class="bd-alert"> <div class="bd-alert-header"> <span>'+a+'</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">'+b+"</div> </div> </div></div>")};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+"/data/emotefilter.json",function(a){bemotes=a.blacklist})},EmoteModule.prototype.obsCallback=function(a){var b=this;if(settingsCookie["bda-es-7"]){$(".emoji").each(function(){var a=$(this);if(-1!=a.attr("src").indexOf(".png")){var b=a.next(),c=a.attr("alt");b.size()>0&&"SPAN"==b.prop("tagName")&&(c+=b.text(),b.remove()),"SPAN"!=a.parent().prop("tagName")?a.replaceWith("<span>"+c+"</span>"):a.replaceWith(c)}});for(var c=0;c<a.addedNodes.length;++c){var d=a.addedNodes.item(c);if(d){var e=b.getNodes(d);for(var f in e)e.hasOwnProperty(f)&&b.injectEmote(e[f])}}}},EmoteModule.prototype.getNodes=function(a){for(var b,c=[],d=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1);b=d.nextNode();)c.push(b);return c};var bemotes=[],spoilered=[];EmoteModule.prototype.injectEmote=function(a){function b(){var a=c.innerHTML,b=a.split(/\s+/g);if(b&&(b.some(function(b){if("[!s]"==b.slice(0,4)){a=a.replace("[!s]","");var d=$(c).parent(),e=d.attr("data-reactid");if(spoilered.indexOf(e)>-1)return;return d.addClass("spoiler"),void d.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(!(b.length<4)){if("ClauZ"==b)return void(a=a.replace("ClauZ",'<img src="https://cdn.frankerfacez.com/emoticon/70852/1" style="width:25px; transform:translate(-29px, -14px);"></img>'));var f=b,g="",h=["emoteflip","emotespin","emotepulse","emotespin2","emotespin3","emote1spin","emote2spin","emote3spin","emotetr","emotebl","emotebr","emoteshake","emoteshake2","emoteshake3","emoteflap"];if(b.indexOf(":")>-1){var i=b.split(/:(?!.*:)/);""!=i[0]&&""!=i[1]&&(userEmoteCss=!0,f=i[0],settingsCookie["bda-es-8"]&&(g="emote"+i[1],h.indexOf(g)<0&&(g="")))}if(-1==$.inArray(f,bemotes)){if(emotesTwitch.emotes.hasOwnProperty(f)){var j=Math.round(f.length/4),k=f.substr(0,j)+"﷙"+f.substr(j,j)+"﷙"+f.substr(2*j,j)+"﷙"+f.substr(3*j),l=twitchEmoteUrlStart+emotesTwitch.emotes[f].image_id+twitchEmoteUrlEnd;return void(a=a.replace(b,'<div class="emotewrapper"><img class="emote '+g+'" alt="'+k+'" src="'+l+'"/><input onclick=\'quickEmoteMenu.favorite("'+k+'", "'+l+'");\' class="fav" title="Favorite!" type="button"></div>'))}if(subEmotesTwitch.hasOwnProperty(f)){var j=Math.round(f.length/4),k=f.substr(0,j)+"﷙"+f.substr(j,j)+"﷙"+f.substr(2*j,j)+"﷙"+f.substr(3*j),l=twitchEmoteUrlStart+subEmotesTwitch[f]+twitchEmoteUrlEnd;return void(a=a.replace(b,'<div class="emotewrapper"><img class="emote '+g+'" alt="'+k+'" src="'+l+'"/><input onclick=\'quickEmoteMenu.favorite("'+k+'", "'+l+'");\' class="fav" title="Favorite!" type="button"></div>'))}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(f)){var j=Math.round(f.length/4),k=f.substr(0,j)+"﷙"+f.substr(j,j)+"﷙"+f.substr(2*j,j)+"﷙"+f.substr(3*j),l=ffzEmoteUrlStart+emotesFfz[f]+ffzEmoteUrlEnd;return void(a=a.replace(b,'<div class="emotewrapper"><img class="emote '+g+'" alt="'+k+'" src="'+l+'"/><input onclick=\'quickEmoteMenu.favorite("'+k+'", "'+l+'");\' class="fav" title="Favorite!" type="button"></div>'))}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(f)){var j=Math.round(f.length/4),k=f.substr(0,j)+"﷙"+f.substr(j,j)+"﷙"+f.substr(2*j,j)+"﷙"+f.substr(3*j),l=emotesBTTV[f];return void(a=a.replace(b,'<div class="emotewrapper"><img class="emote '+g+'" alt="'+k+'" src="'+l+'"/><input onclick=\'quickEmoteMenu.favorite("'+k+'", "'+l+'");\' class="fav" title="Favorite!" type="button"></div>'))}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(f)){var j=Math.round(f.length/4),k=f.substr(0,j)+"﷙"+f.substr(j,j)+"﷙"+f.substr(2*j,j)+"﷙"+f.substr(3*j),l=bttvEmoteUrlStart+emotesBTTV2[f]+bttvEmoteUrlEnd;return void(a=a.replace(b,'<div class="emotewrapper"><img class="emote '+g+'" alt="'+k+'" src="'+l+'"/><input onclick=\'quickEmoteMenu.favorite("'+k+'", "'+l+'");\' class="fav" title="Favorite!" type="button"></div>'))}}}}),null!=c.parentElement)){var d=c.parentElement.offsetHeight;c.innerHTML=a.replace(new RegExp("﷙","g"),"");var e=c.parentElement.offsetHeight,f=$(".scroller.messages").first();f.scrollTop(f.scrollTop()+(e-d))}}if("undefined"!=typeof emotesTwitch&&a.parentElement){var c=a.parentElement;if("SPAN"==c.tagName&&($(c.parentElement).hasClass("markup")||$(c.parentElement).hasClass("message-content"))){var d=!1;$(c.parentElement).hasClass("edited")&&(c=c.parentElement.parentElement.firstChild,d=!0),d?setTimeout(b,250):b()}}},EmoteModule.prototype.autoCapitalize=function(){var a=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var b=$(".channel-textarea-inner textarea").val();if(void 0!=b){var c=b.split(" ").pop();if(c.length>3){if("danSgame"==c)return;var d=a.capitalize(c.toLowerCase());null!==d&&void 0!==d&&$(".channel-textarea-inner textarea").val(b.replace(c,d))}}}})},EmoteModule.prototype.capitalize=function(a){var b=emotesTwitch.emotes;for(var c in b)if(b.hasOwnProperty(c)&&a==(c+"").toLowerCase())return c},PublicServers.prototype.getPanel=function(){return this.container},PublicServers.prototype.init=function(){var a=this,b=$(".guilds>li:first-child");b.after($("<li></li>",{id:"bd-pub-li",css:{height:"20px",display:1==settingsCookie["bda-gs-1"]?"":"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(){a.show()});var c="";c+='<div id="pubs-container">',c+=' <div id="pubs-spinner">',c+=' <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>',c+=" </div>",c+=' <div id="pubs-header">',c+=' <h2 id="pubs-header-title">Public Servers</h2>',c+=' <button id="sbtn">Search</button>',c+=' <input id="sterm" type="text" placeholder="Search term..."/>',c+=" </div>",c+=' <div class="scroller-wrap">',c+=' <div class="scroller">',c+=' <div id="slist" class="servers-listing">',c+=" ",c+=" </div>",c+=" </div>",c+=" </div>",c+=' <div id="pubs-footer">',c+=' <div>Server list provided by <a href="https://www.discordservers.com/" target="_blank">DiscordServers.com</a></div>',c+=" </div>",c+="</div>",this.container=c,$("#bd-pub-li").length<1&&setTimeout(function(){a.init()},250)},PublicServers.prototype.show=function(){var a=this;$("body").append(this.getPanel());var b={sort:[{online:"desc"}],from:0,size:20,query:{filtered:{query:{match_all:{}}}}};$("#sbtn").on("click",function(){a.search()}),$("#sterm").on("keyup",function(b){13==b.keyCode&&a.search()}),this.loadServers(b,!1);var a=this;$(document).on("mouseup.bdps",function(b){$("#bd-pub-button").is(b.target)||$("#pubs-container").is(b.target)||0!==$("#pubs-container").has(b.target).length||a.hide()})},PublicServers.prototype.hide=function(){$("#pubs-container").remove(),$(document).off("mouseup.bdps")},PublicServers.prototype.loadServers=function(a,b){var c=this;$("#sbtn").prop("disabled",!0),$("#sterm").prop("disabled",!0),$("#slist").empty(),$("#pubs-spinner").show(),$.ajax({type:"POST",dataType:"json",url:"https://search-discordservers-izrtub5nprzrl76ugyy6hdooe4.us-west-1.es.amazonaws.com/app/_search",crossDomain:!0,data:JSON.stringify(a),success:function(a){var d=a.hits.hits;b?$("#pubs-header-title").text("Public Servers - Search Results: "+d.length):$("#pubs-header-title").text("Public Servers"),d.forEach(function(a){var b=a._source,d=b.invite_code,e='<div class="server-row">';e+='<div class="server-icon" style="background-image:url('+b.icon+')"></div>',e+='<div class="server-info server-name">',e+="<span>"+b.name+" by "+b.owner.name+"</span>",e+="</div>",e+='<div class="server-info server-members">',e+="<span>"+b.online+"/"+b.members+" Members</span>",e+="</div>",e+='<div class="server-info server-region">',e+="<span>"+b.region+"</span>",e+="</div>",e+='<div class="server-info">',e+="<button data-server-invite-code="+d+">Join</button>",e+="</div>",e+="</div>",$("#slist").append(e),$("button[data-server-invite-code="+d+"]").on("click",function(){c.joinServer(d)})})},done:function(){$("#pubs-spinner").hide(),$("#sbtn").prop("disabled",!1),$("#sterm").prop("disabled",!1)},always:function(){$("#pubs-spinner").hide(),$("#sbtn").prop("disabled",!1),$("#sterm").prop("disabled",!1)},error:function(){$("#pubs-spinner").hide(),$("#sbtn").prop("disabled",!1),$("#sterm").prop("disabled",!1)},complete:function(){$("#pubs-spinner").hide(),$("#sbtn").prop("disabled",!1),$("#sterm").prop("disabled",!1)}})},PublicServers.prototype.search=function(){var a={sort:[{online:"desc"}],from:0,size:20,query:{filtered:{query:{match_all:{}}}}},b={filter:{and:[{query:{match_phrase_prefix:{name:$("#sterm").val()}}}]}};$("#sterm").val()&&$.extend(a,b),this.loadServers(a,!0)},PublicServers.prototype.joinServer=function(a){$(".guilds-add").click(),$(".action.join .btn").click(),$(".create-guild-container input").val(a),$(".form.join-server .btn-primary").click()},QuickEmoteMenu.prototype.init=function(){$(document).on("mousedown",function(a){"rmenu"!=a.target.id&&$("#rmenu").remove()}),this.favoriteEmotes={};var a=localStorage.bdfavemotes;void 0!=a&&(this.favoriteEmotes=JSON.parse(atob(a)));var b="";b+='<div id="bda-qem">',b+=' <button class="active" id="bda-qem-twitch" onclick=\'quickEmoteMenu.switchHandler(this); return false;\'>Twitch</button>',b+=" <button id=\"bda-qem-favourite\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Favourite</button>",b+=" <button id=\"bda-qem-emojis\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Emojis</buttond>",b+="</div>",this.qmeHeader=b;var c="";c+='<div id="bda-qem-twitch-container">',c+=' <div class="scroller-wrap fade">',c+=' <div class="scroller">',c+=' <div class="emote-menu-inner">';for(var d in emotesTwitch.emotes)if(emotesTwitch.emotes.hasOwnProperty(d)){var e=emotesTwitch.emotes[d].image_id;c+='<div class="emote-container">',c+=' <img class="emote-icon" id="'+d+'" alt="" src="https://static-cdn.jtvnw.net/emoticons/v1/'+e+'/1.0" title="'+d+'">',c+=" </img>",c+="</div>"}c+=" </div>",c+=" </div>",c+=" </div>",c+="</div>",this.teContainer=c;var f="";f+='<div id="bda-qem-favourite-container">',f+=' <div class="scroller-wrap fade">',f+=' <div class="scroller">',f+=' <div class="emote-menu-inner">';for(var d in this.favoriteEmotes){var g=this.favoriteEmotes[d];f+='<div class="emote-container">',f+=' <img class="emote-icon" alt="" src="'+g+'" title="'+d+"\" oncontextmenu='quickEmoteMenu.favContext(event, this);'>",f+=" </img>",f+="</div>"}f+=" </div>",f+=" </div>",f+=" </div>",f+="</div>",this.faContainer=f},QuickEmoteMenu.prototype.favContext=function(a,b){a.stopPropagation();var c=$("<div/>",{id:"rmenu","data-emoteid":$(b).prop("title"),text:"Remove"});return c.css({top:a.pageY-$("#bda-qem-favourite-container").offset().top,left:a.pageX-$("#bda-qem-favourite-container").offset().left}),$(b).parent().append(c),c.on("click",function(a){return a.preventDefault(),a.stopPropagation(),$(this).remove(),console.log($(this).data("emoteid")),delete quickEmoteMenu.favoriteEmotes[$(this).data("emoteid")],quickEmoteMenu.updateFavorites(),!1}),!1},QuickEmoteMenu.prototype.switchHandler=function(a){this.switchQem($(a).attr("id"))},QuickEmoteMenu.prototype.switchQem=function(a){var b=$("#bda-qem-twitch"),c=$("#bda-qem-favourite"),d=$("#bda-qem-emojis");switch(b.removeClass("active"),c.removeClass("active"),d.removeClass("active"),$(".emoji-picker").hide(),$("#bda-qem-favourite-container").hide(),$("#bda-qem-twitch-container").hide(),a){case"bda-qem-twitch":b.addClass("active"),$("#bda-qem-twitch-container").show();break;case"bda-qem-favourite":c.addClass("active"),$("#bda-qem-favourite-container").show();break;case"bda-qem-emojis":d.addClass("active"),$(".emoji-picker").show()}this.lastTab=a;var e=$(".emote-icon");e.off(),e.on("click",function(){var a=$(this).attr("title"),b=$(".channel-textarea-inner textarea");b.val(" "==b.val().slice(-1)?b.val()+a:b.val()+" "+a)})},QuickEmoteMenu.prototype.obsCallback=function(a){if(settingsCookie["bda-es-9"]?a.removeClass("bda-qme-hidden"):a.addClass("bda-qme-hidden"),settingsCookie["bda-es-0"]){a.prepend(this.qmeHeader),a.append(this.teContainer),a.append(this.faContainer),void 0==this.lastTab&&(this.lastTab="bda-qem-favourite"),this.switchQem(this.lastTab)}},QuickEmoteMenu.prototype.favorite=function(a,b){this.favoriteEmotes.hasOwnProperty(a)||(this.favoriteEmotes[a]=b),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){var a="";a+='<div id="bda-qem-favourite-container">',a+=' <div class="scroller-wrap fade">',a+=' <div class="scroller">',a+=' <div class="emote-menu-inner">';for(var b in this.favoriteEmotes){var c=this.favoriteEmotes[b];a+='<div class="emote-container">',a+=' <img class="emote-icon" alt="" src="'+c+'" title="'+b+"\" oncontextmenu='quickEmoteMenu.favContext(event, this);'>",a+=" </img>",a+="</div>"}a+=" </div>",a+=" </div>",a+=" </div>",a+="</div>",this.faContainer=a,$("#bda-qem-favourite-container").replaceWith(a),window.localStorage.bdfavemotes=btoa(JSON.stringify(this.favoriteEmotes))},CustomCssEditor.prototype.init=function(){var a=this;a.hideBackdrop=!1,a.editor=CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta"),{lineNumbers:!0,mode:"css",indentUnit:4,theme:"neat"}),a.editor.on("change",function(b){var c=b.getValue();a.applyCustomCss(c,!1,!1)});var b="";b+='<div id="bd-customcss-attach-controls">',b+=' <ul class="checkbox-group">',b+=" <li>",b+=' <div class="checkbox" onclick="settingsPanel.updateSetting(this);">',b+=' <div class="checkbox-inner"><input id="bda-css-0" type="checkbox" '+(settingsCookie["bda-css-0"]?"checked":"")+"><span></span></div>",b+=' <span title="Update client css while typing">Live Update</span>',b+=" </div>",b+=" </li>",b+=" <li>",b+=' <div class="checkbox" onclick="settingsPanel.updateSetting(this);">',b+=' <div class="checkbox-inner"><input id="bda-css-1" type="checkbox" '+(settingsCookie["bda-css-1"]?"checked":"")+"><span></span></div>",b+=' <span title="Autosave css to localstorage when typing">Autosave</span>',b+=" </div>",b+=" </li>",b+=" <li>",b+=' <div class="checkbox" onclick="settingsPanel.updateSetting(this);">',b+=' <div class="checkbox-inner"><input id="bda-css-2" type="checkbox" '+(customCssEditor.hideBackdrop?"checked":"")+"><span></span></div>",b+=' <span title="Hide the callout backdrop to disable modal close events">Hide Backdrop</span>',b+=" </div>",b+=" </li>",b+=" </ul>",b+=' <div id="bd-customcss-detach-controls-buttons">',b+=' <button class="btn btn-primary" id="bd-customcss-detached-update" onclick="return false;">Update</button>',b+=' <button class="btn btn-primary" id="bd-customcss-detached-save" onclick="return false;">Save</button>',b+=' <button class="btn btn-primary" id="bd-customcss-detached-detach" onclick="customCssEditor.detach(); return false;">Detach</button>',b+=" </div>",b+="</div>",this.attachEditor=b,$("#bd-customcss-innerpane").append(b),$("#bd-customcss-detached-update").on("click",function(){return a.applyCustomCss(a.editor.getValue(),!0,!1),!1}),$("#bd-customcss-detached-save").on("click",function(){return a.applyCustomCss(a.editor.getValue(),!1,!0),!1});var c="";c+='<div id="bd-customcss-detach-container">',c+=' <div id="bd-customcss-detach-editor">',c+=" </div>",c+="</div>",this.detachedEditor=c},CustomCssEditor.prototype.attach=function(){$("#editor-detached").hide(),$("#app-mount").removeClass("bd-detached-editor"),$("#bd-customcss-pane").append($("#bd-customcss-innerpane")),$("#bd-customcss-detached-detach").show(),$("#bd-customcss-detach-container").remove()},CustomCssEditor.prototype.detach=function(){this.attach(),$("#editor-detached").show(),$("#bd-customcss-detached-detach").hide(),$("#app-mount").addClass("bd-detached-editor"),$(".app").parent().append(this.detachedEditor),$("#bd-customcss-detach-editor").append($("#bd-customcss-innerpane"))},CustomCssEditor.prototype.applyCustomCss=function(a,b,c){0==$("#customcss").length&&$("head").append('<style id="customcss"></style>'),(b||settingsCookie["bda-css-0"])&&$("#customcss").html(a),(c||settingsCookie["bda-css-1"])&&localStorage.setItem("bdcustomcss",btoa(a))};var settingsButton=null,panel=null;SettingsPanel.prototype.init=function(){var a=this;a.construct();var b=$("body");settingsCookie["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),settingsCookie["bda-gs-2"]?b.addClass("bd-minimal"):b.removeClass("bd-minimal"),settingsCookie["bda-gs-3"]?b.addClass("bd-minimal-chan"):b.removeClass("bd-minimal-chan"),settingsCookie["bda-gs-4"]&&voiceMode.enable(),settingsCookie["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),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 a=$(this).offset(),b=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(b),$(emoteNamePopup).css("left",a.left-25),$(emoteNamePopup).css("top",a.top-32),$("div[data-reactid='.0.1.1']").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote")};var customCssInitialized=!1,lastTab="";SettingsPanel.prototype.changeTab=function(a){lastTab=a;$("#bd-control-groups");switch($(".bd-tab").removeClass("selected"),$(".bd-pane").hide(),$("#"+a).addClass("selected"),$("#"+a.replace("tab","pane")).show(),a){case"bd-settings-tab":break;case"bd-customcss-tab":customCssInitialized||(customCssEditor.init(),customCssInitialized=!0)}},SettingsPanel.prototype.updateSetting=function(a){var b=$(a).children().find('input[type="checkbox"]'),c=!b.is(":checked"),d=b.attr("id");b.prop("checked",c),"bda-css-2"==d&&($("#app-mount").removeClass("bd-hide-bd"),customCssEditor.hideBackdrop=c,c&&$("#app-mount").addClass("bd-hide-bd")),settingsCookie[d]=c,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(),$("#app-mount").removeClass("bda-dark"),settingsCookie["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),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 a=$(this).offset(),b=$(this).attr("alt");$(emoteNamePopup).find(".tipsy-inner").text(b),$(emoteNamePopup).css("left",a.left-25),$(emoteNamePopup).css("top",a.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 a(){$(".tab-bar-item").removeClass("selected"),settingsButton.addClass("selected"),$(".form .settings-right .settings-inner").first().hide(),panel.show(),""==lastTab?c.changeTab("bd-settings-tab"):c.changeTab(lastTab)}function b(){$(".btn.btn-settings").length<1?setTimeout(b,100):$(".btn.btn-settings").first().on("click",function(){function a(){if($(".modal-inner").first().is(":visible")){panel.hide();var b=$(".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()}),b.append(settingsButton),$(".form .settings-right .settings-inner").last().after(panel),$("#bd-settings-new").removeClass("selected")}else setTimeout(a,100)}a()})}var c=this;panel=$("<div/>",{id:"bd-pane",class:"settings-inner",css:{display:"none"}});var d='<div class="scroller-wrap"> <div class="scroller settings-wrapper settings-panel"> <div class="tab-bar TOP"> <div class="tab-bar-item bd-tab" id="bd-settings-tab" onclick="settingsPanel.changeTab(\'bd-settings-tab\');">Core</div> <div class="tab-bar-item bd-tab" id="bd-emotes-tab" onclick="settingsPanel.changeTab(\'bd-emotes-tab\');">Emotes</div> <div class="tab-bar-item bd-tab" id="bd-customcss-tab" onclick="settingsPanel.changeTab(\'bd-customcss-tab\');">Custom CSS</div> <div class="tab-bar-item bd-tab" id="bd-plugins-tab" onclick="settingsPanel.changeTab(\'bd-plugins-tab\');">Plugins</div> <div class="tab-bar-item bd-tab" id="bd-themes-tab" onclick="settingsPanel.changeTab(\'bd-themes-tab\');">Themes</div> </div> <div class="bd-settings"> <div class="bd-pane control-group" id="bd-settings-pane" style="display:none;"> <ul class="checkbox-group">';for(var e in settings){var f=settings[e],g=f.id;"core"==f.cat&&f.implemented&&!f.hidden&&(d+='<li><div class="checkbox" onclick="settingsPanel.updateSetting(this);" ><div class="checkbox-inner"><input type="checkbox" id="'+g+'" '+(settingsCookie[g]?"checked":"")+"><span></span></div><span>"+e+" - "+f.info+"</span></div></li>");
}d+=" </ul> </div>",d+='<div class="bd-pane control-group" id="bd-emotes-pane" style="display:none;"> <ul class="checkbox-group">';for(var e in settings){var f=settings[e],g=f.id;"emote"==f.cat&&f.implemented&&!f.hidden&&(d+='<li><div class="checkbox" onclick="settingsPanel.updateSetting(this);" ><div class="checkbox-inner"><input type="checkbox" id="'+g+'" '+(settingsCookie[g]?"checked":"")+"><span></span></div><span>"+e+" - "+f.info+"</span></div></li>")}d+=" </ul> </div>";var h=atob(localStorage.getItem("bdcustomcss"));customCssEditor.applyCustomCss(h,!0,!1),d+=' <div class="bd-pane control-group" id="bd-customcss-pane" style="display:none;"> <div id="editor-detached" style="display:none;"> <h3>Editor Detached</h3> <button class="btn btn-primary" onclick="customCssEditor.attach(); return false;">Attach</button> </div> <div id="bd-customcss-innerpane"><textarea id="bd-custom-css-ta">'+h+'</textarea></div> </div> <div class="bd-pane control-group" id="bd-plugins-pane" style="display:none;"> <table class="bd-g-table"> <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th><th></th></tr></thead><tbody>',$.each(bdplugins,function(){var a=this.plugin;d+="<tr> <td>"+a.getName()+'</td> <td width="99%"><textarea>'+a.getDescription()+"</textarea></td> <td>"+a.getAuthor()+"</td> <td>"+a.getVersion()+'</td> <td><button class="bd-psb" onclick="pluginModule.showSettings(\''+a.getName()+'\'); return false;"></button></td> <td> <div class="checkbox" onclick="pluginModule.handlePlugin(this);"> <div class="checkbox-inner"> <input id="'+a.getName()+'" type="checkbox" '+(pluginCookie[a.getName()]?"checked":"")+"> <span></span> </div> </div> </td></tr>"}),d+='</tbody></table> </div> <div class="bd-pane control-group" id="bd-themes-pane" style="display:none;">',"undefined"==typeof themesupport2?d+=" Your version does not support themes. Download the latest version.":(d+=' <table class="bd-g-table"> <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr></thead><tbody>',$.each(bdthemes,function(){d+="<tr> <td>"+this.name.replace(/_/g," ")+'</td> <td width="99%"><textarea>'+this.description+"</textarea></td> <td>"+this.author+"</td> <td>"+this.version+'</td> <td> <div class="checkbox" onclick="themeModule.handleTheme(this);"> <div class="checkbox-inner"> <input id="ti'+this.name+'" type="checkbox" '+(themeCookie[this.name]?"checked":"")+"> <span></span> </div> </div> </td></tr>"}),d+="</tbody></table>"),d+=' </div> </div> </div> <div style="background:#2E3136; color:#ADADAD; height:30px; position:absolute; bottom:0; left:0; right:0;"> <span style="line-height:30px;margin-left:10px;">BetterDiscord v'+version+"(JSv"+jsVersion+') by Jiiks</span> <span style="float:right;line-height:30px;margin-right:10px;"><a href="http://betterdiscord.net" target="_blank">BetterDiscord.net</a></span> </div></div>',settingsButton=$("<div/>",{class:"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:a}),panel.html(d),b()};var _hash;Utils.prototype.getTextArea=function(){return $(".channel-textarea-inner textarea")},Utils.prototype.jqDefer=function(a){window.jQuery?a():setTimeout(function(){this.jqDefer(a)},100)},Utils.prototype.getHash=function(){$.getJSON("https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master",function(a){_hash=a.sha,emoteModule.getBlacklist()})},Utils.prototype.loadHtml=function(a,b){var c=$("<div/>",{class:"bd-container"}).appendTo("body");a="//cdn.rawgit.com/Jiiks/BetterDiscordApp/"+_hash+"/html/"+a+".html",c.load(a,b())},Utils.prototype.injectJs=function(a){$("<script/>",{type:"text/javascript",src:a}).appendTo($("body"))},Utils.prototype.injectCss=function(a){$("<link/>",{type:"text/css",rel:"stylesheet",href:a}).appendTo($("head"))},Utils.prototype.log=function(a){console.info("%c[BetterDiscord]%c "+a,"color:teal; font-weight:bold;","")},Utils.prototype.err=function(a){console.info("%c[BetterDiscord]%c "+a,"color:red; font-weight:bold;","")},VoiceMode.prototype.obsCallback=function(){var a=this;settingsCookie["bda-gs-4"]&&(a.disable(),setTimeout(function(){a.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 a=this.plugin;a.load();var b=a.getName(),c=!1;pluginCookie.hasOwnProperty(b)?c=pluginCookie[b]:pluginCookie[b]=!1,c&&a.start()})},PluginModule.prototype.handlePlugin=function(a){var b=$(a).children().find('input[type="checkbox"]'),c=!b.is(":checked"),d=b.attr("id");b.prop("checked",c),c?(bdplugins[d].plugin.start(),pluginCookie[d]=!0):(bdplugins[d].plugin.stop(),pluginCookie[d]=!1),this.savePluginData()},PluginModule.prototype.showSettings=function(a){if(null!=bdplugins[a]&&"function"==typeof bdplugins[a].plugin.getSettingsPanel){var b=bdplugins[a].plugin.getSettingsPanel();$(".modal-inner").off("click.bdpsm").on("click.bdpsm",function(a){$("#bd-psm-id").length?$(".bd-psm").remove():$(".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(b)}},PluginModule.prototype.loadPluginData=function(){var a=$.cookie("bd-plugins");void 0!=a&&(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()})},PluginModule.prototype.socketEvent=function(a,b){$.each(bdplugins,function(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.socketEvent&&this.plugin.socketEvent(b)})},PluginModule.prototype.rawObserver=function(a){$.each(bdplugins,function(){pluginCookie[this.plugin.getName()]&&"function"==typeof this.plugin.observer&&this.plugin.observer(a)})};var themeCookie={};ThemeModule.prototype.loadThemes=function(){this.loadThemeData(),$.each(bdthemes,function(){var a=this.name,b=!1;themeCookie.hasOwnProperty(a)?themeCookie[a]&&(b=!0):themeCookie[a]=!1,b&&$("head").append('<style id="'+a+'">'+unescape(bdthemes[a].css)+"</style>")})},ThemeModule.prototype.handleTheme=function(a){var b=$(a).children().find('input[type="checkbox"]'),c=!b.is(":checked"),d=b.attr("id").substring(2);b.prop("checked",c),c?($("head").append('<style id="'+d+'">'+unescape(bdthemes[d].css)+"</style>"),themeCookie[d]=!0):($("#"+d).remove(),themeCookie[d]=!1),this.saveThemeData()},ThemeModule.prototype.loadThemeData=function(){var a=$.cookie("bd-themes");void 0!=a&&(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(){},BdWSocket.prototype.open=function(a){utils.log("Socket Host: "+a);try{bdSocket=new WebSocket(a),bdSocket.onopen=this.onOpen,bdSocket.onmessage=this.onMessage,bdSocket.onerror=this.onError,bdSocket.onclose=this.onClose}catch(a){utils.log(a)}},BdWSocket.prototype.onOpen=function(){utils.log("Socket Open");var a={op:2,d:{token:JSON.parse(localStorage.getItem("token")),properties:JSON.parse(localStorage.getItem("superProperties")),v:3}};bdws.send(a)},BdWSocket.prototype.onMessage=function(a){var b,c,d;try{b=JSON.parse(a.data),c=b.d,d=b.t}catch(a){return void utils.err(a)}switch(d){case"READY":bdSocket.interval=setInterval(function(){bdws.send({op:1,d:Date.now()})},c.heartbeat_interval),utils.log("Socket Ready");break;case"PRESENCE_UPDATE":pluginModule.socketEvent("PRESENCE_UPDATE",c);break;case"TYPING_START":pluginModule.socketEvent("TYPING_START",c);break;case"MESSAGE_CREATE":pluginModule.socketEvent("MESSAGE_CREATE",c);break;case"MESSAGE_UPDATE":pluginModule.socketEvent("MESSAGE_UPDATE",c)}},BdWSocket.prototype.onError=function(a){utils.log("Socket Error - "+a.message)},BdWSocket.prototype.onClose=function(a){utils.log("Socket Closed - "+a.code+" : "+a.reason),clearInterval(bdSocket.interval),bdws.start()},BdWSocket.prototype.send=function(a){1==bdSocket.readyState&&bdSocket.send(JSON.stringify(a))},BdWSocket.prototype.getSocket=function(){return bdSocket},BdApi.joinServer=function(a){opublicServers.joinServer(a)},BdApi.injectCSS=function(a,b){$("head").append('<style id="'+a+'"></style>'),$("#"+a).html(b)},BdApi.clearCSS=function(a){$("#"+a).remove()},BdApi.getPlugin=function(a){return bdplugins.hasOwnProperty(a)?bdplugins[a].plugin:null},BdApi.getIpc=function(){return betterDiscordIPC},BdApi.getCore=function(){return mainCore},BdApi.getUserIdByName=function(a){for(var b=$(".member-username"),c=0;c<b.length;c++){var d=$(b[c]);if(d.text()==a){var e=d.closest(".member").find(".avatar-small").css("background-image");return e.match(/\d+/)}}return null};var gg;BdApi.getUserNameById=function(a){for(var b=$(".avatar-small"),c=0;c<b.length;c++){var d=$(b[c]),e=d.css("background-image");if(a==e.match(/\d+/))return d.parent().find(".member-username").text()}return null},BdApi.setPlaying=function(a){bdws.send({op:3,d:{idle_since:null,game:{name:a}}})},BdApi.setStatus=function(a,b){bdws.send({op:3,d:{idle_since:a,game:{name:b}}})};