fixes
This commit is contained in:
parent
422e24c22f
commit
8b77ffa41a
|
@ -1082,28 +1082,33 @@
|
||||||
const originalfunction = module[modulefunction];
|
const originalfunction = module[modulefunction];
|
||||||
module.BDFDBpatch[modulefunction].originalMethod = originalfunction;
|
module.BDFDBpatch[modulefunction].originalMethod = originalfunction;
|
||||||
module[modulefunction] = function () {
|
module[modulefunction] = function () {
|
||||||
|
let called = false, stopCall = false;
|
||||||
const data = {
|
const data = {
|
||||||
thisObject: this,
|
thisObject: this,
|
||||||
methodArguments: arguments,
|
methodArguments: arguments,
|
||||||
originalMethod: originalfunction,
|
originalMethod: originalfunction,
|
||||||
originalMethodName: modulefunction,
|
originalMethodName: modulefunction,
|
||||||
callOriginalMethod: _ => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)
|
callOriginalMethod: _ => {if (!stopCall) data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)},
|
||||||
|
callOriginalMethodAfterwards: _ => {callInstead = true;},
|
||||||
|
stopOriginalMethodCall: _ => {stopCall = true;}
|
||||||
};
|
};
|
||||||
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded && module.BDFDBpatch[modulefunction]) {
|
if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded && module.BDFDBpatch[modulefunction]) {
|
||||||
if (!BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].before)) for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].before)) {
|
if (!BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].before)) for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].before)) {
|
||||||
BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].before[id], `"before" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].before[id].pluginname)(data);
|
BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].before[id], `"before" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].before[id].pluginname)(data);
|
||||||
}
|
}
|
||||||
if (BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].instead)) BDFDB.TimeUtils.suppress(data.callOriginalMethod, `originalMethod of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`)();
|
let hasInsteadPatches = !BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].instead);
|
||||||
else for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].instead)) {
|
if (hasInsteadPatches) for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].instead)) {
|
||||||
let tempreturn = BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].instead[id], `"instead" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].instead[id].pluginname)(data);
|
let tempreturn = BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].instead[id], `"instead" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].instead[id].pluginname)(data);
|
||||||
if (tempreturn !== undefined) data.returnValue = tempreturn;
|
if (tempreturn !== undefined) data.returnValue = tempreturn;
|
||||||
}
|
}
|
||||||
|
if ((!hasInsteadPatches || callInstead) && !stopCall) BDFDB.TimeUtils.suppress(data.callOriginalMethod, `originalMethod of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`)();
|
||||||
if (!BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].after)) for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].after)) {
|
if (!BDFDB.ObjectUtils.isEmpty(module.BDFDBpatch[modulefunction].after)) for (let id in BDFDB.ObjectUtils.sort(module.BDFDBpatch[modulefunction].after)) {
|
||||||
let tempreturn = BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].after[id], `"after" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].after[id].pluginname)(data);
|
let tempreturn = BDFDB.TimeUtils.suppress(module.BDFDBpatch[modulefunction].after[id], `"after" callback of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`, module.BDFDBpatch[modulefunction].after[id].pluginname)(data);
|
||||||
if (tempreturn !== undefined) data.returnValue = tempreturn;
|
if (tempreturn !== undefined) data.returnValue = tempreturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else BDFDB.TimeUtils.suppress(data.callOriginalMethod, `originalMethod of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`)();
|
else BDFDB.TimeUtils.suppress(data.callOriginalMethod, `originalMethod of ${modulefunction} in ${module.constructor ? module.constructor.displayName || module.constructor.name : "module"}`)();
|
||||||
|
called = false, stopCall = false;
|
||||||
return modulefunction == "render" && data.returnValue === undefined ? null : data.returnValue;
|
return modulefunction == "render" && data.returnValue === undefined ? null : data.returnValue;
|
||||||
};
|
};
|
||||||
module[modulefunction].originalsource = originalfunction;
|
module[modulefunction].originalsource = originalfunction;
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue