MediaWiki:Gadget-editableRollback.js

$( function { 'use strict';

$( '.mw-rollback-link a' ).click( function( e ) {   var container = $( this ).closest( '.mw-rollback-link' ), tmp;    e.preventDefault;    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, ' ' ); } );       $( this ).after( ' ' +               '  ' + '' + ' '       );        // Style rollback form        $( '.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-submit-button', container ).css( { 'position': 'absolute', 'right': '0' } );        // Default rollback text        $( '.rollback-text', container ).css( 'width', '100%' )            .val( 'Reverted edits by ' + name + ' (talk) to last revision by $1' );    }    // This puts the cursor at the end of the text    $( '.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' );    window.location = $( 'a', container ).prop( 'href' ) + '&summary=' + $( '.rollback-text', container ).val; } );

} );