你现在正在访问的是萌娘百科用于保存和管理图片、音频等媒体文件的子项目萌娘共享,想要回到萌娘百科,请使用浏览器上的返回按钮、或点击这里
“MediaWiki:Gadget-deletion.js”的版本间的差异
小 (// Edit Via InPageEdit) |
AnnAngela-dbot(讨论 | 贡献) (代码变动:bf83eaea - ci: use eslint flat config (#400) by U:AnnAngela, co-authored-by: U:Bhsd,GH:github-actions[bot]) (1个标签:由机器人或全自动脚本执行的操作) |
||
(未显示4个用户的14个中间版本) | |||
第1行: | 第1行: | ||
− | /* | + | /** |
− | // <pre> | + | * ------------------------------------------------------------------------- |
+ | * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!! | ||
+ | * ------------------------------------------------------------------------- | ||
+ | */ | ||
+ | var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/deletion/MediaWiki:Gadget-deletion.js|user=[[U:AnnAngela]]|co-authors=[[U:Bhsd]]、GH:github-actions[bot]|longId=bf83eaea8eb4d94405bdf6885ec072fec997dd56|shortId=bf83eaea|summary=ci: use eslint flat config (#400)|body=<nowiki>Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com>↩Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; | ||
+ | |||
+ | /* <pre> */ | ||
+ | |||
"use strict"; | "use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
第17行: | 第24行: | ||
function step(op) { | function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | if (f) throw new TypeError("Generator is already executing."); | ||
− | while (_) try { | + | while (g && (g = 0, op[0] && (_ = 0)), _) 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 (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]; | if (y = 0, t) op = [op[0] & 2, t.value]; | ||
第37行: | 第44行: | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | } | ||
+ | }; | ||
+ | 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)); | ||
+ | }; | ||
+ | var __values = (this && this.__values) || function(o) { | ||
+ | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
+ | if (m) return m.call(o); | ||
+ | if (o && typeof o.length === "number") return { | ||
+ | next: function () { | ||
+ | if (o && i >= o.length) o = void 0; | ||
+ | return { value: o && o[i++], done: !o }; | ||
+ | } | ||
+ | }; | ||
+ | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | }; | ||
$(function () { return (function () { return __awaiter(void 0, void 0, void 0, function () { | $(function () { return (function () { return __awaiter(void 0, void 0, void 0, function () { | ||
− | var globalDeletionLock, | + | var deduplicate, generatePageLinkSelector, globalDeletionLock, DELCATS, PAGENAME, USERNAME, api, $root, $items, $control, $portlet, $portletAnchor, pages, isDelCat, trustedUsers, candidatePages, candidatePages_1, candidatePages_1_1, _a, title, pageid, _b, user, retryTimes, html, $html, $reason, $actor, reason, actor, link, isTrusted, e_1, e_2_1; |
+ | var e_2, _c; | ||
return __generator(this, function (_d) { | return __generator(this, function (_d) { | ||
switch (_d.label) { | switch (_d.label) { | ||
case 0: | case 0: | ||
− | if (mw.config.get("wgNamespaceNumber") !== 14 || !mw.config.get("wgIsArticle") || !mw.config.get("wgUserGroups").includes("sysop")) { | + | if (mw.config.get("wgNamespaceNumber") !== 14 || !mw.config.get("wgIsArticle") || !mw.config.get("wgUserGroups").includes("sysop") || !$(".mw-category-generated > div")[0]) { |
− | return [2 | + | return [2]; |
} | } | ||
+ | deduplicate = function (iterable) { return __spreadArray([], __read(new Set(iterable).values()), false); }; | ||
+ | generatePageLinkSelector = function (title) { return deduplicate([encodeURI(title), mw.util.wikiUrlencode(title)]).map(function (selector) { return "a[href$=\"/".concat(selector, "\"]"); }).join(","); }; | ||
globalDeletionLock = false; | globalDeletionLock = false; | ||
− | + | DELCATS = { | |
"zh.moegirl.org.cn": "即将删除的页面", | "zh.moegirl.org.cn": "即将删除的页面", | ||
+ | "mzh.moegirl.org.cn": "即将删除的页面", | ||
"commons.moegirl.org.cn": "即将删除的页面", | "commons.moegirl.org.cn": "即将删除的页面", | ||
"en.moegirl.org.cn": "Pages awaiting deletion", | "en.moegirl.org.cn": "Pages awaiting deletion", | ||
第54行: | 第101行: | ||
"library.moegirl.org.cn": "即将删除的页面" | "library.moegirl.org.cn": "即将删除的页面" | ||
}; | }; | ||
− | + | PAGENAME = mw.config.get("wgPageName"); | |
− | + | USERNAME = mw.config.get("wgUserName"); | |
− | + | $("body").on("click", "a", function (e) { return globalDeletionLock ? window.open(e.target.href, "_blank") && false : null; }); | |
− | + | api = new mw.Api(); | |
− | + | $root = $(".mw-category-generated"), $items = $root.find("li"); | |
− | + | $control = $("<p id='batdel-control'>"); | |
− | + | $portlet = $(mw.util.addPortletLink("p-cactions", "#", wgULS("批量删除本分类下页面", "批 次刪 除本分 類 下 頁 面"), "ca-batdel", wgULS(" 批量 删除 本分类下 页面", " 批次刪除 本 分類下頁 面"))).addClass("sysop-show"), $portletAnchor = $portlet.find("a"); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | api = | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
pages = []; | pages = []; | ||
− | + | isDelCat = mw.config.get("wgTitle") === DELCATS[location.hostname]; | |
− | if (! | + | if (!isDelCat) return [3, 15]; |
globalDeletionLock = true; | globalDeletionLock = true; | ||
− | + | $portletAnchor.text(wgULS(" 正在加载中……", "正在加 載 中……")); | |
− | return [4 | + | return [4, (function () { return __awaiter(void 0, void 0, void 0, function () { |
var result, eol, aufrom, _result; | var result, eol, aufrom, _result; | ||
return __generator(this, function (_a) { | return __generator(this, function (_a) { | ||
第184行: | 第123行: | ||
_a.label = 1; | _a.label = 1; | ||
case 1: | case 1: | ||
− | if (!(aufrom !== eol)) return [3 | + | if (!(aufrom !== eol)) return [3, 3]; |
− | return [4 | + | return [4, api.post({ |
action: "query", | action: "query", | ||
+ | assertuser: USERNAME, | ||
list: "allusers", | list: "allusers", | ||
aurights: "rollback", | aurights: "rollback", | ||
第200行: | 第140行: | ||
aufrom = eol; | aufrom = eol; | ||
} | } | ||
− | result.push.apply(result, _result.query.allusers.map(function (_a) { | + | result.push.apply(result, __spreadArray([], __read(_result.query.allusers.map(function (_a) { |
var name = _a.name; | var name = _a.name; | ||
return name; | return name; | ||
− | })); | + | })), false)); |
− | return [3 | + | return [3, 1]; |
− | case 3: return [2 | + | case 3: return [2, result]; |
} | } | ||
}); | }); | ||
}); })()]; | }); })()]; | ||
− | case | + | case 1: |
− | + | trustedUsers = _d.sent(); | |
− | + | return [4, (function () { return __awaiter(void 0, void 0, void 0, function () { | |
− | + | var result, eol, gcmcontinue, _result; | |
− | return [4 | ||
− | var result, eol, | ||
return __generator(this, function (_a) { | return __generator(this, function (_a) { | ||
switch (_a.label) { | switch (_a.label) { | ||
第220行: | 第158行: | ||
result = []; | result = []; | ||
eol = Symbol(); | eol = Symbol(); | ||
− | + | gcmcontinue = undefined; | |
_a.label = 1; | _a.label = 1; | ||
case 1: | case 1: | ||
− | if (!( | + | if (!(gcmcontinue !== eol)) return [3, 3]; |
− | return [4 | + | return [4, api.post({ |
action: "query", | action: "query", | ||
+ | assertuser: USERNAME, | ||
format: "json", | format: "json", | ||
− | + | rvprop: "user", | |
− | + | prop: "revisions", | |
− | + | generator: "categorymembers", | |
− | + | gcmtitle: PAGENAME, | |
− | + | gcmprop: "ids|title", | |
− | + | gcmtype: "page|subcat|file", | |
+ | gcmlimit: "max", | ||
+ | gcmcontinue: gcmcontinue | ||
})]; | })]; | ||
case 2: | case 2: | ||
_result = _a.sent(); | _result = _a.sent(); | ||
if (_result["continue"]) { | if (_result["continue"]) { | ||
− | + | gcmcontinue = _result["continue"].gcmcontinue; | |
} | } | ||
else { | else { | ||
− | + | gcmcontinue = eol; | |
} | } | ||
− | result.push.apply(result, _result.query. | + | result.push.apply(result, __spreadArray([], __read(Object.values(_result.query.pages)), false)); |
− | return [3 | + | return [3, 1]; |
− | case 3: return [2 | + | case 3: return [2, result.filter(function (_a) { |
var title = _a.title; | var title = _a.title; | ||
− | return document.querySelector( | + | return document.querySelector(generatePageLinkSelector(title)); |
})]; | })]; | ||
} | } | ||
}); | }); | ||
}); })()]; | }); })()]; | ||
− | case | + | case 2: |
− | + | candidatePages = _d.sent(); | |
− | + | _d.label = 3; | |
− | + | case 3: | |
− | + | _d.trys.push([3, 12, 13, 14]); | |
− | + | candidatePages_1 = __values(candidatePages), candidatePages_1_1 = candidatePages_1.next(); | |
− | + | _d.label = 4; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
case 4: | case 4: | ||
− | _d.sent(); | + | if (!!candidatePages_1_1.done) return [3, 11]; |
− | + | _a = candidatePages_1_1.value, title = _a.title, pageid = _a.pageid, _b = __read(_a.revisions, 1), user = _b[0].user; | |
− | + | retryTimes = 0; | |
− | link.after("<a href=\"".concat( | + | _d.label = 5; |
+ | case 5: | ||
+ | if (!(retryTimes < 3)) return [3, 10]; | ||
+ | _d.label = 6; | ||
+ | case 6: | ||
+ | _d.trys.push([6, 8, , 9]); | ||
+ | return [4, api.post({ | ||
+ | action: "parse", | ||
+ | assertuser: USERNAME, | ||
+ | pageid: pageid, | ||
+ | prop: "text" | ||
+ | })]; | ||
+ | case 7: | ||
+ | html = (_d.sent()).parse.text["*"]; | ||
+ | $html = $(html).children(".infoBox.will2Be2Deleted"); | ||
+ | $reason = $html.find("#reason"), $actor = $html.find("#actor a").first(); | ||
+ | reason = $reason.text().trim(), actor = $actor.text().trim(); | ||
+ | link = $(generatePageLinkSelector(title)); | ||
+ | if ($reason.length === 1 && $actor.length === 1 && reason && actor) { | ||
+ | isTrusted = user === actor && trustedUsers.includes(user); | ||
+ | pages.push({ | ||
+ | title: title, | ||
+ | user: user, | ||
+ | isTrusted: isTrusted, | ||
+ | reason: reason | ||
+ | }); | ||
+ | link.addClass("batdel-checked"); | ||
+ | if (isTrusted) { | ||
+ | link.after("<div>".concat(wgULS("挂删人", "掛刪人"), "\uFF1A<a href=\"/User:").concat(user, "\" class=\"mw-userlink batdel-bypass\"><bdi>").concat(user, "</bdi></a></div><div>").concat(wgULS(" 挂删理由", "掛刪理由"), "\uFF1A").concat(reason, "</div>")); | ||
+ | } | ||
+ | else { | ||
+ | link.prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:该次挂删不可靠,请手动检查", "禁止刪除:該次掛刪不可靠,請手動檢查"), "\uFF08").concat(user !== $actor.text() ? wgULS("最后编辑者与挂删人不符", "最後編輯者與掛刪人不符") : wgULS("最后编辑者没有巡查权限", " 最後編輯者沒有巡查權限"), "\uFF09</div>")); | ||
+ | console.warn("[BatchDelete] ".concat(title, " does not have a trusted flag")); | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | pages.push({ | ||
+ | title: title, | ||
+ | user: actor, | ||
+ | isTrusted: false, | ||
+ | reason: reason | ||
+ | }); | ||
+ | link.addClass("batdel-bypass").prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:该次挂删不可靠,请手动检查(挂删模板未给出理由或挂删人)", "禁止刪除:該次掛刪不可靠,請手動檢查(掛刪模板未給出理由或掛刪人)"), "</div>")); | ||
+ | console.warn("[BatchDelete] ".concat(title, " has empty reason or actor")); | ||
+ | } | ||
+ | return [3, 10]; | ||
+ | case 8: | ||
+ | e_1 = _d.sent(); | ||
+ | console.error("[BatchDelete]", e_1); | ||
+ | return [3, 9]; | ||
+ | case 9: | ||
+ | retryTimes++; | ||
+ | return [3, 5]; | ||
+ | case 10: | ||
+ | candidatePages_1_1 = candidatePages_1.next(); | ||
+ | return [3, 4]; | ||
+ | case 11: return [3, 14]; | ||
+ | case 12: | ||
+ | e_2_1 = _d.sent(); | ||
+ | e_2 = { error: e_2_1 }; | ||
+ | return [3, 14]; | ||
+ | case 13: | ||
+ | try { | ||
+ | if (candidatePages_1_1 && !candidatePages_1_1.done && (_c = candidatePages_1["return"])) _c.call(candidatePages_1); | ||
+ | } | ||
+ | finally { if (e_2) throw e_2.error; } | ||
+ | return [7]; | ||
+ | case 14: | ||
+ | $items.find("a:not(.batdel-bypass, .batdel-checked)").each(function (_, ele) { | ||
+ | var $link = $(ele); | ||
+ | $link.prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:无法获取页面挂删信息", "禁止刪除:無法獲取頁面掛刪信息"), "</div>")); | ||
+ | console.warn("[BatchDelete] ".concat($link.text(), " is not processed")); | ||
}); | }); | ||
globalDeletionLock = false; | globalDeletionLock = false; | ||
− | mw.hook("wikipage.content").fire($(".mw-userlink.bypass")); | + | mw.hook("wikipage.content").fire($(".mw-userlink.batdel-bypass")); |
− | + | $portletAnchor.text(wgULS("批量删除本分类下页面", "批次刪除本分類下頁面")); | |
− | _d.label = | + | _d.label = 15; |
− | case | + | case 15: |
− | $("body").on(" | + | $portlet.on("click", function () { |
− | + | if ($("#batdel-control")[0] || globalDeletionLock) { | |
− | return __awaiter(void 0, void 0, void 0, function () { | + | return; |
− | var | + | } |
− | return __generator(this, function ( | + | var selectedNum = $("<span>0</span>"), totalNum = $("<span>?</span>"); |
− | switch ( | + | var toggleSelection = $("<button>".concat(wgULS("全选/全不选", "全選/全不選"), "</button>")), runDeletion = $("<button>提交</button>"), cancelDeletion = $("<button>取消</button>"); |
+ | $control.empty().append([ | ||
+ | "".concat(wgULS("请选择要删除的页面", "請選擇要刪除的頁面"), " ["), | ||
+ | selectedNum, "/", totalNum, "] ", | ||
+ | toggleSelection, runDeletion, cancelDeletion, | ||
+ | ]).prependTo($root); | ||
+ | $("body").addClass("batdel-body"); | ||
+ | $items.each(function (_, ele) { | ||
+ | return $(ele).prepend($("<input type='checkbox' class='batdel-select'>").prop("disabled", $(ele).find(".batdel-error")[0])); | ||
+ | }).find(".stub").toggleClass("stub _stub"); | ||
+ | var checkboxes = $items.find(".batdel-select:not(:disabled)"); | ||
+ | totalNum.text(checkboxes.length); | ||
+ | checkboxes.on("change", function () { | ||
+ | return selectedNum.text(checkboxes.filter(":checked").length); | ||
+ | }); | ||
+ | $root.children("div").children("p").each(function (_, ele) { | ||
+ | $("<button class=\"batdel-controlButton\">".concat(wgULS("全选/全不选本类别页面", "全選/全不選本類別頁面"), "</button>")).on("click", function (e) { | ||
+ | return $(e.target).closest(".mw-category-generated > div").find(".batdel-select:not(:disabled)").each(function (_, ele) { return $(ele).prop("checked", !ele.checked); }).trigger("change"); | ||
+ | }).appendTo(ele); | ||
+ | }); | ||
+ | toggleSelection.on("click", function () { | ||
+ | $items.find(".batdel-select:not(:disabled)").each(function (_, ele) { return $(ele).prop("checked", !ele.checked); }).trigger("change"); | ||
+ | }); | ||
+ | cancelDeletion.on("click", function () { | ||
+ | if (globalDeletionLock) { | ||
+ | return; | ||
+ | } | ||
+ | $control.remove(); | ||
+ | $(".batdel-controlButton").remove(); | ||
+ | $root.find("._stub").toggleClass("stub _stub"); | ||
+ | $items.find(".batdel-select").remove(); | ||
+ | $(".batdel-disabled").removeClass("batdel-disabled"); | ||
+ | $("body").removeClass("batdel-body"); | ||
+ | }); | ||
+ | runDeletion.on("click", function () { return __awaiter(void 0, void 0, void 0, function () { | ||
+ | var _a, deletionReason, _b, $spinner, $status, _loop_1, _c, _d, ele, state_1, e_3_1, e_4; | ||
+ | var e_3, _e; | ||
+ | return __generator(this, function (_f) { | ||
+ | switch (_f.label) { | ||
case 0: | case 0: | ||
− | + | _a = globalDeletionLock; | |
− | if ( | + | if (_a) return [3, 2]; |
− | + | return [4, oouiDialog.confirm("".concat(wgULS("您确定要删除这些页面吗?", "您確定要刪除這些頁面嗎?"), "\uFF08").concat(wgULS(" 选中了", " 選中了")).concat($items.find(".batdel-select:checked").length).concat(wgULS("个页面", "個頁面"), "\uFF09"), { | |
− | + | title: wgULS("批量删除分类页面工具", "批次刪除分類頁面工具") | |
+ | })]; | ||
case 1: | case 1: | ||
− | + | _a = !(_f.sent()); | |
− | + | _f.label = 2; | |
− | |||
case 2: | case 2: | ||
− | if ( | + | if (_a) { |
− | + | return [2]; | |
− | return [2 | ||
} | } | ||
− | + | if (!isDelCat) return [3, 3]; | |
− | + | _b = ""; | |
− | + | return [3, 5]; | |
− | + | case 3: return [4, oouiDialog.prompt("".concat(wgULS("请输入删除理由", "請輸入刪除理由")), { | |
− | + | title: wgULS(" 批量删除分类页面工具", "批次刪除分類頁面工具"), | |
− | case | + | size: "medium", |
− | if (! | + | required: true |
− | + | })]; | |
− | + | case 4: | |
− | + | _b = _f.sent(); | |
− | return [4 | + | _f.label = 5; |
− | title: "批量删除分类 | + | case 5: |
+ | deletionReason = _b; | ||
+ | _f.label = 6; | ||
+ | case 6: | ||
+ | if (!(!isDelCat && deletionReason === "")) return [3, 8]; | ||
+ | return [4, oouiDialog.prompt("".concat(wgULS(" 请输入删除理由", " 請輸入刪除理由")), { | ||
+ | title: wgULS("批量删除分类页面工具", "批次刪除分類頁面工具"), | ||
+ | size: "medium", | ||
+ | required: true | ||
})]; | })]; | ||
− | case | + | case 7: |
− | + | deletionReason = _f.sent(); | |
− | return [2 | + | return [3, 6]; |
+ | case 8: | ||
+ | if (deletionReason === null) { | ||
+ | return [2]; | ||
} | } | ||
− | + | deletionReason = deletionReason ? "\uFF08".concat(deletionReason, "\uFF09") : ""; | |
− | |||
− | |||
− | |||
globalDeletionLock = true; | globalDeletionLock = true; | ||
− | + | $spinner = $('<img src="https://img.moegirl.org.cn/common/d/d1/Windows_10_loading.gif" style="height: 1em; margin-top: -.25em;">'), $status = $("<span>"); | |
+ | $root.find(".batdel-result").remove(); | ||
+ | $root.find(".batdel-select").prop("disabled", true); | ||
+ | $control.append("<br>", $spinner, $status); | ||
+ | $root.find("a:not(.batdel-bypass)").each(function (_, ele) { | ||
var self = $(ele); | var self = $(ele); | ||
− | if ( | + | if (!self.closest("li").find(".batdel-select:checked")[0]) { |
− | self.addClass("disabled"); | + | self.addClass("batdel-disabled"); |
} | } | ||
}); | }); | ||
− | + | _f.label = 9; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
case 9: | case 9: | ||
− | + | _f.trys.push([9, 18, , 19]); | |
− | + | $status.text(wgULS(" 正在删除,已完成删除的页面将会被删除线划去……", "正在刪除,已完成刪除的頁面將會被刪除線划去……")); | |
− | + | _loop_1 = function (ele) { | |
+ | var self_1, url, target, page, e_5; | ||
+ | return __generator(this, function (_g) { | ||
+ | switch (_g.label) { | ||
+ | case 0: | ||
+ | self_1 = $(ele); | ||
+ | if (!self_1.text().trim()) { | ||
+ | return [2, { value: void 0 }]; | ||
+ | } | ||
+ | self_1.css("margin-right", "1em"); | ||
+ | url = new URL(new mw.Uri(self_1.prop("href"))); | ||
+ | target = decodeURIComponent(url.searchParams.has("title") ? url.searchParams.get("title") : url.pathname.replace(/^\//, "")).replace(/_/g, " "); | ||
+ | page = pages.filter(function (_a) { | ||
+ | var title = _a.title; | ||
+ | return title === target; | ||
+ | })[0]; | ||
+ | _g.label = 1; | ||
+ | case 1: | ||
+ | _g.trys.push([1, 3, , 4]); | ||
+ | return [4, api.postWithToken("csrf", { | ||
+ | action: "delete", | ||
+ | assertuser: USERNAME, | ||
+ | format: "json", | ||
+ | title: target, | ||
+ | tags: "Automation tool", | ||
+ | reason: "\u6279\u91CF\u5220\u9664\u3010".concat(PAGENAME, "\u3011\u4E0B\u7684\u9875\u9762").concat(isDelCat && page.isTrusted && page.reason && page.user ? "\uFF08[[User_talk:".concat(page.user, "|").concat(page.user, "]]\u7684\u6302\u5220\u7406\u7531\uFF1A").concat(page.reason, " \uFF09") : deletionReason) | ||
+ | }, { | ||
+ | timeout: 99999 | ||
+ | })]; | ||
+ | case 2: | ||
+ | _g.sent(); | ||
+ | self_1.css("text-decoration", "line-through").after("<span class=\"batdel-result batdel-success\">".concat(wgULS("删除成功", "刪除成功"), "</span>")); | ||
+ | return [3, 4]; | ||
+ | case 3: | ||
+ | e_5 = _g.sent(); | ||
+ | self_1.after("<span class=\"batdel-result batdel-error\"> ".concat(wgULS("删除失败", "刪除失敗"), "\uFF1A").concat(e_5 instanceof Error ? "".concat(e_5, " ").concat(e_5.stack.split("\n")[1].trim()) : JSON.stringify(e_5), "</span>")); | ||
+ | return [3, 4]; | ||
+ | case 4: return [2]; | ||
+ | } | ||
+ | }); | ||
+ | }; | ||
+ | _f.label = 10; | ||
+ | case 10: | ||
+ | _f.trys.push([10, 15, 16, 17]); | ||
+ | _c = __values($root.find("a").not(".batdel-bypass, .batdel-disabled").toArray()), _d = _c.next(); | ||
+ | _f.label = 11; | ||
+ | case 11: | ||
+ | if (!!_d.done) return [3, 14]; | ||
+ | ele = _d.value; | ||
+ | return [5, _loop_1(ele)]; | ||
+ | case 12: | ||
+ | state_1 = _f.sent(); | ||
+ | if (typeof state_1 === "object") | ||
+ | return [2, state_1.value]; | ||
+ | _f.label = 13; | ||
+ | case 13: | ||
+ | _d = _c.next(); | ||
+ | return [3, 11]; | ||
+ | case 14: return [3, 17]; | ||
+ | case 15: | ||
+ | e_3_1 = _f.sent(); | ||
+ | e_3 = { error: e_3_1 }; | ||
+ | return [3, 17]; | ||
+ | case 16: | ||
+ | try { | ||
+ | if (_d && !_d.done && (_e = _c["return"])) _e.call(_c); | ||
} | } | ||
− | + | finally { if (e_3) throw e_3.error; } | |
− | case | + | return [7]; |
+ | case 17: | ||
+ | $spinner.remove(); | ||
+ | $status.addClass("batdel-success").text(wgULS("删除已完成!", "刪除已完成!")); | ||
+ | return [3, 19]; | ||
+ | case 18: | ||
+ | e_4 = _f.sent(); | ||
+ | $spinner.remove(); | ||
+ | $status.text("".concat(wgULS("发生错误", "發生錯誤"), "\uFF1A").concat(e_4 instanceof Error ? "".concat(e_4, " ").concat(e_4.stack.split("\n")[1].trim()) : JSON.stringify(e_4))); | ||
+ | return [3, 19]; | ||
+ | case 19: return [2]; | ||
} | } | ||
}); | }); | ||
− | }); | + | }); }); |
+ | return false; | ||
}); | }); | ||
− | return [2 | + | return [2]; |
} | } | ||
}); | }); | ||
− | }); })(); }); | + | }); })(); }); |
− | / | + | |
+ | /* </pre> */ |
2024年4月16日 (二) 08:59的最新版本
/** * ------------------------------------------------------------------------- * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!! * ------------------------------------------------------------------------- */ var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/deletion/MediaWiki:Gadget-deletion.js|user=[[U:AnnAngela]]|co-authors=[[U:Bhsd]]、GH:github-actions[bot]|longId=bf83eaea8eb4d94405bdf6885ec072fec997dd56|shortId=bf83eaea|summary=ci: use eslint flat config (#400)|body=<nowiki>Co-authored-by: Bhsd <55071315+bhsd-harry📧users.noreply.github.com>↩Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; /* <pre> */ "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 (g && (g = 0, op[0] && (_ = 0)), _) 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 }; } }; 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)); }; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; $(function () { return (function () { return __awaiter(void 0, void 0, void 0, function () { var deduplicate, generatePageLinkSelector, globalDeletionLock, DELCATS, PAGENAME, USERNAME, api, $root, $items, $control, $portlet, $portletAnchor, pages, isDelCat, trustedUsers, candidatePages, candidatePages_1, candidatePages_1_1, _a, title, pageid, _b, user, retryTimes, html, $html, $reason, $actor, reason, actor, link, isTrusted, e_1, e_2_1; var e_2, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: if (mw.config.get("wgNamespaceNumber") !== 14 || !mw.config.get("wgIsArticle") || !mw.config.get("wgUserGroups").includes("sysop") || !$(".mw-category-generated > div")[0]) { return [2]; } deduplicate = function (iterable) { return __spreadArray([], __read(new Set(iterable).values()), false); }; generatePageLinkSelector = function (title) { return deduplicate([encodeURI(title), mw.util.wikiUrlencode(title)]).map(function (selector) { return "a[href$=\"/".concat(selector, "\"]"); }).join(","); }; globalDeletionLock = false; DELCATS = { "zh.moegirl.org.cn": "即将删除的页面", "mzh.moegirl.org.cn": "即将删除的页面", "commons.moegirl.org.cn": "即将删除的页面", "en.moegirl.org.cn": "Pages awaiting deletion", "ja.moegirl.org.cn": "削除依頼中のページ", "library.moegirl.org.cn": "即将删除的页面" }; PAGENAME = mw.config.get("wgPageName"); USERNAME = mw.config.get("wgUserName"); $("body").on("click", "a", function (e) { return globalDeletionLock ? window.open(e.target.href, "_blank") && false : null; }); api = new mw.Api(); $root = $(".mw-category-generated"), $items = $root.find("li"); $control = $("<p id='batdel-control'>"); $portlet = $(mw.util.addPortletLink("p-cactions", "#", wgULS("批量删除本分类下页面", "批次刪除本分類下頁面"), "ca-batdel", wgULS("批量删除本分类下页面", "批次刪除本分類下頁面"))).addClass("sysop-show"), $portletAnchor = $portlet.find("a"); pages = []; isDelCat = mw.config.get("wgTitle") === DELCATS[location.hostname]; if (!isDelCat) return [3, 15]; globalDeletionLock = true; $portletAnchor.text(wgULS("正在加载中……", "正在加載中……")); return [4, (function () { return __awaiter(void 0, void 0, void 0, function () { var result, eol, aufrom, _result; return __generator(this, function (_a) { switch (_a.label) { case 0: result = []; eol = Symbol(); aufrom = undefined; _a.label = 1; case 1: if (!(aufrom !== eol)) return [3, 3]; return [4, api.post({ action: "query", assertuser: USERNAME, list: "allusers", aurights: "rollback", aulimit: "max", aufrom: aufrom })]; case 2: _result = _a.sent(); if (_result["continue"]) { aufrom = _result["continue"].aufrom; } else { aufrom = eol; } result.push.apply(result, __spreadArray([], __read(_result.query.allusers.map(function (_a) { var name = _a.name; return name; })), false)); return [3, 1]; case 3: return [2, result]; } }); }); })()]; case 1: trustedUsers = _d.sent(); return [4, (function () { return __awaiter(void 0, void 0, void 0, function () { var result, eol, gcmcontinue, _result; return __generator(this, function (_a) { switch (_a.label) { case 0: result = []; eol = Symbol(); gcmcontinue = undefined; _a.label = 1; case 1: if (!(gcmcontinue !== eol)) return [3, 3]; return [4, api.post({ action: "query", assertuser: USERNAME, format: "json", rvprop: "user", prop: "revisions", generator: "categorymembers", gcmtitle: PAGENAME, gcmprop: "ids|title", gcmtype: "page|subcat|file", gcmlimit: "max", gcmcontinue: gcmcontinue })]; case 2: _result = _a.sent(); if (_result["continue"]) { gcmcontinue = _result["continue"].gcmcontinue; } else { gcmcontinue = eol; } result.push.apply(result, __spreadArray([], __read(Object.values(_result.query.pages)), false)); return [3, 1]; case 3: return [2, result.filter(function (_a) { var title = _a.title; return document.querySelector(generatePageLinkSelector(title)); })]; } }); }); })()]; case 2: candidatePages = _d.sent(); _d.label = 3; case 3: _d.trys.push([3, 12, 13, 14]); candidatePages_1 = __values(candidatePages), candidatePages_1_1 = candidatePages_1.next(); _d.label = 4; case 4: if (!!candidatePages_1_1.done) return [3, 11]; _a = candidatePages_1_1.value, title = _a.title, pageid = _a.pageid, _b = __read(_a.revisions, 1), user = _b[0].user; retryTimes = 0; _d.label = 5; case 5: if (!(retryTimes < 3)) return [3, 10]; _d.label = 6; case 6: _d.trys.push([6, 8, , 9]); return [4, api.post({ action: "parse", assertuser: USERNAME, pageid: pageid, prop: "text" })]; case 7: html = (_d.sent()).parse.text["*"]; $html = $(html).children(".infoBox.will2Be2Deleted"); $reason = $html.find("#reason"), $actor = $html.find("#actor a").first(); reason = $reason.text().trim(), actor = $actor.text().trim(); link = $(generatePageLinkSelector(title)); if ($reason.length === 1 && $actor.length === 1 && reason && actor) { isTrusted = user === actor && trustedUsers.includes(user); pages.push({ title: title, user: user, isTrusted: isTrusted, reason: reason }); link.addClass("batdel-checked"); if (isTrusted) { link.after("<div>".concat(wgULS("挂删人", "掛刪人"), "\uFF1A<a href=\"/User:").concat(user, "\" class=\"mw-userlink batdel-bypass\"><bdi>").concat(user, "</bdi></a></div><div>").concat(wgULS("挂删理由", "掛刪理由"), "\uFF1A").concat(reason, "</div>")); } else { link.prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:该次挂删不可靠,请手动检查", "禁止刪除:該次掛刪不可靠,請手動檢查"), "\uFF08").concat(user !== $actor.text() ? wgULS("最后编辑者与挂删人不符", "最後編輯者與掛刪人不符") : wgULS("最后编辑者没有巡查权限", "最後編輯者沒有巡查權限"), "\uFF09</div>")); console.warn("[BatchDelete] ".concat(title, " does not have a trusted flag")); } } else { pages.push({ title: title, user: actor, isTrusted: false, reason: reason }); link.addClass("batdel-bypass").prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:该次挂删不可靠,请手动检查(挂删模板未给出理由或挂删人)", "禁止刪除:該次掛刪不可靠,請手動檢查(掛刪模板未給出理由或掛刪人)"), "</div>")); console.warn("[BatchDelete] ".concat(title, " has empty reason or actor")); } return [3, 10]; case 8: e_1 = _d.sent(); console.error("[BatchDelete]", e_1); return [3, 9]; case 9: retryTimes++; return [3, 5]; case 10: candidatePages_1_1 = candidatePages_1.next(); return [3, 4]; case 11: return [3, 14]; case 12: e_2_1 = _d.sent(); e_2 = { error: e_2_1 }; return [3, 14]; case 13: try { if (candidatePages_1_1 && !candidatePages_1_1.done && (_c = candidatePages_1["return"])) _c.call(candidatePages_1); } finally { if (e_2) throw e_2.error; } return [7]; case 14: $items.find("a:not(.batdel-bypass, .batdel-checked)").each(function (_, ele) { var $link = $(ele); $link.prop("target", "_blank").after("<div class=\"batdel-error\">".concat(wgULS("禁止删除:无法获取页面挂删信息", "禁止刪除:無法獲取頁面掛刪信息"), "</div>")); console.warn("[BatchDelete] ".concat($link.text(), " is not processed")); }); globalDeletionLock = false; mw.hook("wikipage.content").fire($(".mw-userlink.batdel-bypass")); $portletAnchor.text(wgULS("批量删除本分类下页面", "批次刪除本分類下頁面")); _d.label = 15; case 15: $portlet.on("click", function () { if ($("#batdel-control")[0] || globalDeletionLock) { return; } var selectedNum = $("<span>0</span>"), totalNum = $("<span>?</span>"); var toggleSelection = $("<button>".concat(wgULS("全选/全不选", "全選/全不選"), "</button>")), runDeletion = $("<button>提交</button>"), cancelDeletion = $("<button>取消</button>"); $control.empty().append([ "".concat(wgULS("请选择要删除的页面", "請選擇要刪除的頁面"), " ["), selectedNum, "/", totalNum, "] ", toggleSelection, runDeletion, cancelDeletion, ]).prependTo($root); $("body").addClass("batdel-body"); $items.each(function (_, ele) { return $(ele).prepend($("<input type='checkbox' class='batdel-select'>").prop("disabled", $(ele).find(".batdel-error")[0])); }).find(".stub").toggleClass("stub _stub"); var checkboxes = $items.find(".batdel-select:not(:disabled)"); totalNum.text(checkboxes.length); checkboxes.on("change", function () { return selectedNum.text(checkboxes.filter(":checked").length); }); $root.children("div").children("p").each(function (_, ele) { $("<button class=\"batdel-controlButton\">".concat(wgULS("全选/全不选本类别页面", "全選/全不選本類別頁面"), "</button>")).on("click", function (e) { return $(e.target).closest(".mw-category-generated > div").find(".batdel-select:not(:disabled)").each(function (_, ele) { return $(ele).prop("checked", !ele.checked); }).trigger("change"); }).appendTo(ele); }); toggleSelection.on("click", function () { $items.find(".batdel-select:not(:disabled)").each(function (_, ele) { return $(ele).prop("checked", !ele.checked); }).trigger("change"); }); cancelDeletion.on("click", function () { if (globalDeletionLock) { return; } $control.remove(); $(".batdel-controlButton").remove(); $root.find("._stub").toggleClass("stub _stub"); $items.find(".batdel-select").remove(); $(".batdel-disabled").removeClass("batdel-disabled"); $("body").removeClass("batdel-body"); }); runDeletion.on("click", function () { return __awaiter(void 0, void 0, void 0, function () { var _a, deletionReason, _b, $spinner, $status, _loop_1, _c, _d, ele, state_1, e_3_1, e_4; var e_3, _e; return __generator(this, function (_f) { switch (_f.label) { case 0: _a = globalDeletionLock; if (_a) return [3, 2]; return [4, oouiDialog.confirm("".concat(wgULS("您确定要删除这些页面吗?", "您確定要刪除這些頁面嗎?"), "\uFF08").concat(wgULS("选中了", "選中了")).concat($items.find(".batdel-select:checked").length).concat(wgULS("个页面", "個頁面"), "\uFF09"), { title: wgULS("批量删除分类页面工具", "批次刪除分類頁面工具") })]; case 1: _a = !(_f.sent()); _f.label = 2; case 2: if (_a) { return [2]; } if (!isDelCat) return [3, 3]; _b = ""; return [3, 5]; case 3: return [4, oouiDialog.prompt("".concat(wgULS("请输入删除理由", "請輸入刪除理由")), { title: wgULS("批量删除分类页面工具", "批次刪除分類頁面工具"), size: "medium", required: true })]; case 4: _b = _f.sent(); _f.label = 5; case 5: deletionReason = _b; _f.label = 6; case 6: if (!(!isDelCat && deletionReason === "")) return [3, 8]; return [4, oouiDialog.prompt("".concat(wgULS("请输入删除理由", "請輸入刪除理由")), { title: wgULS("批量删除分类页面工具", "批次刪除分類頁面工具"), size: "medium", required: true })]; case 7: deletionReason = _f.sent(); return [3, 6]; case 8: if (deletionReason === null) { return [2]; } deletionReason = deletionReason ? "\uFF08".concat(deletionReason, "\uFF09") : ""; globalDeletionLock = true; $spinner = $('<img src="https://img.moegirl.org.cn/common/d/d1/Windows_10_loading.gif" style="height: 1em; margin-top: -.25em;">'), $status = $("<span>"); $root.find(".batdel-result").remove(); $root.find(".batdel-select").prop("disabled", true); $control.append("<br>", $spinner, $status); $root.find("a:not(.batdel-bypass)").each(function (_, ele) { var self = $(ele); if (!self.closest("li").find(".batdel-select:checked")[0]) { self.addClass("batdel-disabled"); } }); _f.label = 9; case 9: _f.trys.push([9, 18, , 19]); $status.text(wgULS("正在删除,已完成删除的页面将会被删除线划去……", "正在刪除,已完成刪除的頁面將會被刪除線划去……")); _loop_1 = function (ele) { var self_1, url, target, page, e_5; return __generator(this, function (_g) { switch (_g.label) { case 0: self_1 = $(ele); if (!self_1.text().trim()) { return [2, { value: void 0 }]; } self_1.css("margin-right", "1em"); url = new URL(new mw.Uri(self_1.prop("href"))); target = decodeURIComponent(url.searchParams.has("title") ? url.searchParams.get("title") : url.pathname.replace(/^\//, "")).replace(/_/g, " "); page = pages.filter(function (_a) { var title = _a.title; return title === target; })[0]; _g.label = 1; case 1: _g.trys.push([1, 3, , 4]); return [4, api.postWithToken("csrf", { action: "delete", assertuser: USERNAME, format: "json", title: target, tags: "Automation tool", reason: "\u6279\u91CF\u5220\u9664\u3010".concat(PAGENAME, "\u3011\u4E0B\u7684\u9875\u9762").concat(isDelCat && page.isTrusted && page.reason && page.user ? "\uFF08[[User_talk:".concat(page.user, "|").concat(page.user, "]]\u7684\u6302\u5220\u7406\u7531\uFF1A").concat(page.reason, " \uFF09") : deletionReason) }, { timeout: 99999 })]; case 2: _g.sent(); self_1.css("text-decoration", "line-through").after("<span class=\"batdel-result batdel-success\">".concat(wgULS("删除成功", "刪除成功"), "</span>")); return [3, 4]; case 3: e_5 = _g.sent(); self_1.after("<span class=\"batdel-result batdel-error\"> ".concat(wgULS("删除失败", "刪除失敗"), "\uFF1A").concat(e_5 instanceof Error ? "".concat(e_5, " ").concat(e_5.stack.split("\n")[1].trim()) : JSON.stringify(e_5), "</span>")); return [3, 4]; case 4: return [2]; } }); }; _f.label = 10; case 10: _f.trys.push([10, 15, 16, 17]); _c = __values($root.find("a").not(".batdel-bypass, .batdel-disabled").toArray()), _d = _c.next(); _f.label = 11; case 11: if (!!_d.done) return [3, 14]; ele = _d.value; return [5, _loop_1(ele)]; case 12: state_1 = _f.sent(); if (typeof state_1 === "object") return [2, state_1.value]; _f.label = 13; case 13: _d = _c.next(); return [3, 11]; case 14: return [3, 17]; case 15: e_3_1 = _f.sent(); e_3 = { error: e_3_1 }; return [3, 17]; case 16: try { if (_d && !_d.done && (_e = _c["return"])) _e.call(_c); } finally { if (e_3) throw e_3.error; } return [7]; case 17: $spinner.remove(); $status.addClass("batdel-success").text(wgULS("删除已完成!", "刪除已完成!")); return [3, 19]; case 18: e_4 = _f.sent(); $spinner.remove(); $status.text("".concat(wgULS("发生错误", "發生錯誤"), "\uFF1A").concat(e_4 instanceof Error ? "".concat(e_4, " ").concat(e_4.stack.split("\n")[1].trim()) : JSON.stringify(e_4))); return [3, 19]; case 19: return [2]; } }); }); }); return false; }); return [2]; } }); }); })(); }); /* </pre> */