BetterDiscordApp-v1/js/main.min.js

2 lines
42 KiB
JavaScript
Raw Normal View History

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!"
2016-04-27 16:30:06 +02:00
}s+=" </ul> </div>",s+='<div class="bd-pane control-group" id="bd-emotes-pane" style="display:none;"> <ul class="checkbox-group">';for(var o in settings){var n=settings[o],a=n.id;"emote"==n.cat&&n.implemented&&!n.hidden&&(s+='<li><div class="checkbox" onclick="settingsPanel.updateSetting(this);" ><div class="checkbox-inner"><input type="checkbox" id="'+a+'" '+(settingsCookie[a]?"checked":"")+"><span></span></div><span>"+o+" - "+n.info+"</span></div></li>")}s+=" </ul> </div>";var d=atob(localStorage.getItem("bdcustomcss"));customCssEditor.applyCustomCss(d,!0,!1),s+=' <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">'+d+'</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 e=this.plugin;s+="<tr> <td>"+e.getName()+'</td> <td width="99%"><textarea>'+e.getDescription()+"</textarea></td> <td>"+e.getAuthor()+"</td> <td>"+e.getVersion()+'</td> <td><button class="bd-psb" onclick="pluginModule.showSettings(\''+e.getName()+'\'); return false;"></button></td> <td> <div class="checkbox" onclick="pluginModule.handlePlugin(this);"> <div class="checkbox-inner"> <input id="'+e.getName()+'" type="checkbox" '+(pluginCookie[e.getName()]?"checked":"")+"> <span></span> </div> </div> </td></tr>"}),s+='</tbody></table> </div> <div class="bd-pane control-group" id="bd-themes-pane" style="display:none;">',"undefined"==typeof themesupport2?s+=" Your version does not support themes. Download the latest version.":(s+=' <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(){s+="<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>"}),s+="</tbody></table>"),s+=' </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:e}),panel.html(s),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=$("<div/>",{"class":"bd-container"}).appendTo("body");e="//cdn.rawgit.com/Jiiks/BetterDiscordApp/"+_hash+"/html/"+e+".html",i.load(e,t())},Utils.prototype.injectJs=function(e){$("<script/>",{t