Skip to content

Commit

Permalink
don't highlight if it's a user subpage
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Aug 4, 2023
1 parent 4befd21 commit 09ee484
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions UserHighlighterSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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/<username>"
user = user.replace('Contribs/', ''); // The Contribs abbreviation too
}
return user;
}

Expand Down

0 comments on commit 09ee484

Please sign in to comment.