“MediaWiki:Gadget-libOOUIDialog.js”的版本间的差异

来自萌娘文库
跳转至: 导航搜索
(同步小工具)
1个标签Bot
(跨站同步)
1个标签Bot
 
第1行: 第1行:
// 修改后须同步至 commons library en ja 等全部站点
+
/* <pre> */
// <pre>
+
/**
 +
* -------------------------------------------------------------------------
 +
* !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 +
* -------------------------------------------------------------------------
 +
*/
 +
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libOOUIDialog/MediaWiki:Gadget-libOOUIDialog.js|user=[[U:AnnAngela]]|longId=919932be0afb735fe504f53f5b4df6f83d8c6bd8|shortId=919932b|message=init}}';
 +
 
 
"use strict";
 
"use strict";
 +
var __read = (this && this.__read) || function (o, n) {
 +
    var m = typeof Symbol === "function" && o[Symbol.iterator];
 +
    if (!m) return o;
 +
    var i = m.call(o), r, ar = [], e;
 +
    try {
 +
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
 +
    }
 +
    catch (error) { e = { error: error }; }
 +
    finally {
 +
        try {
 +
            if (r && !r.done && (m = i["return"])) m.call(i);
 +
        }
 +
        finally { if (e) throw e.error; }
 +
    }
 +
    return ar;
 +
};
 
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
 
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 (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
第38行: 第60行:
 
                 }
 
                 }
 
                 else {
 
                 else {
                     size = __spreadArray(__spreadArray([], sizes, true), ["full"], false).includes(option.size) ? option.size : "small";
+
                     size = __spreadArray(__spreadArray([], __read(sizes), false), ["full"], false).includes(option.size) ? option.size : "small";
 
                 }
 
                 }
 
                 return new Promise(function (res) {
 
                 return new Promise(function (res) {
第79行: 第101行:
 
     };
 
     };
 
})();
 
})();
// </pre>
+
 
 +
/* </pre> */

2022年9月6日 (二) 01:53的最新版本

/* <pre> */
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libOOUIDialog/MediaWiki:Gadget-libOOUIDialog.js|user=[[U:AnnAngela]]|longId=919932be0afb735fe504f53f5b4df6f83d8c6bd8|shortId=919932b|message=init}}';

"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
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([], __read(sizes), false), ["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> */