Jump to content

User:Qwerfjkl/scripts/RETF.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Qwerfjkl (talk | contribs) at 18:11, 14 September 2021. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:Joeytje50/RETF.js'); //backlink: [[User:Joeytje50/RETF.js]]
RETF.replace(text);

// <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();
            doFixTyposREGTF();

        } );
        }
    } );
} );
function doFixTyposREGTF() {
	RETF.load();
    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();
}
// </nowiki>
// [[Category:Wikipedia scripts]]