MediaWiki:Gadget-libOOUIDialog.js
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
// <pre> "use strict"; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; (function () { var running = false; var resArray = []; var sizes = ["small", "medium", "large", "larger"]; window.oouiDialog = Object.fromEntries(["alert", "confirm", "prompt"].map(function (method) { return [method, function (text_jQuery, _option) { var option = $.isPlainObject(_option) ? _option : {}; var textInput = $.extend({ autocomplete: false }, $.isPlainObject(option.textInput) ? option.textInput : {}); if (textInput.required || option.required) { textInput.required = true; if (!("indicator" in textInput)) { textInput.indicator = "required"; } if (!("validate" in textInput)) { textInput.validate = "not-empty"; } } var size; if (option.allowFullscreen !== true) { var rect = OO.ui.Element.static.getDimensions(window).rect; var windowWidth_1 = rect.right - rect.left; var acceptableSize = sizes.filter(function (s) { return OO.ui.WindowManager.static.sizes[s].width < windowWidth_1; }); size = sizes.includes(option.size) ? acceptableSize.length > 0 ? acceptableSize.includes(option.size) ? option.size : acceptableSize[acceptableSize.length - 1] : "small" : "small"; } else { size = __spreadArray(__spreadArray([], sizes, true), ["full"], false).includes(option.size) ? option.size : "small"; } return new Promise(function (res) { if (running) { resArray.push(res); } else { running = true; res(); } }).then(function () { return OO.ui[method](text_jQuery instanceof $ ? text_jQuery : $("<p>").html(text_jQuery), $.extend({ title: "萌娘百科提醒您" }, option, { size: size, textInput: textInput })); })["catch"](function (e) { if (resArray.length > 0) { resArray.shift()(); } else { running = false; } throw e; }).then(function (result) { if (resArray.length > 0) { resArray.shift()(); } else { running = false; } return result; }); }]; })); var sanity = $("<span>"); window.oouiDialog.sanitize = function (text) { return sanity.text(text).html(); }; })(); // </pre>