User:Liangent/Scripts/scriptloader.js
< User:Liangent | Scripts
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
(function($) {
var loadedTracker = {};
window.require = function(files, callback) { // or load anything, eg. css?
if (!$.isArray(files)) files = [files];
if (files.length != 0) {
if (files[0].src === undefined) src = 'lib';
if (files[0].src == 'lib') {
files[0].src = 'wiki';
files[0].data = {
morebits: 'User:Jimmy_xu_wrk/Friendly/morebits.js',
mediawiki: 'User:Liangent/Scripts/Libraries/MediaWiki.js',
jqueryui: 'User:Liangent/Scripts/Libraries/jquery-ui.min.js'
}[files[0].data];
}
if (files[0].data === undefined) throw 'No data supplied';
if (files[0].src == 'wiki') {
files[0].src = 'url';
files[0].data = wgScript + "?title=" + encodeURIComponent(files[0].data) + "&action=raw&ctype=text/javascript";
}
if (files[0].src == 'url') {
var ready = function() {
window.require(files.slice(1), callback);
};
if (loadedTracker[files[0].src] === undefined) {
loadedTracker[files[0].src] = true;
$.getScript(files[0].data, ready);
} else {
ready();
}
} else {
throw files[0].src + ' is unsupported';
}
} else {
callback();
}
};
})(jQuery);