From ab7ccf061d9adcb6540c9ba5a6c6986d1378fe00 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sat, 21 May 2016 22:00:32 +0300 Subject: [PATCH] Fixed server invite code --- js/main.js | 8 ++--- js/main.min.js | 98 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 2a88adcf..65db80d5 100644 --- a/js/main.js +++ b/js/main.js @@ -831,7 +831,7 @@ PublicServers.prototype.init = function () {
\
\
\ - \ + \
\ \
\ @@ -872,8 +872,8 @@ PublicServers.prototype.getPinnedServer = function() { "size": 1, "query": { "query_string": { - "default_operator": "AND", - "query": "BetterDiscord" + "default_operator": "AND", + "query": "BetterDiscord" } } }; @@ -1075,7 +1075,7 @@ PublicServers.prototype.loadServers = function(dataset, search, clear) { }; PublicServers.prototype.search = function(start, clear) { - var sterm = $("#pubs-sterm").val(); + var sterm = $("#pubs-sterm").val(); var dataset = { "sort": [{ "online": "desc" }], diff --git a/js/main.min.js b/js/main.min.js index df1f1d72..1ee6dba2 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1,2 +1,96 @@ -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.72,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"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core"},"Coloured Text":{id:"bda-gs-7",info:"Make text colour the same as role colour",implemented:!0,hidden:!1,cat:"core"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch 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:"thtp://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-gs-6":!1,"bda-gs-7":!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-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:{a:{title:"v1.72 : Public Servers",text:"Public servers now have categories, description, tags, dark mode and more!",img:""},b:{title:"v1.72 : Import/Export",text:"Import/Export buttons now disappear in themes/plugins tabs to avoid confusion",img:""},c:{title:"v1.72 : Changelog",text:"You can now reopen this changelog from the settings",img:""},d:{title:"v1.71 : Hide Twitch emotes",text:"Hide all emotes option now toggles Twitch emotes instead!",img:""},e:{title:"v1.71 : Override FFZ emote",text:'Use the :bttv emote modifier to override a FFZ emote with a BTTV one!',img:""},f:{title:"v1.70 : 0.2.8 Support",text:"Added support for Core version 0.2.8.",img:""},g:{title:"v1.70 : Setting Import/Export",text:"You can now import and export your settings!",img:""},h:{title:"v1.70 : Public Server List Infinite Scroll",text:"Public server list now has the ability to load more than 20 servers.",img:""},i:{title:"v1.70 : 24 hour timestamps",text:"Replace 12 hour timestamp with 24 hour timestamps!",img:""},j:{title:"v1.70 : Coloured text",text:"Make text colour the same as role colour!",img:""}},fixes:{a:{title:"v1.72 : Settings panel",text:"Settings panel will now show no matter how you open it!",img:""},b:{title:"v1.72 : Fixed emote edit bug",text:"Edits now appear properly even with emotes!",img:""},c:{title:"v1.72 : Public servers",text:"Public servers button is visible again!",img:""},d:{title:"v1.72 : Public servers",text:"Updated public servers api endpoint url for fetching correct serverlist.",img:""},e:{title:"v1.71 : Fixed emotes and edit",text:"Emotes work again! So does editing emotes!",img:""},f:{title:"Spoilers are currently broken :(",text:"Ps. I know this in the fixes section :o",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 s=($(".guilds>li:first-child"),$("
';if(null!=bdchangelog.changes){e+='

New Stuff

    ';for(var t in bdchangelog.changes)t=bdchangelog.changes[t],e+="
  • "+t.title+"
    "+t.text+"
  • ";e+="
"}if(null!=bdchangelog.fixes){e+='

Fixed

    ';for(var s in bdchangelog.fixes)s=bdchangelog.fixes[s],e+="
  • "+s.title+"
    "+s.text+"
  • ";e+="
"}if(null!=bdchangelog.upcoming){e+='

Coming Soon

    ';for(var i in bdchangelog.upcoming)i=bdchangelog.upcoming[i],e+="
  • "+i.title+"
    "+i.text+"
  • ";e+="
"}return e+='
'},Core.prototype.alert=function(e,t){for(var s="",i=0;5>i;i++)s+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var o=' ';$("body").append(o),utils.addBackdrop(s)};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(e){bemotes=e.blacklist})},EmoteModule.prototype.obsCallback=function(e){var t=this;$(".emoji").each(function(){var e=$(this);-1!=e.attr("src").indexOf(".png")&&e.replaceWith(e.attr("alt"))});for(var s=0;s-1&&(o=o.replace("[!s]",""),i.data("spoilered",!1),i.addClass("spoiler"));var c=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"],p="",u=!1,m=o;if(o.indexOf(":")>-1){var b=o.split(":");""!=b[0]&&""!=b[1]&&(c.indexOf(b[1])>-1&&(m=b[0],p=settingsCookie["bda-es-8"]?"emote"+b[1]:""),"bttv"==b[1]&&(m=b[0],u=!0))}if(-1==$.inArray(m,bemotes)){if("undefind"!=typeof emotesTwitch&&settingsCookie["bda-es-7"]&&emotesTwitch.emotes.hasOwnProperty(m)&&m.length>=4){null!=d&&(e.splice(t+a++,0,document.createTextNode(d)),d=null);var h=twitchEmoteUrlStart+emotesTwitch.emotes[m].image_id+twitchEmoteUrlEnd;return e.splice(t+a++,0,s.createEmoteElement(m,h,p)),void(r=!0)}if("undefined"!=typeof subEmotesTwitch&&settingsCookie["bda-es-7"]&&subEmotesTwitch.hasOwnProperty(m)&&m.length>=4){null!=d&&(e.splice(t+a++,0,document.createTextNode(d)),d=null);var h=twitchEmoteUrlStart+subEmotesTwitch[m]+twitchEmoteUrlEnd;return e.splice(t+a++,0,s.createEmoteElement(m,h,p)),void(r=!0)}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(m)&&m.length>=4){null!=d&&(e.splice(t+a++,0,document.createTextNode(d)),d=null);var h=emotesBTTV[m];return e.splice(t+a++,0,s.createEmoteElement(m,h,p)),void(r=!0)}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&(!u||!emotesBTTV2.hasOwnProperty(m))&&emotesFfz.hasOwnProperty(m)&&m.length>=4){null!=d&&(e.splice(t+a++,0,document.createTextNode(d)),d=null);var h=ffzEmoteUrlStart+emotesFfz[m]+ffzEmoteUrlEnd;return e.splice(t+a++,0,s.createEmoteElement(m,h,p)),void(r=!0)}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(m)&&m.length>=4){null!=d&&(e.splice(t+a++,0,document.createTextNode(d)),d=null);var h=bttvEmoteUrlStart+emotesBTTV2[m]+bttvEmoteUrlEnd;return u&&emotesFfz.hasOwnProperty(m)&&(m+=":bttv"),e.splice(t+a++,0,s.createEmoteElement(m,h,p)),void(r=!0)}null==d?d=o:d+=""+o,n===l.length-1&&e.splice(t+a,0,document.createTextNode(d))}}),r){var l=i.outerHeight();i.html(e);var c=$(".scroller.messages").first();c.scrollTop(c.scrollTop()+(i.outerHeight()-l))}}}})}var s=this;if(e.parentElement){var i=$(e).parent();(i.hasClass("markup")||i.hasClass("message-content"))&&(t(),i.children().hasClass("edited")&&setTimeout(t,250))}},EmoteModule.prototype.createEmoteElement=function(e,t,s){var i=Math.round(e.length/4),o=e.substr(0,i)+"﷙"+e.substr(i,i)+"﷙"+e.substr(2*i,i)+"﷙"+e.substr(3*i),n=''+o+'';return $.parseHTML(n.replace(new RegExp("﷙","g"),""))[0]},EmoteModule.prototype.autoCapitalize=function(){var e=this;$("body").delegate($(".channel-textarea-inner textarea:first"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var t=$(".channel-textarea-inner textarea:first").val();if(void 0!=t){var s=t.split(" ").pop();if(s.length>3){if("danSgame"==s)return;var i=e.capitalize(s.toLowerCase());null!==i&&void 0!==i&&$(".channel-textarea-inner textarea:first").val(t.replace(s,i))}}}})},EmoteModule.prototype.capitalize=function(e){var t=emotesTwitch.emotes;for(var s in t)if(t.hasOwnProperty(s)&&e==(s+"").toLowerCase())return s},PublicServers.prototype.getPanel=function(){return this.container},PublicServers.prototype.init=function(){this.filtered=["134680912691462144","86004744966914048"],this.bdServer=null,this.loadingServers=!1;var e=this,t=$(".guilds>:first-child");t.after($("
",{"class":"guild",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"}))))),$("#bd-pub-button").on("click",function(){e.show()});var s='

Public Servers

  • All
  • FPS Games
  • MMO Games
  • MOBA Games
  • Strategy Games
  • Sports Games
  • Puzzle Games
  • Retro Games
  • Party Games
  • Tabletop Games
  • Sandbox Games
  • Community
  • Language
  • Programming
  • Other
  • Simulation Games
';this.container=s,$("#bd-pub-li").length<1&&setTimeout(function(){e.init()},250)},PublicServers.prototype.getPinnedServer=function(){var e=this,t={sort:[{online:"desc"}],size:1,query:{query_string:{default_operator:"AND",query:"BetterDiscord"}}};$.ajax({type:"POST",dataType:"json",url:"https://search-discordservers-izrtub5nprzrl76ugyy6hdooe4.us-west-1.es.amazonaws.com/discord_servers/_search",crossDomain:!0,data:JSON.stringify(t),success:function(t){try{var s=t.hits.hits[0]._source;"86004744966914048"==s.identifier&&(e.bdServer=s,e.showPinnedServer())}catch(i){e.bdServer=null}}})},PublicServers.prototype.hidePinnedServer=function(){$("#pubs-container .scroller-wrap").css({"margin-top":"0",height:"500px"}),$(".server-pinned").hide()},PublicServers.prototype.showPinnedServer=function(){$(".server-pinned .server-icon").css("background-image","url("+this.bdServer.icon+")"),$(".server-pinned .server-members span").text(this.bdServer.online+"/"+this.bdServer.members+" Members"),$(".server-pinned .server-region span").text(this.bdServer.region),$(".server-pinned .server-info button").data("server-invite-code",this.bdServer.invite_code),$("#pubs-container .scroller-wrap").css({"margin-top":"75px",height:"425px"}),$(".server-pinned").show()},PublicServers.prototype.show=function(){var e=this;this.hidePinnedServer(),$("#pubs-cat-select").text("All"),this.selectedCategory="all",$("#pubs-container .scroller-wrap").css({"margin-top":"0",height:"500px"}),$(".server-pinned").hide(),$(".app").append(this.getPanel()),null==this.bdServer?this.getPinnedServer():this.showPinnedServer(),e.search(0,!0),$("#pubs-searchbtn").off("click").on("click",function(){e.search()}),$("#pubs-sterm").off("keyup").on("keyup",function(t){13==t.keyCode&&e.search(0,!0)}),$("#pubs-cat-select").off("click").on("click",function(){$("#pubs-select-dropdown").addClass("open")}),$(".pubs-cat-select-li").off("click").on("click",function(){$("#pubs-select-dropdown").removeClass("open"),$("#pubs-cat-select").text($(this).text()),e.selectedCategory!=$(this).data("val")&&(e.selectedCategory=$(this).data("val"),e.search(0,!0))}),$("#pubs-container").off("mouseup").on("mouseup",function(){$("#pubs-select-dropdown").removeClass("open")});var e=this;$(document).on("mouseup.bdps",function(t){$("#bd-pub-button").is(t.target)||$("#pubs-container").is(t.target)||0!==$("#pubs-container").has(t.target).length||e.hide()}),$("#pubs-scroller").off("scroll.pubs").on("scroll.pubs",function(){if(!e.loadingServers){var t=$("#pubs-list");$(this).scrollTop()+550
',o+='
',o+='
',t.is_official&&(o+='Official!'),o+=''+t.name+"";var n=[];t.categories.forEach(function(e){n.push(e.name)}),o+=''+n.join(", ")+"",o+=''+(void 0==t.description?"No Description":t.description)+"",o+="
",o+="
",o+='
',o+=""+t.online+"/"+t.members+" Members",o+="
",o+='
',o+=""+t.region+"",o+="
",o+='
',o+="",o+="
",o+="
",$("#pubs-list").append(o),$("button[data-server-invite-code="+s+"]").on("click",function(){i.joinServer(s)})}),t&&$("#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",!1),$("#pubs-sterm").prop("disabled",!1),i.loadingServers=!1},always:function(){$("#pubs-spinner").hide(),$("#pubs-spinner-bottom").hide(),$("#pubs-searchbtn").prop("disabled",!1),$("#pubs-sterm").prop("disabled",!1),i.loadingServers=!1},error:function(){$("#pubs-spinner").hide(),$("#pubs-spinner-bottom").hide(),$("#pubs-searchbtn").prop("disabled",!1),$("#pubs-sterm").prop("disabled",!1),i.loadingServers=!1},complete:function(){$("#pubs-spinner").hide(),$("#pubs-spinner-bottom").hide(),$("#pubs-searchbtn").prop("disabled",!1),$("#pubs-sterm").prop("disabled",!1),i.loadingServers=!1}})},PublicServers.prototype.search=function(e,t){var s=$("#pubs-sterm").val(),i={sort:[{online:"desc"}],from:e,size:20,query:{filtered:{query:{query_string:{default_operator:"AND",query:s?s:"*"}},filter:{bool:{must_not:[{terms:{identifier:this.filtered}}]}}}}};"all"!=this.selectedCategory&&(i.query.filtered.filter.bool.must=[{term:{"categories.id":this.selectedCategory}}]),this.loadServers(i,!0,t)},PublicServers.prototype.joinServer=function(e){$(".guilds-add").click(),$(".action.join .btn").click(),$(".create-guild-container input").val(e),$(".form.join-server .btn-primary").click()},QuickEmoteMenu.prototype.init=function(){$(document).on("mousedown",function(e){"rmenu"!=e.target.id&&$("#rmenu").remove()}),this.favoriteEmotes={};var e=localStorage.bdfavemotes;void 0!=e&&(this.favoriteEmotes=JSON.parse(atob(e)));var t="";t+='
',t+=' ',t+=" ",t+="
",this.qmeHeader=t;var s="";s+='
',s+='
',s+='
',s+='
';for(var i in emotesTwitch.emotes)if(emotesTwitch.emotes.hasOwnProperty(i)){var o=emotesTwitch.emotes[i].image_id;s+='
',s+=' ',s+=" ",s+="
"}s+="
",s+="
",s+="
",s+="
",this.teContainer=s;var n="";n+='
',n+='
',n+='
',n+='
';for(var i in this.favoriteEmotes){var a=this.favoriteEmotes[i];n+='
',n+=' ",n+=" ",n+="
"}n+="
",n+="
",n+="
",n+="
",this.faContainer=n},QuickEmoteMenu.prototype.favContext=function(e,t){e.stopPropagation();var s=$("
",{id:"rmenu","data-emoteid":$(t).prop("title"),text:"Remove"});return s.css({top:e.pageY-$("#bda-qem-favourite-container").offset().top,left:e.pageX-$("#bda-qem-favourite-container").offset().left}),$(t).parent().append(s),s.on("click",function(e){return e.preventDefault(),e.stopPropagation(),$(this).remove(),delete quickEmoteMenu.favoriteEmotes[$(this).data("emoteid")],quickEmoteMenu.updateFavorites(),!1}),!1},QuickEmoteMenu.prototype.switchHandler=function(e){this.switchQem($(e).attr("id"))},QuickEmoteMenu.prototype.switchQem=function(e){var t=$("#bda-qem-twitch"),s=$("#bda-qem-favourite"),i=$("#bda-qem-emojis");switch(t.removeClass("active"),s.removeClass("active"),i.removeClass("active"),$(".emoji-picker").hide(),$("#bda-qem-favourite-container").hide(),$("#bda-qem-twitch-container").hide(),e){case"bda-qem-twitch":t.addClass("active"),$("#bda-qem-twitch-container").show();break;case"bda-qem-favourite":s.addClass("active"),$("#bda-qem-favourite-container").show();break;case"bda-qem-emojis":i.addClass("active"),$(".emoji-picker").show()}this.lastTab=e;var o=$(".emote-icon");o.off(),o.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)})},QuickEmoteMenu.prototype.obsCallback=function(e){if(settingsCookie["bda-es-9"]?e.removeClass("bda-qme-hidden"):e.addClass("bda-qme-hidden"),settingsCookie["bda-es-0"]){e.prepend(this.qmeHeader),e.append(this.teContainer),e.append(this.faContainer),void 0==this.lastTab&&(this.lastTab="bda-qem-favourite"),this.switchQem(this.lastTab)}},QuickEmoteMenu.prototype.favorite=function(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){var e="";e+='
',e+='
',e+='
',e+='
';for(var t in this.favoriteEmotes){var s=this.favoriteEmotes[t];e+='
',e+=' ",e+=" ",e+="
"}e+="
",e+="
",e+="
",e+="
",this.faContainer=e,$("#bda-qem-favourite-container").replaceWith(e),window.localStorage.bdfavemotes=btoa(JSON.stringify(this.favoriteEmotes))},CustomCssEditor.prototype.init=function(){var e=this;e.hideBackdrop=!1,e.editor=CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta"),{lineNumbers:!0,mode:"css",indentUnit:4,theme:"neat"}),e.editor.on("change",function(t){var s=t.getValue();e.applyCustomCss(s,!1,!1)});var t="";t+='
',t+='
    ', -t+="
  • ",t+='
    ',t+='
    ",t+=' Live Update',t+="
    ",t+="
  • ",t+="
  • ",t+='
    ',t+='
    ",t+=' Autosave',t+="
    ",t+="
  • ",t+="
  • ",t+='
    ',t+='
    ",t+=' Hide Backdrop',t+="
    ",t+="
  • ",t+="
",t+='
',t+=' ',t+=' ',t+=' ',t+="
",t+="
",this.attachEditor=t,$("#bd-customcss-innerpane").append(t),$("#bd-customcss-detached-update").on("click",function(){return e.applyCustomCss(e.editor.getValue(),!0,!1),!1}),$("#bd-customcss-detached-save").on("click",function(){return e.applyCustomCss(e.editor.getValue(),!1,!0),!1});var s="";s+='
',s+='
',s+="
",s+="
",this.detachedEditor=s},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(e,t,s){0==$("#customcss").length&&$("head").append(''),(t||settingsCookie["bda-css-0"])&&$("#customcss").html(e),(s||settingsCookie["bda-css-1"])&&localStorage.setItem("bdcustomcss",btoa(e))};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-gs-5"]&&$("#app-mount").addClass("bda-dark"),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-37),$(".app").append($(emoteNamePopup))}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})):$(document).off("mouseover",".emote")};var customCssInitialized=!1,lastTab="";SettingsPanel.prototype.changeTab=function(e){lastTab=e;$("#bd-control-groups");switch($(".bd-tab").removeClass("selected"),$(".bd-pane").hide(),$("#"+e).addClass("selected"),$("#"+e.replace("tab","pane")).show(),e){case"bd-settings-tab":$(".bda-slist-top").show();break;case"bd-emotes-tab":$(".bda-slist-top").show();break;case"bd-customcss-tab":$(".bda-slist-top").show(),customCssInitialized||(customCssEditor.init(),customCssInitialized=!0);break;case"bd-themes-tab":$(".bda-slist-top:first").hide();break;case"bd-plugins-tab":$(".bda-slist-top:first").hide();break;default:$(".bda-slist-top").show()}},SettingsPanel.prototype.updateSetting=function(e){var t=$(e).children().find('input[type="checkbox"]'),s=!t.is(":checked"),i=t.attr("id");t.prop("checked",s),"bda-css-2"==i&&($("#app-mount").removeClass("bd-hide-bd"),customCssEditor.hideBackdrop=s,s&&$("#app-mount").addClass("bd-hide-bd")),settingsCookie[i]=s,this.updateSettings()},SettingsPanel.prototype.updateSettings=function(){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=$("
"),$(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?t.changeTab("bd-settings-tab"):t.changeTab(lastTab)}var t=this;panel=$("
",{id:"bd-pane","class":"settings-inner",css:{display:"none"}});var s='
Core
Emotes
Custom CSS
Plugins
Themes
",s+=' ";var a=atob(localStorage.getItem("bdcustomcss"));customCssEditor.applyCustomCss(a,!0,!1),s+=' ",s+='
    ',$.each(bdplugins,function(){var e=this.plugin,t=!1;"function"==typeof e.getSettingsPanel&&(t=null!=e.getSettingsPanel()&&""!=e.getSettingsPanel()),s+='
  • '+e.getName()+" v"+e.getVersion()+" by "+e.getAuthor()+'
    '+e.getDescription()+'
  • "}),s+="
",s+=' ",s+='
BetterDiscord v'+("undefined"==typeof version?bdVersion:version)+"(JSv"+jsVersion+') by Jiiks BetterDiscord.net changelog
',settingsButton=$("
",{"class":"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:e}),panel.html(s),this.panel=panel},SettingsPanel.prototype.inject=function(e){if("childList"==e.type&&!(e.addedNodes.length<=0||$(e.addedNodes[0]).find(".user-settings-modal").length<=0)){var t=this;this.panel.hide();var s=$(".tab-bar.SIDE").first();$(".tab-bar.SIDE .tab-bar-item").click(function(){$(".form .settings-right .settings-inner").first().show(),$("#bd-settings-new").removeClass("selected"),t.panel.hide()}),s.append(settingsButton),$(".form .settings-right .settings-inner").last().after(t.panel),$("#bd-settings-new").removeClass("selected")}};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 s=$("
",{"class":"bd-container"}).appendTo("body");e="//cdn.rawgit.com/Jiiks/BetterDiscordApp/"+_hash+"/html/"+e+".html",s.load(e,t())},Utils.prototype.injectJs=function(e){$("