Jump to content

User:Catrope/vector.js

From mediawiki.org

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
window.checkedRevs = function( prefix, separator ) {
    if ( prefix === undefined ) {
        prefix = 'r';
    }
    if ( separator === undefined ) {
        separator =  ', ';
    }
    var s = [];
    jQuery( '.TablePager_col_selectforchange input:checked' ).each( function() {
        s.push( prefix + jQuery( this ).val() );
    } );
    return s.reverse().join(separator);
}

window.checkedRevs_gui = function() {
    var prefix = prompt( 'checkedRevs prefix', 'r' ),
        separator =  prompt( 'checkedRevs separator', ', ' ),
        s = [];
    jQuery( '.TablePager_col_selectforchange input:checked' ).each( function() {
        s.push( prefix + jQuery( this ).val() );
    } );
    prompt( 'checkedRevs return', s.reverse().join(separator) );
}

$(function() {
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Code' ) {
    $( '.TablePager_nav' ).next( 'table' ).find( 'td:last' ).append(
            $('<input type="submit" value="Checked Revs" />' ).click( window.checkedRevs_gui )
    );
}
} );