From 88840f401555477a83f2f9aae1fb31032e657b3f Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 26 Apr 2019 12:23:23 +0200 Subject: [PATCH] Update BetterFriendCount.plugin.js --- .../BetterFriendCount.plugin.js | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Plugins/BetterFriendCount/BetterFriendCount.plugin.js b/Plugins/BetterFriendCount/BetterFriendCount.plugin.js index 98e611064d..c070885999 100644 --- a/Plugins/BetterFriendCount/BetterFriendCount.plugin.js +++ b/Plugins/BetterFriendCount/BetterFriendCount.plugin.js @@ -3,7 +3,7 @@ class BetterFriendCount { getName () {return "BetterFriendCount";} - getVersion () {return "1.1.3";} + getVersion () {return "1.1.4";} getAuthor () {return "DevilBro";} @@ -20,11 +20,10 @@ class BetterFriendCount { }; this.css = ` - ${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badge}:not(.betterfriendcount-badge), - ${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badgewrapper}:not(.betterfriendcount-badge) { + ${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.settingstabbarbadge}:not(.betterfriendcount-badge) { display: none !important; } - ${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.badgewrapper}.betterfriendcount-badge { + ${BDFDB.dotCNS.friends + BDFDB.dotCNS.settingstabbar + BDFDB.dotCN.settingstabbarbadge}.betterfriendcount-badge { margin-left: 5px !important; } `; @@ -96,21 +95,24 @@ class BetterFriendCount { let relationships = this.FriendUtils.getRelationships(), relationshipCount = {}; for (let type in this.relationshipTypes) relationshipCount[this.relationshipTypes[type]] = 0; for (let id in relationships) relationshipCount[this.relationshipTypes[relationships[id]]]++; - let badgeclass = BDFDB.disCN.badgewrapper; - for (let item of tabitems) switch (BDFDB.getReactValue(item, "return.memoizedProps.id")) { + for (let item of tabitems) switch (BDFDB.getReactValue(item, "return.return.memoizedProps.id")) { case "ALL": - item.appendChild(BDFDB.htmlToElement(`
${relationshipCount.FRIEND}
`)); + item.appendChild(this.createBadge(relationshipCount.FRIEND, "friendcount")); break; case "ONLINE": - item.appendChild(BDFDB.htmlToElement(`
${this.UserMetaStore.getOnlineFriendCount()}
`)); + item.appendChild(this.createBadge(this.UserMetaStore.getOnlineFriendCount(), "onlinefriendcount")); break; case "PENDING": - item.appendChild(BDFDB.htmlToElement(`
${relationshipCount.PENDING_INCOMING}
`)); - item.appendChild(BDFDB.htmlToElement(`
${relationshipCount.PENDING_OUTGOING}
`)); + item.appendChild(this.createBadge(relationshipCount.PENDING_INCOMING, "requestincount")); + item.appendChild(this.createBadge(relationshipCount.PENDING_OUTGOING, "requestoutcount")); break; case "BLOCKED": - item.appendChild(BDFDB.htmlToElement(`
${relationshipCount.BLOCKED}
`)); + item.appendChild(this.createBadge(relationshipCount.BLOCKED, "blockedcount")); break; } } + + createBadge (amount, type) { + return BDFDB.htmlToElement(`
${amount}
`) + } } \ No newline at end of file