This commit is contained in:
Mirco Wittrien 2021-05-13 21:18:23 +02:00
parent 84f3d1757e
commit 8306d9557f
3 changed files with 68 additions and 67 deletions

View File

@ -2,7 +2,7 @@
* @name BetterFriendList
* @author DevilBro
* @authorId 278543574059057154
* @version 1.3.2
* @version 1.3.3
* @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": {
"name": "BetterFriendList",
"author": "DevilBro",
"version": "1.3.2",
"version": "1.3.3",
"description": "Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount"
},
"changeLog": {
"fixed": {
"Mutual Guilds": "Visible again"
"Changed Style": ""
}
}
};
@ -66,7 +66,6 @@ module.exports = (_ => {
}
} : (([Plugin, BDFDB]) => {
var rerenderTimeout, sortKey, sortReversed, searchQuery, searchTimeout;
var settings = {};
const placeHolderId = "PLACEHOLDER_BETTERFRIENDLIST";
@ -83,11 +82,11 @@ module.exports = (_ => {
return class BetterFriendList extends Plugin {
onLoad () {
this.defaults = {
settings: {
addTotalAmount: {value: true, description: "Add total amount for all/requested/blocked"},
addSortOptions: {value: true, description: "Add sort options"},
addSearchbar: {value: true, description: "Add searchbar"},
addMutualGuild: {value: true, description: "Add mutual servers in friend list"}
general: {
addTotalAmount: {value: true, description: "Add total Amount for All/Requested/Blocked"},
addSortOptions: {value: true, description: "Add Sort Options"},
addSearchbar: {value: true, description: "Add a Searchbar"},
addMutualGuild: {value: true, description: "Add mutual Servers in Friend List"}
}
};
@ -140,17 +139,23 @@ module.exports = (_ => {
}
getSettingsPanel (collapseStates = {}) {
let settingsPanel, settingsItems = [];
let settingsPanel;
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
collapseStates: collapseStates,
children: _ => {
let settingsItems = [];
for (let key in settings) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["settings", key],
label: this.defaults.settings[key].description,
value: settings[key]
}));
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
for (let key in this.defaults.general) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["general", key],
label: this.defaults.general[key].description,
value: this.settings.general[key]
}));
return settingsItems;
}
});
}
onSettingsClosed () {
@ -161,14 +166,12 @@ module.exports = (_ => {
}
forceUpdateAll () {
settings = BDFDB.DataUtils.get(this, "settings");
BDFDB.PatchUtils.forceAllUpdates(this);
this.rerenderList();
}
processTabBar (e) {
if (settings.addTotalAmount && e.returnvalue.props.children) for (let checkChild of e.returnvalue.props.children) if (checkChild && checkChild.props.id == "ADD_FRIEND") {
if (this.settings.general.addTotalAmount && e.returnvalue.props.children) for (let checkChild of e.returnvalue.props.children) if (checkChild && checkChild.props.id == "ADD_FRIEND") {
let relationships = BDFDB.LibraryModules.RelationshipStore.getRelationships(), relationshipCount = {};
for (let type in BDFDB.DiscordConstants.RelationshipTypes) relationshipCount[type] = 0;
for (let id in relationships) relationshipCount[relationships[id]]++;
@ -182,7 +185,7 @@ module.exports = (_ => {
newChildren.push(this.createBadge(BDFDB.LibraryModules.StatusMetaUtils.getOnlineFriendCount()));
break;
case "PENDING":
newChildren.push(this.createBadge(relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_INCOMING], this.labels.incoming));
newChildren.push(this.createBadge(relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_INCOMING], this.labels.incoming, relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_INCOMING] > 0 && BDFDB.DiscordConstants.Colors.STATUS_RED));
newChildren.push(this.createBadge(relationshipCount[BDFDB.DiscordConstants.RelationshipTypes.PENDING_OUTGOING], this.labels.outgoing));
break;
case "BLOCKED":
@ -238,7 +241,7 @@ module.exports = (_ => {
className: BDFDB.disCN._betterfriendlisttitle,
children: e2.returnValue.replace(users.length, users.filter(u => u && u.key != placeHolderId).length)
}),
settings.addSortOptions && [
this.settings.general.addSortOptions && [
{key: "usernameLower", label: BDFDB.LanguageUtils.LanguageStrings.FRIENDS_COLUMN_NAME},
{key: "statusIndex", label: BDFDB.LanguageUtils.LanguageStrings.FRIENDS_COLUMN_STATUS}
].filter(n => n).map(data => BDFDB.ReactUtils.createElement("div", {
@ -268,7 +271,7 @@ module.exports = (_ => {
this.rerenderList();
}
})),
settings.addSearchbar && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
this.settings.general.addSearchbar && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
query: searchQuery,
onChange: value => {
@ -313,7 +316,7 @@ module.exports = (_ => {
}
else {
if (e.instance.props.user.id == placeHolderId) return null;
else if (settings.addMutualGuild && e.instance.props.mutualGuilds && e.instance.props.mutualGuilds.length) {
else if (this.settings.general.addMutualGuild && e.instance.props.mutualGuilds && e.instance.props.mutualGuilds.length) {
if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = (...args) => {
@ -337,10 +340,11 @@ module.exports = (_ => {
}, true));
}
createBadge (amount, text) {
createBadge (amount, text, color) {
let badge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, {
className: BDFDB.disCN.peoplesbadge,
count: amount,
color: color || BDFDB.DiscordConstants.Colors.PRIMARY_DARK,
style: {marginLeft: 6}
});
return text ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {

View File

@ -167,16 +167,15 @@
18. PLUGINSUPPORT
1. BDFDB
2. DATEVIEWER
3. SERVERFOLDERS
4. MEMBERCOUNT
5. LINENUMBERS
6. PERMISSIONVIEWER
7. DIRECTDOWNLOAD
8. BETTERFORMATINGREDUX
9. CHANNELHISTORY
10. CHANNELTABS
11. TYPINGINDICATOR
12. BADGESEVERYWHERE
3. MEMBERCOUNT
4. LINENUMBERS
5. PERMISSIONVIEWER
6. DIRECTDOWNLOAD
7. BETTERFORMATINGREDUX
8. CHANNELHISTORY
9. CHANNELTABS
10. TYPINGINDICATOR
11. BADGESEVERYWHERE
19. UPDATENOTICE
20. WATERMARK
*/
@ -6035,7 +6034,6 @@ img[src="/assets/cef02719c12d8aaf38894c16dca7fbe6.svg"] { /* rolesettings addr
z-index: -1;
}
/* ---- 15.4. SEARCHBARS ---- */
.container-2XeR5Z, /* searchbar inner */
@ -6066,6 +6064,12 @@ img[src="/assets/cef02719c12d8aaf38894c16dca7fbe6.svg"] { /* rolesettings addr
filter: drop-shadow(1px 1px var(--textshadow));
}
.base-PmTxvP[style*="var(--bdfdb-blurple)"], /* numberbadge */
.base-PmTxvP[style*="background-color: rgb(88, 101, 242)"],
.base-PmTxvP[style*="background-color: rgb(114, 137, 218)"] {
text-shadow: 1px 1px var(--textshadow);
}
.iconBadge-2wi9r4 { /* iconbadge */
background-color: rgba(var(--transparencycolor), .3);
}
@ -6447,13 +6451,7 @@ html .colorDefault-XdNdIp .bg-8df5St {
opacity: 1;
}
/* ---- 18.3. SERVERFOLDERS ---- */
.base-PmTxvP[style*="var(--bdfdb-blurple)"] {
text-shadow: 1px 1px var(--textshadow);
}
/* ---- 18.4. MEMBERCOUNT ---- */
/* ---- 18.3. MEMBERCOUNT ---- */
#app-mount #MemberCount {
background-color: transparent;
@ -6482,7 +6480,7 @@ html .colorDefault-XdNdIp .bg-8df5St {
filter: blur(var(--backgroundblur));
}
/* ---- 18.5. LINENUMBERS ---- */
/* ---- 18.4. LINENUMBERS ---- */
.hljs ol li {
border-left-color: var(--background-modifier-accent);
@ -6491,7 +6489,7 @@ html .colorDefault-XdNdIp .bg-8df5St {
color: rgb(var(--textdarker));
}
/* ---- 18.6. PERMISSIONVIEWER ---- */
/* ---- 18.5. PERMISSIONVIEWER ---- */
#permissions-modal-wrapper #permissions-modal { /* modal container */
background-color: transparent;
@ -6561,7 +6559,7 @@ html .colorDefault-XdNdIp .bg-8df5St {
color: var(--header-secondary);
}
/* ---- 18.7. DIRECTDOWNLOAD ---- */
/* ---- 18.6. DIRECTDOWNLOAD ---- */
#files_directDownload .file {
background-color: rgba(var(--transparencycolor), .4);
@ -6582,7 +6580,7 @@ html .colorDefault-XdNdIp .bg-8df5St {
background-color: rgb(var(--accentcolor));
}
/* ---- 18.8. BETTERFORMATINGREDUX ---- */
/* ---- 18.7. BETTERFORMATINGREDUX ---- */
.innerDisabled-2mc-iF ~ .bf-toolbar {
display: none;
@ -6640,14 +6638,14 @@ html .colorDefault-XdNdIp .bg-8df5St {
color: #fff;
}
/* ---- 18.9 CHANNELHISTORY ---- */
/* ---- 18.8 CHANNELHISTORY ---- */
.channelHistoryButtons {
top: 4px;
left: 310px;
}
/* ---- 18.10 CHANNELTABS ---- */
/* ---- 18.9 CHANNELTABS ---- */
html .channelTabs-tabContainer,
html .channelTabs-favContainer {
@ -6758,7 +6756,7 @@ html .channelTabs-newTab:hover {
color: var(--interactive-active);
}
/* ---- 18.11 TYPINGINDICATOR ---- */
/* ---- 18.10 TYPINGINDICATOR ---- */
html .typingindicator-guild,
html .typingindicator-dms,
@ -6771,7 +6769,7 @@ html .typingindicator-folder {
padding: 2px 0;
}
/* ---- 18.12 BADGESEVERYWHERE ---- */
/* ---- 18.11 BADGESEVERYWHERE ---- */
.inner-dA0J42:not(.colored-1armap) .badge-7CsdQq:not(.indicator-cY1-b4) {
background: #fff;

View File

@ -129,11 +129,10 @@ html.oldBrand, html.newBrand {
13. BDSUPPORT
14. POWERCORDSUPPORT
15. PLUGINSUPPORT
1. IMAGEZOOM
2. HIDEUTILS
3. READALLNOTIFICATIONSBUTTON
4. SERVERSEARCH
5. CHANNELTABS
1. HIDEUTILS
2. READALLNOTIFICATIONSBUTTON
3. SERVERSEARCH
4. CHANNELTABS
*/
@ -2053,6 +2052,11 @@ html.oldBrand, html.newBrand {
filter: brightness(75%);
}
.base-PmTxvP[style*="background-color: rgb(88, 101, 242)"],
.base-PmTxvP[style*="background-color: rgb(114, 137, 218)"] {
background-color: rgb(var(--accentcolor)) !important;
}
/* ---- 12.5. ICONS ---- */
[style*="/assets/f78426a064bc9dd24847519259bc42af.png"],
@ -2422,25 +2426,20 @@ html .powercord-updater .debug-info b {
/* ~~~~ 15. PLUGINSUPPORT ~~~~ */
/* ---- 15.1. IMAGEZOOM ---- */
.zoomLens-uOK8xV {
border-color: rgb(var(--accentcolor)) !important;
}
/* ---- 15.2. HIDEUTILS ---- */
/* ---- 15.1. HIDEUTILS ---- */
#HideUtils-Settings button {
background-color: rgb(var(--accentcolor)) !important;
}
/* ---- 15.3. READALLNOTIFICATIONSBUTTON ---- */
/* ---- 15.2. READALLNOTIFICATIONSBUTTON ---- */
.wrapper-1BJsBx:active .childWrapper-anI2G9.button-Jt-tIg {
background: var(--accentcolor-hover);
}
/* ---- 15.4. SERVERSEARCH ---- */
/* ---- 15.3. SERVERSEARCH ---- */
#server-search .wrapper-25eVIn {
background-color: rgb(47, 49, 54) !important;
@ -2450,7 +2449,7 @@ html .powercord-updater .debug-info b {
background-color: rgb(var(--accentcolor)) !important;
}
/* ---- 15.5. CHANNELTABS ---- */
/* ---- 15.4. CHANNELTABS ---- */
.channelTabs-unreadBadge:not(.channelTabs-noUnread) {
background-color: rgb(var(--accentcolor)) !important;