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

来自萌娘文库
跳转至: 导航搜索
(同步小工具)
1个标签Bot
(跨站同步)
 
(未显示2个用户的2个中间版本)
第1行: 第1行:
/* eslint-disable prefer-arrow-callback */
+
/* <pre> */
/* eslint-disable prefer-template */
+
/**
/* eslint-disable comma-dangle */
+
* -------------------------------------------------------------------------
/* eslint-disable no-var */
+
* !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
/* eslint dot-notation: ["error", { "allowPattern": "^(?:catch|default)$" } ] */
+
* -------------------------------------------------------------------------
/* eslint-disable no-unused-vars */
+
*/
/* eslint-disable no-redeclare */
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/shortlink/MediaWiki:Gadget-shortlink.js|user=[[U:星海子]]|longId=a86ddb4cca7b0659e3282a6bbd51dd43f02e9c9e|shortId=a86ddb4|message=fix(shortlink): duplicate id}}';
/* global mw, $, OO, moment, Cron, prettyPrint, wgULS */
+
 
/* eslint-enable no-unused-vars */
 
/* eslint-enable no-redeclare */
 
 
"use strict";
 
"use strict";
// <pre>
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 +
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 +
    return new (P || (P = Promise))(function (resolve, reject) {
 +
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 +
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 +
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 +
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 +
    });
 +
};
 +
