This commit is contained in:
Mirco Wittrien 2022-11-23 10:55:10 +01:00
parent aeb8aaa8f7
commit b52e03589d
2 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @name EditChannels
* @author DevilBro
* @authorId 278543574059057154
* @version 4.4.6
* @version 4.4.7
* @description Allows you to locally edit Channels
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -57,6 +57,7 @@ module.exports = (_ => {
}
} : (([Plugin, BDFDB]) => {
var changedChannels = {};
var appTitleObserver;
return class EditChannels extends Plugin {
onLoad () {
@ -131,9 +132,9 @@ module.exports = (_ => {
`;
}
onStart () {
let observer = new MutationObserver(_ => {this.changeAppTitle();});
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
onStart () {
appTitleObserver = new MutationObserver(_ => this.changeAppTitle());
appTitleObserver.observe(document.head.querySelector("title"), {childList: true});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryChannels", {after: e => {
if (!e.methodArguments[0].query) return;
@ -156,6 +157,7 @@ module.exports = (_ => {
}
onStop () {
if (appTitleObserver) appTitleObserver.disconnect();
this.forceUpdateAll();
}

View File

@ -57,6 +57,7 @@ module.exports = (_ => {
}
} : (([Plugin, BDFDB]) => {
var changedUsers = {};
var appTitleObserver;
return class EditUsers extends Plugin {
onLoad () {
@ -199,9 +200,9 @@ module.exports = (_ => {
`;
}
onStart () {
let observer = new MutationObserver(_ => {this.changeAppTitle();});
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
onStart () {
appTitleObserver = new MutationObserver(_ => this.changeAppTitle());
appTitleObserver.observe(document.head.querySelector("title"), {childList: true});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.RelationshipStore, "getName", {after: e => {
if (e.methodArguments[2] && changedUsers[e.methodArguments[2].id] && changedUsers[e.methodArguments[2].id].name) return changedUsers[e.methodArguments[2].id].name;
@ -321,6 +322,7 @@ module.exports = (_ => {
}
onStop () {
if (appTitleObserver) appTitleObserver.disconnect();
this.forceUpdateAll();
}