User:Inductiveload/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// Load local dev script if available, or fall back to an on-wiki version
window.inductiveload = {};
window.inductiveload.localhost = 'https://localhost:5555';
mw.loader.getScript(window.inductiveload.localhost + '/commons/common.js')
    .then(function () {
    	console.log("Local Common.js script loaded");
    }, function (e) {
        // Script failed. X is not available
        mw.log.error("Local Common.js script failed to load - falling back to on-wiki version");
        mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Inductiveload/common-fallback.js&action=raw&ctype=text/javascript');
    });