Fixed settings sidebar injection

This commit is contained in:
Alexei Stukov 2017-05-01 12:36:48 +03:00 committed by GitHub
parent 2d4416466c
commit 9859064dc6
1 changed files with 2 additions and 2 deletions

4
js/main.min.js vendored
View File

@ -576,8 +576,8 @@ get items(){return[{'text':'Core','id':'core'},{'text':'Emotes','id':'emotes'},{
get component(){return BDV2.react.createElement("span",null,BDV2.react.createElement(V2Components.SideBar,{onClick:this.onClick,headerText:"BetterDiscord",items:this.items}),BDV2.react.createElement("span",{style:{fontSize:"12px",fontWeight:"600",color:"#72767d",padding:"6px 10px"}},`v${bdVersion}:${jsVersion} by `,BDV2.react.createElement("a",{href:"https://github.com/Jiiks/",target:"_blank"},"Jiiks")))}
get root(){let _root=$("#bd-settings-sidebar");if(!_root.length){if(!this.injectRoot())return null;return this.root}
return _root[0]}
injectRoot(){let changeLog=$(".ui-tab-bar-item:contains('Change Log')");if(!changeLog.length)return!1;$("<span/>",{'id':'bd-settings-sidebar'}).insertBefore(changeLog.prev());return!0}
render(){let root=this.root;if(!root){console.log("FAILED TO LOCATE ROOT: .ui-tab-bar-item:contains('Change Log')");return}
injectRoot(){let changeLog=$(".ui-tab-bar-item:not(.danger)").last();if(!changeLog.length)return!1;$("<span/>",{'id':'bd-settings-sidebar'}).insertBefore(changeLog.prev());return!0}
render(){let root=this.root;if(!root){console.log("FAILED TO LOCATE ROOT: .ui-tab-bar-item:not(.danger)");return}
BDV2.reactDom.render(this.component,root)}}
class V2_SettingsPanel{constructor(){let self=this;self.sideBarOnClick=self.sideBarOnClick.bind(self);self.onChange=self.onChange.bind(self);self.updateSettings=this.updateSettings.bind(self);self.sidebar=new V2_SettingsPanel_Sidebar(self.sideBarOnClick)}
get root(){let _root=$("#bd-settingspane-container");if(!_root.length){if(!this.injectRoot())return null;return this.root}