This commit is contained in:
Mirco Wittrien 2019-12-01 15:40:19 +01:00
parent c3830d65d9
commit 43b2137234
2 changed files with 26 additions and 14 deletions

View File

@ -1013,9 +1013,16 @@
InvitationCard: "InviteRow", InvitationCard: "InviteRow",
InviteCard: "InviteRow", InviteCard: "InviteRow",
PopoutContainer: "Popout", PopoutContainer: "Popout",
QuickSwitchChannelResult: "Channel",
QuickSwitchGuildResult: "Guild",
QuickSwitchResult: "Result",
MemberCard: "Member", MemberCard: "Member",
WebhookCard: "Webhook" WebhookCard: "Webhook"
}; };
WebModulesData.Forceobserve = {
QuickSwitchChannelResult: true,
QuickSwitchGuildResult: true,
};
WebModulesData.Patchfinder = { WebModulesData.Patchfinder = {
Account: "accountinfo", Account: "accountinfo",
App: "app", App: "app",
@ -1032,6 +1039,9 @@
PopoutContainer: "popout", PopoutContainer: "popout",
PrivateChannelCall: "callcurrentcontainer", PrivateChannelCall: "callcurrentcontainer",
PrivateChannelsList: "dmchannelsscroller", PrivateChannelsList: "dmchannelsscroller",
QuickSwitchChannelResult: "quickswitchresult",
QuickSwitchGuildResult: "quickswitchresult",
QuickSwitchResult: "quickswitchresult",
MemberCard: "guildsettingsmembercard", MemberCard: "guildsettingsmembercard",
MutualGuilds: "userprofilebody", MutualGuilds: "userprofilebody",
MutualFriends: "userprofilebody", MutualFriends: "userprofilebody",
@ -1225,15 +1235,15 @@
for (let patchtype in plugin.patchedModules) for (let type in plugin.patchedModules[patchtype]) { for (let patchtype in plugin.patchedModules) for (let type in plugin.patchedModules[patchtype]) {
if (WebModulesData.GlobalModules[type] && typeof WebModulesData.GlobalModules[type] == "function") patchInstance(WebModulesData.GlobalModules[type], type, patchtype); if (WebModulesData.GlobalModules[type] && typeof WebModulesData.GlobalModules[type] == "function") patchInstance(WebModulesData.GlobalModules[type], type, patchtype);
else { else {
var mapped = WebModulesData.Patchmap[type]; let mapped = WebModulesData.Patchmap[type];
var classname = WebModulesData.Patchfinder[type.split(" _ _ ")[1] || type]; let classname = WebModulesData.Patchfinder[type.split(" _ _ ")[1] || type];
var mappedtype = mapped ? mapped + " _ _ " + type : type; let mappedtype = mapped ? mapped + " _ _ " + type : type;
if (mapped) { if (mapped) {
plugin.patchedModules[patchtype][mappedtype] = plugin.patchedModules[patchtype][type]; plugin.patchedModules[patchtype][mappedtype] = plugin.patchedModules[patchtype][type];
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); else if (DiscordClasses[classname]) checkForInstance(classname, mappedtype, patchtype, WebModulesData.Forceobserve[type.split(" _ _ ")[1] || type]);
} }
} }
function patchInstance(instance, type, patchtype) { function patchInstance(instance, type, patchtype) {
@ -1251,16 +1261,18 @@
} }
} }
} }
function checkForInstance(classname, type, patchtype) { function checkForInstance(classname, type, patchtype, forceobserve) {
const app = document.querySelector(BDFDB.dotCN.app), bdsettings = document.querySelector("#bd-settingspane-container " + BDFDB.dotCN.scrollerwrap); const app = document.querySelector(BDFDB.dotCN.app), bdsettings = document.querySelector("#bd-settingspane-container " + BDFDB.dotCN.scrollerwrap);
var instancefound = false; let instancefound = false;
if (app) { if (!forceobserve) {
var appins = BDFDB.ReactUtils.findConstructor(app, type, {unlimited:true}) || BDFDB.ReactUtils.findConstructor(app, type, {unlimited:true, up:true}); if (app) {
if (appins && (instancefound = true)) patchInstance(appins, type, patchtype); let appins = BDFDB.ReactUtils.findConstructor(app, type, {unlimited:true}) || BDFDB.ReactUtils.findConstructor(app, type, {unlimited:true, up:true});
} if (appins && (instancefound = true)) patchInstance(appins, type, patchtype);
if (!instancefound && bdsettings) { }
var bdsettingsins = BDFDB.ReactUtils.findConstructor(bdsettings, type, {unlimited:true}); if (!instancefound && bdsettings) {
if (bdsettingsins && (instancefound = true)) patchInstance(bdsettingsins, type, patchtype); let bdsettingsins = BDFDB.ReactUtils.findConstructor(bdsettings, type, {unlimited:true});
if (bdsettingsins && (instancefound = true)) patchInstance(bdsettingsins, type, patchtype);
}
} }
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];

File diff suppressed because one or more lines are too long