Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
$(document).ready(function(){varapi=newmw.Api();if(mw.config.get("wgCanonicalSpecialPageName")=="Contributions"){$("ul.mw-contributions-list").before("<div style='display:inline-block;' id='revdelCP'>Revision deletion: <input type='button' id='revdelSelectAll' value='Select all'><input type='button' id='revdelSelectNone' value='Select none'>\<span style='white-space:nowrap;'><input type='checkbox' id='revdelContent' name='revdelOptions' value='content'> delete content</span> \<span style='white-space:nowrap;'><input type='checkbox' id='revdelName' name='revdelOptions' value='userName'> delete user name</span> \<span style='white-space:nowrap;'><input type='checkbox' id='revdelComment' name='revdelOptions' value='editSummary'> delete edit summary</span> \<span style='white-space:nowrap;'><input type='checkbox' id='undelContent' name='revdelOptions' value='content'> undelete content</span> \<span style='white-space:nowrap;'><input type='checkbox' id='undelName' name='revdelOptions' value='userName'> undelete user name</span> \<span style='white-space:nowrap;'><input type='checkbox' id='undelComment' name='revdelOptions' value='editSummary'> undelete edit summary</span> \<br/><select id='wpRevDeleteReasonList'><option value='other'>Other reason</option></select><input name='wpReason' size='60' id='wpReason' maxlength='100'>\<input type='button' class='revdelSubmit' id='revdelSubmit' value='Revdel selected entries'> <input type='button' class='revdelSubmit' id='oversightSubmit' value='Oversight selected entries'></div>");$("ul.mw-contributions-list .mw-revdelundel-link").each(function(ind,el){varrevId=/ids=(\d+)/.exec($(this).children("a").attr("href"))[1];varpageTitle=/target=([^&]+)/.exec($(this).children("a").attr("href"))[1];el.innerHTML="<input type='checkbox' name='"+decodeURIComponent(pageTitle)+"' class='revdelIds' value='"+revId+"'>";});$("ul.mw-contributions-list").after("</form>");//load canned summaries$.get("/w/index.php?title=MediaWiki:Revdelete-reason-dropdown&action=raw",function(data){reasons=data.replace(/\*\* ([^\*]+)/g,'<option value="$1">$1</option>');reasons=reasons.replace(/\* ([^<]+)([^\*]+)/g,'<optgroup label="$1">$2</optgroup>');$('#wpRevDeleteReasonList').append(reasons);});//attach handlers$("#revdelSelectAll").click(function(){$('input.revdelIds').each(function(){$(this).prop("checked",true);})});$("#revdelSelectNone").click(function(){$('input.revdelIds').each(function(){$(this).prop("checked",false);})});$("#revdelSubmit").click(function(){//figure out which revisions and pages we're working on.varrevCount=0;varnumTitles=0;varpageTitles={};$("input.revdelIds:checked").each(function(ind){revCount=ind+1;if(ind>4999){alert("You can't do more than 5000 revdels at once! Canceling...");returnfalse;}if(typeofpageTitles[$(this).attr("name")]=="undefined"){pageTitles[$(this).attr("name")]=$(this).val();numTitles++;}else{pageTitles[$(this).attr("name")]=pageTitles[$(this).attr("name")]+"|"+$(this).val();}});if(numTitles==0){alert("You didn't select any revisions to delete!");returnfalse;}varconfirmString="You are attempting to modify "+revCount+" revisions.\n\nThe following revision attributes will be changed:\n";//figure out what we're doing to each revision. This is pretty clunky, but whatever.vardeleteString="";varrevealString="";vartypeString="revdel";if($("#revdelContent").prop("checked")==$("#undelContent").prop("checked")){confirmString=confirmString+"-Content visibility won't change.\n";}elseif($("#revdelContent").prop("checked")){deleteString="content";confirmString=confirmString+"-Content will be deleted.\n";}else{revealString="content";confirmString=confirmString+"-Content will be revealed.\n";}if($("#revdelComment").prop("checked")==$("#undelComment").prop("checked")){confirmString=confirmString+"-Edit summary visibility won't change.\n";}elseif($("#revdelComment").prop("checked")){if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"comment";confirmString=confirmString+"-Edit summary will be deleted.\n";}else{if(revealString!=""){revealString=revealString+"|";}revealString=revealString+"comment";confirmString=confirmString+"-Edit summary will be revealed.\n";}if($("#revdelName").prop("checked")==$("#undelName").prop("checked")){confirmString=confirmString+"-User name visibility won't change.\n";}elseif($("#revdelName").prop("checked")){if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"user";confirmString=confirmString+"-User name will be deleted.\n";}else{if(revealString!=""){revealString=revealString+"|";}revealString=revealString+"user";confirmString=confirmString+"-User name will be revealed.\n";}if(deleteString==""&&revealString==""){alert("You didn't select any properties of the revisions to change!");returnfalse;}varsummary="";//construct the revdel summaryif($("#wpRevDeleteReasonList").val()=="other"){if($("#wpReason").val()==""){alert("You didn't select or write in an edit summary for the logs!");returnfalse;}summary=$("#wpReason").val();}else{summary=$("#wpRevDeleteReasonList").val();if($("#wpReason").val()!=""){summary=summary+": "+$("#wpReason").val();}}confirmString=confirmString+"\nYour revdel summary is: "+summary+"\n\nAre you sure you want to do this?";if(confirm(confirmString)){varnumCompleted=0;for(titleinpageTitles){varajaxData;ajaxData={action:"revisiondelete",type:"revision",ids:pageTitles[title],reason:summary};if(deleteString!=""){ajaxData.hide=deleteString;}if(revealString!=""){ajaxData.show=revealString;}api.postWithToken('csrf',ajaxData).done(function(){numCompleted++;if(numCompleted==numTitles){alert("modified "+revCount+" revision(s) successfully!");returnfalse;}});}}returnfalse;})$("#oversightSubmit").click(function(){//figure out which revisions and pages we're working on.varrevCount=0;varnumTitles=0;varpageTitles={};$("input.revdelIds:checked").each(function(ind){revCount=ind+1;if(ind>49){alert("You can't do more than 50 revdels at once! Canceling...");returnfalse;}if(typeofpageTitles[$(this).attr("name")]=="undefined"){pageTitles[$(this).attr("name")]=$(this).val();numTitles++;}else{pageTitles[$(this).attr("name")]=pageTitles[$(this).attr("name")]+"|"+$(this).val();}});if(numTitles==0){alert("You didn't select any revisions to delete!");returnfalse;}varconfirmString="You are attempting to modify "+revCount+" revisions.\n\nThe following revision attributes will be changed:\n";//figure out what we're doing to each revision. This is pretty clunky, but whatever.vardeleteString="";varoversighting=-1;if($("#revdelContent").prop("checked")==$("#undelContent").prop("checked")){confirmString=confirmString+"-Content visibility won't change.\n";}elseif($("#revdelContent").prop("checked")){deleteString="content";confirmString=confirmString+"-Content will be oversighted.\n";oversighting=1;}else{if(oversighting==1){alert("we can't oversight and un-oversight edits at the same time!");returnfalse;}deleteString="content";confirmString=confirmString+"-Content will be returned to normal (admin-only) revision deletion.\n";oversighting=0;}if($("#revdelComment").prop("checked")==$("#undelComment").prop("checked")){confirmString=confirmString+"-Edit summary visibility won't change.\n";}elseif($("#revdelComment").prop("checked")){if(oversighting==0){alert("we can't oversight and un-oversight edits at the same time!");returnfalse;}if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"comment";confirmString=confirmString+"-Edit summary will be oversighted.\n";oversighting=1;}else{if(oversighting==1){alert("we can't oversight and un-oversight edits at the same time!");returnfalse;}if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"comment";confirmString=confirmString+"-Edit summary will be returned to normal (admin-only) revision deletion.\n";oversighting=0;}if($("#revdelName").prop("checked")==$("#undelName").prop("checked")){confirmString=confirmString+"-User name visibility won't change.\n";}elseif($("#revdelName").prop("checked")){if(oversighting==0){alert("we can't oversight and un-oversight edits at the same time!");returnfalse;}if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"user";confirmString=confirmString+"-User name will be oversighted.\n";oversighting=1;}else{if(oversighting==1){alert("we can't oversight and un-oversight edits at the same time!");returnfalse;}if(deleteString!=""){deleteString=deleteString+"|";}deleteString=deleteString+"user";confirmString=confirmString+"-User name will be returned to normal (admin-only) revision deletion.\n";oversighting=0;}if(deleteString==""){alert("You didn't select any properties of the revisions to change!");returnfalse;}varsummary="";//construct the revdel summaryif($("#wpRevDeleteReasonList").val()=="other"){if($("#wpReason").val()==""){alert("You didn't select or write in an edit summary for the logs!");returnfalse;}summary=$("#wpReason").val();}else{summary=$("#wpRevDeleteReasonList").val();if($("#wpReason").val()!=""){summary=summary+": "+$("#wpReason").val();}}confirmString=confirmString+"\nYour oversight summary is: "+summary+"\n\nAre you sure you want to do this?";if(confirm(confirmString)){varnumCompleted=0;for(titleinpageTitles){varajaxData;ajaxData={action:"revisiondelete",type:"revision",ids:pageTitles[title],reason:summary,hide:deleteString};if(oversighting==1){ajaxData.suppress="yes";}elseif(oversighting==0){ajaxData.suppress="no";}else{alert("Something went wrong, so we're going to abort without doing anything.");}api.postWithToken('csrf',ajaxData).done(function(){numCompleted++;if(numCompleted==numTitles){alert("modified "+revCount+" revision(s) successfully!");returnfalse;}});}}returnfalse;})}});