Update ServerCounter.plugin.js
This commit is contained in:
parent
304d9147cf
commit
eb2bf4a104
|
@ -2,7 +2,7 @@
|
||||||
* @name ServerCounter
|
* @name ServerCounter
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.0.3
|
* @version 1.0.4
|
||||||
* @description Adds a Server Counter to the Server List
|
* @description Adds a Server Counter to the Server List
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,13 +17,8 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "ServerCounter",
|
"name": "ServerCounter",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Adds a Server Counter to the Server List"
|
"description": "Adds a Server Counter to the Server List"
|
||||||
},
|
|
||||||
"changeLog": {
|
|
||||||
"fixed": {
|
|
||||||
"Works again": "Can discord stop messing with the server list, jeez"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,7 +72,7 @@ module.exports = (_ => {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
after: {
|
after: {
|
||||||
Guilds: "render"
|
Guilds: "type"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -91,32 +86,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processGuilds (e) {
|
processGuilds (e) {
|
||||||
if (typeof e.returnvalue.props.children == "function") {
|
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "UnreadDMs"});
|
||||||
let childrenRender = e.returnvalue.props.children;
|
|
||||||
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
|
|
||||||
let children = childrenRender(...args);
|
|
||||||
this.checkTree(children);
|
|
||||||
return children;
|
|
||||||
}, "", this);
|
|
||||||
}
|
|
||||||
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 = BDFDB.TimeUtils.suppress((...args) => {
|
|
||||||
let children = childrenRender(...args);
|
|
||||||
this.injectCounter(children);
|
|
||||||
return children;
|
|
||||||
}, "", this);
|
|
||||||
}
|
|
||||||
else this.injectCounter(returnvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
injectCounter (returnvalue) {
|
|
||||||
let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "ConnectedUnreadDMs"});
|
|
||||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
|
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCNS.guildouter + BDFDB.disCN._servercounterservercountwrap,
|
className: BDFDB.disCNS.guildouter + BDFDB.disCN._servercounterservercountwrap,
|
||||||
children: BDFDB.ReactUtils.createElement("div", {
|
children: BDFDB.ReactUtils.createElement("div", {
|
||||||
|
|
Loading…
Reference in New Issue