Skip to content

Commit

Permalink
MarkBlocked: add line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Jul 2, 2024
1 parent 42c258f commit 800cabb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Gadget-markblocked.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ Configuration variables:
if ( $( link ).is( '.mw-changeslist-date, .ext-discussiontools-init-timestamplink, .mw-history-undo > a, .mw-rollback-link > a' ) ) {
return;
}

url = $( link ).attr( 'href' );
if ( !url ) {
return;
}

const articleMatch = articleRegex.exec( url ),
scriptMatch = scriptRegex.exec( url );
if ( articleMatch ) {
Expand All @@ -112,19 +114,24 @@ Configuration variables:
return;
}
pageTitle = decodeURIComponent( pageTitle ).replace( /_/g, ' ' );

user = userTitleRegex.exec( pageTitle );
if ( !user ) {
return;
}

const userTitle = mw.Title.newFromText( user[ 2 ] );
if ( !userTitle ) {
return;
}

user = userTitle.getMainText();
if ( ipv6Regex.test( user ) ) {
user = user.toUpperCase();
}

$( link ).addClass( 'userlink' );

if ( !userLinks[ user ] ) {
userLinks[ user ] = [];
}
Expand Down

0 comments on commit 800cabb

Please sign in to comment.