Update ReadAllNotificationsButton.plugin.js
This commit is contained in:
parent
adb02f76f2
commit
d18cc4150e
|
@ -14,12 +14,12 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "ReadAllNotificationsButton",
|
"name": "ReadAllNotificationsButton",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"description": "Add a button to clear all notifications"
|
"description": "Add a button to clear all notifications"
|
||||||
},
|
},
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
"fixed": {
|
"fixed": {
|
||||||
"Crash on Canary": "Fixed the crash issue that occured one some plugins on canary"
|
"Works again": "Can discord stop messing with the server list, jeez"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -219,12 +219,25 @@ module.exports = (_ => {
|
||||||
if (typeof e.returnvalue.props.children == "function") {
|
if (typeof e.returnvalue.props.children == "function") {
|
||||||
let childrenRender = e.returnvalue.props.children;
|
let childrenRender = e.returnvalue.props.children;
|
||||||
e.returnvalue.props.children = (...args) => {
|
e.returnvalue.props.children = (...args) => {
|
||||||
|
let children = childrenRender(...args);
|
||||||
|
this.checkTree(children);
|
||||||
|
return children;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else this.checkTree(e.returnvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkTree (returnvalue) {
|
||||||
|
let tree = BDFDB.ReactUtils.findChild(returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"});
|
||||||
|
if (tree) {
|
||||||
|
let childrenRender = tree.props.children;
|
||||||
|
tree.props.children = (...args) => {
|
||||||
let children = childrenRender(...args);
|
let children = childrenRender(...args);
|
||||||
this.injectButton(children);
|
this.injectButton(children);
|
||||||
return children;
|
return children;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else this.injectButton(e.returnvalue);
|
else this.injectButton(returnvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
injectButton (returnvalue) {
|
injectButton (returnvalue) {
|
||||||
|
|
Loading…
Reference in New Issue