MediaWiki:Gadget-libJQuery.js:修订间差异
跳到导航
跳到搜索
小 (导入1个版本) |
无编辑摘要 |
||
第1行: | 第1行: | ||
"use strict"; | "use strict"; | ||
(function ($, mw) { | (function ($, mw) { | ||
第81行: | 第73行: | ||
}); | }); | ||
}(jQuery, mediaWiki)); | }(jQuery, mediaWiki)); | ||
2024年1月2日 (二) 23:27的最新版本
"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));