MediaWiki:Gadget-CleanDeleteReasons.js:修订间差异
外观
删除的内容 添加的内容
创建页面,内容为“//Written and maintained by User:Mike.lifeguard function deletemods(){ if (mw.config.get('wgAction') === "delete") { // 使用严格相等运算符提升严谨性 const wpReason = document.getElementById("wpReason"); // 使用 const 声明非重新赋值变量 if (!wpReason) return; const regexp = /(内容为|page was empty|content before blanking was)/i; if (regexp.test(wpReason.value)){ wpReason.value = "";…” |
小无编辑摘要 |
||
| (未显示另一用户的1个中间版本) | |||
| 第1行: | 第1行: | ||
// |
// Originally written by Mike.lifeguard, updated by darklama. |
||
// based on [[b:MediaWiki:Gadget-CleanDeleteReasons.js]] |
|||
function deletemods(){ |
|||
if ( mw.config.get( 'wgAction' ) === 'delete' ) { |
|||
$( function() { |
|||
const wpReason = document.getElementById("wpReason"); // 使用 const 声明非重新赋值变量 |
|||
var wpReason = $( '#wpReason > input' ); |
|||
if (!wpReason) return; |
|||
var regexp = /(内容为|page was empty|content before blanking was)/i; |
|||
if ( regexp.test( wpReason.attr( 'value' ) ) ) { |
|||
wpReason.attr( 'value', '' ); |
|||
} |
|||
} |
|||
} ); |
|||
} |
|||
} |
} |
||
// 原生JS文档就绪事件,替代$(deletemods) |
|||
document.addEventListener('DOMContentLoaded', deletemods); |
|||
2026年6月14日 (日) 21:39的最新版本
// Originally written by Mike.lifeguard, updated by darklama.
// based on [[b:MediaWiki:Gadget-CleanDeleteReasons.js]]
if ( mw.config.get( 'wgAction' ) === 'delete' ) {
$( function() {
var wpReason = $( '#wpReason > input' );
var regexp = /(内容为|page was empty|content before blanking was)/i;
if ( regexp.test( wpReason.attr( 'value' ) ) ) {
wpReason.attr( 'value', '' );
}
} );
}