User:Sekidoki/Scripts/FileUploadWizard-loader.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// <nowiki>
/* Install on User:Sekidoki/Scripts/FileUploadWizard-loader.js. */
(function () {
'use strict';
const page = String(mw.config.get('wgPageName')).replace(/_/g, ' ');
if (page !== 'Template:Upload Wizard Page' || mw.config.get('wgAction') !== 'view' || new URLSearchParams(location.search).get('fuwdev') !== '1') return;
if (window.fuwDevLoading) return;
window.fuwDevLoading = true;
mw.loader.using(['mediawiki.util', 'mediawiki.api']).then(function () {
const raw = (name, type) => mw.util.getUrl('User:Sekidoki/Scripts/' + name, { action: 'raw', ctype: type });
mw.loader.load(raw('FileUploadWizard-dev.css', 'text/css'), 'text/css');
// The interface reads its text from i18n and its rules from core, so both load first.
return mw.loader.getScript(raw('FileUploadWizard-i18n.js', 'text/javascript')).then(function () {
return mw.loader.getScript(raw('FileUploadWizard-core.js', 'text/javascript'));
}).then(function () {
return mw.loader.getScript(raw('FileUploadWizard-dev.js', 'text/javascript'));
});
}).catch(function () {
window.fuwDevLoading = false;
const root = document.getElementById('fuw-dev-root');
if (root) {
const message = document.createElement('p');
message.setAttribute('role', 'alert');
message.textContent = '上傳精靈載入失敗/上传向导加载失败。請重新整理頁面/请刷新页面。';
root.appendChild(message);
}
});
}());
// </nowiki>