1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
function Core(){}function EmoteModule(){}function PublicServers(){}function QuickEmoteMenu(){}function SettingsPanel(){}function Utils(){}function VoiceMode(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,jsVersion=1.5,supportedVersion="0.1.5",mainObserver,twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/",twitchEmoteUrlEnd="/1.0",ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/",ffzEmoteUrlEnd="/1",bttvEmoteUrlStart="",bttvEmoteUrlEnd="",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:{settings:{title:"New settings menu!",text:"The settings menu has been moved to the Discord settings dialog!",img:""},spoilers:{title:"Spoilers!",text:"BetterDiscord now supports spoilers, use [!s] in your message to turn it into a spoiler!",img:""},emotenames:{title:"Emote Names!",text:'The emote name on hover has been fixed and reimplemented by <a href="https://github.com/pendo324" target="_blank">pendo324</a>',img:""},customcss:{title:"Custom CSS!",text:"Apply custom CSS to your client! note: The CSS is stored in localstorage. If it's deleted for some reason, you will lose it and it cannot be recovered(keep a backup).",img:""}},fixes:null,upcoming:{ignore:{title:"Ignore User!",text:"Ignore users you don't like",img:""},more:{title:"More Things!",text:"More things but probably not in the next version.",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 i=$(".guilds li:first-child");i.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"})))));var o=$("<button/>",{"class":"btn",id:"bd-show-channels",text:"R",css:{cursor:"pointer"},click:function(){settingsCookie["bda-gs-3"]=!1,$("body").removeClass("bd-minimal-chan"),t.saveSettings()}});if($(".guilds-wrapper").prepend(o),opublicServers=new PublicServers,settingsPanel=new SettingsPanel,settingsPanel.init(),quickEmoteMenu.init(!1),$("#tc-settings-button").on("click",function(){settingsPanel.show()}),$("#bd-pub-button").on("click",function(){opublicServers.show()}),opublicServers.init(),emoteModule.autoCapitalize(),settingsCookie.version<jsVersion){var s=t.constructChangelog();$("body").append(s),settingsCookie.version=jsVersion,t.saveSettings()}}else setTimeout(e,100)}var t=this;return version<supportedVersion?void alert("BetterDiscord v"+version+"(your version) is not supported by the latest js("+jsVersion+"). Please download the latest version from GitHub."):(utils=new Utils,utils.getHash(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,voiceMode=new VoiceMode,emoteModule.init(),this.initSettings(),this.initObserver(),void $(document).ready(function(){setTimeout(e,1e3)}))},Core.prototype.initSettings=function(){if(void 0==$.cookie("better-discord"))settingsCookie=defaultCookie,this.saveSettings();else{this.loadSettings();for(var e in defaultCookie)void 0==settingsCookie[e]&&(settingsCookie[e]=defaultCookie[e],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"))},Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(e){e.forEach(function(e){null!=e.target.getAttribute("class")&&-1!=e.target.getAttribute("class").indexOf("titlebar")&&(quickEmoteMenu.obsCallback(),voiceMode.obsCallback()),emoteModule.obsCallback(e)})}),mainObserver.observe(document,{childList:!0,subtree:!0})},Core.prototype.constructChangelog=function(){var e='<div id="bd-wn-modal" class="modal" style="opacity:1;"> <div class="modal-inner"> <div id="bdcl" class="change-log"> <div class="header"> <strong>What\'s new in BetterDiscord JS v'+jsVersion+'</strong> <button class="close" onclick=\'$("#bd-wn-modal").remove();\'></button> </div><!--header--> <div class="scroller-wrap"> <div class="scroller">';if(null!=bdchangelog.changes){e+='<h1 class="changelog-added"> <span>New Stuff</span></h1><ul>';for(var t in bdchangelog.changes)t=bdchangelog.changes[t],e+="<li> <strong>"+t.title+"</strong> <div>"+t.text+"</div></li>";e+="</ul>"}if(null!=bdchangelog.fixes){e+='<h1 class="changelog-fixed"> <span>Fixed</span></h1><ul>';for(var i in bdchangelog.fixes)i=bdchangelog.fixes[i],e+="<li> <strong>"+i.title+"</strong> <div>"+i.text+"</div></li>";e+="</ul>"}if(null!=bdchangelog.upcoming){e+='<h1 class="changelog-in-progress"> <span>Coming Soon</span></h1><ul>';for(var o in bdchangelog.upcoming)o=bdchangelog.upcoming[o],e+="<li> <strong>"+o.title+"</strong> <div>"+o.text+"</div></li>";e+="</ul>"}return e+=' </div><!--scoller--> </div><!--scroller-wrap--> <div class="footer"> </div><!--footer--> </div><!--change-log--> </div><!--modal-inner--></div><!--modal-->'};var emotesFfz={},emotesBTTV={},emotesTwitch={emotes:{emote:{image_id:0}}},subEmotesTwitch={},twitchAc={"4head":"4Head",anele:"ANELE",argieb8:"ArgieB8",arsonnosexy:"ArsonNoSexy",asianglow:"AsianGlow",atgl:"AtGL",athenapms:"AthenaPMS",ativy:"AtIvy",atww:"AtWW",babyrage:"BabyRage",batchest:"BatChest",bcwarrior:"BCWarrior",biblethump:"BibleThump",bigbrother:"BigBrother",bionicbunion:"BionicBunion",blargnaut:"BlargNaut",bloodtrail:"BloodTrail",bort:"BORT",brainslug:"BrainSlug",brokeback:"BrokeBack",buddhabar:"BuddhaBar",coolcat:"CoolCat",corgiderp:"CorgiDerp",cougarhunt:"CougarHunt",daesuppy:"DAESuppy",dansgame:"DansGame",dathass:"DatHass",datsheffy:"DatSheffy",dbstyle:"DBstyle",deexcite:"deExcite",deilluminati:"deIlluminati",dendiface:"DendiFace",dogface:"DogFace",doomguy:"DOOMGuy",eagleeye:"EagleEye",elegiggle:"EleGiggle",evilfetus:"EvilFetus",failfish:"FailFish",fpsmarksman:"FPSMarksman",frankerz:"FrankerZ",freakinstinkin:"FreakinStinkin",fungineer:"FUNgineer",funrun:"FunRun",fuzzyotteroo:"FuzzyOtterOO",gasjoker:"GasJoker",gingerpower:"GingerPower",grammarking:"GrammarKing",hassanchop:"HassanChop",heyguys:"HeyGuys",hotpokket:"HotPokket",humblelife:"HumbleLife",itsboshytime:"ItsBoshyTime",jebaited:"Jebaited",jkanstyle:"JKanStyle",joncarnage:"JonCarnage",kapow:"KAPOW",kappa:"Kappa",kappapride:"KappaPride",keepo:"Keepo",kevinturtle:"KevinTurtle",kippa:"Kippa",kreygasm:"Kreygasm",kzskull:"KZskull",mau5:"Mau5",mcat:"mcaT",mechasupes:"MechaSupes",mrdestructoid:"MrDestructoid",mvgame:"MVGame",nightbat:"NightBat",ninjatroll:"NinjaTroll",nonospot:"NoNoSpot",notatk:"NotATK",notlikethis:"NotLikeThis",omgscoots:"OMGScoots",onehand:"OneHand",opieop:"OpieOP",optimizeprime:"OptimizePrime",osbeaver:"OSbeaver",osbury:"OSbury",osdeo:"OSdeo",osfrog:"OSfrog",oskomodo:"OSkomodo",osrob:"OSrob",ossloth:"OSsloth",panicbasket:"panicBasket",panicvis:"PanicVis",pazpazowitz:"PazPazowitz",peopleschamp:"PeoplesChamp",permasmug:"PermaSmug",picomause:"PicoMause",pipehype:"PipeHype",pjharley:"PJHarley",pjsalt:"PJSalt",pmstwin:"PMSTwin",pogchamp:"PogChamp",poooound:"Poooound",praiseit:"PraiseIt",prchase:"PRChase",punchtrees:"PunchTrees",puppeyface:"PuppeyFace",raccattack:"RaccAttack",ralpherz:"RalpherZ",redcoat:"RedCoat",residentsleeper:"ResidentSleeper",ritzmitz:"RitzMitz",rulefive:"RuleFive",shadylulu:"ShadyLulu",shazam:"Shazam",shazamicon:"shazamicon",shazbotstix:"ShazBotstix",shibez:"ShibeZ",smorc:"SMOrc",smskull:"SMSkull",sobayed:"SoBayed",soonerlater:"SoonerLater",srihead:"SriHead",ssssss:"SSSsss",stonelightning:"StoneLightning",strawbeary:"StrawBeary",supervinlin:"SuperVinlin",swiftrage:"SwiftRage",tbbaconbiscuit:"tbBaconBiscuit",tbchickenbiscuit:"tbChickenBiscuit",tbquesarito:"tbQuesarito",tbsausagebiscuit:"tbSausageBiscuit",tbspicy:"tbSpicy",tbsriracha:"tbSriracha",tf2john:"TF2John",theking:"TheKing",theringer:"TheRinger",thetarfu:"TheTarFu",thething:"TheThing",thunbeast:"ThunBeast",tinyface:"TinyFace",toospicy:"TooSpicy",trihard:"TriHard",ttours:"TTours",uleetbackup:"UleetBackup",unclenox:"UncleNox",unsane:"UnSane",vaultboy:"VaultBoy",volcania:"Volcania",wholewheat:"WholeWheat",winwaker:"WinWaker",wtruck:"WTRuck",wutface:"WutFace",youwhy:"YouWHY"};EmoteModule.prototype.init=function(){},EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/emotefilter.json",function(e){bemotes=e.blacklist})},EmoteModule.prototype.obsCallback=function(e){var t=this;if(settingsCookie["bda-es-7"])for(var i=0;i<e.addedNodes.length;++i){var o=e.addedNodes.item(i);if(o){var s=t.getNodes(o);for(var n in s)s.hasOwnProperty(n)&&t.injectEmote(s[n])}}},EmoteModule.prototype.getNodes=function(e){for(var t,i=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);t=o.nextNode();)i.push(t);return i};var bemotes=[],spoilered=[];EmoteModule.prototype.injectEmote=function(e){if("undefined"!=typeof emotesTwitch&&e.parentElement){var t=e.parentElement;if("SPAN"==t.tagName&&$(t.parentElement).hasClass("markup")){var i=t.innerHTML,o=i.split(/\s+/g);if(o&&(o.some(function(e){if("[!s]"==e.slice(0,4)){i=i.replace("[!s]","");var o=$(t).parent(),s=o.attr("data-reactid");if(spoilered.indexOf(s)>-1)return;return o.addClass("spoiler"),void o.on("click",function(){$(this).removeClass("spoiler"),spoilered.push($(this).attr("data-reactid"))})}if(-1==$.inArray(e,bemotes)&&!(e.length<4))return emotesTwitch.emotes.hasOwnProperty(e)?settingsCookie["bda-es-6"]?void(i=i.replace(e,'<img title="'+e.substr(0,e.length/2)+""+e.substr(e.length/2)+'" src="'+twitchEmoteUrlStart+emotesTwitch.emotes[e].image_id+twitchEmoteUrlEnd+'" />')):void(i=i.replace(e,"<img src="+twitchEmoteUrlStart+emotesTwitch.emotes[e].image_id+twitchEmoteUrlEnd+" ></img>")):"undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(e)?settingsCookie["bda-es-6"]?void(i=i.replace(e,'<img title="'+e.substr(0,e.length/2)+""+e.substr(e.length/2)+'" src="'+ffzEmoteUrlStart+emotesFfz[e]+ffzEmoteUrlEnd+'" />')):void(i=i.replace(e,"<img src="+ffzEmoteUrlStart+emotesFfz[e]+ffzEmoteUrlEnd+" ></img>")):"undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(e)?settingsCookie["bda-es-6"]?void(i=i.replace(e,'<img title="'+e.substr(0,e.length/2)+""+e.substr(e.length/2)+'" src="'+emotesBTTV[e]+'" />')):void(i=i.replace(e,"<img src="+emotesBTTV[e]+" ></img>")):subEmotesTwitch.hasOwnProperty(e)?settingsCookie["bda-es-6"]?void(i=i.replace(e,'<img title="'+e.substr(0,e.length/2)+""+e.substr(e.length/2)+'" src="'+twitchEmoteUrlStart+subEmotesTwitch[e]+twitchEmoteUrlEnd+'" />')):void(i=i.replace(e,"<img src="+twitchEmoteUrlStart+subEmotesTwitch[e]+twitchEmoteUrlEnd+" ></img>")):void 0}),null!=t.parentElement)){var s=t.parentElement.offsetHeight;t.innerHTML=i.replace(new RegExp("","g"),"");var n=t.parentElement.offsetHeight,a=$(".scroller.messages").first();a.scrollTop(a.scrollTop()+(n-s))}}}},EmoteModule.prototype.autoCapitalize=function(){var e=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var t=$(".channel-textarea-inner textarea").val();if(void 0!=t){var i=t.split(" ").pop();if(i.length>3){var o=e.capitalize(i.toLowerCase());null!=o&&$(".channel-textarea-inner textarea").val(t.replace(i,o))}}}})},EmoteModule.prototype.capitalize=function(e){return twitchAc.hasOwnProperty(e)?twitchAc[e]:null};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 e=this;this.container=$("<div/>",{id:"bd-ps-container",style:"display:none"});var t=$("<div/>",{id:"bd-ps-header"});$("<h2/>",{text:"Public Servers"}).appendTo(t),$("<span/>",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(t),t.appendTo(this.getPanel());var i=$("<div/>",{id:"bd-ps-body"});i.appendTo(this.getPanel());var o=$("<table/>",{border:"0"}),s=$("<thead/>");s.appendTo(o);var n=$("<tr/>",{}).append($("<th/>",{text:"Name"})).append($("<th/>",{text:"Code"})).append($("<th/>",{text:"Language"})).append($("<th/>",{text:"Description"})).append($("<th/>",{text:"Join"}));n.appendTo(s);var a=$("<tbody/>",{id:"bd-ps-tbody"});a.appendTo(o),o.appendTo(i),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){e.show()});var r=publicServers.servers;for(var l in r)if(r.hasOwnProperty(l)){var d=r[l],c=d.code,p=d.title,u=d.language,m=d.description;this.addServer(l,c,p,u,m)}},PublicServers.prototype.addServer=function(e,t,i,o,s){var n=this,a=$("#bd-ps-tbody"),r=$("<td/>").append($("<div/>",{"class":"bd-ps-description",text:s})),l=$("<tr/>");l.append($("<td/>",{text:i})),l.append($("<td/>",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:t})),l.append($("<td/>",{text:o})),l.append(r),l.append($("<td/>").append($("<button/>",{text:"Join",css:{height:"30px",display:"block","margin-top":"10px","background-color":"#36393E",border:"1px solid #404040",outline:"1px solid #000",color:"#EDEDED"},click:function(){n.joinServer(t)}}))),a.append(l)},PublicServers.prototype.show=function(){this.getPanel().toggle();var e=$("#bd-pub-li");e.removeClass(),this.getPanel().is(":visible")&&e.addClass("active")},PublicServers.prototype.joinServer=function(e){$(".guilds-add").click(),$(".action.join .btn").click(),$(".create-guild-container input").val(e),$(".form.join-server .btn-primary").click()};var emoteBtn,emoteMenu;QuickEmoteMenu.prototype.init=function(e){emoteBtn=null,$(".channel-textarea").first().removeClass("emotemenu-enabled"),emoteMenu||this.initEmoteList();var t;emoteBtn=$("<div/>",{id:"twitchcord-button-container",style:"display:none"}).append($("<button/>",{id:"twitchcord-button",onclick:"return false;"})),$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form").append(emoteBtn),emoteMenu.detach(),emoteBtn.append(emoteMenu),$("#twitchcord-button").on("click",function(){t=!t,t?(emoteMenu.addClass("emotemenu-open"),$(this).addClass("twitchcord-button-open")):(emoteMenu.removeClass(),$(this).removeClass())}),settingsCookie["bda-es-0"]&&($(".channel-textarea").first().addClass("emotemenu-enabled"),emoteBtn.show());var i=$(".emote-icon");i.off(),i.on("click",function(){var e=$(this).attr("id"),t=$(".channel-textarea-inner textarea");t.val(" "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)})},QuickEmoteMenu.prototype.obsCallback=function(){if(emoteBtn&&$(".content.flex-spacer.flex-horizontal .flex-spacer.flex-vertical form")){var e=$("#twitchcord-button-container");void 0==e.parent().prop("tagName")&&(quickEmoteMenu=new QuickEmoteMenu,quickEmoteMenu.init(!0))}},QuickEmoteMenu.prototype.initEmoteList=function(){emoteMenu=$("<div/>",{id:"emote-menu"});var e=$("<div/>",{id:"emote-menu-header"}).append($("<span/>",{text:"Global Emotes"})),t=$("<div/>",{id:"emote-menu-inner"});emoteMenu.append(e),emoteMenu.append(t);for(var i in emotesTwitch.emotes)if(emotesTwitch.emotes.hasOwnProperty(i)){var o=emotesTwitch.emotes[i].image_id;t.append($("<div/>",{"class":"emote-container"}).append($("<img/>",{"class":"emote-icon",id:i,alt:"",src:"https://static-cdn.jtvnw.net/emoticons/v1/"+o+"/1.0",title:i})))}};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-jd"]&&(opublicServers.joinServer("0Tmfo5ZbORCRqbAd"),settingsCookie["bda-jd"]=!1,mainCore.saveSettings())},SettingsPanel.prototype.applyCustomCss=function(e){0==$("#customcss").length&&$("head").append('<style id="customcss"></style>'),$("#customcss").html(e),localStorage.setItem("bdcustomcss",btoa(e))},SettingsPanel.prototype.construct=function(){function e(){var e=$(this).children().find('input[type="checkbox"]'),t=!e.is(":checked"),i=e.attr("id");e.prop("checked",t),settingsCookie[i]=t,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(),mainCore.saveSettings()}function t(){$(".tab-bar-item").removeClass("selected"),settingsButton.addClass("selected"),$(".form .settings-right .settings-inner").first().hide(),panel.show()}function i(){$(".btn.btn-settings").length<1?setTimeout(i,100):$(".btn.btn-settings").first().on("click",function(){function e(){if($(".modal-inner").first().is(":visible")){panel.hide();var t=$(".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()}),t.append(settingsButton),panel.insertAfter(".form .settings-right .settings-inner"),$("#bd-settings-new").removeClass("selected")}else setTimeout(e,100)}e()})}var o=this;panel=$("<div/>",{"class":"settings-inner",style:"display:none;"});var s=$("<div/>",{"class":" scroller-wrap polyfil"});panel.append(s);var n=$("<div/>",{"class":"scroller settings-wrapper settings-panel"}),a=$("<div/>",{"class":"scrollbar"}).append($("<div/>",{"class":"track"}).append($("<div/>",{"class":"thumb"})));n.append(a),s.append(n);var r=$("<div/>",{"class":"control-groups"}),l=$("<div/>",{"class":"control-groups"});n.append(r),n.append(l);var d=$("<div/>",{"class":"control-group"}),c=$("<div/>",{"class":"control-group"});r.append(d),l.append(c),d.append($("<label/>",{text:"BetterDiscord Settings"})),c.append($("<label/>",{text:"Custom CSS"}));var p=$("<textarea/>",{id:"custom-css-ta"}),u=atob(localStorage.getItem("bdcustomcss"));o.applyCustomCss(u),p.val(u),c.append(p),p.on("input propertychange",function(){o.applyCustomCss($(this).val())});var m=$("<ul/>",{"class":"checkbox-group"});for(var g in settings){var h=settings[g],b=h.id;h.implemented&&m.append($("<li/>").append($("<div/>",{"class":"checkbox",click:e}).append($("<div/>",{"class":"checkbox-inner"}).append($("<input/>",{type:"checkbox",id:b,prop:{checked:settingsCookie[b]}})).append($("<span/>"))).append($("<span/>",{text:g+" - "+h.info}))))}d.append(m);var f=$("<div/>",{css:{background:"#1A1A1A",color:"#ADADAD",height:"30px",position:"absolute",bottom:"0",left:"0",right:"0"}}),v=$("<span/>",{text:"BetterDiscord v"+version+"(JSv"+jsVersion+") by Jiiks",css:{"line-height":"30px","margin-left":"10px"}}),k=$("<span/>",{css:{"float":"right","line-height":"30px","margin-right":"10px"}});for(var y in links)$("<a/>",{text:links[y].text,href:links[y].href,target:links[y].target}).append($("<span/>",{text:" | "})).appendTo(k);f.append(v),f.append(k),s.append(f),settingsButton=$("<div/>",{"class":"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:t}),i()};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()})},VoiceMode.prototype.obsCallback=function(){console.log("voiceMode obs");var e=this;settingsCookie["bda-gs-4"]&&(e.disable(),setTimeout(function(){e.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","")}; |