MediaWiki:Gadget-libJQuery.js

来自萌娘文库
星海-interfacebot讨论 | 贡献2022年9月6日 (二) 01:53的版本 (跨站同步)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
/* <pre> */
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libJQuery/MediaWiki:Gadget-libJQuery.js|user=[[U:AnnAngela]]|longId=933a60a3ea0382fd227141260c3225a488af0ca3|shortId=933a60a|message=chore: Add track field}}';

"use strict";
(function ($, mw) {
    $.extend({
        createIcon: function (iconClass) {
            return $("<span>", {
                "class": "ui-icon ".concat(iconClass, " jquery-inline-icon"),
                text: " "
            });
        },
        createNotifyArea: function (textNode, icon, state) {
            return $("<div>", {
                "class": "ui-widget"
            }).append($("<div>", {
                "class": "".concat(state, " ui-corner-all"),
                style: "margin-top:20px; padding:0.7em;"
            }).append($("<p>").append($.createIcon(icon).css("margin-right", ".3em"), textNode)));
        },
        ucFirst: function (str) {
            return str.charAt(0).toUpperCase() + str.slice(1);
        }
    });
    mw.messages.set({
        "libjq-cancel-title": "关闭该对话框 [Esc]",
        "libjq-proceed-title": "在单行输入框内按下回车键",
        "libjq-report-title": "报告错误以改进本工具"
    });
    var buttonConfig = {
        proceed: {
            icon: "ui-icon-circle-check",
            "class": "ui-button-green",
            title: "libjq-proceed-title"
        },
        cancel: {
            icon: "ui-icon-circle-close",
            "class": "ui-button-red",
            title: "libjq-cancel-title"
        },
        report: {
            icon: "ui-icon-circle-check",
            "class": "",
            title: "libjq-report-title"
        }
    };
    $.extend($.fn, {
        specialButton: function (which) {
            return this.button({
                icons: {
                    primary: buttonConfig[which].icon
                }
            }).addClass(buttonConfig[which]["class"]).attr("title", mw.msg(buttonConfig[which].title));
        },
        _jqInteraction: function () {
            var _this = this;
            return this.on({
                mouseenter: function () {
                    _this.addClass("ui-state-hover");
                },
                mouseleave: function () {
                    _this.removeClass("ui-state-hover").removeClass("ui-state-active");
                }
            }).on("focusin", function () {
                _this.addClass("ui-state-focus");
            }).on("focusout", function () {
                _this.removeClass("ui-state-focus");
            }).on("mousedown", function (e) {
                if (0 === e.originalEvent.button) {
                    _this.addClass("ui-state-active");
                }
            }).on("mouseup", function () {
                _this.removeClass("ui-state-active");
            });
        }
    });
}(jQuery, mediaWiki));

/* </pre> */