diff --git a/js/main.min.js b/js/main.min.js index bd0a8d52..9ed3a1c7 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1,3 +1,3 @@ -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")}function Utils(){}function VoiceMode(){}function PluginModule(){}function BdApi(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,pluginModule,jsVersion=1.54,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":!1,"bda-es-2":!1,"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:{favemotes:{title:"Favorite Emotes!",text:"You can now favorite emotes and have them listed in the quick emote menu!",img:""},plugins:{title:"Plugins!",text:"Combined with Core 0.2.3, you can now write JavaScript plugins for Discord!",img:""},settingsmenu:{title:"Settings Menu!",text:"New and improved settings menu!",img:""},csseditor:{title:"New CSS Editor!",text:"New CSS Editor powered by CodeMirror!",img:""},minimalmode:{title:"Minimal mode makeover!",text:"New and improved minimal mode!",img:""}},fixes:{reload:{title:"Reload Fix!",text:"Fixed an issue that caused Discord to crash on reload!",img:""},eemotes:{title:"Edit Emotes!",text:"Edited messages now display emotes properly!",img:""},pservers:{title:"Public Servers",text:"Public servers have been fixed!",img:""},other:{title:"Bugfixes!",text:"Several smaller bugs fixed!",img:""}},upcoming:{ignore:{title:"Ignore User!",text:"Ignore users you don't like!",img:""},themes:{title:"Custom themes!",text:"Write your own or download custom themes!",img:""},favemotes:{title:"Favorite emotes!",text:"Add your favorite emote(s) to the quick emote menu!",img:""},more:{title:"More Things!",text:"More things but probably not in the next version!",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 B=$(".guilds li:first-child");B.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 Q=$("
    ';if(null!=bdchangelog.changes){A+='

    New Stuff

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

    Fixed

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

    Coming Soon

      ';for(var Q in bdchangelog.upcoming)Q=bdchangelog.upcoming[Q],A+="
    • "+Q.title+"
      "+Q.text+"
    • ";A+="
    "}return A+='
    '};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(A){bemotes=A.blacklist})},EmoteModule.prototype.obsCallback=function(A){var D=this;if(settingsCookie["bda-es-7"])for(var B=0;B-1)return;return Q.addClass("spoiler"),void Q.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(!(D.length<4)&&-1==$.inArray(D,bemotes)){if(emotesTwitch.emotes.hasOwnProperty(D)){var P=Math.round(D.length/4);return void(A=A.replace(D,''+D.substr(0,P)+'))}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),E=ffzEmoteUrlStart+emotesFfz[D]+ffzEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),E=emotesBTTV[D];return void(A=A.replace(D,'
    '+g+'
    '))}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),E=bttvEmoteUrlStart+emotesBTTV2[D]+bttvEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}if(subEmotesTwitch.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),E=twitchEmoteUrlStart+subEmotesTwitch[D]+twitchEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}}}),null!=B.parentElement)){var Q=B.parentElement.offsetHeight;B.innerHTML=A.replace(new RegExp("﷙","g"),"");var w=B.parentElement.offsetHeight,P=$(".scroller.messages").first();P.scrollTop(P.scrollTop()+(w-Q))}}}if("undefined"!=typeof emotesTwitch&&A.parentElement){var B=A.parentElement;if("SPAN"==B.tagName){var Q=!1;$(B.parentElement).hasClass("edited")&&(B=B.parentElement.parentElement.firstChild,Q=!0),Q?setTimeout(D,250):D()}}},EmoteModule.prototype.autoCapitalize=function(){var A=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var D=$(".channel-textarea-inner textarea").val();if(void 0!=D){var B=D.split(" ").pop();if(B.length>3){var Q=A.capitalize(B.toLowerCase());null!=Q&&$(".channel-textarea-inner textarea").val(D.replace(B,Q))}}}})},EmoteModule.prototype.capitalize=function(A){var D=emotesTwitch.emotes;for(var B in D)if(D.hasOwnProperty(B)&&A==(B+"").toLowerCase())return B};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 A=this;this.container=$("
    ",{id:"bd-ps-container",style:"display:none"});var D=$("
    ",{id:"bd-ps-header"});$("

    ",{text:"Public Servers"}).appendTo(D),$("",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(D),D.appendTo(this.getPanel());var B=$("
    ",{id:"bd-ps-body"});B.appendTo(this.getPanel());var Q=$("",{border:"0"}),w=$("");w.appendTo(Q);var P=$("",{}).append($("",{id:"bd-ps-tbody"});g.appendTo(Q),Q.appendTo(B),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){A.show()});var E=publicServers.servers;for(var e in E)if(E.hasOwnProperty(e)){var C=E[e],t=C.code,s=C.title,o=C.language,v=C.description;this.addServer(e,t,s,o,v)}},PublicServers.prototype.addServer=function(A,D,B,Q,w){var P=this,g=$("#bd-ps-tbody"),E=$("");e.append($("
    ",{text:"Name"})).append($("",{text:"Code"})).append($("",{text:"Language"})).append($("",{text:"Description"})).append($("",{text:"Join"}));P.appendTo(w);var g=$("
    ").append($("
    ",{"class":"bd-ps-description",text:w})),e=$("
    ",{text:B})),e.append($("",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:D})),e.append($("",{text:Q})),e.append(E),e.append($("").append($("
    ';if(null!=bdchangelog.changes){A+='

    New Stuff

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

    Fixed

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

    Coming Soon

      ';for(var Q in bdchangelog.upcoming)Q=bdchangelog.upcoming[Q],A+="
    • "+Q.title+"
      "+Q.text+"
    • ";A+="
    "}return A+='
    '};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(A){bemotes=A.blacklist})},EmoteModule.prototype.obsCallback=function(A){var D=this;if(settingsCookie["bda-es-7"])for(var B=0;B-1)return;return Q.addClass("spoiler"),void Q.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(!(D.length<4)&&-1==$.inArray(D,bemotes)){if(emotesTwitch.emotes.hasOwnProperty(D)){var P=Math.round(D.length/4);return void(A=A.replace(D,''+D.substr(0,P)+'))}if("undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),e=ffzEmoteUrlStart+emotesFfz[D]+ffzEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}if("undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),e=emotesBTTV[D];return void(A=A.replace(D,'
    '+g+'
    '))}if("undefined"!=typeof emotesBTTV2&&settingsCookie["bda-es-2"]&&emotesBTTV2.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),e=bttvEmoteUrlStart+emotesBTTV2[D]+bttvEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}if(subEmotesTwitch.hasOwnProperty(D)){var P=Math.round(D.length/4),g=D.substr(0,P)+"﷙"+D.substr(P,P)+"﷙"+D.substr(2*P,P)+"﷙"+D.substr(3*P),e=twitchEmoteUrlStart+subEmotesTwitch[D]+twitchEmoteUrlEnd;return void(A=A.replace(D,'
    '+g+'
    '))}}}),null!=B.parentElement)){var Q=B.parentElement.offsetHeight;B.innerHTML=A.replace(new RegExp("﷙","g"),"");var w=B.parentElement.offsetHeight,P=$(".scroller.messages").first();P.scrollTop(P.scrollTop()+(w-Q))}}}if("undefined"!=typeof emotesTwitch&&A.parentElement){var B=A.parentElement;if("SPAN"==B.tagName){var Q=!1;$(B.parentElement).hasClass("edited")&&(B=B.parentElement.parentElement.firstChild,Q=!0),Q?setTimeout(D,250):D()}}},EmoteModule.prototype.autoCapitalize=function(){var A=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var D=$(".channel-textarea-inner textarea").val();if(void 0!=D){var B=D.split(" ").pop();if(B.length>3){var Q=A.capitalize(B.toLowerCase());null!=Q&&$(".channel-textarea-inner textarea").val(D.replace(B,Q))}}}})},EmoteModule.prototype.capitalize=function(A){var D=emotesTwitch.emotes;for(var B in D)if(D.hasOwnProperty(B)&&A==(B+"").toLowerCase())return B};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 A=this;this.container=$("
    ",{id:"bd-ps-container",style:"display:none"});var D=$("
    ",{id:"bd-ps-header"});$("

    ",{text:"Public Servers"}).appendTo(D),$("",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(D),D.appendTo(this.getPanel());var B=$("
    ",{id:"bd-ps-body"});B.appendTo(this.getPanel());var Q=$("",{border:"0"}),w=$("");w.appendTo(Q);var P=$("",{}).append($("",{id:"bd-ps-tbody"});g.appendTo(Q),Q.appendTo(B),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){A.show()});var e=publicServers.servers;for(var E in e)if(e.hasOwnProperty(E)){var t=e[E],s=t.code,C=t.title,o=t.language,v=t.description;this.addServer(E,s,C,o,v)}},PublicServers.prototype.addServer=function(A,D,B,Q,w){var P=this,g=$("#bd-ps-tbody"),e=$("");E.append($("
    ",{text:"Name"})).append($("",{text:"Code"})).append($("",{text:"Language"})).append($("",{text:"Description"})).append($("",{text:"Join"}));P.appendTo(w);var g=$("
    ").append($("
    ",{"class":"bd-ps-description",text:w})),E=$("
    ",{text:B})),E.append($("",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:D})),E.append($("",{text:Q})),E.append(e),E.append($("").append($("