Jump to content

User:Enterprisey/merge-helper.js

From Wikipedia!

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.
//<nowiki>
( function ( $, mw ) {
    const TRIGGER_PAGE = "User:APerson/merge-helper.js";
    
    if ( mw.config.get( "wgPageName" ) !== TRIGGER_PAGE ) return;
    
    $( "#jump-to-nav" ).after( $( "<pre>" )
                    .attr( "id", "merge-helper" )
                    .css( "border", "thin solid #c5c5c5" )
                    .css( "padding", "5px" ) );
    
    $.getJSON(
            mw.util.wikiScript('api'),
            {
                format: 'json',
                action: 'query',
                list: 'usercontribs',
                ucuser: mw.config.get( "wgUserName" ),
                uclimit: 50,
                ucprop: "title|comment|sizediff",
                ucnamespace: "0|1"
            }
        ).done( function ( data ) {
            var contribs = data.query.usercontribs;
            contribs = contribs.filter( function ( contrib ) { return /[Mm]erge/.test( contrib.comment ); } );
            $( "#merge-helper" ).text( JSON.stringify( contribs ) );
        } );
}( jQuery, mediaWiki ) );
//</nowiki>