From 09ee48449367cdf3268b0a5c6d0f07dba4f2416a Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Thu, 3 Aug 2023 17:31:16 -0700 Subject: [PATCH] don't highlight if it's a user subpage --- UserHighlighterSimple.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/UserHighlighterSimple.js b/UserHighlighterSimple.js index 84312ba..641af32 100644 --- a/UserHighlighterSimple.js +++ b/UserHighlighterSimple.js @@ -50,6 +50,10 @@ class UserHighlighterSimple { return; } that.user = that.getUserName(); + let isUserSubpage = that.user.includes('/'); + if ( isUserSubpage ) { + return; + } that.hasAdvancedPermissions = false; that.addClassesAndHoverTextToLinkIfNeeded(); // If the user has any advanced perms, they are likely to have a signature, so be aggressive about overriding the background and foreground color. That way there's no risk their signature is unreadable due to background color and foreground color being too similar. Don't do this for users without advanced perms... being able to see a redlinked username is useful. @@ -176,9 +180,9 @@ class UserHighlighterSimple { return ''; } - notInSpecialUserOrUserTalkNamespace() { + notInUserOrUserTalkNamespace() { let namespace = this.titleHelper.getNamespaceId(); - let notInSpecialUserOrUserTalkNamespace = this.$.inArray(namespace, [-1, 2, 3]) === -1; + let notInSpecialUserOrUserTalkNamespace = this.$.inArray(namespace, [2, 3]) === -1; return notInSpecialUserOrUserTalkNamespace; } @@ -218,7 +222,7 @@ class UserHighlighterSimple { let title = this.getTitle(url, urlHelper); this.titleHelper = new mw.Title(title); - if ( this.notInSpecialUserOrUserTalkNamespace() ) { + if ( this.notInUserOrUserTalkNamespace() ) { return false; } @@ -245,10 +249,6 @@ class UserHighlighterSimple { */ getUserName() { var user = this.titleHelper.getMain().replace(/_/g, ' '); - if (this.titleHelper.getNamespaceId() === -1) { - user = user.replace('Contributions/', ''); // For special page "Contributions/" - user = user.replace('Contribs/', ''); // The Contribs abbreviation too - } return user; }