User:Miavchik/global.js

// linkParser.js // by Kopcap94 !function( mw, $ ) { if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' )) === -1 ) return; $( ' ', {       id: 'linkParser',        style: 'float: right; margin-bottom: 5px;',        text: 'Parse',        type: 'button'    }) .insertAfter( '.wpSummary_canMinorEdit' ) .on( 'click', function {       var text = $( '#wpTextbox1' ).val,            new_text = text;        $.each( text.match( /(%[A-Za-z0-9]{2}){1,}/g ), function( i, v ) { try { new_text = new_text.replace( v, decodeURIComponent( v ) ); } catch( e ) { console.log( 'There was error ( ' + e + ' ) during attempt to parse this: ' + v ); }       });        $( '#wpTextbox1' ).val( new_text );    }); }( mediaWiki, jQuery );