User:Mike.lifeguard/enhancedUndelete.js
Appearance
From Meta, a Wikimedia project coordination wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Enhanced Undelete Tool // Stolen from Wikibooks created & Maintained by [[b:User:Darklama]] and [[b:User:Mike.lifeguard]] // // Adds a "Select All" and "Invert Selection" button to Special:Undelete. // Used for administrators only. functionenhancedUndelete(){ if(wgCanonicalSpecialPageName!="Undelete") return; varfi=document.getElementsByTagName("input"); for(i=0;i<fi.length;i++){ if(!fi[i].hasAttribute("type"))continue; if(fi[i].getAttribute("type")=="reset"){ varsa=document.createElement("input"); sa.setAttribute("type","button"); sa.setAttribute("value","Select All"); fi[i].parentNode.insertBefore(sa,fi[i].nextSibling); sa.onclick=function(){ for(vari=0;i<fi.length;i++){ if(fi[i].hasAttribute("type")&&fi[i].getAttribute("type")=="checkbox"){ fi[i].checked=true; } } }; // add invert selection button varinv=document.createElement("input"); inv.setAttribute("type","button"); inv.setAttribute("value","Invert All"); fi[i].parentNode.insertBefore(inv,fi[i].nextSibling); inv.onclick=function(){ // if a deleted edit is checked, uncheck it, and vis-versa. for(vari=0;i<fi.length;i++){ if(fi[i].hasAttribute("type")&&fi[i].getAttribute("type")=="checkbox"){ fi[i].checked=!fi[i].checked; } } } } elseif(fi[i].getAttribute("type")=="checkbox"){ fi[i].checked=true; } } } if(wgCanonicalSpecialPageName=="Undelete")addOnloadHook(enhancedUndelete);