Skip to content

Commit

Permalink
Update MediaWiki:Group-sysop.js
Browse files Browse the repository at this point in the history
使unprotect的原因浏览链接正确添加
调整按钮位置(先浏览后编辑)
调整选择器(避免给ipe快速编辑加浏览按钮)
增加版本删除原因浏览链接
  • Loading branch information
lovelyCARDINAL committed Aug 4, 2022
1 parent 214a34f commit 4dc44ec
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/groups/MediaWiki:Group-sysop.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
/* 函数定义块 */
//添加删除原因链接
function addLink($obj, act) {
const href = $obj.css("margin-right", "1em")[0].href,
const href = $obj.css("margin-left", "1em")[0].href,
reasonPageName = href.slice(href.indexOf("title=") + 6, href.indexOf("&action"));
$obj.after(`<a target="_blank" href="/${reasonPageName}">浏览${act}原因</a>`);
$obj.before(`<a target="_blank" href="/${reasonPageName}">浏览${act}原因</a>`);
}
//防滥用过滤器相关
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -104,17 +104,20 @@
}
/* 函数执行块 */
await $.ready;
//删除保护原因浏览链接
if (window.location.href.indexOf("action=delete") !== -1) {
//删除、保护、版本删除原因浏览链接
if (mw.config.get("wgAction") === "delete") {
if ($(".mw-delete-editreasons")[0]) {
addLink($(".mw-delete-editreasons a"), "删除");
addLink($(".mw-delete-editreasons > a"), "删除");
}
if ($(".mw-filedelete-editreasons")[0]) {
addLink($(".mw-filedelete-editreasons a"), "删除");
addLink($(".mw-filedelete-editreasons > a"), "删除");
}
}
if (window.location.href.indexOf("action=protect") !== -1 && $(".mw-protect-editreasons")[0]) {
addLink($(".mw-protect-editreasons a"), "保护");
if (/protect$/.test(mw.config.get("wgAction")) && $(".mw-protect-editreasons")[0]) {
addLink($(".mw-protect-editreasons > a"), "保护");
}
if (mw.config.get("wgCanonicalSpecialPageName") === "Revisiondelete" && $(".mw-revdel-editreasons")[0]) {
addLink($(".mw-revdel-editreasons > a"), "删除");
}
//防滥用过滤器日志
// abuseLog();
Expand Down Expand Up @@ -149,4 +152,4 @@
}
}
})();
// </pre>
// </pre>

0 comments on commit 4dc44ec

Please sign in to comment.