var __generator = (this && this.__generator) || function (thisArg, body) {
 +
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
 +
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
 +
    function verb(n) { return function (v) { return step([n, v]); }; }
 +
    function step(op) {
 +
        if (f) throw new TypeError("Generator is already executing.");
 +
        while (_) try {
 +
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
 +
            if (y = 0, t) op = [op[0] & 2, t.value];
 +
            switch (op[0]) {
 +
                case 0: case 1: t = op; break;
 +
                case 4: _.label++; return { value: op[1], done: false };
 +
                case 5: _.label++; y = op[1]; op = [0]; continue;
 +
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
 +
                default:
 +
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
 +
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
 +
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
 +
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
 +
                    if (t[2]) _.ops.pop();
 +
                    _.trys.pop(); continue;
 +
            }
 +
            op = body.call(thisArg, _);
 +
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
 +
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
 +
    }
 +
};
 
$(function () {
 
$(function () {
 
     var wgArticleId = mw.config.get("wgArticleId") || -1;
 
     var wgArticleId = mw.config.get("wgArticleId") || -1;
第24行: 第57行:
 
     $body.css("height", "auto");
 
     $body.css("height", "auto");
 
     var links = [{
 
     var links = [{
        id: "page",
+
            id: "page",
        href: "curid=" + wgArticleId,
+
            href: "curid=".concat(wgArticleId),
        title: wgULS("本页面的短链接(页面ID)","本頁面的短網址(頁面ID)"),
+
            title: wgULS("本页面的短链接(页面ID)", "本頁面的短網址(頁面ID)"),
        text: wgULS("本页短链","本頁短網址"),
+
            text: wgULS("本页短链", "本頁短網址"),
        wikitext: "[[Special:重定向/page/" + wgArticleId + "]]",
+
            wikitext: "[[Special:\u91CD\u5B9A\u5411/page/".concat(wgArticleId, "]]")
    }, {
+
        }, {
        id: "currev",
+
            id: "newrev",
        href: "oldid=" + wgCurRevisionId,
+
            href: "oldid=".concat(wgCurRevisionId),
        title: wgULS("本页面最新版本的短链接(版本ID)","本頁面最新修訂的短網址(版本ID)"),
+
            title: wgULS("本页面最新版本的短链接(版本ID)", "本頁面最新修訂的短網址(版本ID)"),
        text: wgULS("最新版本","最新修訂"),
+
            text: wgULS("最新版本", "最新修訂"),
        wikitext: "[[Special:固定链接/" + wgCurRevisionId + "]]",
+
            wikitext: "[[Special:\u56FA\u5B9A\u94FE\u63A5/".concat(wgCurRevisionId, "]]")
    }];
+
        }];
 
     if (wgRevisionId > 0) {
 
     if (wgRevisionId > 0) {
 
         if (wgCurRevisionId !== wgRevisionId) {
 
         if (wgCurRevisionId !== wgRevisionId) {
 
             links.push({
 
             links.push({
 
                 id: "rev",
 
                 id: "rev",
                 href: "oldid=" + wgRevisionId,
+
                 href: "oldid=".concat(wgRevisionId),
                 title: wgULS("本页面当前版本的短链接(版本ID)","本頁面當前修訂的短網址(版本ID)"),
+
                 title: wgULS("本页面当前版本的短链接(版本ID)", "本頁面當前修訂的短網址(版本ID)"),
                 text: wgULS("当前版本","當前修訂"),
+
                 text: wgULS("当前版本", "當前修訂"),
                 wikitext: "[[Special:固定链接/" + wgRevisionId + "]]",
+
                 wikitext: "[[Special:\u56FA\u5B9A\u94FE\u63A5/".concat(wgRevisionId, "]]")
 
             }, {
 
             }, {
 
                 id: "currev",
 
                 id: "currev",
                 href: "diff=" + wgRevisionId,
+
                 href: "diff=".concat(wgRevisionId),
                 title: wgULS("本页面当前版本与前一版本的差异的链接(版本ID)","本頁面當前修訂與前一修訂的短網址(版本ID)"),
+
                 title: wgULS("本页面当前版本与前一版本的差异的链接(版本ID)", "本頁面當前修訂與前一修訂的短網址(版本ID)"),
                 text: wgULS("当前版本差异","當前修訂差異"),
+
                 text: wgULS("当前版本差异", "當前修訂差異"),
                 wikitext: "[[Special:差异/" + wgRevisionId + "]]",
+
                 wikitext: "[[Special:\u5DEE\u5F02/".concat(wgRevisionId, "]]")
 
             }, {
 
             }, {
 
                 id: "curdiff",
 
                 id: "curdiff",
                 href: "diff=" + wgCurRevisionId + "&oldid=" + wgRevisionId,
+
                 href: "diff=".concat(wgCurRevisionId, "&oldid=").concat(wgRevisionId),
                 title: wgULS("与本页面最新版本的差异的短链接(版本ID)","與本頁面最新修訂差異的短網址(版本ID)"),
+
                 title: wgULS("与本页面最新版本的差异的短链接(版本ID)", "與本頁面最新修訂差異的短網址(版本ID)"),
                 text: wgULS("与最新版本差异","與最新修訂差異"),
+
                 text: wgULS("与最新版本差异", "與最新修訂差異"),
                 wikitext: "[[Special:差异/" + wgRevisionId + "/" + wgCurRevisionId + "]]",
+
                 wikitext: "[[Special:\u5DEE\u5F02/".concat(wgRevisionId, "/").concat(wgCurRevisionId, "]]")
 
             });
 
             });
         } else if (wgDiffNewId !== wgCurRevisionId) {
+
         }
 +
        else if (wgDiffNewId !== wgCurRevisionId) {
 
             links.push({
 
             links.push({
 
                 id: "currev",
 
                 id: "currev",
                 href: "diff=" + wgCurRevisionId,
+
                 href: "diff=".concat(wgCurRevisionId),
                 title: wgULS("本页面最新版本与前一版本的差异的链接(版本ID)","本頁面最新修訂與前一修訂差異的短網址(版本ID)"),
+
                 title: wgULS("本页面最新版本与前一版本的差异的链接(版本ID)", "本頁面最新修訂與前一修訂差異的短網址(版本ID)"),
                 text: wgULS("最新版本差异","與最新修訂差異"),  
+
                 text: wgULS("最新版本差异", "與最新修訂差異"),
                 wikitext: "[[Special:差异/" + wgCurRevisionId + "]]",
+
                 wikitext: "[[Special:\u5DEE\u5F02/".concat(wgCurRevisionId, "]]")
 
             });
 
             });
 
         }
 
         }
第70行: 第104行:
 
         links.push({
 
         links.push({
 
             id: "diff",
 
             id: "diff",
             href: "diff=" + wgDiffNewId + "&oldid=" + wgDiffOldId,
+
             href: "diff=".concat(wgDiffNewId, "&oldid=").concat(wgDiffOldId),
             title: wgULS("当前比较的差异的短链接(版本ID)","當前比較的差異的短網址(版本ID)"),
+
             title: wgULS("当前比较的差异的短链接(版本ID)", "當前比較的差異的短網址(版本ID)"),
             text: wgULS("当前比较的差异","當前比較的差異"),
+
             text: wgULS("当前比较的差异", "當前比較的差異"),
             wikitext: "[[Special:差异/" + wgDiffOldId + "/" + wgDiffNewId + "]]",
+
             wikitext: "[[Special:\u5DEE\u5F02/".concat(wgDiffOldId, "/").concat(wgDiffNewId, "]]")
 
         });
 
         });
 
     }
 
     }
     $mwPanel.append('<div class="portal" role="navigation" id="p-sl" aria-labelledby="p-sl-label" style="position: sticky; top: 0;"><h3 lang="zh-CN" dir="ltr" id="p-sl-label">'+ wgULS("短链接","短網址") +'</h3><div class="body"><ul>' +
+
     $mwPanel.append("<div class=\"portal\" role=\"navigation\" id=\"p-sl\" aria-labelledby=\"p-sl-label\" style=\"position: sticky; top: 0;\"><h3 lang=\"zh-CN\" dir=\"ltr\" id=\"p-sl-label\">".concat(wgULS("短链接", "短網址"), "</h3><div class=\"body\"><ul>").concat(links.map(function (l) { return "<li id=\"sl-".concat(l.id, "\"><a href=\"").concat(mw.config.get("wgServer")).concat(mw.config.get("wgScriptPath"), "/_?").concat(l.href, "\" title=\"").concat(l.title, "\">").concat(l.text, "</a><br><span>\uFF08<a data-copy-content=\"").concat(l.wikitext, "\" data-type=\"wikitext\" href=\"javascript:void(0);\"></a>\uFF09</span><br><span>\uFF08<a data-copy-content=\"").concat(mw.config.get("wgServer")).concat(mw.config.get("wgScriptPath"), "/_?").concat(l.href, "\" data-type=\"").concat(wgULS("短链接", "短網址"), "\" href=\"javascript:void(0);\"></a>\uFF09</span></li>"); }).join("\n"), "</ul></div></div>"));
        links.map(function (l) {
+
    var markStatus = function (ele, status) { return ele.innerText = status ? "".concat(ele.dataset.type).concat(wgULS("复制成功", "複製成功")) : "".concat(wgULS("复制", "複製")).concat(ele.dataset.type); };
            return '<li id="sl-' + l.id + '"><a href="' + mw.config.get("wgServer") + mw.config.get("wgScriptPath") + "/_?" + l.href + '" title="' + l.title + '">' + l.text + '</a><br><span><a data-wikitext="' + l.wikitext + '" href="javascript:void(0);">'+ wgULS("复制对应wikitext","複製對應wikitext") + '</a></span></li>';
+
    $("#mw-panel a[data-type]").each(function (_, ele) {
        }).join("\n") +
+
        markStatus(ele, false);
        "</ul></div></div>");
+
    });
 
     var valueNode = $("<pre/>", {
 
     var valueNode = $("<pre/>", {
 
         css: {
 
         css: {
 
             position: "absolute",
 
             position: "absolute",
 
             left: "-99999px",
 
             left: "-99999px",
             "z-index": "-99999",
+
             "z-index": "-99999"
 
         }
 
         }
 
     }).appendTo("body");
 
     }).appendTo("body");
     $("#mw-panel a[data-wikitext]").on("click", function () {
+
     $("#mw-panel a[data-copy-content]").on("click", function () {
         var self = $(this),
+
         var _a;
            selection = window.getSelection();
+
        return __awaiter(this, void 0, void 0, function () {
        var rangeCount = selection.rangeCount;
+
            var self, selection_1, rangeCount_1, range_1;
        var range;
+
            return __generator(this, function (_b) {
        if (rangeCount > 0) {
+
                switch (_b.label) {
            range = selection.getRangeAt(0);
+
                    case 0:
        }
+
                        self = $(this);
        valueNode.text(this.dataset.wikitext);
+
                        if (!(typeof ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText) === "function")) return [3, 2];
        selection.selectAllChildren(valueNode[0]);
+
                        return [4, navigator.clipboard.writeText(this.dataset.copyContent)];
        document.execCommand("copy");
+
                    case 1:
        self.text( wgULS("wikitext复制成功","wikitext複製成功") ).data("last-time", new Date().getTime()).addClass("text-modified");
+
                        _b.sent();
        window.setTimeout(function () {
+
                        return [3, 3];
            selection.removeAllRanges();
+
                    case 2:
            if (rangeCount > 0) {
+
                        selection_1 = window.getSelection();
                 selection.addRange(range);
+
                        rangeCount_1 = selection_1.rangeCount;
             }
+
                        if (rangeCount_1 > 0) {
            valueNode.empty();
+
                            range_1 = selection_1.getRangeAt(0);
         }, 0);
+
                        }
        return false;
+
                        valueNode.text(this.dataset.copyContent);
 +
                        selection_1.selectAllChildren(valueNode[0]);
 +
                        document.execCommand("copy");
 +
                        window.setTimeout(function () {
 +
                            selection_1.removeAllRanges();
 +
                            if (rangeCount_1 > 0) {
 +
                                selection_1.addRange(range_1);
 +
                            }
 +
                            valueNode.empty();
 +
                        }, 7);
 +
                        _b.label = 3;
 +
                    case 3:
 +
                        markStatus(this, true);
 +
                        self.data("last-time", new Date().getTime()).addClass("text-modified");
 +
                        return [2, false];
 +
                 }
 +
             });
 +
         });
 
     });
 
     });
 
     setInterval(function () {
 
     setInterval(function () {
         $("#mw-panel a[data-wikitext].text-modified").each(function () {
+
         $("#mw-panel a[data-copy-content].text-modified").each(function () {
 
             var self = $(this);
 
             var self = $(this);
 
             if (self.data("last-time") < new Date().getTime() - 3000) {
 
             if (self.data("last-time") < new Date().getTime() - 3000) {
                 self.text( wgULS("复制对应wikitext","複製對應wikitext") ).removeClass("text-modified");
+
                 markStatus(this, false);
 +
                self.removeClass("text-modified");
 
             }
 
             }
 
         });
 
         });
第121行: 第173行:
 
     });
 
     });
 
});
 
});
// </pre>
+
 
 +
