User:Liangent/Gadgets/Toolkit/main.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
if (window.require === undefined) {
(function($) {
var scripts = {'': null};
window.require = function(files, callback) { // or load anything, eg. css?
if (!$.isArray(files)) files = [files];
if (!$.isFunction(callback)) callback = function() {};
if (files.length != 0) {
if (files[0].data === undefined) files[0] = {data: new String(files[0])};
// so data is always ok now.
if (files[0].src === undefined) files[0].src = 'lib';
if (files[0].src == 'lib') {
files[0].src = 'wiki';
var dataLocation = {
morebits: 'User:Jimmy_xu_wrk/Friendly/morebits.js',
mediawiki: 'User:Liangent/Scripts/Libraries/MediaWiki.js',
jqueryui: 'User:Liangent/Scripts/Libraries/jquery-ui.min.js',
jquery_cookie: 'User:Liangent/Scripts/Libraries/jquery.cookie.min.js',
jquery: ''
}[files[0].data];
if (dataLocation === undefined) throw files[0].data + ' cannot be found';
files[0].data = dataLocation;
}
if (files[0].src == 'wiki') {
files[0].src = 'uri';
if (files[0].data.length != 0) {
files[0].data = wgScript + '?title=' + encodeURIComponent(files[0].data) + '&action=raw&ctype=text/javascript';
}
}
if (files[0].src == 'uri' || files[0].src == 'url') {
var ready = function() {
window.require(files.slice(1), callback);
};
if (scripts[files[0].data] === undefined) {
scripts[files[0].data] = [ready];
$.getScript(files[0].data, function() {
var callbacks = scripts[files[0].data];
// must do this first. because we have already loaded the script,
// new functions pushed into callbacks in callback() will be never executed.
// setting scripts[files[0].data] to null stops functions from being
// added to callbacks.
scripts[files[0].data] = null;
$.each(callbacks, function() {
this();
});
});
} else if ($.isArray(scripts[files[0].data])) {
scripts[files[0].data].push(ready);
} else {
ready();
}
} else {
throw files[0].src + ' is unsupported';
}
} else {
callback();
}
};
})(jQuery);
}
require([
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/patrol.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/clock.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/afd.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/ifd.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/onlinestatus.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/wordcount.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/uiimprove.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/linktranslator.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/poke.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/developer.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/deepcopy.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/summaryabbr.js'},
{src: 'wiki', data: 'User:Liangent/Gadgets/Toolkit/historyug.js'}
]);
// importing from google js api causes some strange problems
//importScript('User:Liangent/Gadgets/Toolkit/ajaxsearch.js');