跳转到内容

MediaWiki:Gadget-CleanDeleteReasons.js

来自萌娘共享
AnnAngela-dbot留言 | 贡献2025年7月25日 (五) 23:55的版本 (代码变动:103d1a56 - feat: rename (#594) by U:AnnAngela, co-authored-by: GH:github-actions[bot])

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/CleanDeleteReasons/Gadget-CleanDeleteReasons.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=103d1a563ea4ccc8ff29fb55c9bcd88329a56eb5|shortId=103d1a56|summary=feat: rename (#594)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";(async()=>{await $.ready;const e=document.querySelector("#wpReason");if("delete"!==mw.config.get("wgAction")||!e)return;const t=new mw.Api;/(?:^内容|內容|被清空前|页面为空|頁面為空|page was empty|content was|content before blanking was)/i.test(e.value)&&(e.value="");const n=(await t.post({action:"parse",pageid:mw.config.get("wgArticleId"),prop:"text",format:"json",formatversion:2}))?.parse?.text||null;if(!n)return;const o=(new DOMParser).parseFromString(n,"text/html"),a=o.querySelector(".mw-parser-output > .infoBox.will2Be2Deleted #reason"),r=o.querySelector(".mw-parser-output > .infoBox.will2Be2Deleted #actor a");a&&r&&(e.value=`删除被挂删的页面,[[User_talk:${r.innerText}|${r.innerText}]]的挂删理由:''${a.innerText}''`)})(); 

/* </pre> */