lib
This commit is contained in:
parent
43b2137234
commit
23dd551722
|
@ -1019,10 +1019,10 @@
|
||||||
MemberCard: "Member",
|
MemberCard: "Member",
|
||||||
WebhookCard: "Webhook"
|
WebhookCard: "Webhook"
|
||||||
};
|
};
|
||||||
WebModulesData.Forceobserve = {
|
WebModulesData.Forceobserve = [
|
||||||
QuickSwitchChannelResult: true,
|
"QuickSwitchChannelResult",
|
||||||
QuickSwitchGuildResult: true,
|
"QuickSwitchGuildResult"
|
||||||
};
|
];
|
||||||
WebModulesData.Patchfinder = {
|
WebModulesData.Patchfinder = {
|
||||||
Account: "accountinfo",
|
Account: "accountinfo",
|
||||||
App: "app",
|
App: "app",
|
||||||
|
@ -1243,7 +1243,7 @@
|
||||||
delete plugin.patchedModules[patchtype][type];
|
delete plugin.patchedModules[patchtype][type];
|
||||||
}
|
}
|
||||||
if (!classname) patchInstance(BDFDB.ModuleUtils.findByName(mappedtype.split(" _ _ ")[0]), mappedtype, patchtype);
|
if (!classname) patchInstance(BDFDB.ModuleUtils.findByName(mappedtype.split(" _ _ ")[0]), mappedtype, patchtype);
|
||||||
else if (DiscordClasses[classname]) checkForInstance(classname, mappedtype, patchtype, WebModulesData.Forceobserve[type.split(" _ _ ")[1] || type]);
|
else if (DiscordClasses[classname]) checkForInstance(classname, mappedtype, patchtype, WebModulesData.Forceobserve.includes(type.split(" _ _ ")[1] || type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function patchInstance(instance, type, patchtype) {
|
function patchInstance(instance, type, patchtype) {
|
||||||
|
@ -1276,21 +1276,32 @@
|
||||||
}
|
}
|
||||||
if (!instancefound) {
|
if (!instancefound) {
|
||||||
let found = false, disclass = BDFDB.disCN[classname], dotclass = BDFDB.dotCN[classname];
|
let found = false, disclass = BDFDB.disCN[classname], dotclass = BDFDB.dotCN[classname];
|
||||||
let instanceobserver = new MutationObserver(cs => {cs.forEach(c => {c.addedNodes.forEach(n => {
|
for (let ele of document.querySelectorAll(dotclass)) {
|
||||||
if (found || !n || !n.tagName) return;
|
let ins = BDFDB.ReactUtils.getInstance(ele);
|
||||||
var ele = null;
|
if (isCorrectInstance(ins, type)) {
|
||||||
if ((ele = BDFDB.DOMUtils.containsClass(n, disclass) ? n : n.querySelector(dotclass)) != null) {
|
found = true;
|
||||||
var ins = BDFDB.ReactUtils.getInstance(ele);
|
patchInstance(ins, type, patchtype);
|
||||||
if (isCorrectInstance(ins, type)) {
|
BDFDB.ModuleUtils.forceAllUpdates(plugin, type);
|
||||||
found = true;
|
break;
|
||||||
instanceobserver.disconnect();
|
|
||||||
patchInstance(ins, type, patchtype);
|
|
||||||
BDFDB.ModuleUtils.forceAllUpdates(plugin, type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});});});
|
}
|
||||||
BDFDB.ObserverUtils.connect(plugin, BDFDB.dotCN.appmount, {name:"checkForInstanceObserver", instance:instanceobserver, multi:true
|
if (!found) {
|
||||||
}, {childList:true, subtree:true});
|
let instanceobserver = new MutationObserver(cs => {cs.forEach(c => {c.addedNodes.forEach(n => {
|
||||||
|
if (found || !n || !n.tagName) return;
|
||||||
|
let ele = null;
|
||||||
|
if ((ele = BDFDB.DOMUtils.containsClass(n, disclass) ? n : n.querySelector(dotclass)) != null) {
|
||||||
|
let ins = BDFDB.ReactUtils.getInstance(ele);
|
||||||
|
if (isCorrectInstance(ins, type)) {
|
||||||
|
found = true;
|
||||||
|
instanceobserver.disconnect();
|
||||||
|
patchInstance(ins, type, patchtype);
|
||||||
|
BDFDB.ModuleUtils.forceAllUpdates(plugin, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});});});
|
||||||
|
BDFDB.ObserverUtils.connect(plugin, BDFDB.dotCN.appmount, {name:"checkForInstanceObserver", instance:instanceobserver, multi:true
|
||||||
|
}, {childList:true, subtree:true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isCorrectInstance(instance, name) {
|
function isCorrectInstance(instance, name) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue