Thành viên:Unpear/csdcheck.js
Giao diện
Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet Explorer và Safari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.
function csdCheck() {
// Clean up the visible text in the deletion dropdown
if (document.getElementById('wpDeleteReasonList') == null) return false;
var deleteList = document.getElementById('wpDeleteReasonList').options;
var re = /\[\[([^\]\|]*\|)?([^\]]*)\]\]/g; // convert pipe links to their display text.
for (var i = 0; i < deleteList.length; i++) {
var option = deleteList[i];
option.text = option.text.replace(re,'$2');
}
// Blank the reason box and replace with the relevant list item, if applicable
if (location.href.indexOf('wpReason') > -1) {
// This deletion can be autofilled
var loc = location.href;
var reg = /23([a-z0-9]+)/ig;
var result = reg.exec(loc);
var options = document.getElementById('wpDeleteReasonList').options;
for (var i = 0; i < options.length; i ++) {
if (options[i].value.indexOf(result[1]) > -1) {
document.getElementById('wpDeleteReasonList').selectedIndex = options[i].index;
document.getElementById('wpReason').value = '';
break;
}
}
}
}
if (wgAction == 'delete') hookEvent('load', csdCheck);