MediaWiki:Gadget-botRollback.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/**
* This is an on-site JS hack to add a button marking a rollback as a bot edit.
* and visit a page history.
* @author MarkTraceur, 2014
*/
( function ( $, mw ) {
var $rollbackLinks = $( '.mw-rollback-link' ),
isHistory = $( 'body' ).hasClass( 'action-history' );
$rollbackLinks.each( function ( i, link ) {
var $span = $( link ),
$link = $span.find( 'a' ),
$botLink = $( '<a>' )
.prop( 'href', $link.prop( 'href' ) + '&bot=1' )
.prop( 'title', 'Rollback and mark as bot' )
.text( 'br' ),
$botSpan = $( '<span>' )
.addClass( 'mw-bot-rollback-link' )
.append( $botLink );
$span.after( $botSpan );
if ( isHistory ) {
$span.after( ' | ' );
} else {
$span.after( ' ' );
$botSpan.prepend( '[' );
$botSpan.append( ']' );
}
} );
}( jQuery, mediaWiki ) );