From e88cb59b31a10f83ed1db289c30b3a5e3c20a999 Mon Sep 17 00:00:00 2001 From: Bastard Operator Date: Thu, 31 Dec 2020 13:02:22 +0100 Subject: [PATCH] Remove #fedilove on chat and statuses at UI level + some UI improvements --- src/routes/_components/Nav.html | 4 ++-- src/routes/_components/profile/AccountDisplayName.html | 1 + src/scss/themes/ozark.scss | 2 +- static/fedilove-no-react.js | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/routes/_components/Nav.html b/src/routes/_components/Nav.html index 64eb88ea..2726f895 100644 --- a/src/routes/_components/Nav.html +++ b/src/routes/_components/Nav.html @@ -20,8 +20,8 @@ Your possible crush
- ... - - + + -
diff --git a/src/routes/_components/profile/AccountDisplayName.html b/src/routes/_components/profile/AccountDisplayName.html index 62f09cac..a1055079 100644 --- a/src/routes/_components/profile/AccountDisplayName.html +++ b/src/routes/_components/profile/AccountDisplayName.html @@ -17,6 +17,7 @@ accountName: ({ account }) => (account.display_name || account.username), massagedAccountName: ({ accountName, emojis, $autoplayGifs, $omitEmojiInDisplayNames }) => { accountName = escapeHtml(accountName) + accountName = accountName.replace(/#fedilove/gi, '').trim(); if ($omitEmojiInDisplayNames) { // display name emoji are annoying to some screenreader users const emojiFreeDisplayName = removeEmoji(accountName, emojis) diff --git a/src/scss/themes/ozark.scss b/src/scss/themes/ozark.scss index 2485bb86..af02efbb 100644 --- a/src/scss/themes/ozark.scss +++ b/src/scss/themes/ozark.scss @@ -89,7 +89,7 @@ div#chat-party-global { margin: auto 0; color: #000; } - span { + span#acct { margin: auto 0; margin-left: .5em; color: #8a8a8a; diff --git a/static/fedilove-no-react.js b/static/fedilove-no-react.js index 4912a484..e5b0a78a 100644 --- a/static/fedilove-no-react.js +++ b/static/fedilove-no-react.js @@ -95,7 +95,7 @@ var fediloveUI = { // to-do: check is it XSS safe to add it like this :) ?? $('div#chat-party-global > div#image > img').attr('src', avatar); - $('div#chat-party-global > div#name > a').html(name); + $('div#chat-party-global > div#name > a > span').html(name); $('div#chat-party-global > div#name > span').text(acct); if (accid != 0) $('div#chat-party-global > div#name > a').attr('href', `/accounts/${accid}`); } @@ -147,6 +147,8 @@ var fediloveEvents = { return; } if (fediloveData.gotEmojifyTextFunction) { + dname = dname.replace(/#fedilove/gi, '').trim(); + dname = dname.replace(/\s+/g, ' ').trim().replace(/\s/g, ' '); fediloveUI.paintChatAvatarAndName(accid, acct, avatar, fediloveFunctions.emojifyText(dname, emojis)); clearInterval(_this); }