BetterDiscordApp-v2/js/main.min.js

2 lines
56 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(){}function devMode(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,themeModule,customCssEditor,dMode,jsVersion=1.73,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"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",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-gs-8":!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:{"0a":{title:"1.73 : Native sub emotes",text:"Native sub emote support disabled for now due to a critical bug",img:""},"1a":{title:"1.73 : In
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-37),$(".app").append($(emote