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(AIV);varAIVpageName='Wikipedia:Administrator_intervention_against_vandalism';varsection='1';varvandal;varreason;varusername;functionaddlilinkAIV(url,name,id){mw.util.addPortletLink('p-cactions',url,name,id,null,null);}functionAIV(){if(document.title.indexOf("User talk:")!=-1){username=encodeURIComponent(mw.config.get('wgTitle'));vartest=username.split('.');if(test[3]){addlilinkAIV('javascript:AIVandal("'+username+'")','Report IP','td-report');}else{addlilinkAIV('javascript:AIVandal("'+username+'")','Report','td-report');}}if(document.title.indexOf("User contributions")!=-1){username=___location.href.split('/')[5];if(username==undefined||username==""){//if this is the case, then something is upif(___location.href.indexOf("&target=")){//it looks like we came here from a target link, lets just take the username from thatusername=___location.href.split('=')[2];}}addlilinkAIV('javascript:AIVandal("'+username+'")','Report','td-report');}}functionAIVandal(vandalU){vandal=vandalU;if(vandal==document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML){alert('You don\'t want to report yourself, do you?');return;}reason=prompt('Reason?:');if(!reason)return;document.getElementById('bodyContent').innerHTML='Please wait'+'...';document.getElementById('bodyContent').innerHTML+='<br />Grabbing page...';$.ajax({type:'GET',url:mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php?action=query&prop=info|revisions&format=xml&intoken=edit&rvprop=content&titles='+AIVpageName+'&rvsection='+section,dataType:"xml",success:function(xml){varpagetext=$(xml).find('rev').text();varedittoken=$(xml).find('page').attr('edittoken');PageReady(pagetext,edittoken);},error:function(){document.getElementById('bodyContent').innerHTML+='<br />Error reading page: '+AIVpageName;}});}functionPageReady(pagetext,edittoken){varx;varmyArray=pagetext.split(" ");varadd=true;document.getElementById('bodyContent').innerHTML+='<br />Searching for existing report...';for(x=0;x<myArray.length;x++){varmyArray2=myArray[x].split(/\n/);vary;for(y=0;y<myArray2.length;y++){if(myArray2[y]=='{{IPvandal|'+vandal+'}}'||myArray2[y]=='*{{IPvandal|'+vandal+'}}'||myArray2[y]=='{{vandal|'+vandal+'}}'||myArray2[y]=='*{{vandal|'+vandal+'}}'){add=false;}}}if(add){document.getElementById('bodyContent').innerHTML+='<br />No report found, adding...';}else{//alert('CSD tag found');document.getElementById('bodyContent').innerHTML+='<br />Report found, will not add...';return;}//let's do something expiremntal, to see if it's an IP addressvartest=username.split('.');if(test[3]){pagetext+='\n*{{IPvandal|'+vandal+'}} - '+reason+' --~'+'~'+'~'+'~';}else{pagetext+='\n*{{vandal|'+vandal+'}} - '+reason+' --~'+'~'+'~'+'~';}varparams={action:'edit',title:AIVpageName,section:section,summary:'Reporting [[Special:Contributions/'+vandal+'|'+vandal+']] using [[WP:ARV|ARV 2.2]].',minor:null,text:pagetext,token:edittoken}document.getElementById('bodyContent').innerHTML+='<br />Submitting form...';varxmlhttp=sajax_init_object();xmlhttp.overrideMimeType('application/json');xmlhttp.open('POST',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php',true);xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlhttp.send(AIVparams(params));}functionAIVparams(arr){varresarr=Array();for(variinarr){if(typeofarr[i]=='undefined'){continue;}varres;if(arr[i]instanceofArray){varv=Array();for(varj=0;j<arr[i].length;++j){v[j]=encodeURIComponent(arr[i][j]);}res=v.join('|');}else{res=encodeURIComponent(arr[i]);}resarr.push(encodeURIComponent(i)+'='+res);}returnresarr.join('&');}