Update OldTitleBar.plugin.js

This commit is contained in:
Mirco Wittrien 2022-10-29 12:13:39 +02:00
parent 4680313272
commit 1d9b9222e9
1 changed files with 14 additions and 25 deletions

View File

@ -2,7 +2,7 @@
* @name OldTitleBar * @name OldTitleBar
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.7.5 * @version 1.7.6
* @description Allows you to switch to Discord's old Titlebar * @description Allows you to switch to Discord's old Titlebar
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -127,16 +127,14 @@ module.exports = (_ => {
} }
}; };
this.patchedModules = { this.modulePatches = {
before: { before: [
HeaderBar: "default" "HeaderBar"
}, ],
after: { after: [
App: "render", "AuthWrapper",
AppSkeleton: "render", "StandardSidebarView"
StandardSidebarView: "default", ]
AuthWrapper: "render"
}
}; };
this.css = ` this.css = `
@ -240,15 +238,6 @@ module.exports = (_ => {
BDFDB.DiscordUtils.rerenderAll(); BDFDB.DiscordUtils.rerenderAll();
} }
} }
processApp (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {props: [["type", ["WINDOWS", "MACOS"]]]});
if (index > -1) children[index] = null;
}
processAppSkeleton (e) {
this.processApp(e);
}
processHeaderBar (e) { processHeaderBar (e) {
let wrapper = BDFDB.ReactUtils.findChild(e.instance, {props: ["toolbar", "children"]}); let wrapper = BDFDB.ReactUtils.findChild(e.instance, {props: ["toolbar", "children"]});
@ -264,17 +253,17 @@ module.exports = (_ => {
this.injectButtons(children, true); this.injectButtons(children, true);
} }
processAuthWrapper (e) {
if (!BDFDB.ArrayUtils.is(e.returnvalue.props.children)) e.returnvalue.props.children = [e.returnvalue.props.children];
this.injectSettingsToolbar(e.returnvalue.props.children, true);
}
processStandardSidebarView (e) { processStandardSidebarView (e) {
let sidebarView = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowstandardsidebarview]]}); let sidebarView = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowstandardsidebarview]]});
if (!sidebarView) return; if (!sidebarView) return;
if (!BDFDB.ArrayUtils.is(sidebarView.props.children)) sidebarView.props.children = [sidebarView.props.children]; if (!BDFDB.ArrayUtils.is(sidebarView.props.children)) sidebarView.props.children = [sidebarView.props.children];
this.injectSettingsToolbar(sidebarView.props.children); this.injectSettingsToolbar(sidebarView.props.children);
} }
processAuthWrapper (e) {
if (!BDFDB.ArrayUtils.is(e.returnvalue.props.children)) e.returnvalue.props.children = [e.returnvalue.props.children];
this.injectSettingsToolbar(e.returnvalue.props.children, true);
}
injectSettingsToolbar (children, fixed) { injectSettingsToolbar (children, fixed) {
if (!this.settings.general.addToSettings) return; if (!this.settings.general.addToSettings) return;