Jump to content

User:Dvyjones/MWJS/init.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.
//<nowiki>
// Load prototype.js
googleJavaScriptAPI = document.createElement('script');
googleJavaScriptAPI.setAttribute('src','http://www.google.com/jsapi');
document.getElementsByTagName( 'head' )[0].appendChild( googleJavaScriptAPI );
loadPrototype = document.createElement('script');
loadPrototype.setAttribute('type','text/javascript');
loadPrototypeNode = document.createTextNode('// Load prototype\ngoogle.load("prototype", "1.6.0.2");');
loadPrototype.appendChild(loadPrototypeNode);
document.getElementsByTagName( 'head' )[0].appendChild( loadPrototype );

// Create the MWJS class, and append it to the head for easy use
//loadMWJS = document.createElement('script');
//loadMWJS.setAttribute('type','text/javascript');
//loadMWJSNode = document.createTextNode('var mwjs = Class.create({
//    load: function(module) {
//        loadModule = document.createElement(\'script\');
//        loadModule.setAttribute(\'src\', wgScriptPath + \'/index.php?title=\' + encodeURIComponent(\'User:Dvyjones/MWJS/\' + module.replace(/ /g, \'_\') + \'.js\') + \'&action=raw&ctype=text/javascript\');
//        document.getElementsByTagName( 'head' )[0].appendChild( loadModule );
//    }
//});');
//loadMWJS.appendChild(loadMWJSNode);
//document.getElementsByTagName( 'head' )[0].appendChild( loadMWJS );

//</nowiki>