Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$(document).ready(function(){if(mw.config.get("wgCanonicalSpecialPageName")=="Contributions"){$("ul.mw-contributions-list").before("Revision deletion: <form style='display:inline;'><input type='button' id='revdelSelectAll' value='Select all'><input type='button' id='revdelSelectNone' value='Select none'><input type='checkbox' id='revdelContent' name='revdelOptions' value='content'> delete content <input type='checkbox' id='revdelName' name='revdelOptions' value='userName'> delete user name <input type='checkbox' id='revdelComment' name='revdelOptions' value='editSummary'> delete edit summary <input type='checkbox' id='undelContent' name='revdelOptions' value='content'> undelete content <input type='checkbox' id='undelName' name='revdelOptions' value='userName'> undelete user name <input type='checkbox' id='undelComment' name='revdelOptions' value='editSummary'> undelete edit summary <br/><select id='wpRevDeleteReasonList'><option value='other'>Other reason</option></select><input name='wpReason' size='60' id='wpReason' maxlength='100'><input type='button' id='revdelSubmit' value='Revdel selected entries'>");$("span.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$.post("/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.varrevIds="";varrevCount=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();}else{pageTitles[$(this).attr("name")]=pageTitles[$(this).attr("name")]+"|"+$(this).val();}});if(revIds==""){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="";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)){varpageBatches=Object.keys(pageTitles);varnumBatches=pageBatches.length;varnumCompleted=0;foreach(titleinpageBatches){varajaxData;ajaxData={action:"revisiondelete",type:"revision",ids:pageTitles[title],reason:summary,token:mw.user.tokens.get('editToken')};if(deleteString!=""){ajaxData.hide=deleteString;}if(revealString!=""){ajaxData.show=revealString;}$.post('/w/api.php/',ajaxData,function(){numCompleted++;if(numCompleted==numBatches){alert("modified "+revCount+" revision(s) successfully!");returnfalse;}});}}returnfalse;})}});