MediaWiki:Gadget-libJQuery.js

From Moegirlpedia
Revision as of 18:16, 5 September 2022 by 星海-interfacebot (talk | contribs) (跨站同步)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* <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> */