update mod loader

This commit is contained in:
Your New SJW Waifu 2020-10-12 09:37:31 -05:00
parent f7f7edba57
commit bdd281ab3d
1 changed files with 6 additions and 2 deletions

View File

@ -129,7 +129,8 @@ function PleromaModLoader () {
this.containers = {
main: document.querySelector(".main"),
notifications: document.querySelector(".notifications"),
userPanel: document.querySelector(".user-panel")
userPanel: document.querySelector(".user-panel"),
settingsModal: document.querySelector(".settings-modal")
};
const observerConfig = { subtree: true, childList: true };
@ -138,7 +139,7 @@ function PleromaModLoader () {
mutations.length > 0 &&
mutations[0].addedNodes.length > 0 &&
mutations[0].addedNodes[0].classList &&
mutations[0].addedNodes[0].classList.contains("settings")
mutations[0].addedNodes[0].classList.contains("settings_tab-switcher")
) {
this.appendModSettings(mutations[0].addedNodes[0].querySelector("div[label]:first-child"));
}
@ -166,6 +167,9 @@ function PleromaModLoader () {
if (this.containers.userPanel) {
this.observer.observe(this.containers.userPanel, observerConfig);
}
if (this.containers.settingsModal) {
this.observer.observe(this.containers.settingsModal, observerConfig);
}
}
].forEach((fn) => { PleromaModLoader.prototype[fn.name] = fn; });
[