From 55632e1d5815e5cbbfb2c7b61a82e91108a94ed5 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sat, 29 May 2021 15:04:58 +0200 Subject: [PATCH] stuff --- Library/0BDFDB.plugin.js | 4 ++++ Plugins/CharCounter/CharCounter.plugin.js | 22 +++++++++++----------- Themes/_res/UsrBgs.css | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 4b2eab4bc5..8dff40ad6f 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -7877,6 +7877,10 @@ module.exports = (_ => { }; InternalBDFDB._processUserInfoNode = function (user, wrapper) { if (!user || !wrapper) return; + LibraryModules.ImageEditUtils.getPrimaryColorForAvatar(BDFDB.UserUtils.getAvatar(user.id)).then(color => { + const rgb = BDFDB.ColorUtils.convert(color, "RGB"); + if (rgb) wrapper.style.setProperty("--user-banner-color", rgb, "important"); + }); if (InternalData.UserBackgrounds[user.id]) for (let property in InternalData.UserBackgrounds[user.id]) wrapper.style.setProperty(property, InternalData.UserBackgrounds[user.id][property], "important"); }; InternalBDFDB.processMessageHeader = function (e) { diff --git a/Plugins/CharCounter/CharCounter.plugin.js b/Plugins/CharCounter/CharCounter.plugin.js index 7e33db987e..c2a31eb18b 100644 --- a/Plugins/CharCounter/CharCounter.plugin.js +++ b/Plugins/CharCounter/CharCounter.plugin.js @@ -2,7 +2,7 @@ * @name CharCounter * @author DevilBro * @authorId 278543574059057154 - * @version 1.5.0 + * @version 1.5.1 * @description Adds a Character Counter to most Inputs * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,12 +17,12 @@ module.exports = (_ => { "info": { "name": "CharCounter", "author": "DevilBro", - "version": "1.5.0", + "version": "1.5.1", "description": "Adds a Character Counter to most Inputs" }, "changeLog": { "fixed": { - "Message Input": "Works again for the message textarea" + "Change Nick": "Counter gets added again" } } }; @@ -85,7 +85,7 @@ module.exports = (_ => { after: { ChannelTextAreaContainer: "render", Note: "render", - ChangeNickname: "default", + ChangeIdentity: "default", CustomStatusModal: "render" } }; @@ -114,7 +114,7 @@ module.exports = (_ => { bottom: -1.0em; } ${BDFDB.dotCN._charcounternickcounter} { - right: 0 !important; + right: 8px !important; top: 0 !important; } ${BDFDB.dotCN._charcountercustomstatuscounter} { @@ -158,12 +158,12 @@ module.exports = (_ => { if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.usernotepopout) > -1 ? "popoutnote" : "profilenote", "textarea"); } - processChangeNickname (e) { - let formItem = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "FormItem"}); - if (formItem) { - let [children, index] = BDFDB.ReactUtils.findParent(formItem, {name: "TextInput"}); - if (index > -1) this.injectCounter(formItem, children, "nick", BDFDB.dotCN.input); - } + processChangeIdentity (e) { + let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: c => c && c.props && c.props.setNickname}); + if (index > -1) children.unshift(BDFDB.ReactUtils.createElement("div", { + className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.charcounter, BDFDB.disCN._charcountercounter, BDFDB.disCN._charcounternickcounter), + children: `${(children[index].props.nickname || "").length}/${maxLenghts.nick}` + })); } processCustomStatusModal (e) { diff --git a/Themes/_res/UsrBgs.css b/Themes/_res/UsrBgs.css index 22dcfc95ec..e145f2b516 100644 --- a/Themes/_res/UsrBgs.css +++ b/Themes/_res/UsrBgs.css @@ -85,7 +85,7 @@ content: ""; position: relative; display: block; - background: var(--user-background, var(--background-secondary)) var(--user-popout-position, center)/cover no-repeat; + background: var(--user-background, var(--user-banner-color, var(--background-secondary))) var(--user-popout-position, center)/cover no-repeat; top: 0; width: 100%; height: 120px;