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.

// <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', '#', 'Install scriptManager', 'ca-install scriptManager', 'Attempt to convert scripts to scriptManager'); 

        $( link ).click( function ( event ) {

            event.preventDefault();

            doScriptManager();



        } );

        }

    } );

} );

function doScriptManager() {	

        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/(?<!\/\/)importScript\([\'\"](.+)[\'\"]\)(.+\]\])/g, "//importScript('$1'); // Backlink: [[$1]]\n  \"$1\"  : \n\"//en.wikipedia.org/?action=raw&ctype=text/javascript&title=$1\",");

        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/(?<!\/\/)mw\.loader\.load\(\'(.+(User\:.+\.js).+)\'\)\;? ?(.+\]\] ?)?/g, "//mw.loader.load('$1');$3\n  \"$2\"  : \n\"//en.wikipedia.org/?action=raw&ctype=text/javascript&title=$2\",");

	    document.editform.wpTextbox1.value = "importScript('User:MusikAnimal/scriptManager.js'); // Backlink: [[User:MusikAnimal/scriptManager.js]]\nscriptsToManage = {\n" + document.editform.wpTextbox1.value + "\n}";

    document.editform.wpSummary.value = "Attempted to install [[User:MusikAnimal/scriptManager]] and convert scripts.";

    document.editform.submit();

}

// </nowiki>