/* </pre> */

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

/* <pre> */
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/shortlink/MediaWiki:Gadget-shortlink.js|user=[[U:星海子]]|longId=a86ddb4cca7b0659e3282a6bbd51dd43f02e9c9e|shortId=a86ddb4|message=fix(shortlink): duplicate id}}';

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
$(function () {
    var wgArticleId = mw.config.get("wgArticleId") || -1;
    var wgCurRevisionId = mw.config.get("wgCurRevisionId") || -1;
    var wgRevisionId = mw.config.get("wgRevisionId") || -1;
    var wgDiffOldId = mw.config.get("wgDiffOldId") || -1;
    var wgDiffNewId = mw.config.get("wgDiffNewId") || -1;
    if (wgArticleId <= 0 && wgRevisionId <= 0 && wgCurRevisionId <= 0 && wgDiffOldId <= 0 && wgDiffNewId <= 0) {
        return;
    }
    var $body = $("body");
    var $mwPanel = $("#mw-panel");
    $body.css("height", "auto");
    var links = [{
            id: "page",
            href: "curid=".concat(wgArticleId),
            title: wgULS("本页面的短链接(页面ID)", "本頁面的短網址(頁面ID)"),
            text: wgULS("本页短链", "本頁短網址"),
            wikitext: "[[Special:\u91CD\u5B9A\u5411/page/".concat(wgArticleId, "]]")
        }, {
            id: "newrev",
            href: "oldid=".concat(wgCurRevisionId),
            title: wgULS("本页面最新版本的短链接(版本ID)", "本頁面最新修訂的短網址(版本ID)"),
            text: wgULS("最新版本", "最新修訂"),
            wikitext: "[[Special:\u56FA\u5B9A\u94FE\u63A5/".concat(wgCurRevisionId, "]]")
        }];
    if (wgRevisionId > 0) {
        if (wgCurRevisionId !== wgRevisionId) {
            links.push({
                id: "rev",
                href: "oldid=".concat(wgRevisionId),
                title: wgULS("本页面当前版本的短链接(版本ID)", "本頁面當前修訂的短網址(版本ID)"),
                text: wgULS("当前版本", "當前修訂"),
                wikitext: "[[Special:\u56FA\u5B9A\u94FE\u63A5/".concat(wgRevisionId, "]]")
            }, {
                id: "currev",
                href: "diff=".concat(wgRevisionId),
                title: wgULS("本页面当前版本与前一版本的差异的链接(版本ID)", "本頁面當前修訂與前一修訂的短網址(版本ID)"),
                text: wgULS("当前版本差异", "當前修訂差異"),
                wikitext: "[[Special:\u5DEE\u5F02/".concat(wgRevisionId, "]]")
            }, {
                id: "curdiff",
                href: "diff=".concat(wgCurRevisionId, "&oldid=").concat(wgRevisionId),
                title: wgULS("与本页面最新版本的差异的短链接(版本ID)", "與本頁面最新修訂差異的短網址(版本ID)"),
                text: wgULS("与最新版本差异", "與最新修訂差異"),
                wikitext: "[[Special:\u5DEE\u5F02/".concat(wgRevisionId, "/").concat(wgCurRevisionId, "]]")
            });
        }
        else if (wgDiffNewId !== wgCurRevisionId) {
            links.push({
                id: "currev",
                href: "diff=".concat(wgCurRevisionId),
                title: wgULS("本页面最新版本与前一版本的差异的链接(版本ID)", "本頁面最新修訂與前一修訂差異的短網址(版本ID)"),
                text: wgULS("最新版本差异", "與最新修訂差異"),
                wikitext: "[[Special:\u5DEE\u5F02/".concat(wgCurRevisionId, "]]")
            });
        }
    }
    if (wgDiffNewId > 0 && wgDiffOldId > 0) {
        links.push({
            id: "diff",
            href: "diff=".concat(wgDiffNewId, "&oldid=").concat(wgDiffOldId),
            title: wgULS("当前比较的差异的短链接(版本ID)", "當前比較的差異的短網址(版本ID)"),
            text: wgULS("当前比较的差异", "當前比較的差異"),
            wikitext: "[[Special:\u5DEE\u5F02/".concat(wgDiffOldId, "/").concat(wgDiffNewId, "]]")
        });
    }
    $mwPanel.append("<div class=\"portal\" role=\"navigation\" id=\"p-sl\" aria-labelledby=\"p-sl-label\" style=\"position: sticky; top: 0;\"><h3 lang=\"zh-CN\" dir=\"ltr\" id=\"p-sl-label\">".concat(wgULS("短链接", "短網址"), "</h3><div class=\"body\"><ul>").concat(links.map(function (l) { return "<li id=\"sl-".concat(l.id, "\"><a href=\"").concat(mw.config.get("wgServer")).concat(mw.config.get("wgScriptPath"), "/_?").concat(l.href, "\" title=\"").concat(l.title, "\">").concat(l.text, "</a><br><span>\uFF08<a data-copy-content=\"").concat(l.wikitext, "\" data-type=\"wikitext\" href=\"javascript:void(0);\"></a>\uFF09</span><br><span>\uFF08<a data-copy-content=\"").concat(mw.config.get("wgServer")).concat(mw.config.get("wgScriptPath"), "/_?").concat(l.href, "\" data-type=\"").concat(wgULS("短链接", "短網址"), "\" href=\"javascript:void(0);\"></a>\uFF09</span></li>"); }).join("\n"), "</ul></div></div>"));
    var markStatus = function (ele, status) { return ele.innerText = status ? "".concat(ele.dataset.type).concat(wgULS("复制成功", "複製成功")) : "".concat(wgULS("复制", "複製")).concat(ele.dataset.type); };
    $("#mw-panel a[data-type]").each(function (_, ele) {
        markStatus(ele, false);
    });
    var valueNode = $("<pre/>", {
        css: {
            position: "absolute",
            left: "-99999px",
            "z-index": "-99999"
        }
    }).appendTo("body");
    $("#mw-panel a[data-copy-content]").on("click", function () {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var self, selection_1, rangeCount_1, range_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        self = $(this);
                        if (!(typeof ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText) === "function")) return [3, 2];
                        return [4, navigator.clipboard.writeText(this.dataset.copyContent)];
                    case 1:
                        _b.sent();
                        return [3, 3];
                    case 2:
                        selection_1 = window.getSelection();
                        rangeCount_1 = selection_1.rangeCount;
                        if (rangeCount_1 > 0) {
                            range_1 = selection_1.getRangeAt(0);
                        }
                        valueNode.text(this.dataset.copyContent);
                        selection_1.selectAllChildren(valueNode[0]);
                        document.execCommand("copy");
                        window.setTimeout(function () {
                            selection_1.removeAllRanges();
                            if (rangeCount_1 > 0) {
                                selection_1.addRange(range_1);
                            }
                            valueNode.empty();
                        }, 7);
                        _b.label = 3;
                    case 3:
                        markStatus(this, true);
                        self.data("last-time", new Date().getTime()).addClass("text-modified");
                        return [2, false];
                }
            });
        });
    });
    setInterval(function () {
        $("#mw-panel a[data-copy-content].text-modified").each(function () {
            var self = $(this);
            if (self.data("last-time") < new Date().getTime() - 3000) {
                markStatus(this, false);
                self.removeClass("text-modified");
            }
        });
    }, 1000);
    $(window).on("resize", function () {
        $mwPanel.height($body.height());
    });
});

/* </pre> */