User:Alexsh/restore.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// Restore Page Select Auomatic Script
// Source code by Tietew@jawiki, refactoring by Alexsh@zhwiki
if(wgPageName=='Special:Undelete'){addOnloadHook(showRestoreButton);}
function showRestoreButton(){
var e = document.getElementById("undelete");
var s = e.getElementsByTagName("h2")[1];
var x = document.createElement("p");
addButton(x,wgULS("选择全部","選擇全部"),function(){chk(true);});
addButton(x,wgULS("清除选择","清除選擇"),function(){chk(false);});
e.insertBefore(x,s.nextSibling);
}
function chk(ac){
var x = document.getElementsByTagName("input");
for(var i = 0;i<x.length;i++){if (x[i].type=='checkbox') x[i].checked=ac?true:false;}
}
function addButton(front,val,ac){
var btn=document.createElement("button");
btn.type='button';
btn.innerHTML=val;
addClickHandler( btn, ac );
front.appendChild(btn);
}