Jump to content

User:Qwerfjkl/scripts/RETF.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/RETF.js&action=raw&ctype=text/javascript');
// <nowiki>
// Make sure the utilities module is loaded (will only load if not already)
mw.loader.using( 'mediawiki.util', function () {

    // Wait for the page to be parsed
    $( document ).ready( function () { 

if (document.editform) {
        var link = mw.util.addPortletLink( 'p-tb', '#', 'RegExTypoFix', 'ca-regExTypoFix', 'Fix typos'); 
        $( link ).click( function ( event ) {
            event.preventDefault();
            doFixTyposRETF();

        } );
        }
    } );
} );
function doFixTyposRETF() {
    document.editform.wpTextbox1.value = RETF.replace(document.editform.wpTextbox1.value);
    document.editform.wpSummary.value = "Fixed typos via [[User:Qwerfjkl/scripts/RETF.js|script]]";
    //document.editform.submit();
    document.editform.wpDiff.click()
}
// </nowiki>