MediaWiki:Gadget-botRollback.js
Napomena: Nakon snimanja, trebate očistiti memoriju svog programa za Internet kako biste odmah vidjeli promjene: Mozilla: kliknite reload (ili ctrl-r), IE / Opera: ctrl-f5, Safari: cmd-r, Konqueror ctrl-r.
/**
* 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 ) );