User:Username/BlockAbuser.js: Difference between revisions

From Test Wiki
Content deleted Content added
edit
No edit summary
Line 25: Line 25:
return;
return;
}
}

const username = decodeURIComponent(
href.split( '/wiki/User:' )[1]
).replace( /_/g, ' ' );

// Skip IPs
if ( ipRegex.test( username ) ) {
return;
}

// Only one checkbox per user
if ( seenUsers.has( username ) ) {
return;
}
seenUsers.add( username );

// Create checkbox
const $checkbox = $( '<input>' )
.attr( {
type: 'checkbox',
'data-username': username
} )
.css( {
marginRight: '4px',
verticalAlign: 'middle'
} );

// Insert checkbox before the username link
$link.before( $checkbox );
} );

} );