MediaWiki:Gadget-editableRollback.js

$( function { 'use strict';

$( '.mw-rollback-link a' ).click( function( e ) {   e.preventDefault;    var container = $( this ).closest( '.mw-rollback-link' ), userlink = , tmp = ;    if ( $( '.rollback-summary', container ).length ) {        $( '.rollback-summary', container ).toggle;    } else {        var name = '';        $( this ).prop( 'href', function( $, href ) { name = href.match( /&from=([^&]*)&token/ ); name = name[1].replace( /\+/g, ' ' ); } );       if ( name.match( /\d+\.\d+\.\d+\.\d+/ ) ) {            userlink =  + name +         } else {            userlink =  + name +         }

$( this ).after( '   ' ); $( '.rollback-summary', container ).css( { 'position': 'absolute', 'padding': '10px', 'border': '1px solid #CCC', 'background-color': '#F9F9F9', 'left': '182px', 'z-index': '99', 'right': '26px', 'height': '24px' } ); $( '.rollback-summary form', container ).css( 'position', 'relative' ); $( '.rollback-summary span', container ).css( { 'position': 'absolute', 'left': '0px', 'right': '88px', 'top': '1px' } ); $( '.rollback-text', container ).css( 'width', '100%' ).val( 'Reverted edits by ' + userlink + ' (talk) to last revision by $1' ); $( '.rollback-submit-button', container ).css( { 'position': 'absolute', 'right': '0' } ); }   $( '.rollback-summary input:first', container ).focus; tmp = $( '.rollback-summary input:first', container ).val; $( '.rollback-summary input:first', container ).val( '' ).val( tmp ); } );

$( '.rollback-submit-button' ).live( 'click', function {   var container = $( this ).closest( '.mw-rollback-link' ), url = '';    $( 'a', container ).prop( 'href', function { url = this + '&summary=' + $( '.rollback-text', container ).val; } );     window.location = url; } );

} );