User:Enterprisey/rename-reason-fixer.js

$( function {    $( "a[href^='https://meta.wikimedia.org/w/index.php'][href*='title=Special:GlobalRenameUser']" ).each( function ( index ) { var oldUrl = decodeURI( $( this ).attr( "href" ) ); var serverName = mw.config.get( "wgServerName" ); var newUrl = oldUrl.replace( /\[\[.+?\|/g, "[[:m:" +           ( serverName === "meta.wikimedia.org" ? "" :                mw.config.get( "wgServerName" ).split( "." )[1] + ":" +                mw.config.get( "wgServerName" ).split( "." )[0] + ":" ) +            "Special:Permalink/" + mw.config.get( "wgRevisionId" ) + "|" );        $( this ).attr( "href", encodeURI( newUrl ) );    } ); } );