Localization fix and layer identifiers

This commit is contained in:
Alexei Stukov 2017-05-04 18:47:15 +03:00 committed by GitHub
parent a5089721db
commit b933703f4f
1 changed files with 3 additions and 1 deletions

4
js/main.min.js vendored
View File

@ -374,7 +374,9 @@ settingsInner+='\
</div>\
</div></div>\
';function showSettings(){$(".tab-bar-item").removeClass("selected");settingsButton.addClass("selected");$(".form .settings-right .settings-inner").first().hide();panel.show();if(lastTab==""){self.changeTab("bd-settings-tab")}else{self.changeTab(lastTab)}}
settingsButton=$("<div/>",{class:"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:showSettings});panel.html(settingsInner);this.panel=panel};SettingsPanel.prototype.inject=function(mutation){if(this.injectNew(mutation))return;if(mutation.type!="childList")return;if(mutation.addedNodes.length<=0)return;if($(mutation.addedNodes[0]).find(".user-settings-modal").length<=0)return;var self=this;this.panel.hide();var tabBar=$(".tab-bar.SIDE").first();$(".tab-bar.SIDE .tab-bar-item").click(function(){$(".form .settings-right .settings-inner").first().show();$("#bd-settings-new").removeClass("selected");self.panel.hide()});tabBar.append(settingsButton);$(".form .settings-right .settings-inner").last().after(self.panel);$("#bd-settings-new").removeClass("selected")};SettingsPanel.prototype.injectNew=function(mutation){let self=this;if(!mutation.target.classList.contains("layers"))return;if(!$(".ui-tab-bar-header:contains('App Settings')").length)return;if($("#bd-settings-sidebar").length)return;self.v2SettingsPanel.renderSidebar();return!0};SettingsPanel.prototype.versionInfo=function(){let self=this;let element=$("<div/>",{class:'bd-versioninfo-wrapper'}).append($("<span/>",{text:`BetterDiscord v${(typeof(version) === "undefined" ? bdVersion : version)}:${jsVersion} by `})).append($("<a/>",{text:'Jiiks',href:'https://google.com',target:'_blank'}));return element}
settingsButton=$("<div/>",{class:"tab-bar-item",text:"BetterDiscord",id:"bd-settings-new",click:showSettings});panel.html(settingsInner);this.panel=panel};SettingsPanel.prototype.inject=function(mutation){if(this.injectNew(mutation))return;if(mutation.type!="childList")return;if(mutation.addedNodes.length<=0)return;if($(mutation.addedNodes[0]).find(".user-settings-modal").length<=0)return;var self=this;this.panel.hide();var tabBar=$(".tab-bar.SIDE").first();$(".tab-bar.SIDE .tab-bar-item").click(function(){$(".form .settings-right .settings-inner").first().show();$("#bd-settings-new").removeClass("selected");self.panel.hide()});tabBar.append(settingsButton);$(".form .settings-right .settings-inner").last().after(self.panel);$("#bd-settings-new").removeClass("selected")};SettingsPanel.prototype.injectNew=function(mutation){let self=this;if(!mutation.target.classList.contains("layers"))return;if($(".guild-settings-base-section").length){try{mutation.addedNodes[0].setAttribute('layer-id','server-settings')}catch(err){}}
if(!$(".user-settings-account").length)return;try{mutation.addedNodes[0].setAttribute('layer-id','user-settings')}catch(err){}
if($("#bd-settings-sidebar").length)return;self.v2SettingsPanel.renderSidebar();return!0};SettingsPanel.prototype.versionInfo=function(){let self=this;let element=$("<div/>",{class:'bd-versioninfo-wrapper'}).append($("<span/>",{text:`BetterDiscord v${(typeof(version) === "undefined" ? bdVersion : version)}:${jsVersion} by `})).append($("<a/>",{text:'Jiiks',href:'https://google.com',target:'_blank'}));return element}
SettingsPanel.prototype.tabBarNew=function(){let self=this;let _tabBar=$("<div/>",{class:'tab-bar TOP',style:'border-bottom:none'});let items=[{'id':'bd-core','text':'Core'},{'id':'bd-emotes','text':'Emotes'},{'id':'bd-customcss','text':'Custom CSS'},{'id':'bd-plugins','text':'Plugins'},{'id':'bd-themes','text':'Themes'}];items.map(value=>{_tabBar.append($("<div/>",{class:'tab-bar-item bd-tab',text:value.text,id:value.id,click:()=>self.changeTabNew(value.id)}))});return _tabBar}
SettingsPanel.prototype.changeTabNew=function(id){$(".bd-tab").removeClass("selected");$(`#${id}`).addClass("selected");$(".bd-pane").hide();$(`#${id}-pane`).show();if(id==='bd-customcss'){if(!customCssInitialized){customCssEditor.init();customCssInitialized=!0}}}
SettingsPanel.prototype.updateSettingNew=function(id,checked){if(id=="bda-css-2"){$("#app-mount").removeClass("bd-hide-bd");customCssEditor.hideBackdrop=checked;if(checked){$("#app-mount").addClass("bd-hide-bd")}}