User:UncleDouggie/twinkle-minified.js

if(typeof(TwinkleConfig)=='undefined')TwinkleConfig={};TwinkleConfig.watchRevertedPages=[];TwinkleConfig.watchWarnings=false;Twinkle={};Twinkle.init={modulesAreReady:false,documentIsReady:false,modulesHaveStarted:false,loadModules:function{var defaultDir="User:UncleDouggie";this.modules=[{dir:defaultDir,name:"morebits"},{dir:defaultDir,name:"twinklewarn"},{dir:defaultDir,name:"twinklespeedy"},{dir:defaultDir,name:"twinklearv"},{dir:defaultDir,name:"twinklefluff"},{dir:defaultDir,name:"twinklediff"},{dir:defaultDir,name:"twinkleprotect"},{dir:defaultDir,name:"twinkleprod"},{dir:defaultDir,name:"twinklexfd"},{dir:defaultDir,name:"twinkleimage"},{dir:defaultDir,name:"twinkleunlink"},{dir:defaultDir,name:"twinkledelimages"},{dir:defaultDir,name:"twinkledeprod"},{dir:defaultDir,name:"twinklebatchdelete"},{dir:defaultDir,name:"twinklebatchprotect"},{dir:defaultDir,name:"twinkleimagetraverse"},{dir:defaultDir,name:"twinklebatchundelete"},{dir:defaultDir,name:"twinklecloser"},{dir:defaultDir ,name:"twinkleundelete"},{dir:defaultDir,name:"morebits-test"}];if(typeof(TwinkleConfig)==='undefined'){TwinkleConfig={};}if(typeof(TwinkleConfig.debug)==='undefined'){TwinkleConfig.debug=false;}if(typeof(TwinkleConfig.debugFirefox)==='undefined'){TwinkleConfig.debugFirefox=false;}var smaxage,maxage;if(TwinkleConfig.debug){smaxage=1;maxage=1;mediaWiki.config.set("debug","true");}else{smaxage=7200;maxage=7200;}for(var i=0;i<this.modules.length;i++){var modulePath=this.modules[i].dir+"/"+this.modules[i].name+".js";if(TwinkleConfig.debugFirefox){}else{var url=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+modulePath+"&action=raw&ctype=text/javascript&smaxage="+smaxage+"&maxage="+maxage;}}},moduleReady:function(moduleName,moduleCallback){var moduleFound=false;var modulesAreReady=true;for(var i=0;i<this.modules.length;i++){if(this.modules[i].name===moduleName){if(typeof(this.modules[i].callback)!=="undefined"){alert("Twinkle.init.moduleReady: attempt to register duplicate module "+moduleName);return;}this. modules[i].callback=moduleCallback;moduleFound=true;}else if(typeof(this.modules[i].callback)==="undefined"){modulesAreReady=false;}}if(!moduleFound){alert("Twinkle.init.moduleReady: attempt to register unknown module "+moduleName);return;}this.modulesAreReady=modulesAreReady;this.attemptStart;},documentReady:function{Twinkle.init.documentIsReady=true;Twinkle.init.attemptStart;},attemptStart:function{if(!this.modulesHaveStarted&&this.documentIsReady&&this.modulesAreReady){for(var i=0;i<this.modules.length;i++){this.modules[i].callback;}this.modulesHaveStarted=true;}}} Twinkle.init.loadModules;$(document).ready(Twinkle.init.documentReady);function twinklearv{var username;if(wgNamespaceNumber==3||wgNamespaceNumber==2||(wgNamespaceNumber==-1&&wgTitle=="Contributions")){if(wgNamespaceNumber==-1&&wgTitle=="Contributions"){username=decodeURIComponent(document.evaluate('substring-after(//div[@id="contentSub"]//a[@title="Special:Log"][last]/@href, "user=")',document,null,XPathResult.STRING_TYPE,null).stringValue.replace(/\+/g,"%20"));}else{username=wgTitle.split('/')[0];}if(!username)return;var name=isIPAddress(username)?'Report IP':'Report';var title=isIPAddress(username)?'Report IP to Administrators':'Report user to Administrators';if(Twinkle.authorizedUser){twAddPortletLink("javascript:twinklearv.callback(\""+username.replace(/\"/g,"\\\"")+"\")","ARV","tw-arv",name,title);}else{twAddPortletLink('javascript:alert("Your account is too new to use Twinkle.");','ARV','tw-arv',name,title);}if(typeof(TwinkleConfig.markAIVReportAsMinor)=='undefined'){ TwinkleConfig.markAIVReportAsMinor=true;}if(typeof(TwinkleConfig.markUAAReportAsMinor)=='undefined'){TwinkleConfig.markUAAReportAsMinor=true;}if(typeof(TwinkleConfig.markSockReportAsMinor)=='undefined'){TwinkleConfig.markSockReportAsMinor=true;}}}function num2order(num){switch(num){case 1:return'';case 2:return'2nd';case 3:return'3rd';default:return num+'th';}}twinklearv.callback=function twinklearvCallback(uid){if(uid==wgUserName){alert('You don\'t want to report yourself, do you?');return;}var Window=new SimpleWindow(600,500);Window.setTitle("Advance Reporting and Vetting");var form=new QuickForm(twinklearv.callback.evaluate);var categories=form.append({type:'select',name:'category',label:'Select report type: ',event:twinklearv.callback.change_category});categories.append({type:'option',label:'Vandalism',value:'aiv'});categories.append({type:'option',label:'Username',value:'username'});categories.append({type:'option',label:'Sockpuppeteer',value:'sock'});categories.append({type: 'option',label:'Sockpuppet',value:'puppet'});form.append({type:'field',label:'Work area',name:'work_area'});form.append({type:'hidden',name:'uid',value:uid});var result=form.render;Window.setContent(result);Window.display;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.category.dispatchEvent(evt);} twinklearv.callback.change_category=function twinklearvCallbackChangeCategory(e){var value=e.target.value;var root=e.target.form;var old_area;for(var i=0;i<root.childNodes.length;++i){var node=root.childNodes[i];if(node instanceof Element&&node.getAttribute('name')=='work_area'){old_area=node;break;}}var work_area=null;switch(value){default:case'aiv':work_area=new QuickForm.element({type:'field',label:'Report user for vandalism',name:'work_area'});work_area.append({type:'input',name:'page',label:'Primary linked page: ',tooltip:'Leave blank to not link to the page in the report',value:QueryString.exists('vanarticle')?QueryString.get('vanarticle'):,event:function(e){var value=e.target.value;var root=e.target.form;if(value==){root.badid.disabled=root.goodid.disabled=true;}else{root.badid.disabled=false;root.goodid.disabled=root.badid.value=='';}}});work_area.append({type:'input',name:'badid',label:'Revision ID for target page when vandalised: ',tooltip:'Leave blank for no diff link', value:QueryString.exists('vanarticlerevid')?QueryString.get('vanarticlerevid'):,disabled:!QueryString.exists('vanarticle'),event:function(e){var value=e.target.value;var root=e.target.form;root.goodid.disabled=value==;}});work_area.append({type:'input',name:'goodid',label:'Last good revision ID before vandalism of target page: ',tooltip:'Leave blank for diff link to previous revision',value:QueryString.exists('vanarticlegoodrevid')?QueryString.get('vanarticlegoodrevid'):'',disabled:!QueryString.exists('vanarticle')||QueryString.exists('vanarticlerevid')});work_area.append({type:'checkbox',name:'arvtype',list:[{label:'Vandalism after final (level 4 or 4im) warning given',value:'final'},{label:'Vandalism after recent (within 1 day) release of block',value:'postblock'},{label:'Evidently a vandalism-only account',value:'vandalonly',disabled:isIPAddress(root.uid.value)},{label:'Account is evidently a spambot or a compromised account',value:'spambot'},{label: 'Account is a promotion-only account',value:'promoonly'}]});work_area.append({type:'textarea',name:'reason',label:'Comment: '});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'username':work_area=new QuickForm.element({type:'field',label:'Report username violation',name:'work_area'});work_area.append({type:'header',label:'Type(s) of inappropriate username',tooltip:'Wikipedia does not allow usernames that are misleading, promotional, offensive or disruptive. Domain names and e-mail addresses are likewise prohibited. These criteria apply to both usernames and signatures. Usernames that are inappropriate in another language, or that represent an inappropriate name with misspellings and substitutions, or do so indirectly or by implication, are still considered inappropriate.'});work_area.append({type:'checkbox',name:'arvtype',list:[{label:'Misleading username',value:'misleading',tooltip: 'Misleading usernames imply relevant, misleading things about the contributor. For example, misleading points of fact, an impression of undue authority, or the suggestion that the account is operated by a group, project or collective rather than one individual.'},{label:'Promotional username',value:'promotional',tooltip:'Promotional usernames are advertisements for a company or group.'},{label:'Offensive username',value:'offensive',tooltip:'Offensive usernames make harmonious editing difficult or impossible.'},{label:'Disruptive username',value:'disruptive',tooltip:'Disruptive usernames include outright trolling or personal attacks, or otherwise show a clear intent to disrupt Wikipedia.'}]});work_area.append({type:'textarea',name:'reason',label:'Comment:'});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'puppet':work_area=new QuickForm.element({type:'field',label:'Report suspected sockpuppet',name: 'work_area'});work_area.append({type:'input',name:'sockmaster',label:'Sockpuppeteer',tooltip:'The username of the sockpuppeteer (sockmaster) without the User:-prefix',});work_area.append({type:'textarea',label:'Evidence:',name:'evidence',tooltip:'Enter your evidence. It should make clear that each of these users is likely to be abusing multiple accounts. Usually this means diffs, page histories or other information that justifies why the users are a) the same and b) disruptive. This should purely be evidence and information needed to judge the matter. Avoid all other discussion that is not evidence of sockpuppetry or other multiple account abuse.'});work_area.append({type:'checkbox',list:[{label:'Request CheckUser evidence',name:'checkuser',tooltip:'CheckUser is a tool used to obtain technical evidence related to a sock-puppetry allegation. It will not be used without good cause, which you must clearly demonstrate. Make sure your evidence explains why CheckUser is appropriate.'},{label
 * 'Notify reported users',name:'notify',tooltip:'Notification is not mandatory. In many cases, especially of chronic sockpuppeteers, notification may be counterproductive. However, especially in less egregious cases involving users who has not been reported before, notification may make the cases fairer and also appear to be fairer in the eyes of the accused. Use your judgment.'}]});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'sock':work_area=new QuickForm.element({type:'field',label:'Report suspected sockpuppeteer',name:'work_area'});work_area.append({type:'dyninput',name:'sockpuppet',label:'Sockpuppets',sublabel:'Sock: ',tooltip:'The username of the sockpuppet without the User:-prefix',min:2});work_area.append({type:'textarea',label:'Evidence:',name:'evidence',tooltip:

'Enter your evidence. It should make clear that each of these users is likely to be abusing multiple accounts. Usually this means diffs, page histories or other information that justifies why the users are a) the same and b) disruptive. This should purely be evidence and information needed to judge the matter. Avoid all other discussion that is not evidence of sockpuppetry or other multiple account abuse.'});work_area.append({type:'checkbox',list:[{label:'Request CheckUser evidence',name:'checkuser',tooltip:'CheckUser is a tool used to obtain technical evidence related to a sock-puppetry allegation. It will not be used without good cause, which you must clearly demonstrate. Make sure your evidence explains why CheckUser is appropriate.'},{label:'Notify reported users',name:'notify',tooltip: 'Notification is not mandatory. In many cases, especially of chronic sockpuppeteers, notification may be counterproductive. However, especially in less egregious cases involving users who has not been reported before, notification may make the cases fairer and also appear to be fairer in the eyes of the accused. Use your judgment.'}]});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;}} twinklearv.callbacks={aiv:function(self){uid=self.params.uid;reason=self.params.reason;var form=self.responseXML.getElementById('editform');if(!form){self.statelem.error('Failed to retrieve edit form.');return;}var text=form.wpTextbox1.value;var re=new RegExp("\\{\\{\\s*(?:(?:[Ii][Pp])?[Vv]andal|[Uu]serlinks)\\s*\\|\\s*(?:1=)?\\s*"+RegExp.escape(uid,true)+"\\s*\\}\\}");var myArr;if((myArr=re.exec(text))){self.statelem.info('Report already present, will not add a new one');return;}self.statelem.status('Adding new report...');var postData={'wpMinoredit':(form.wpMinoredit.checked||TwinkleConfig.markAIVReportAsMinor)?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':form.wpSection.value,'wpSummary':'Reporting '+uid+'.'+TwinkleConfig.summaryAd,'wpTextbox1':text+'*\{\{'+(isIPAddress( uid)?'IPvandal':'vandal')+'|'+(/\=/.test(uid)?'1=':)+uid+'\}\} - '+reason.replace(/\r?\n/g," ")+' '+};self.post(postData);},username:function(self){uid=self.params.uid;reason=self.params.reason;var form=self.responseXML.getElementById('editform');if(!form){self.statelem.error('Failed to retrieve edit form.');return;}var text=form.wpTextbox1.value;if(new RegExp("\\{\\{\\s*user-uaa\\s*\\|\\s*(1\\s*=\\s*)?"+RegExp.escape(uid,true)+"\\s*(\\||\\})").test(text)){self.statelem.error('User is already listed.');return;}self.statelem.status('Adding new report...');var postData={'wpMinoredit':(form.wpMinoredit.checked||TwinkleConfig.markUAAReportAsMinor)?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':form.wpSection.value,'wpSummary':'Reporting '+uid+'.'+TwinkleConfig. summaryAd,'wpTextbox1':text.replace(/-->/,"-->\n"+reason.replace('\$',"$$$$"))};self.post(postData);},sock:{main:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;if(self.params.notify){var query={'title':'User talk:'+self.params.uid,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('Notifying suspected sockpuppeteer',query,twinklearv.callbacks.sock.notifySock);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;var statusIndicator2=new Status('Notifying suspected sockpuppets','0%');var total=self.params.sockpuppets.length;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;var params2=clone(self.params);params2.total=total;params2.obj=statusIndicator2;params2.current=0;var socks=self.params.sockpuppets;for(var i=0;i<socks.length;++i){var query={'title':'User talk:'+socks[i],'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("Notification for "+socks[i],query,twinklearv.callbacks.sock.notifySock);wikipedia_wiki.params=params2;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;}}text+="\{\{subst:SPI report|socksraw="+self.params.sockpuppets.map(function(v){return"* \{\{"+(isIPAddress(v)?"checkip":"checkuser")+"|1="+v+"\}\}"}).join("\n")+"\n|evidence="+self.params.evidence+" \n";if(self.params.checkuser){text+="|checkuser=yes";}text+="\}\}";var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form. wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':form.wpSection.value,'wpSummary':'Adding new report for '+self.params.uid+'.'+TwinkleConfig.summaryAd,'wpTextbox1':text};self.post(postData);},notifySock:function(self){var form=self.responseXML.getElementById('editform');text=form.wpTextbox1.value;var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':form.wpSection.value,'wpSummary':"Notifying about suspicion of sockpuppeteering."+TwinkleConfig.summaryAd,'wpTextbox1':text+"\n\{\{subst:socksuspectnotice|1="+self.params.uid+"\}\} \~\~\~\~"};self.post(postData);}}} twinklearv.callback.evaluate=function(e){var form=e.target;var reason="";if(form.reason){comment=form.reason.value;}var uid=form.uid.value;switch(form.category.value){default:case'aiv':var types=form.getChecked('arvtype');if(types.length==0&&comment==){alert('You must specify some reason');return;}types=types.map(function(v){switch(v){case'final':return'vandalism after final warning';break;case'postblock':return'vandalism after recent release of block';break;case'spambot':return'account is evidently a spambot or a compromised account';break;case'vandalonly':return'actions evidently indicate a vandalism-only account';break;case'promoonly':return'account is being used only for promotional purposes';break;}}).join(', ');if(form.page.value!=){reason+='On Category|File):/i,':$1:')+;if(form.badid.value!=){var query={'title':form.page.value,'diff':form.badid.value,'oldid':form.goodid.value};reason+=' (['+mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+ QueryString.create(query)+' diff])';}reason+=';';}if(types){reason+=" "+types;}if(comment!=){reason+=(reason==""?"":". ")+comment+'.';}Status.init(form);var query={'title':'Wikipedia:Administrator intervention against vandalism','action':'submit','section':1};wikipedia_wiki=new Wikipedia.wiki('Processing AIV request',query,twinklearv.callbacks.aiv);wikipedia_wiki.params={reason:reason,uid:uid};wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;break;case'username':var types=form.getChecked('arvtype');if(types.length==0){alert('You must specify at least one breached violation');return;}types=types.map(function(v){return v.toLowerCaseFirstChar;});if(types.length<=2){types=types.join(' and ');}else{types=[types.slice(0,-1).join(', '),types.slice(-1)].join(' and ');}var article='a';if(/[aeiouwyh]/.test(types[0])){article='an';}reason="*\{\{user-uaa|1="+uid+"\}\} &mdash; Violation of username policy because it's "+article+" "+types+" username; ";if(comment!=){reason+="''"+comment .toUpperCaseFirstChar+"''. ";}reason+="\~\~\~\~";Status.init(form);var query={'title':'Wikipedia:Usernames for administrator attention','action':'submit','section':1};wikipedia_wiki=new Wikipedia.wiki('Processing UAA request',query,twinklearv.callbacks.username);wikipedia_wiki.params={reason:reason,uid:uid};wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;break;case'sock':var sockpuppets=form.getTexts('sockpuppet');var evidence=form.evidence.value.rtrim;var checkuser=form.checkuser.checked;var notify=form.notify.checked;Status.init(form);var query={'title':'Wikipedia:Sockpuppet investigations/'+uid,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('Retrieving discussion page',query,twinklearv.callbacks.sock.main);wikipedia_wiki.params={uid:uid,sockpuppets:sockpuppets,evidence:evidence,checkuser:checkuser,notify:notify};wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;break;case'puppet':var sockpuppets=new Array(uid);var evidence=form.evidence.value.rtrim;var checkuser=form.checkuser.checked;var notify=form.notify.checked;var master=form.sockmaster.value.rtrim;Status.init(form);var query={'title':'Wikipedia:Sockpuppet investigations/'+master,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('Retrieving discussion page',query,twinklearv.callbacks.sock.main);wikipedia_wiki.params={uid:master,sockpuppets:sockpuppets,evidence:evidence,checkuser:checkuser,notify:notify};wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;}} Twinkle.init.moduleReady("twinklearv",twinklearv);function twinklebatchdelete{if(userIsInGroup('sysop')&&(wgNamespaceNumber>0||wgCanonicalSpecialPageName=='Prefixindex')){twAddPortletLink("javascript:twinklebatchdelete.callback","D-batch","tw-batch","Delete pages found in this category/on this page","");if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}if(typeof(TwinkleConfig.batchDeleteChunks)=='undefined'){TwinkleConfig.batchdeleteChunks=1;}if(typeof(TwinkleConfig.batchDeleteMinCutOff)=='undefined'){TwinkleConfig.batchDeleteMinCutOff=0;}if(typeof(TwinkleConfig.batchMax)=='undefined'){TwinkleConfig.batchMax=5000;}}}twinklebatchdelete.unlinkCache={};twinklebatchdelete.callback=function twinklesbatchdeleteCallback{var Window=new SimpleWindow(800,400);Window.setTitle("Batch deletion");var form=new QuickForm(twinklebatchdelete.callback.evaluate);form.append({type:'checkbox',list:[{label:'Delete pages',name:'delete_page' ,value:'delete',checked:true},{label:'Remove backlinks to the page',name:'unlink_page',value:'unlink',checked:true},{label:'Delete redirects to deleted pages',name:'delete_redirects',value:'delete_redirects',checked:true}]});form.append({type:'textarea',name:'reason',label:'Reason: '});if(wgNamespaceNumber==Namespace.CATEGORY){var query={'action':'query','generator':'categorymembers','gcmtitle':wgPageName,'gcmlimit':TwinkleConfig.batchMax,'prop':['categories','revisions'],'rvprop':['size']};}else if(wgCanonicalSpecialPageName=='Prefixindex'){if(QueryString.exists('from')){var gapnamespace=QueryString.get('namespace');var gapprefix=QueryString.get('from').toUpperCaseFirstChar;}else{var pathSplit=location.pathname.split('/');if(pathSplit.length<3||pathSplit[2]!="Special:PrefixIndex")return;var titleSplit=pathSplit[3].split(':');var gapnamespace=Namespace[titleSplit[0].toUpperCase];if(titleSplit.length<2||typeof(gapnamespace)=='undefined'){var gapnamespace=Namespace.MAIN;var gapprefix =pathSplit.splice(3).join('/');}else{pathSplit=pathSplit.splice(4);pathSplit.splice(0,0,titleSplit.splice(1).join(':'));var gapprefix=pathSplit.join('/');}}var query={'action':'query','generator':'allpages','gapnamespace':gapnamespace,'gapprefix':gapprefix,'gaplimit':TwinkleConfig.batchMax,'prop':['categories','revisions'],'rvprop':['size']}}else{var query={'action':'query','generator':'links','titles':wgPageName,'gpllimit':TwinkleConfig.batchMax,'prop':['categories','revisions'],'rvprop':['size']};}var wikipedia_api=new Wikipedia.api('Grabbing pages',query,function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//page[@ns != "'+Namespace.IMAGE+'" and not(@missing)]',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<snapshot.snapshotLength;++i){var object=snapshot.snapshotItem(i);var page=xmlDoc.evaluate('@title',object,null,XPathResult.STRING_TYPE,null).stringValue;var size=xmlDoc.evaluate('revisions/rev/@size',object,null, XPathResult.NUMBER_TYPE,null).numberValue;var disputed=xmlDoc.evaluate('boolean(categories/cl[@title="Category:Contested candidates for speedy deletion"])',object,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;list.push({label:page+' ('+size+')'+(disputed?' DISPUTED':''),value:page,checked:!disputed});}self.params.form.append({type:'checkbox',name:'pages',list:list}) self.params.form.append({type:'submit'});var result=self.params.form.render;self.params.Window.setContent(result);});wikipedia_api.params={form:form,Window:Window};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinklebatchdelete.currentDeleteCounter=0;twinklebatchdelete.currentUnlinkCounter=0;twinklebatchdelete.currentdeletor;twinklebatchdelete.callback.evaluate=function twinklebatchdeleteCallbackEvaluate(event){Wikipedia.actionCompleted.notice='Status';Wikipedia.actionCompleted.postfix='batch deletion is now complete';wgPageName=wgPageName.replace(/_/g,' ');var pages=event.target.getChecked('pages');var reason=event.target.reason.value;var delete_page=event.target.delete_page.checked;var unlink_page=event.target.unlink_page.checked;var delete_redirects=event.target.delete_redirects.checked;if(!reason){return;}Status.init(event.target);if(!pages){Status.error('Error','nothing to delete, aborting');return;}function toCall(work){if(work.length==0&&twinklebatchdelete.currentDeleteCounter<=0&&twinklebatchdelete.currentUnlinkCounter<=0){window.clearInterval(twinklebatchdelete.currentdeletor);Wikipedia.removeCheckpoint;return;}else if(work.length!=0&&(twinklebatchdelete.currentDeleteCounter<= TwinkleConfig.batchDeleteMinCutOff||twinklebatchdelete.currentUnlinkCounter<=TwinkleConfig.batchDeleteMinCutOff)){twinklebatchdelete.unlinkCache=[];var pages=work.shift;twinklebatchdelete.currentDeleteCounter+=pages.length;twinklebatchdelete.currentUnlinkCounter+=pages.length;for(var i=0;i<pages.length;++i){var page=pages[i];var query={'action':'query','titles':page} var wikipedia_api=new Wikipedia.api('Checking if page '+page+' exists',query,twinklebatchdelete.callbacks.main);wikipedia_api.params={page:page,reason:reason,unlink_page:unlink_page,delete_page:delete_page,delete_redirects:delete_redirects};wikipedia_api.post;}}}var work=pages.chunk(TwinkleConfig.batchdeleteChunks);Wikipedia.addCheckpoint;twinklebatchdelete.currentdeletor=window.setInterval(toCall,1000,work);} twinklebatchdelete.callbacks={main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){self.params.page=normal;}var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("It seems that the page doesn't exists, perhaps it has already been deleted");return;}if(self.params.unlink_page){var query={'action':'query','list':'backlinks','blfilterredir':'nonredirects','blnamespace':[0,100],'bltitle':self.params.page,'bllimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing backlinks',query,twinklebatchdelete.callbacks.unlinkBacklinksMain);wikipedia_api.params=self.params;wikipedia_api.post;}else{--twinklebatchdelete.currentUnlinkCounter;}if(self.params.delete_page){if(self.params.delete_redirects){var query={'action':'query','list':'backlinks','blfilterredir': 'redirects','bltitle':self.params.page,'bllimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing backlinks',query,twinklebatchdelete.callbacks.deleteRedirectsMain);wikipedia_api.params=self.params;wikipedia_api.post;}var query={'title':self.params.page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting page '+self.params.page,query,twinklebatchdelete.callbacks.deletePage,function(self){--twinklebatchdelete.currentDeleteCounter;var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);});wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}else{--twinklebatchdelete.currentDeleteCounter;}},deleteRedirectsMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate( '//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var total=snapshot.snapshotLength*2;if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Deleting redirects','0%');var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'delete'} var wikipedia_wiki=new Wikipedia.wiki("Deleting "+title,query,twinklebatchdelete.callbacks.deleteRedirects);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}},deleteRedirects:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpReason':"Speedy deleted per (CSD G8), Redirect to deleted page \""+self.params.page+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Speedy deleted per (CSD G8), Redirect to deleted page \""+self.params.page+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}self.post(postData);},deletePage:function(self){var form=this.responseXML.getElementById('deleteconfirm');var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Deleted because \""+self.params.reason+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);},unlinkBacklinksMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){--twinklebatchdelete.currentUnlinkCounter;return;}var statusIndicator=new Status('Unlinking backlinks','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');--twinklebatchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');--twinklebatchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint;return;}self.params.total=total;self.params.obj=statusIndicator;self.params.current=0;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'} var wikipedia_wiki=new Wikipedia.wiki("Unlinking on "+title,query,twinklebatchdelete.callbacks.unlinkBacklinks);var params=clone(self.params);params.title=title;wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get;}},unlinkBacklinks:function(self){var form=self.responseXML.getElementById('editform');if(!form){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var text;if(self.params.title in twinklebatchdelete.unlinkCache){text=twinklebatchdelete.unlinkCache[self.params.title];}else{text=form.wpTextbox1.value;}var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.removeLink(self.params.page);text=wikiPage.getText;twinklebatchdelete.unlinkCache[self.params.title]=text;if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var postData={'wpMinoredit':form.wpMinoredit.checked?'':undefined,'wpWatchthis':undefined,'wpStarttime':form.wpStarttime. value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':'Removing backlinks to page '+self.params.page+" that has been deleted because \""+self.params.reason+"\")"+"; "+TwinkleConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);}} Twinkle.init.moduleReady("twinklebatchdelete",twinklebatchdelete);function twinklebatchprotect{if(userIsInGroup('sysop')&&(wgNamespaceNumber>0||wgCanonicalSpecialPageName=='Prefixindex')){twAddPortletLink("javascript:twinklebatchprotect.callback","P-batch","tw-pbatch","Protect pages found on this page","");if(typeof(TwinkleConfig.protectionSummaryAd)=='undefined'){TwinkleConfig.protectionSummaryAd=TwinkleConfig.summaryAd;}if(typeof(TwinkleConfig.batchProtectChunks)=='undefined'){TwinkleConfig.batchProtectChunks=50;}if(typeof(TwinkleConfig.batchProtectMinCutOff)=='undefined'){TwinkleConfig.batchProtectMinCutOff=5;}if(typeof(TwinkleConfig.batchMax)=='undefined'){TwinkleConfig.batchMax=5000;}}}twinklebatchprotect.unlinkCache={};twinklebatchprotect.callback=function twinklesbatchprotectCallback{var Window=new SimpleWindow(800,400);Window.setTitle("Batch protection");var form=new QuickForm(twinklebatchprotect.callback.evaluate);form.append({type:'select',name:'move',label: 'Move protection',list:[{label:'Allow all users (still autoconfirmed)',value:,selected:true},{label:'Block new and unregistered users',value:'autoconfirmed'},{label:'Block all non-admin users',value:'sysop'}]});form.append({type:'select',name:'edit',label:'Edit protection',list:[{label:'Allow all users',value:,selected:true},{label:'Block new and unregistered users',value:'autoconfirmed'},{label:'Block all non-admin users',value:'sysop'}]});form.append({type:'select',name:'create',label:'Create protection',list:[{label:'Allow all users (still autoconfirmed)',value:'',selected:true},{label:'Block new and unregistered users',value:'autoconfirmed'},{label:'Block all non-admin users',value:'sysop'}]});form.append({type:'checkbox',list:[{name:'cascade',label:'Cascade protection'}]});form.append({type:'select',name:'expiry',label:'Expiration: ',list:[{label:'15 minutes',value:'15 minutes'},{label:'30 minutes',value:'30 minutes'},{label:'45 minutes',value:'45 minutes'},{label:'1 hour', value:'1 hour'},{label:'2 hours',value:'2 hours'},{label:'3 hours',value:'3 hours'},{label:'6 hours',value:'6 hours'},{label:'12 hours',value:'12 hours'},{label:'1 day',value:'1 day'},{label:'2 days',value:'2 days'},{label:'3 days',value:'3 days'},{label:'4 days',value:'4 days'},{label:'5 days',value:'5 days'},{label:'6 days',value:'6 days'},{label:'1 week',value:'1 week'},{label:'2 weeks',value:'2 weeks'},{label:'1 month',value:'1 month'},{label:'2 months',value:'2 months'},{label:'3 months',value:'3 months'},{label:'6 months',value:'6 months'},{label:'1 year',value:'1 year'},{label:'2 years',value:'2 years'},{label:'3 years',value:'3 years'},{label:'6 years',value:'6 years'},{label:'indefinite',selected:true,value:'indefinite'}]});form.append({type:'textarea',name:'reason',label:'Reason: '});if(wgNamespaceNumber==Namespace.CATEGORY){var query={'action':'query','generator':'categorymembers','gcmtitle':wgPageName,'gcmlimit':TwinkleConfig.batchMax,'prop':['revisions'],'rvprop':['size']} xmlDoc.evaluate('revisions/rev/@size',object,null,XPathResult.NUMBER_TYPE,null).numberValue;list.push({label:page+(size?' ('+size+')':''),value:page,checked:true});}self.params.form.append({type:'checkbox',name:'pages',list:list}) self.params.form.append({type:'submit'});var result=self.params.form.render;self.params.Window.setContent(result);});wikipedia_api.params={form:form,Window:Window};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinklebatchprotect.currentProtectCounter=0;twinklebatchprotect.currentprotector;twinklebatchprotect.callback.evaluate=function twinklebatchprotectCallbackEvaluate(event){wgPageName=wgPageName.replace(/_/g,' ');var pages=event.target.getChecked('pages');var reason=event.target.reason.value;var create=event.target.create.value;var edit=event.target.edit.value;var cascade=event.target.cascade.checked;var expiry=event.target.expiry.value;var move=event.target.move.value;if(!reason){return;}Status.init(event.target);if(!pages){Status.error('Error','nothing to delete, aborting');return;}function toCall(work){if(work.length==0&&twinklebatchprotect.currentProtectCounter<=0){Status.info('work done');window.clearInterval(twinklebatchprotect.currentprotector);Wikipedia.removeCheckpoint;return;}else if(work.length!=0&&twinklebatchprotect.currentProtectCounter<=TwinkleConfig.batchProtectMinCutOff){var pages=work.shift;twinklebatchprotect.currentProtectCounter+=pages.length;for(var i=0;i<pages. length;++i){var page=pages[i];var query={'action':'query','titles':page} var wikipedia_api=new Wikipedia.api('Checking if page '+page+' exists',query,twinklebatchprotect.callbacks.main);wikipedia_api.params={page:page,reason:reason,move:move,edit:edit,create:create,expiry:expiry,cascade:cascade};wikipedia_api.post;}}}var work=pages.chunk(TwinkleConfig.batchProtectChunks);Wikipedia.addCheckpoint;twinklebatchprotect.currentprotector=window.setInterval(toCall,1000,work);} twinklebatchprotect.callbacks={main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){self.params.page=normal;}var query={'title':self.params.page,'action':'protect'};var wikipedia_wiki=new Wikipedia.wiki('Protecting page '+self.params.page,query,twinklebatchprotect.callbacks.protectPage,function(self){--twinklebatchprotect.currentProtectCounter;var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);});wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;},protectPage:function(self){var form=self.responseXML.getElementById('mw-Protect-Form');var postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-edit':self.params.edit, 'wpProtectExpirySelection-edit':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-edit':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-move':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?:undefined,'mwProtectWatch':form.mwProtectWatch.checked?:undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+TwinkleConfig.protectionSummaryAd};self.post(postData);}} Twinkle.init.moduleReady("twinklebatchprotect",twinklebatchprotect);function twinklebatchundelete{if(wgNamespaceNumber!=Namespace.USER){return;}if(userIsInGroup('sysop')){twAddPortletLink("javascript:twinklebatchundelete.callback","Und-batch","tw-batch-undel","Undelete 'em all","");if(typeof(TwinkleConfig.batchUndeleteChunks)=='undefined'){TwinkleConfig.batchundeleteChunks=50;}if(typeof(TwinkleConfig.batchUndeleteMinCutOff)=='undefined'){TwinkleConfig.batchUndeleteMinCutOff=5;}if(typeof(TwinkleConfig.batchMax)=='undefined'){TwinkleConfig.batchMax=5000;}}}twinklebatchundelete.callback=function twinklebatchundeleteCallback{var Window=new SimpleWindow(800,400);var form=new QuickForm(twinklebatchundelete.callback.evaluate);form.append({type:'textarea',name:'reason',label:'Reason: '});var query={'action':'query','generator':'links','titles':wgPageName,'gpllimit':TwinkleConfig.batchMax,};var wikipedia_api=new Wikipedia.api('Grabbing pages',query,function(self){var xmlDoc=self. responseXML;var snapshot=xmlDoc.evaluate('//page[@missing]',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<snapshot.snapshotLength;++i){var object=snapshot.snapshotItem(i);var page=xmlDoc.evaluate('@title',object,null,XPathResult.STRING_TYPE,null).stringValue;list.push({label:page,value:page,checked:true});}self.params.form.append({type:'checkbox',name:'pages',list:list}) self.params.form.append({type:'submit'});var result=self.params.form.render;self.params.Window.setContent(result);});wikipedia_api.params={form:form,Window:Window};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinklebatchundelete.currentUndeleteCounter=0;twinklebatchundelete.currentundeleteor;twinklebatchundelete.callback.evaluate=function(event){Wikipedia.actionCompleted.notice='Status';Wikipedia.actionCompleted.postfix='batch undeletion is now completed';var pages=event.target.getChecked('pages');var reason=event.target.reason.value;if(!reason){return;}Status.init(event.target);if(!pages){Status.error('Error','nothing to undelete, aborting');return;}var work=pages.chunk(TwinkleConfig.batchUndeleteChunks);Wikipedia.addCheckpoint;twinklebatchundelete.currentundeleteor=window.setInterval(twinklebatchundelete.callbacks.main,1000,work,reason);} twinklebatchundelete.callbacks={main:function(work,reason){if(work.length==0&&twinklebatchundelete.currentUndeleteCounter<=0){Status.info('work done');window.clearInterval(twinklebatchundelete.currentundeleteor);Wikipedia.removeCheckpoint;return;}else if(work.length!=0&&twinklebatchundelete.currentUndeleteCounter<=TwinkleConfig.batchUndeleteMinCutOff){var pages=work.shift;twinklebatchundelete.currentUndeleteCounter+=pages.length;for(var i=0;i<pages.length;++i){var title=pages[i];var query={'title':'Special:Undelete','target':title,'action':'submit'};var wikipedia_wiki=new Wikipedia.wiki("Undeleting "+title,query,twinklebatchundelete.callbacks.undeletePage,function(self){--twinklebatchundelete.currentUndeleteCounter;var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.params.title));link.setAttribute('title',self.params.title);link.appendChild(document.createTextNode(self.params.title));self.statelem.info(['completed (',link,')']);}); wikipedia_wiki.params={title:title,reason:reason};wikipedia_wiki.get;}}},undeletePage:function(self){var form=self.responseXML.getElementById('undelete');var postData={'wpComment':self.params.reason+'.'+TwinkleConfig.deletionSummaryAd,'target':self.params.image,'wpEditToken':form.wpEditToken.value,'restore':1} self.post(postData);}};Twinkle.init.moduleReady("twinklebatchundelete",twinklebatchundelete);function twinklecloser{if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}var closeable=false;var type;if(/Wikipedia:Articles_for_creation\/\d{4}-\d{2}-\d{2}/.test(wgPageName)){closeable=true;type='afc';}else if(/Wikipedia:Articles_for_deletion\/Log\/\d{4}_\w+_\d{1,2}/.test(wgPageName)){closeable=true;type='afd';}if(closeable){twinklecloser.mark(type);}}twinklecloser.mark=function twinklecloserMark(type){switch(type){case'afc':var sections=document.evaluate('//h2[span/@class="editsection"]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0;i<sections.snapshotLength;++i){var section=sections.snapshotItem(i);var section_number=document.evaluate('substring-after(span/a/@href, "section=")',section,null,XPathResult.STRING_TYPE,null).stringValue;var a_node=document.createElement('a');a_node.appendChild(document. createTextNode('[close]'));a_node.style.fontWeight='bold';a_node.setAttribute('href','javascript:twinklecloser.actions.afc("'+section_number+'")');section.insertBefore(a_node,section.firstChild);}break;case'afd':var sections=document.evaluate('//h3[span/@class="editsection"]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0;i<sections.snapshotLength;++i){var section=sections.snapshotItem(i);var section_number=document.evaluate('substring-after(span/a/@href, "section=")',section,null,XPathResult.STRING_TYPE,null).stringValue;var page=document.evaluate('span/a/@title',section,null,XPathResult.STRING_TYPE,null).stringValue;var a_node=document.createElement('a');a_node.appendChild(document.createTextNode('[close]'));a_node.style.fontWeight='bold';a_node.style.color='#449922';a_node.setAttribute('href','javascript:twinklecloser.actions.afd("'+section_number+'", "'+page+'")');section.insertBefore(a_node,section.firstChild);}break;}} twinklecloser.actions={afc:function twinklecloserActionsAfc(section){var Window=new SimpleWindow(800,400);Window.setTitle("Close AFC");var form=new QuickForm(twinklecloser.callbacks.afc.evaluate);form.append({label:'Action: ',type:'select',name:'type',event:twinklecloser.callbacks.afc.submenu,list:[{label:'Approved',value:'approved'},{label:'Denied',value:'denied'},{label:'Archive',value:'archive'}]});form.append({type:'div',id:'work_area'});form.append({type:'hidden',name:'section',value:section});form.append({type:'hidden',name:'page',value:page});var result=form.render;Window.setContent(result);Window.display;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.type.dispatchEvent(evt);},afd:function twinklecloserActionsAfd(section,page){var Window=new SimpleWindow(800,400);Window.setTitle("Close AFD");var form=new QuickForm(twinklecloser.callbacks.afd.evaluate);form.append({label:'Action: ',type:'radio',name:'type',list:[{label:'Keep',value:'keep'},{ label:'No consensus',value:'no consensus'},{label:'Merge',value:'merge'},{label:'Redirect',value:'redirect',subgroup:{type:'input',name:'target',label:'Target: ',tooltip:'the name of the page to redirect to'}},{label:'Delete',value:'delete',subgroup:{type:'checkbox',list:[{label:'Delete? ',value:'delete',name:'del',tooltop:'if we should delete the page on the fly',checked:true}]}}]});form.append({type:'textarea',name:'reason',label:'Reason:'});form.append({type:'input',name:'affected_page',label:'Affected page: ',value:page.replace(/.*\/(.*?)(\s\(.*?\))?/,"$1")});form.append({type:'div',id:'work_area'});form.append({type:'hidden',name:'section',value:section});form.append({type:'hidden',name:'page',value:page});var result=form.render;Window.setContent(result);Window.display;}} twinklecloser.callbacks={afc:{submenu:function(e){var value=e.target.value;var root=e.target.form;var old_area=document.getElementById('work_area');var work_area=null;switch(value){case'archive':work_area=new QuickForm.element({type:'div',id:'work_area'});work_area.append({type:'checkbox',name:'approved',list:[{label:'Approved ',value:'approved'}]});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'approved':work_area=new QuickForm.element({type:'div',id:'work_area'});work_area.append({type:'input',name:'article',label:'Article ',tooltop:'Leave empty if article was created as specified'});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'denied':work_area=new QuickForm.element({type:'div',id:'work_area'});work_area.append({type:'select',name:'reason',label:'Reason ',list:[{label:'v',value:'v'},{label:'bio',value:'bio'},{label:'nn', value:'nn'},{label:'web',value:'web'},{label:'corp',value:'corp'},{label:'music',value:'music'},{label:'dict',value:'dict'},{label:'context',value:'context'},{label:'blank',value:'blank'},{label:'neo',value:'neo'},{label:'joke',value:'joke'},{label:'lang',value:'lang'},{label:'blp',value:'blp'},{label:'npov',value:'npov'},{label:'not',value:'not'}]});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;}},evaluate:function(e){var form=e.target;var type=form.type.value;var section=form.section.value;var params={type:type};switch(type){case'approved':var article=form.article.value;params.tag='\{\{subst:afc accept'+(article?'|'+article:)+'\}\}';break;case'denied':var reason=form.reason.value;params.tag='\{\{subst:afc '+reason+'\}\}';break;case'archive':var approved=form.approved.checked;params.top='\{\{subst:afc top'+(approved?'|approved':)+'\}\}';params.bottom='\{\{subst:afc b\}\}';break;}Status.init(form);var query ={'title':wgPageName,'action':'submit','section':section};wikipedia_wiki=new Wikipedia.wiki('Processing',query,twinklecloser.callbacks.afc.edit);wikipedia_wiki.params=params;wikipedia_wiki.get;},edit:function(self){var form=self.responseXML.getElementById('editform');text=form.wpTextbox1.value;var summary;switch(self.params.type){case'approved':text+=self.params.tag+'\~\~\~\~';summary='Approving article';break;case'denied':text+=self.params.tag+'\~\~\~\~';summary='Denying article';break;case'archive':text=text.replace(/^(==.*?==)\n/,"$1\n"+self.params.top);text+=self.params.bottom;summary='Archiving';break;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':form.wpSummary.value+' '+summary+TwinkleConfig.summaryAd,'wpTextbox1':text};self.post(postData);}},afd: {submenu:function(e){var value=e.target.value;var root=e.target.form;var old_area=document.getElementById('work_area');var work_area=new QuickForm.element({type:'div',id:'work_area'});switch(value){case'keep':case'no consensus':break;case'redirect':work_area.append({type:'input',name:'target',label:'Target: ',tooltip:'the name of the page to redirect to'});break;case'merge':break;case'delete':work_area.append({type:'checkbox',list:[{label:'Delete? ',value:'delete',name:'del',tooltop:'if we should delete the page on the fly',checked:true}]});break;}work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);},evaluate:function(e){var form=e.target;var reason=form.reason.value;var type=form.type.value;var section=form.section.value;var page=form.page.value;var affected_page=form.affected_page.value;var params={type:type,page:page,reason:reason,affected_page:affected_page};var label;switch(type){case'keep':label="Keep";break;case 'no consensus':label="No consensus";break;case'redirect':label="Redirect";var target=form.target.value;break;case'merge':label="Merge";break;case'delete':label="Delete";var del=form.del.checked;break;}params.label=label;Status.init(form);if(type=='delete'){if(del){var query={'action':'query','list':'backlinks','blfilterredir':'redirects','bltitle':affected_page,'bllimit':5000};var wikipedia_api=new Wikipedia.api('Grabbing redirects',query,twinklecloser.callbacks.afd.deleteRedirectsMain);wikipedia_api.params=params;wikipedia_api.post;var query={'title':affected_page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting page',query,twinklecloser.callbacks.afd.deletePage);wikipedia_wiki.params=params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}}var query={'title':page,'action':'submit','section':section};wikipedia_wiki=new Wikipedia.wiki('Processing',query,twinklecloser.callbacks.afd.edit);wikipedia_wiki.params=params;wikipedia_wiki.get;},deleteRedirectsMain
 * }else if(wgCanonicalSpecialPageName=='Prefixindex'){var query={'action':'query','generator':'allpages','gapnamespace':QueryString.exists('namespace')?QueryString.get('namespace'):document.getElementById('namespace').value,'gapprefix':QueryString.exists('from')?QueryString.get('from').replace('+',' ').toUpperCaseFirstChar:document.getElementById('nsfrom').value.toUpperCaseFirstChar,'gaplimit':TwinkleConfig.batchMax,'prop':['revisions'],'rvprop':['size']}}else{var query={'action':'query','gpllimit':TwinkleConfig.batchMax,'generator':'links','titles':wgPageName,'prop':['revisions'],'rvprop':['size']};}var wikipedia_api=new Wikipedia.api('Grabbing pages',query,function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//page',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<snapshot.snapshotLength;++i){var object=snapshot.snapshotItem(i);var page=xmlDoc.evaluate('@title',object,null,XPathResult.STRING_TYPE,null).stringValue;var size=
 * function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var total=snapshot.snapshotLength*2;if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Deleting redirects','0%');var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}}

var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'delete'} var wikipedia_wiki=new Wikipedia.wiki("Deleting "+title,query,twinklecloser.callbacks.afd.deleteRedirects);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}},deleteRedirects:function(self){var form=this.responseXML.getElementById('deleteconfirm');var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Speedy deleted per (CSD R1), Redirect to deleted page \""+self.params.affected_page+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);},deletePage:function(self){var form=this.responseXML.getElementById('deleteconfirm');var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Deleted per outcome of WP:AFD discussion (see "+self.params.page+")."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);},edit:function(self){var form=self.responseXML.getElementById('editform');text=form.wpTextbox1.value;var summary="Closing discussion, result was \""+self.params.label+"\"";text="\{\{subst:Afd top\}\}"+self.params.label+" "+self.params.reason+". \~\~\~\~\n"+text+"\n\{\{subst:Afd bottom\}\}";var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':summary+TwinkleConfig.summaryAd,'wpTextbox1':text};self.post(postData);}}} Twinkle.init.moduleReady("twinklecloser",twinklecloser);function twinkledeli{if(wgNamespaceNumber<0||wgCurRevisionId==false){return;}if(userIsInGroup('sysop')){twAddPortletLink("javascript:twinkledeli.callback","Deli-batch","tw-deli","Delete file found on page","");if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}if(typeof(TwinkleConfig.deliChunks)=='undefined'){TwinkleConfig.deliChunks=500;}if(typeof(TwinkleConfig.deliMax)=='undefined'){TwinkleConfig.deliMax=5000;}}}twinkledeli.unlinkCache={};twinkledeli.callback=function twinklesdeliCallback{var Window=new SimpleWindow(800,400);Window.setTitle("Batch file deletion");var form=new QuickForm(twinkledeli.callback.evaluate);form.append({type:'checkbox',list:[{label:'Delete files',name:'delete_image',value:'delete',checked:true},{label:'Unlink uses of this file',name:'unlink_image',value:'unlink',checked:true}]});form.append({type:'textarea',name:'reason',label: 'Reason: '});if(wgNamespaceNumber==Namespace.CATEGORY){var query={'action':'query','generator':'categorymembers','gcmtitle':wgPageName,'gcmnamespace':Namespace.IMAGE,'gcmlimit':TwinkleConfig.deliMax,'prop':['imageinfo','categories','revisions'],'grvlimit':1,'grvprop':['user']};}else{var query={'action':'query','generator':'images','titles':wgPageName,'prop':['imageinfo','categories','revisions'],'gimlimit':'max',};}var wikipedia_api=new Wikipedia.api('Grabbing files',query,function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//page[@imagerepository="local"]',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<snapshot.snapshotLength;++i){var object=snapshot.snapshotItem(i);var image=xmlDoc.evaluate('@title',object,null,XPathResult.STRING_TYPE,null).stringValue;var user=xmlDoc.evaluate('imageinfo/ii/@user',object,null,XPathResult.STRING_TYPE,null).stringValue;var last_edit=xmlDoc.evaluate('revisions/rev/@user',object,null,XPathResult. STRING_TYPE,null).stringValue;var disputed=xmlDoc.evaluate('boolean(categories/cl[@title="Category:Contested candidates for speedy deletion"])',object,null,XPathResult.BOOLEAN_TYPE,null).booleanValue||user==last_edit;list.push({label:(i+1)+": "+image+' ('+user+')['+last_edit+']'+(disputed?' DISPUTED':''),value:image,checked:!disputed});}self.params.form.append({type:'checkbox',name:'images',list:list}) self.params.form.append({type:'submit'});var result=self.params.form.render;self.params.Window.setContent(result);});wikipedia_api.params={form:form,Window:Window};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinkledeli.currentDeleteCounter=0;twinkledeli.currentUnlinkCounter=0;twinkledeli.currentdeletor;twinkledeli.callback.evaluate=function twinkledeliCallbackEvaluate(event){wgPageName=wgPageName.replace(/_/g,' ');var images=event.target.getChecked('images');var reason=event.target.reason.value;var delete_image=event.target.delete_image.checked;var unlink_image=event.target.unlink_image.checked;if(!reason){return;}Status.init(event.target);function toCall(work){if(work.length==0&&twinkledeli.currentDeleteCounter<=0&&twinkledeli.currentUnlinkCounter<=0){Status.info('work done');window.clearInterval(twinkledeli.currentdeletor);Wikipedia.removeCheckpoint;return;}else if(twinkledeli.currentDeleteCounter<=0&&twinkledeli.currentUnlinkCounter<=0){twinkledeli.unlinkCache=[];var images=work.shift;twinkledeli.currentDeleteCounter=images.length;for(var i=0;i<images.length;++i){var image=images[i];var query={'action':'query','titles':image} var wikipedia_api=new Wikipedia.api('Checking if file '+image+' exists',query,twinkledeli.callbacks.main);wikipedia_api.params={image:image,reason:reason,unlink_image:unlink_image,delete_image:delete_image};wikipedia_api.post;}}}var work=images.chunk(TwinkleConfig.deliChunks);Wikipedia.addCheckpoint;twinkledeli.currentdeletor=window.setInterval(toCall,1000,work);} twinkledeli.callbacks={main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){self.params.image=normal;}var exists=xmlDoc.evaluate('boolean(//pages/page[@title="'+self.params.image.replace(/"/g,'\\"')+'" and not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("It seems that the page doesn't exists, perhaps it has already been deleted");return;}if(self.params.unlink_image){var query={'action':'query','list':'imageusage','titles':self.params.image,'iulimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing file links',query,twinkledeli.callbacks.unlinkImageInstancesMain);wikipedia_api.params=self.params;wikipedia_api.post;}if(self.params.delete_image){var query={'title':self.params.image,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting file '+self.params.image,query,twinkledeli. callbacks.deleteImage,function(self){--twinkledeli.currentDeleteCounter;var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);});wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}},deleteImage:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':"Deleted because \""+self.params.reason+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpDeleteReasonList':'other','wpReason':"Deleted because \""+self.params.reason+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}},unlinkImageInstancesMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//imageusage/iu/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){--twinklebatchdelete.currentUnlinkCounter;return;}var statusIndicator=new Status('Unlinking file instances ','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');--twinklebatchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');--twinklebatchdelete.currentUnlinkCounter;Wikipedia.removeCheckpoint;return;}self.params.total=total;self.params.obj=statusIndicator;self.params.current=0;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'} var wikipedia_wiki=new Wikipedia.wiki("Unlinking on "+title,query,twinkledeli.callbacks.unlinkImageInstances);var params=clone(self.params);params.title=title;wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get;}},unlinkImageInstances:function(self){var image=self.params.image.replace(/^(?:Image|File):/,);var form=self.responseXML.getElementById('editform');var text;if(self.params.title in twinkledeli.unlinkCache){text=twinkledeli.unlinkCache[self.params.title];}else{text=form.wpTextbox1.value;}var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.commentOutImage(image,'Commented out because image was deleted');text=wikiPage.getText;twinkledeli.unlinkCache[self.params.title]=text;if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':undefined,'wpStarttime':form. wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':'','wpSummary':'Removing instance of file '+image+" that has been deleted because \""+self.params.reason+"\")"+"; "+TwinkleConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);}} Twinkle.init.moduleReady("twinkledelimages",twinkledeli);function twinkleproddelete{if(wgNamespaceNumber!=Namespace.CATEGORY||!userIsInGroup('sysop')||!/^Category:Proposed_deletion_as_of/.test(wgPageName)){return;}twAddPortletLink("javascript:twinkleproddelete.callback","Deprod","tw-deprod","Delete prod pages found in this category","");if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}if(typeof(TwinkleConfig.proddeleteChunks)=='undefined'){TwinkleConfig.proddeleteChunks=50;}}function getChecked(nodelist){if(!(nodelist instanceof NodeList)){return nodelist.checked?[nodelist.value]:[];}var result=[];for(var i=0;i<nodelist.length;++i){if(nodelist[i].checked){result.push(nodelist[i].value);}}return result;}twinkleproddelete.unlinkCache={};twinkleproddelete.concerns={};twinkleproddelete.callback=function twinklesproddeleteCallback{var Window=new SimpleWindow(800,400);Window.setTitle("PROD cleaning");var form=new QuickForm (twinkleproddelete.callback.evaluate);var query={'action':'query','generator':'categorymembers','gcmtitle':wgPageName,'gcmlimit':5000,'prop':['categories','revisions'],'rvprop':['content']};var wikipedia_api=new Wikipedia.api('Grabbing pages',query,function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//page[@ns != "'+Namespace.IMAGE+'"]',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<snapshot.snapshotLength;++i){var object=snapshot.snapshotItem(i);var page=xmlDoc.evaluate('@title',object,null,XPathResult.STRING_TYPE,null).stringValue;var content=xmlDoc.evaluate('revisions/rev',object,null,XPathResult.STRING_TYPE,null).stringValue;var prod_re=/[Dd]ated[ _]prod/;var index=content.indexOf('\{\{dated prod');var concern=;if(index!=-1){var parsed=Mediawiki.Template.parse(content,index);var concern=parsed.parameters.concern||;}list.push({label:page+' ('+concern+')',value:page,checked:concern!=''});twinkleproddelete.concerns[page]= concern;}self.params.form.append({type:'checkbox',name:'pages',list:list}) self.params.form.append({type:'submit'});var result=self.params.form.render;self.params.Window.setContent(result);});wikipedia_api.params={form:form,Window:Window};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinkleproddelete.currentDeleteCounter=0;twinkleproddelete.currentUnlinkCounter=0;twinkleproddelete.currentdeletor;twinkleproddelete.callback.evaluate=function twinkleproddeleteCallbackEvaluate(event){wgPageName=wgPageName.replace(/_/g,' ');var pages=getChecked(event.target.pages);Status.init(event.target);function toCall(work){if(work.length==0){Status.info('work done');window.clearInterval(twinkleproddelete.currentdeletor);Wikipedia.removeCheckpoint;return;}else if(twinkleproddelete.currentDeleteCounter<=0||twinkleproddelete.currentUnlinkCounter<=0){twinkleproddelete.currentcounter=TwinkleConfig.proddeleteChunks;twinkleproddelete.unlinkCache=[];var pages=work.pop;for(var i=0;i<pages.length;++i){var page=pages[i];var query={'action':'query','prop':'revisions','rvprop':['content'],'rvlimit':1,'titles':page} var wikipedia_api=new Wikipedia.api('Checking if page '+page+' exists',query,twinkleproddelete.callbacks.main);wikipedia_api.params={page:page,reason:twinkleproddelete.concerns[page]};wikipedia_api.post;}}}var work=pages.chunk(TwinkleConfig.proddeleteChunks);Wikipedia.addCheckpoint;twinkleproddelete.currentdeletor=window.setInterval(toCall,1000,work);} twinkleproddelete.callbacks={main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){self.params.page=normal;}var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("It seems that the page doesn't exists, perhaps it has already been deleted");return;}var query={'action':'query','list':'backlinks','blfilterredir':'redirects','bltitle':self.params.page,'bllimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing redirects',query,twinkleproddelete.callbacks.deleteRedirectsMain);wikipedia_api.params=self.params;wikipedia_api.post;var query={'title':namespaces[1]+':'+self.params.page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting talk page of page'+self.params.page,query,twinkleproddelete.callbacks.deleteTalkPage);wikipedia_wiki. followRedirect=false;wikipedia_wiki.get;var query={'title':self.params.page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting page '+self.params.page,query,twinkleproddelete.callbacks.deletePage,function(self){--twinkleproddelete.currentDeleteCounter;var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);});wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;},deleteRedirectsMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var total=snapshot.snapshotLength*2;if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Deleting redirects','0%');var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'delete'} var wikipedia_wiki=new Wikipedia.wiki("Deleting "+title,query,twinkleproddelete.callbacks.deleteRedirects);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}},deleteRedirects:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpReason':"Speedy deleted per (CSD R1), Redirect to deleted page \""+self.params.page+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Speedy deleted per (CSD R1), Redirect to deleted page \""+self.params.page+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}self.post(postData);},deletePage:function(self){var form=this.responseXML.getElementById('deleteconfirm');var postData ={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Deleted because expired \[\[WP:PROD\]\]; Reason given: "+self.params.reason+"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);},deleteTalkPage:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);Wikipedia.actionCompleted;return;}var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpReason':"Deleted talk page of a page because expired \[\[WP:PROD\]\]."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}} Twinkle.init.moduleReady("twinkledeprod",twinkleproddelete);function twinklediff{if(wgNamespaceNumber<0){return;}var query={'title':wgPageName,'diff':'cur','oldid':'prev'};twAddPortletLink(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'Last','tw-lastdiff','Show most recent diff');if(!QueryString.exists('diff'))return;twAddPortletLink("javascript:twinklediff.evaluate(false);",'Since','tw-since','Show difference between last diff and the revision made by previous user');twAddPortletLink("javascript:twinklediff.evaluate(true);",'Since mine','tw-sincemine','Show difference between last diff and my last revision');var oldid=document.evaluate('substring-after(//div[@id="mw-diff-ntitle1"]/strong/a[1]/@href, "oldid=")',document,null,XPathResult.STRING_TYPE,null).stringValue;var query={'title':wgPageName,'diff':'cur','oldid':oldid};twAddPortletLink(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'Current','tw-curdiff','Show difference to current revision');} twinklediff.evaluate=function twinklediffEvaluate(me){var ntitle=getElementsByClassName(document.getElementById('bodyContent'),'td','diff-ntitle')[0];var user;if(me){user=wgUserName;}else{var node=document.getElementById('mw-diff-ntitle2');if(!node){return;}user=document.evaluate('a[1]',node,null,XPathResult.STRING_TYPE,null).stringValue;}var query={'prop':'revisions','action':'query','titles':wgPageName,'rvlimit':1,'rvprop':['ids','user'],'rvstartid':wgCurRevisionId-1,'rvuser':user};Status.init(document.getElementById('bodyContent'));var wikipedia_api=new Wikipedia.api('Grabbing data of initial contributor',query,twinklediff.callbacks.main);wikipedia_api.params={user:user};wikipedia_api.post;} twinklediff.callbacks={main:function(self){var xmlDoc=self.responseXML;var revid=xmlDoc.evaluate('//rev/@revid',xmlDoc,null,XPathResult.NUMBER_TYPE,null).numberValue;if(!revid){self.statelem.error('no suitable earlier revision found, or '+self.params.user+' is the only contributor. Aborting.');return;}var query={'title':wgPageName,'oldid':revid,'diff':wgCurRevisionId};window.location=mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query);}} Twinkle.init.moduleReady("twinklediff",twinklediff);twinklefluff={auto:function{if(QueryString.get('oldid')!=wgCurRevisionId){return;}var ntitle=getElementsByClassName(document.getElementById('bodyContent'),'td','diff-ntitle')[0];if(ntitle.getElementsByTagName('a')[0].firstChild.nodeValue.indexOf('Current revision')!=0){return;}vandal=ntitle.getElementsByTagName('a')[3].firstChild.nodeValue;if(!TwinkleConfig.openTalkPageOnAutoRevert){TwinkleConfig.openTalkPage=[];}return twinklefluff.revert(QueryString.get('twinklerevert'),vandal);},normal:function{var spanTag=function(color,content){var span=document.createElement('span');span.style.color=color;span.appendChild(document.createTextNode(content));return span;} if(wgNamespaceNumber==-1&&wgCanonicalSpecialPageName=="Contributions"){username=document.evaluate('substring-after(//div[@id="contentSub"]//a[@title="Special:Log"][last]/@href, "user=")',document,null,XPathResult.STRING_TYPE,null).stringValue;if(TwinkleConfig.showRollbackLinks.indexOf('contribs')!=-1||(wgUserName!=username&&TwinkleConfig.showRollbackLinks.indexOf('others')!=-1)||(wgUserName==username&&TwinkleConfig.showRollbackLinks.indexOf('mine')!=-1)){var list=document.evaluate('//div[@id="bodyContent"]//ul/li[contains(span[@class="mw-uctop"], "(top)")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var vandal=document.evaluate('//div[@id="contentSub"]/a[1]/@title',document,null,XPathResult.STRING_TYPE,null).stringValue.replace(/^User( talk)?:/,'').replace("'","\\'");var revNode=document.createElement('strong');var revLink=document.createElement('a');revLink.appendChild(spanTag('Black',' ['));revLink.appendChild(spanTag('SteelBlue','rollback'));revLink.appendChild( spanTag('Black',']'));revNode.appendChild(revLink);var revVandNode=document.createElement('strong');var revVandLink=document.createElement('a');revVandLink.appendChild(spanTag('Black',' ['));revVandLink.appendChild(spanTag('Red','vandalism'));revVandLink.appendChild(spanTag('Black',']'));revVandNode.appendChild(revVandLink);for(var i=0;i<list.snapshotLength;++i){var current=list.snapshotItem(i);var href=document.evaluate('a[2]/@href',current,null,XPathResult.STRING_TYPE,null).stringValue;var tmpNode=revNode.cloneNode(true);tmpNode.firstChild.setAttribute('href',href+'&'+QueryString.create({'twinklerevert':'norm'}));current.appendChild(tmpNode);var tmpNode=revVandNode.cloneNode(true);tmpNode.firstChild.setAttribute('href',href+'&'+QueryString.create({'twinklerevert':'vand'}));current.appendChild(tmpNode);}}}else{if(wgCanonicalSpecialPageName=="Special:Undelete"){return;}var body=document.getElementById('bodyContent');var firstRev=document.evaluate( 'boolean(/div[@class="firstrevisionheader"])',body,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(firstRev){return;}try{var otitle1=document.getElementById('mw-diff-otitle1');var ntitle1=document.getElementById('mw-diff-ntitle1');if(!otitle1||!ntitle1)return;var otitle=otitle1.parentNode;var ntitle=ntitle1.parentNode;}catch(e){return;}var old_rev_url=document.evaluate('//div[@id="mw-diff-otitle1"]//strong/a/@href',document,null,XPathResult.STRING_TYPE,null).stringValue;var query=new QueryString(old_rev_url.split('?',2)[1]);var oldrev=query.get('oldid');var revertToRevision=document.createElement('div');revertToRevision.setAttribute('id','tw-revert-to-orevision');revertToRevision.style.fontWeight='bold';var revertToRevisionLink=revertToRevision.appendChild(document.createElement('a'));revertToRevisionLink.href="javascript:twinklefluff.revertToRevision('"+oldrev+"')";revertToRevisionLink.appendChild(spanTag('Black','['));revertToRevisionLink.appendChild(spanTag('SaddleBrown', 'restore this version'));revertToRevisionLink.appendChild(spanTag('Black',']'));otitle.insertBefore(revertToRevision,otitle.firstChild);if(document.getElementById('differences-nextlink')){curVersion=false;var new_rev_url=document.evaluate('//div[@id="mw-diff-ntitle1"]//strong/a/@href',document,null,XPathResult.STRING_TYPE,null).stringValue;var query=new QueryString(new_rev_url.split('?',2)[1]);var newrev=query.get('oldid');var revertToRevision=document.createElement('div');revertToRevision.setAttribute('id','tw-revert-to-nrevision');revertToRevision.style.fontWeight='bold';var revertToRevisionLink=revertToRevision.appendChild(document.createElement('a'));revertToRevisionLink.href="javascript:twinklefluff.revertToRevision('"+newrev+"')";revertToRevisionLink.appendChild(spanTag('Black','['));revertToRevisionLink.appendChild(spanTag('SaddleBrown','restore this version'));revertToRevisionLink.appendChild(spanTag('Black',']'));ntitle.insertBefore(revertToRevision,ntitle.firstChild);return;} if(TwinkleConfig.showRollbackLinks.indexOf('diff')!=-1){vandal=document.evaluate('a',document.getElementById('mw-diff-ntitle2'),null,XPathResult.STRING_TYPE,null).stringValue.replace("'","\\'");var revertNode=document.createElement('div');revertNode.setAttribute('id','tw-revert');var agfNode=document.createElement('strong');var vandNode=document.createElement('strong');var normNode=document.createElement('strong');var agfLink=document.createElement('a');var vandLink=document.createElement('a');var normLink=document.createElement('a');agfLink.href="javascript:twinklefluff.revert('agf', '"+vandal+"')";vandLink.href="javascript:twinklefluff.revert('vand' , '"+vandal+"')";normLink.href="javascript:twinklefluff.revert('norm' , '"+vandal+"')";agfLink.appendChild(spanTag('Black','['));agfLink.appendChild(spanTag('DarkOliveGreen','rollback (AGF)'));agfLink.appendChild(spanTag('Black',']'));vandLink.appendChild(spanTag('Black','['));vandLink.appendChild(spanTag('Red','rollback (VANDAL)')); vandLink.appendChild(spanTag('Black',']'));normLink.appendChild(spanTag('Black','['));normLink.appendChild(spanTag('SteelBlue','rollback'));normLink.appendChild(spanTag('Black',']'));agfNode.appendChild(agfLink);vandNode.appendChild(vandLink);normNode.appendChild(normLink);revertNode.appendChild(agfNode);revertNode.appendChild(document.createTextNode(' || '));revertNode.appendChild(normNode);revertNode.appendChild(document.createTextNode(' || '));revertNode.appendChild(vandNode);ntitle.insertBefore(revertNode,ntitle.firstChild);}}}} twinklefluff.revert=function revertPage(type,vandal,rev,page){wgPageName=page||wgPageName;wgCurRevisionId=rev||wgCurRevisionId;Status.init(document.getElementById('bodyContent'));var params={type:type,user:vandal} var query={'action':'query','prop':['info','revisions'],'titles':wgPageName,'rvlimit':50,'rvprop':['ids','timestamp','user','comment'],'intoken':'edit'} var wikipedia_api=new Wikipedia.api('Grabbing data of earlier revisions',query,twinklefluff.callbacks.main);wikipedia_api.params=params;wikipedia_api.post;} twinklefluff.revertToRevision=function revertToRevision(oldrev){Status.init(document.getElementById('bodyContent'));var query={'action':'query','prop':['info','revisions'],'titles':wgPageName,'rvlimit':1,'rvstartid':oldrev,'rvprop':['ids','timestamp','user','comment'],'intoken':'edit','format':'xml'} var wikipedia_api=new Wikipedia.api('Grabbing data of the earlier revision',query,twinklefluff.callbacks.toRevision.main);wikipedia_api.params={rev:oldrev};wikipedia_api.post;} twinklefluff.userIpLink=function(user){return(isIPAddress(user)?""+user+"";} twinklefluff.callbacks={toRevision:{main:function(self){var xmlDoc=self.responseXML;var lastrevid=$(xmlDoc).find('page').attr('lastrevid');var touched=$(xmlDoc).find('page').attr('touched');var starttimestamp=$(xmlDoc).find('page').attr('starttimestamp');var edittoken=$(xmlDoc).find('page').attr('edittoken');var revertToRevID=$(xmlDoc).find('rev').attr('revid');var revertToUser=$(xmlDoc).find('rev').attr('user');if(revertToRevID!=self.params.rev){self.statitem.error('The retrieved rev does not match the requested rev. Aborting.');return;}var optional_summary=prompt("Please, if possible, specify a reason for the revert");if(optional_summary==null){self.statelem.error('Aborted by user.');return;}var summary=sprintf("Reverted to revision %d by %s%s.%s",revertToRevID,revertToUser,optional_summary?"; "+optional_summary:'',TwinkleConfig.summaryAd);var query={'action':'edit','title':wgPageName,'summary':summary,'token':edittoken,'undo':lastrevid,'undoafter':revertToRevID,'basetimestamp': touched,'starttimestamp':starttimestamp,'watchlist':TwinkleConfig.watchRevertedPages.indexOf(self.params.type)!=-1?'watch':undefined,'minor':TwinkleConfig.markRevertedPagesAsMinor.indexOf(self.params.type)!=-1?true:undefined};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Reversion completed";var wikipedia_api=new Wikipedia.api('Saving reverted contents',query,twinklefluff.callbacks.toRevision.complete,self.statelem);wikipedia_api.params=self.params;wikipedia_api.post;},complete:function(self){}},main:function(self){var xmlDoc=self.responseXML;var lastrevid=$(xmlDoc).find('page').attr('lastrevid');var touched=$(xmlDoc).find('page').attr('touched');var starttimestamp=$(xmlDoc).find('page').attr('starttimestamp');var edittoken=$(xmlDoc).find('page').attr('edittoken');var lastuser=$(xmlDoc).find('rev').attr('user');var revs=xmlDoc.evaluate('//rev',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);if(revs.snapshotLength<1){self.statitem.error( 'We have less than one additional revision, thus impossible to revert');return;}var top=revs.snapshotItem(0);if(lastrevid<wgCurRevisionId){Status.error('Error',['The received top revision id ',htmlNode('strong',lastrevid),' is less than our current revision id, this could indicate that the current revision has been deleted, the server is lagging, or that bad data has been received. Will stop proceeding at this point.']);return;}var index=1;if(wgCurRevisionId!=lastrevid){Status.warn('Warning',['Latest revision ',htmlNode('strong',lastrevid),' doesn\'t equal our revision ',htmlNode('strong',wgCurRevisionId)]);if(lastuser==self.params.user){switch(self.params.type){case'vand':Status.info('Info',['Latest revision was made by ',htmlNode('strong',self.params.user),', as we assume vandalism, we continue to revert']);break;case'agf':Status.warn('Warning',['Latest revision was made by ',htmlNode('strong',self.params.user), ', as we assume good faith, we stop reverting, as the problem might have been fixed.']);return;default:Status.warn('Notice',['Latest revision was made by ',htmlNode('strong',self.params.user),', but we will stop reverting anyway.']);return;}}else if(self.params.type=='vand'&&twinklefluff.whiteList.indexOf(top.getAttribute('user'))!=-1&&revs.snapshotLength>1&&revs.snapshotItem(1).getAttribute('pageId')==wgCurRevisionId){Status.info('Info',['Latest revision was made by ',htmlNode('strong',lastuser),', a trusted bot, and the revision before was made by our vandal, so we proceed with the revert.']);index=2;}else{Status.error('Error',['Latest revision was made by ',htmlNode('strong',lastuser),', so it might have already been reverted, stopping  reverting.']);return;}}if(twinklefluff.whiteList.indexOf(self.params.user)!=-1){switch(self.params.type){case'vand':Status.info('Info',['Vandalism revert was chosen on ',htmlNode('strong',self.params.user), ', as this is a whitelisted bot, we assume you wanted to revert vandalism made by the previous user instead.']);index=2;vandal=revs.snapshotItem(1).getAttribute('user');self.params.user=revs.snapshotItem(1).getAttribute('user');break;case'agf':Status.warn('Notice',['Good faith revert was chosen on ',htmlNode('strong',self.params.user),', as this is a whitelisted bot, it makes no sense at all to revert it as a good faith edit, will stop reverting.']);return;break;case'norm':default:var cont=confirm('Normal revert was chosen, but the top user ('+self.params.user+') is a whitelisted bot, do you want to revert the revision before instead?');if(cont){Status.info('Info',['Normal revert was chosen on ',htmlNode('strong',self.params.user),', as this is a whitelisted bot, and per confirm, we\'ll revert the previous revision instead.']);index=2;self.params.user=revs.snapshotItem(1).getAttribute('user');}else{Status.warn('Notice',['Normal revert was chosen on ',htmlNode('strong',self.params.user) ,', this is a whitelisted bot, but per confirmation, revert on top revision will proceed.']);}break;}}var found=false;var count=0;for(var i=index;i<revs.snapshotLength;++i){++count;if(revs.snapshotItem(i).getAttribute('user')!=self.params.user){found=i;break;}}if(!found){self.statelem.error(['No previous revision found, perhaps ',htmlNode('strong',self.params.user),' is the only contributor, or that the user has made more than '+TwinkleConfig.revertMaxRevisions+' edits in a row.']);return;}if(count==0){Status.error('Error',"We were to revert zero revisions. As that makes no sense, we'll stop reverting this time. It could be that the edit already have been reverted, but the revision id was still the same.");return;}var good_revision=revs.snapshotItem(found);if(self.params.type!='vand'&&count>1&&!confirm(self.params.user+' has done '+count+' edits in a row. Are you sure you want to revert them all?')){Status.info('Notice','Stopping reverting per user input');return;}self.params.count= count;self.params.goodid=good_revision.getAttribute('revid');self.params.gooduser=good_revision.getAttribute('user');self.statelem.status([' revision ',htmlNode('strong',self.params.goodid),' that was made ',htmlNode('strong',count),' revisions ago by ',htmlNode('strong',self.params.gooduser)]);var summary;switch(self.params.type){case'agf':var extra_summary=prompt("An optional comment for the edit summary:");if(extra_summary==null){self.statelem.error('Aborted by user.');return;}summary=sprintf("Reverted good faith edits by %1$s (talk)%s%s",self.params.user.replace("\\'","'"),twinklefluff.formatSummaryPostfix(extra_summary),TwinkleConfig.summaryAd);break;case'vand':summary=sprintf("Reverted %d %s by %3$s (talk) identified as vandalism to last revision by %s.%s",self.params.count,self.params.count>1?'edits':'edit',self.params.user.replace("\\'","'"),self.params. gooduser.replace("\\'","'"),TwinkleConfig.summaryAd);break;case'norm':if(TwinkleConfig.offerReasonOnNormalRevert){var extra_summary=prompt("An optional comment for the edit summary:");if(extra_summary==null){self.statelem.error('Aborted by user.');return;}}summary=sprintf("Reverted %d %s by %3$s (talk)%s%s",self.params.count,self.params.count>1?'edits':'edit',self.params.user.replace("\\'","'"),twinklefluff.formatSummaryPostfix(extra_summary),TwinkleConfig.summaryAd);}if(TwinkleConfig.openTalkPage.indexOf(self.params.type)!=-1){Status.info('Info',['Opening user talk page edit form for user ',htmlNode('strong',self.params.user)]);var query={'title':'User talk:'+self.params.user,'action':'edit','preview':'yes','vanarticle':wgPageName.replace(/_/g,' '),'vanarticlerevid':wgCurRevisionId,'vanarticlegoodrevid':self.params.goodid,'type':self.params.type,'count':self.params.count};switch(TwinkleConfig.userTalkPageMode){case'tab':window.open( mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_tab');break;case'blank':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_blank','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;case'window':default:window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'twinklewarnwindow','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;}}var query={'action':'edit','title':wgPageName,'summary':summary,'token':edittoken,'undo':lastrevid,'undoafter':self.params.goodid,'basetimestamp':touched,'starttimestamp':starttimestamp,'watchlist':TwinkleConfig.watchRevertedPages.indexOf(self.params.type)!=-1?'watch':undefined,'minor':TwinkleConfig.markRevertedPagesAsMinor.indexOf(self.params.type)!=-1?true:undefined};Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Reversion completed";var wikipedia_api=new Wikipedia.api( 'Saving reverted contents',query,twinklefluff.callbacks.complete,self.statelem);wikipedia_api.params=self.params;wikipedia_api.post;},complete:function(self){}} twinklefluff.formatSummaryPostfix=function(stringToAdd){if(stringToAdd){stringToAdd='; '+stringToAdd.toUpperCaseFirstChar;if(stringToAdd.search(/[.?!;]$/)==-1){stringToAdd=stringToAdd+'.';}return stringToAdd;}else{return'.';}} function twinklefluffinit{if(Twinkle.authorizedUser){if(typeof(TwinkleConfig.revertMaxRevisions)=='undefined'){TwinkleConfig.revertMaxRevisions=50;}if(typeof(TwinkleConfig.userTalkPageMode)=='undefined'){TwinkleConfig.userTalkPageMode='window';}if(typeof(TwinkleConfig.openTalkPage)=='undefined'){TwinkleConfig.openTalkPage=['agf','norm','vand'];}if(typeof(TwinkleConfig.openTalkPageOnAutoRevert)=='undefined'){TwinkleConfig.openTalkPageOnAutoRevert=false;}if(typeof(TwinkleConfig.markRevertedPagesAsMinor)=='undefined'){TwinkleConfig.markRevertedPagesAsMinor=['vand'];}if(typeof(TwinkleConfig.watchRevertedPages)=='undefined'){TwinkleConfig.watchRevertedPages=['agf','norm','vand','torev'];}if(typeof(TwinkleConfig.offerReasonOnNormalRevert)=='undefined'){TwinkleConfig.offerReasonOnNormalRevert=true;}if(typeof(TwinkleConfig.showRollbackLinks)=='undefined'){TwinkleConfig.showRollbackLinks=['diff','others'];}twinklefluff.whiteList=['HagermanBot','SineBot','HBC AIV helperbot', 'HBC AIV helperbot2','HBC AIV helperbot3',] if(QueryString.exists('twinklerevert')){twinklefluff.auto;}else{twinklefluff.normal;}}};Twinkle.init.moduleReady("twinklefluff",twinklefluffinit);function twinkleimage{if(wgNamespaceNumber==6&&!(document.getElementById("mw-sharedupload"))){twAddPortletLink((Twinkle.authorizedUser?"javascript:twinkleimage.callback":'javascript:alert("Your account is too new to use Twinkle.");'),"DI","tw-di","Nominate file for relative speedy deletion","");if(typeof(TwinkleConfig.notifyUserOnDeli)=='undefined'){TwinkleConfig.notifyUserOnDeli=true;}if(typeof(TwinkleConfig.deliWatchPage)=='undefined'){TwinkleConfig.deliWatchPage="default";}if(typeof(TwinkleConfig.deliWatchUser)=='undefined'){TwinkleConfig.deliWatchUser="default";}}}twinkleimage.callback=function twinkleimageCallback{var Window=new SimpleWindow(600,300);Window.setTitle("File for pseudo-speedy deletion");var form=new QuickForm(twinkleimage.callback.evaluate);form.append({type:'checkbox',list:[{label:'Notify original uploader',value
 * 'notify',name:'notify',tooltip:"Uncheck this if you are planning to make multiple nominations from the same user, and don't want to overload their talk page with too many notifications.",checked:TwinkleConfig.notifyUserOnDeli}]});var field=form.append({type:'field',label:'Type of action wanted'});field.append({type:'radio',name:'type',event:twinkleimage.callback.choice,list:[{label:'No source (CSD F4)',value:'no source',checked:true,tooltip:'Image or media has no source information'},{label:'No license (CSD F4)',value:'no license',tooltip:'Image or media does not have information on its copyright status'},{label:'No source and no license (CSD F4)',value:'no source no license',tooltip:'Image or media has neither information on source nor its copyright status'},{label:'Orphaned fair use (CSD F5)',value:'orphaned fair use',tooltip:

'Image or media is unlicensed for use on Wikipedia and allowed only under a claim of fair use per Wikipedia:Non-free content, but it is not used in any articles'},{label:'No fair use rationale (CSD F6)',value:'no fair use rationale',tooltip:'Image or media is claimed to be used under Wikipedia\'s fair use policy but has no explanation as to why it is permitted under the policy'},{label:'Disputed fair use rationale (CSD F7)',value:'disputed fair use rationale',tooltip:'Image or media has a fair use rationale that is disputed'},{label:'Replaceable fair use (CSD F7)',value:'replaceable fair use',tooltip:'Image or media may fail Wikipedia\'s first non-free content criterion (WP:NFCC) in that it illustrates a subject for which a free image might reasonably be found or created that adequately provides the same information'},{label:'No permission (CSD F11)',value:'no permission',tooltip:'Image or media does not have proof that the author agreed to licence the file'}]});form.append({type
 * 'div',label:'Work area',name:'work_area'});var result=form.render;Window.setContent(result);Window.display;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.type[0].dispatchEvent(evt);}

twinkleimage.callback.choice=function twinkleimageCallbackChoose(event){var value=event.target.value;var root=event.target.form;var work_area=new QuickForm.element({type:'div',name:'work_area'});switch(value){case'no source no license':case'no source':work_area.append({type:'checkbox',name:'non_free',list:[{label:'Non-free',tooltip:'Image is licensed under a fair use claim'}]});break;case'no permission':work_area.append({type:'input',name:'source',label:'Source: '});break;case'disputed fair use rationale':work_area.append({type:'textarea',name:'reason',label:'Concern: '});break;case'orphaned fair use':work_area.append({type:'input',name:'replacement',label:'Replacement: '});break;case'replaceable fair use':work_area.append({type:'checkbox',name:'old_image',list:[{label:'Old image',tooltip:'Image was uploaded before 2006-07-13'}]});break;default:break;};work_area.append({type:'submit'});work_area=work_area.render;root.replaceChild(work_area,root.lastChild);} twinkleimage.callback.evaluate=function twinkleimageCallbackEvaluate(event){wgPageName=wgPageName.replace(/_/g,' ');var notify=event.target.notify.checked;var types=event.target.type;for(var i=0;i<types.length;++i){if(types[i].checked){var type=types[i].value;break;}}if(event.target.non_free){var non_free=event.target.non_free.checked;}if(event.target.source){var source=event.target.source.value;}if(event.target.reason){var reason=event.target.reason.value;}if(event.target.replacement){var replacement=event.target.replacement.value;}if(event.target.old_image){var old_image=event.target.old_image.checked;}var params={type:type,non_free:non_free,source:source,reason:reason,replacement:replacement,old_image:old_image};Status.init(event.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Tagging complete";var wikipedia_page=new Wikipedia.page(wgPageName,'Tagging file with deletion tag');wikipedia_page.setCallbackParameters(params);wikipedia_page.load( twinkleimage.callbacks.taggingImage);if(notify){wikipedia_page.lookupCreator(twinkleimage.callbacks.userNotification);}else{var noteData=document.createElement('pre');noteData.appendChild(document.createTextNode("\{\{subst:di-"+type+"-notice|1="+wgTitle+"\}\} \~\~\~\~"));Status.info('Notification',['Following/similar data should be posted to the original uploader:',document.createElement('br'),noteData]);}} twinkleimage.callbacks={taggingImage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var tag="\{\{di-"+params.type+"|date=\{\{subst:#time:j F Y\}\}";var csdcrit="";switch(params.type){case'no source no license':case'no source':tag+=params.non_free?"|non-free=yes":"";csdcrit="F4";break;case'no permission':tag+=params.source?"|source="+params.source:"";csdcrit="F11";break;case'disputed fair use rationale':tag+=params.reason?"|concern="+params.reason:"";csdcrit="F7";break;case'orphaned fair use':tag+=params.replacement?"|replacement="+params.replacement:"";csdcrit="F5";break;case'replaceable fair use':tag+=params.old_image?"|old image=yes":"";csdcrit="F7";break;case'no license':csdcrit="F4";break;case'no fair use rationale':csdcrit="F6";break;default:break;};tag+="\}\}\n";pageobj.setPageText(tag+text);pageobj.setEditSummary("This file is up for deletion, per CSD "+csdcrit+" ("+params.type+")."+TwinkleConfig.summaryAd); switch(TwinkleConfig.deliWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('nocreate');pageobj.save;},userNotification:function(pageobj){var params=pageobj.getCallbackParameters;var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:di-"+params.type+"-notice|1="+wgTitle+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: tagging for deletion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.deliWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect( true);usertalkpage.append;}} Twinkle.init.moduleReady("twinkleimage",twinkleimage);function twinkleimagetraverse{if(userIsInGroup('sysop')&&wgNamespaceNumber==Namespace.CATEGORY){twAddPortletLink("javascript:twinkleimagetraverse.callback","Traverse","tw-imagetraverse","Traverse category","");if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}}}twinkleimagetraverse.basequery={'action':'query','generator':'categorymembers','gcmtitle':wgPageName,'gcmnamespace':Namespace.IMAGE,'gcmlimit':1,'prop':['imageinfo','categories','revisions'],'rvlimit':20,'iihistory':true,'rvprop':['user','size','flags','ids','comment','timestamp'],'iiprop':['timestamp','user','url','size','comment']};twinkleimagetraverse.callback=function{var Window=new SimpleWindow(1200,650);Window.setTitle("Image traverse");var form=new QuickForm(twinkleimagetraverse.callback.evaluate);form.append({type:'button',label:'Skip',event:twinkleimagetraverse.callbacks.skip});form.append({type: 'button',label:'Delete',event:twinkleimagetraverse.callbacks.deleteMain});form.append({type:'input',label:'Reason',name:'reason',value:'Speedy deleted',size:80});form.append({type:'checkbox',list:[{label:'Remove image instances to the image',name:'unlink',value:'unlink',checked:true}]});var root=document.createElement('table');root.style.background='transparent';root.style.height='780px';var row=root.appendChild(document.createElement('tr'));var options=row.appendChild(document.createElement('td'));options.setAttribute('colspan',2);var rendered=form.render;options.appendChild(rendered);rendered.root=root;options.style.borderBottom='1px solid gray';options.style.height='80px';var row=root.appendChild(document.createElement('tr'));var oview=row.appendChild(document.createElement('td'));var ohistbox=row.appendChild(document.createElement('td'));ohistbox.style.width='250px';ohistbox.style.verticalAlign='top';var histbox=ohistbox.appendChild(document.createElement('div'));histbox.style. overflow='auto';histbox.style.height='500px';oview.style.verticalAlign='top';var view=oview.appendChild(document.createElement('div'));view.style.height='500px';view.style.overflow='auto';var row=root.appendChild(document.createElement('tr'));var ostatus=row.appendChild(document.createElement('td'));ostatus.style.borderTop='1px solid gray';ostatus.setAttribute('colspan',2);var status=ostatus.appendChild(document.createElement('div'));ostatus.style.verticalAlign='top';status.style.height='180px';status.style.overflow='auto';Wikipedia.actionCompleted.event=function{} var wikipedia_api=new Wikipedia.api('Grabbing images',twinkleimagetraverse.basequery,twinkleimagetraverse.callbacks.main);wikipedia_api.params={root:root,view:view,histbox:histbox,status:status,Window:Window};root.params=wikipedia_api.params;wikipedia_api.post;Status.init(status);Window.setContent(root);Window.display;} twinkleimagetraverse.callback.evaluate=function{} function make_wikilink(page,title,oldid,diff){var query={'title':page,'diff':diff,'oldid':oldid} var url=wgScriptPath+'/index.php?'+QueryString.create(query);var a=document.createElement('a');a.setAttribute('href',url);a.setAttribute('title',page);a.appendChild(document.createTextNode(title));return a;}twinkleimagetraverse.callbacks={main:function(self){var xmlDoc=self.responseXML;var image=xmlDoc.evaluate('//pages/page/@title',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(!image){alert('no more images');return;}var next=xmlDoc.evaluate('//query-continue/categorymembers/@gcmcontinue',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var pagehistory=xmlDoc.evaluate('//pages/page/revisions/rev',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var filehistory=xmlDoc.evaluate('//pages/page/imageinfo/ii',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var categories=xmlDoc.evaluate('//pages/page/categories/cl',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var pagehistorylist=document.createElement('ul');var filehistorylist=document. createElement('ul');var categorylist=document.createElement('ul');var entry=document.createElement('li');for(var i=0;i<pagehistory.snapshotLength;++i){var cur=pagehistory.snapshotItem(i);var tmp=entry.cloneNode(false);tmp.appendChild(make_wikilink(image,cur.getAttribute('timestamp'),cur.getAttribute('revid')));tmp.appendChild(document.createTextNode(' '));tmp.appendChild(make_wikilink('User:'+cur.getAttribute('user'),cur.getAttribute('user')));tmp.appendChild(document.createTextNode(' \('+(new Bytes(cur.getAttribute('size'))).toString+'\) \('));tmp.appendChild(document.createElement('em')).appendChild(document.createTextNode(cur.getAttribute('comment')));tmp.appendChild(document.createTextNode('\)'));pagehistorylist.appendChild(tmp);}for(var i=0;i<filehistory.snapshotLength;++i){var cur=filehistory.snapshotItem(i);var tmp=entry.cloneNode(false);var link=document.createElement('a');link.setAttribute('href',cur.getAttribute('url'));link.appendChild(document.createTextNode(cur. getAttribute('timestamp')));tmp.appendChild(link);tmp.appendChild(document.createTextNode(' '));tmp.appendChild(make_wikilink('User:'+cur.getAttribute('user'),cur.getAttribute('user')));tmp.appendChild(document.createTextNode(' \('+(new Bytes(cur.getAttribute('size'))).toString+'\) \('));tmp.appendChild(document.createElement('em')).appendChild(document.createTextNode(cur.getAttribute('comment')));tmp.appendChild(document.createTextNode('\)'));filehistorylist.appendChild(tmp);}for(var i=0;i<categories.snapshotLength;++i){var cur=categories.snapshotItem(i);var tmp=entry.cloneNode(false);tmp.appendChild(make_wikilink(cur.getAttribute('title'),cur.getAttribute('title').replace(/Category:/,'')));categorylist.appendChild(tmp);}self.params.next=next;self.params.image=image;var hist=self.params.histbox;while(hist.hasChildNodes){hist.removeChild(hist.lastChild);}hist.appendChild(document.createElement('h2')).appendChild(document.createTextNode('Image usage'));var placeholder=hist. appendChild(document.createElement('div'));placeholder.appendChild(document.createTextNode('Grabbing data...'));self.params.imageusageplaceholder=placeholder;hist.appendChild(document.createElement('h2')).appendChild(document.createTextNode('Page history'));hist.appendChild(pagehistorylist);hist.appendChild(document.createElement('h2')).appendChild(document.createTextNode('File history'));hist.appendChild(filehistorylist);hist.appendChild(document.createElement('h2')).appendChild(document.createTextNode('Categories'));hist.appendChild(categorylist);var query={'action':'parse','title':image,'text':'\{\{Wikipedia:WikiProject User scripts/Scripts/Twinkle/Template|'+image.replace(/^File:/,'')+'\}\}','prop':'text'} var wikipedia_api=new Wikipedia.api('Rendering',query,twinkleimagetraverse.callbacks.render1);wikipedia_api.params=self.params;wikipedia_api.post;},render1:function(self){var xmlDoc=self.responseXML;var html=xmlDoc.evaluate('//parse/text',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;self.params.view.innerHTML=html;var query={'action':'query','list':'imageusage','iutitle':self.params.image,'iulimit':20,'iufilterredir':'nonredirects'} var wikipedia_api=new Wikipedia.api('Rendering',query,twinkleimagetraverse.callbacks.render2);wikipedia_api.params=self.params;wikipedia_api.post;},render2:function(self){var xmlDoc=self.responseXML;var usage=xmlDoc.evaluate('//imageusage/iu',xmlDoc,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var usagelist=document.createElement('ul');var entry=document.createElement('li');for(var i=0;i<usage.snapshotLength;++i){var cur=usage.snapshotItem(i);var tmp=entry.cloneNode(false);tmp.appendChild(make_wikilink(cur.getAttribute('title'),cur.getAttribute('title')));usagelist.appendChild(tmp);}var hist=self.params.histbox;hist.replaceChild(usagelist,self.params.imageusageplaceholder);},next:function(params){twinkleimagetraverse.basequery['gcmcontinue']=params.next;var wikipedia_api=new Wikipedia.api('Grabbing images',twinkleimagetraverse.basequery,twinkleimagetraverse.callbacks.main);wikipedia_api.params=params;wikipedia_api.post;},skip:function(event){var form=event.target.form;var params=form.root.params;twinkleimagetraverse.callbacks.next(params);Status.info('Skipped',params.image);},deleteMain:function(event){var form=event.target.form;var params=form.root.params;params.reason=form.reason.value;if(form.unlink.checked){var query={'action':'query','list':'imageusage','titles':params.image,'iulimit':5000,'iufilterredir':'nonredirects'};var wikipedia_api=new Wikipedia.api('Grabbing image links',query,twinkleimagetraverse.callbacks.unlinkImageInstancesMain);wikipedia_api.params=params;wikipedia_api.post;}var query={'title':params.image,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting image '+params.image,query,twinkleimagetraverse.callbacks.deleteImage,function(self){twinkleimagetraverse.callbacks.next(self.params);self.statelem.unlink;Status.info('Deleted',self.params.image);});wikipedia_wiki.params=params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;},deleteImage:function(self){var form=this.responseXML.getElementById( 'deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':"Deleted because \""+self.params.reason+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpDeleteReasonList':'other','wpReason':"Deleted because \""+self.params.reason+"\"."+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}},unlinkImageInstancesMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//imageusage/iu/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Unlinking instances image','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}self.params.total=total;self.params.obj=statusIndicator;self.params.current=0;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'} var wikipedia_wiki=new Wikipedia.wiki("Unlinking on "+title,query,twinkleimagetraverse.callbacks.unlinkImageInstances);var params=clone(self.params);params.title=title;wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get;}},unlinkImageInstances:function(self){var image=self.params.image.replace(/^File:/,);var form=self.responseXML.getElementById('editform');var text;if(self.params.title in twinkledeli.unlinkCache){text=twinkledeli.unlinkCache[self.params.title];}else{text=form.wpTextbox1.value;}var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.commentOutImage(image,'Commented out because image was deleted');text=wikiPage.getText;twinkledeli.unlinkCache[self.params.title]=text;if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':undefined,'wpStarttime':form. wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':'Removing instance of image '+image+" that has been deleted because \""+self.params.reason+"\")"+"; "+TwinkleConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);}} Twinkle.init.moduleReady("twinkleimagetraverse",twinkleimagetraverse);function twinkleprod{if(wgNamespaceNumber!=0||wgCurRevisionId==false){return;}if(Twinkle.authorizedUser){twAddPortletLink("javascript:twinkleprod.callback","PROD","tw-prod","Propose deletion via WP:PROD","");}else{twAddPortletLink('javascript:alert("Your account is too new to use Twinkle.");','PROD','tw-prod','Propose deletion via WP:PROD','');}if(typeof(TwinkleConfig.watchProdPages)=='undefined'){TwinkleConfig.watchProdPages=true;}if(typeof(TwinkleConfig.prodReasonDefault)=='undefined'){TwinkleConfig.prodReasonDefault="";}}twinkleprod.callback=function twinkleprodCallback{var Window=new SimpleWindow(800,410);Window.setTitle("Proposed deletion (WP:PROD)");var form=new QuickForm(twinkleprod.callback.evaluate);var field=form.append({type:'field',label:'PROD type'});field.append({type:'radio',name:'prodtype',event:twinkleprod.callback.prodtypechanged,list:[{label:'PROD (proposed deletion)',value:'prod',checked: true,tooltip:'Normal proposed deletion, per WP:PROD'},{label:'BLP PROD (proposed deletion of unsourced BLPs)',value:'prodblp',tooltip:'Proposed deletion of new, completely unsourced biographies of living persons, per WP:BLPPROD'}]});form.append({type:'div',});var result=form.render;Window.setContent(result);Window.display;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.prodtype[0].dispatchEvent(evt);} twinkleprod.callback.prodtypechanged=function(event){var work_area=new QuickForm.element({type:'div',});var field=work_area.append({type:'field',label:'Parameters'});switch(event.target.value){case'prod':field.append({type:'checkbox',list:[{label:'Notify if possible',value:'notify',name:'notify',tooltip:'If a notification is defined in the configuration, then notify the page creator if this is true, else no notify',checked:true}]});field.append({type:'textarea',name:'reason',label:'Reason for proposed deletion:',value:TwinkleConfig.prodReasonDefault,});break;case'prodblp':if(event.target.form.reason)TwinkleConfig.prodReasonDefault=event.target.form.reason.value;field.append({type:'checkbox',list:[{label:'Notify if possible',value:'notify',name:'notify',tooltip:'Creator of article has to be notified.',checked:true,disabled:true}]});var boldtext=document.createElement('b');boldtext.appendChild(document.createTextNode( 'Please note that only unsourced biographies of living persons are eligible for this tag, narrowly construed.'));field.append({type:'div',label:boldtext,});if(wgArticleId<26596183){field.append({type:'header',label:'It appears that this article was created before March 18, 2010, and is thus ineligible for a BLP PROD. Please make sure that this is not the case, or use normal PROD instead.',});}break;default:break;};work_area.append({type:'submit',label:'Propose deletion'});event.target.form.replaceChild(work_area.render,event.target.form.lastChild);} twinkleprod.callbacks={main:function(pageobj){var statelem=pageobj.getStatusElement;if(!pageobj.exists){statelem.error("It seems that the page doesn't exist. Perhaps it has already been deleted.");return;}var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var tag_re=/(\{\{(?:db-?|delete|[aitcmrs]fd|md1)[^{}]*?\|?[^{}]*?\}\})/i;if(tag_re.test(text)){statelem.warn('Page already tagged with a deletion template, aborting procedure');return;}text=text.replace(/{\{\s*(New unreviewed article|Userspace draft)\s*(\|(?:|[^{}])*)?}}\s*/ig,"");var prod_re=/\{\{\s*(?:dated prod|dated prod blp|Prod blp\/dated|Proposed deletion\/dated)\s*\|(?:\{\{[^\{\}]*\}\}|[^\}\{])*\}\}/i;if(!prod_re.test(text)){if(params.usertalk){var thispage=new Wikipedia.page(wgPageName);thispage.setCallbackParameters(params);thispage.lookupCreator(twinkleprod.callbacks.userNotification);}var summaryText="Proposing article for deletion per WP:"+(params.blp?"BLP":"")+"PROD.";text= "\{\{subst:prod"+(params.blp?" blp":("|1="+params.reason))+"\}\}\n"+text;}else{var prod2_re=/\{\{(?:Proposed deletion endorsed|prod-?2).*?\}\}/;if(prod2_re.test(text)){statelem.warn('Page already tagged with \{\{prod\}\} and \{\{prod-2\}\} templates, aborting procedure');return;}var confirmtext="A \{\{prod\}\} tag was already found on this article. \nWould you like to add a \{\{prod-2\}\} (PROD endorsement) tag with your explanation?";if(params.blp){confirmtext="A non-BLP \{\{prod\}\} tag was found on this article. \nWould you like to add a \{\{prod-2\}\} (PROD endorsement) tag with explanation \"unsourced BLP\"?";}if(!confirm(confirmtext)){statelem.warn('Aborted per user request');return;}var summaryText="Endorsing proposed deletion per WP:"+(params.blp?"BLP":"")+"PROD.";text=text.replace(prod_re,text.match(prod_re)+"\n\{\{prod-2|1="+(params.blp?"article is a biography of a living person with no sources":params.reason)+"\}\}\n");}pageobj.setPageText(text);pageobj. setEditSummary(summaryText+TwinkleConfig.summaryAd);pageobj.setWatchlist(TwinkleConfig.watchProdPages);pageobj.setCreateOption('nocreate');pageobj.save;},userNotification:function(pageobj){var params=pageobj.getCallbackParameters;var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:prodwarning"+(params.blp?"BLP":"")+"|1="+wgPageName+"|concern="+params.reason+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: proposed deletion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');usertalkpage.setFollowRedirect(true);usertalkpage.append;}} twinkleprod.callback.evaluate=function twinkleprodCallbackEvaluate(e){wgPageName=wgPageName.replace(/_/g,' ');var form=e.target;var prodtypes=form.prodtype;for(var i=0;i<prodtypes.length;i++){if(!prodtypes[i].checked)continue;var prodtype=prodtypes[i].value;break;}var params={usertalk:form.notify.checked,blp:prodtype=='prodblp',reason:prodtype=='prodblp'?'':form.reason.value};Status.init(form);if(prodtype=='prodblp'&&wgArticleId<26596183){if(!confirm("It appears that this article was created before March 18, 2010, and is thus ineligible for a BLP PROD. Do you want to continue tagging it?")){Status.warn('Notice','Aborting per user input.');return;}}Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Tagging complete";var wikipedia_page=new Wikipedia.page(wgPageName,"Tagging page");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinkleprod.callbacks.main);} Twinkle.init.moduleReady("twinkleprod",twinkleprod);function twinkleprotect{if(wgNamespaceNumber<0){return;}if(userIsInGroup('sysop')){twAddPortletLink("javascript:twinkleprotect.callback","PP","tw-rpp","Protect page","");}else if(Twinkle.authorizedUser){twAddPortletLink("javascript:twinkleprotect.callback","RPP","tw-rpp","Request page protection","");}else{twAddPortletLink('javascript:alert("Your account is too new to use Twinkle.");','RPP','tw-rpp','Request page protection','');}if(typeof(TwinkleConfig.protectionSummaryAd)==='undefined'){TwinkleConfig.protectionSummaryAd=TwinkleConfig.summaryAd;}}twinkleprotect.callback=function twinkleprotectCallback{var Window=new SimpleWindow(600,400);Window.setTitle("Protection of pages");var form=new QuickForm(twinkleprotect.callback.evaluate);if(userIsInGroup('sysop')){form.append({type:'checkbox',name:'request_only',event:twinkleprotect.callback.disabledefaults,list:[{label:'Request protection',value:'request_only',tooltip: 'If you want to request protection via WP:RPP instead of doing the protection by your self.'}]});}form.append({type:'select',name:'category',label:'Type of protection: ',event:twinkleprotect.callback.disabledefaults,list:[{label:'Full protection',list:[{label:'Generic',value:'pp-protected'},{label:'Dispute',selected:wgCurRevisionId!=false,value:'pp-dispute'},{label:'Vandalism',value:'pp-vandalism'},{label:'High-visibility template',value:'pp-template'},{label:'User talk of blocked user',value:'pp-usertalk'}]},{label:'Semi-protection',list:[{label:'Generic',value:'pp-semi-protected'},{label:'Vandalism',value:'pp-semi-vandalism'},{label:'High-visibility template',value:'pp-semi-template'},{label:'User talk of blocked user',value:'pp-semi-usertalk'},{label:'Spambot target',value:'pp-semi-spambot'}]},{label:'Other',list:[{label:'Move-protection',value:'pp-move'},{label:'Create-protection',selected:wgCurRevisionId==false,value:'pp-create'},{label:'Unprotection',value:'unprotect'}]}]});var flags=form.append({type:'field',label:'Options'});flags.append({type:'checkbox',list:[{name:'noinclude',label:'Wrap ',tooltip:'Will wrap the template in tags, so that it won\'t transclude',disabled:!userIsInGroup('sysop'),checked:(wgNamespaceNumber==10),adminonly:true},{name:'small',label:'Iconify',tooltip:'Will use the |small=yes feature of the template, and only render it as a keylock',disabled:!userIsInGroup('sysop'),adminonly:true},{name:'cascade',label:'Cascade protection',tooltip:'Cascade protection will protect all pages that is transcluded into said page'}]});if(userIsInGroup('sysop')){form.append({type:'select',name:'expiry',label:'Expiration: ',list:[{label:'1 hour',value:'1 hour'},{label:'2 hours',value:'2 hours'},{label:'3 hours',value:'3 hours'},{label:'6 hours',value:'6 hours'},{label:'12 hours',value:'12 hours'},{label:'1 day',value:'1 day'},{label:'2 days',value:'2 days'},{label:'3 days',value:'3 days'},{label:'4 days',value:'4 days'},{label: '5 days',value:'5 days'},{label:'6 days',value:'6 days'},{label:'1 week',value:'1 week'},{label:'2 weeks',value:'2 weeks'},{label:'1 month',value:'1 month'},{label:'2 months',value:'2 months'},{label:'3 months',value:'3 months'},{label:'6 months',value:'6 months'},{label:'1 year',value:'1 year'},{label:'indefinite',selected:true,value:'indefinite'}]});}else{form.append({type:'select',name:'expiry',label:'Expiration: ',list:[{label:'temporary',value:'temporary'},{label:'indefinite',value:'indefinite'},{label:,selected:true,value:}]});}form.append({type:'textarea',name:'reason',label:'Reason: '});form.append({type:'submit'});var result=form.render;Window.setContent(result);Window.display;} twinkleprotect.callback.disabledefaults=function twinkleprotectCallbackDisableDefaults(e){var root=e.target.form;if(e.target.value=='unprotect'){root.noinclude.disabled=true;root.cascade.disabled=true;root.expiry.disabled=true;root.small.disabled=true;}else{root.noinclude.disabled=true;root.cascade.disabled=false;root.expiry.disabled=false;root.small.disabled=true;if(userIsInGroup('sysop')&&!root.request_only.checked){root.small.disabled=false;root.noinclude.disabled=false;}}if(/template/.test(e.target.value)){root.noinclude.checked=true;root.expiry.disabled=true;}else{root.noinclude.checked=false;}} twinkleprotect.callback.evaluate=function twinkleprotectCallbackEvaluate(e){var form=e.target;var params={noinclude:form.noinclude.checked,cascade:form.cascade.checked,small:form.small.checked,reason:form.reason.value,expiry:form.expiry.value,type:form.category.value} if(userIsInGroup('sysop')){var request_only=form.request_only.checked;if(request_only&&params.expiry!='indefinite'){params.expiry='temporary';}}Status.init(form);if(userIsInGroup('sysop')&&!request_only){var edit,move,tag=params.type,reason,create='';switch(tag){case'pp-dispute':edit='sysop';move='sysop';reason='Full protection: dispute';break;case'pp-vandalism':edit='sysop';move='sysop';reason='Full protection: vandalism';break;case'pp-template':edit='sysop';move='sysop';reason='Full protection: high-visibility template';break;case'pp-usertalk':edit='sysop';move='sysop';reason='Full protection: user talk of blocked user';break;case'pp-protected':edit='sysop';move='sysop';if(params.reason){tag+='|reason='+params.reason;params.reason=undefined;}reason='Full protection';break;case'pp-semi-vandalism':edit='autoconfirmed';move='autoconfirmed';reason='Semi-protection: vandalism';break;case'pp-semi-usertalk':edit='autoconfirmed';move='autoconfirmed';reason= 'Semi-protection: user talk of blocked user';break;case'pp-semi-template':edit='autoconfirmed';move='autoconfirmed';reason='Semi-protection: high-visibility template';break;case'pp-semi-spambot':edit='autoconfirmed';move='autoconfirmed';reason='Semi-protection: spambot target';break;case'pp-semi-protected':edit='autoconfirmed';move='autoconfirmed';if(params.reason){tag+='|reason='+params.reason;params.reason=undefined;}reason='Semi-protection';break;case'pp-move':edit=;move='sysop';reason='Move-protection';break;case'pp-create':edit=;move=;create='sysop';reason='Create-protection';break;case'unprotect':default:edit=;move=;reason='Unprotection';break;}if(params.reason){reason+=', '+params.reason;}if(reason!=&&reason.charAt(reason.length-1)!='.'){reason+='.';}params.reason=reason;params.tag=tag;params.edit=edit;params.move=move;params.create=create;var query={'title':wgPageName,'action':'protect'};Wikipedia.actionCompleted.redirect=query['title'];Wikipedia.actionCompleted. notice="Done...";var wikipedia_wiki=new Wikipedia.wiki('Protecting page',query,twinkleprotect.callbacks.sysop.protectingPage);wikipedia_wiki.params=params;wikipedia_wiki.get;}else{var typename,reason;switch(params.type){case'pp-dispute':case'pp-vandalism':case'pp-template':case'pp-usertalk':case'pp-protected':typename='full protection';break;case'pp-semi-vandalism':case'pp-semi-usertalk':case'pp-semi-template':case'pp-semi-spambot':case'pp-semi-protected':typename='semi-protection';break;case'pp-move':typename='move-protection';break;case'pp-create':typename='create-protection';break;case'unprotect':default:typename='Unprotection';break;}switch(params.type){case'pp-dispute':reason='dispute';break;case'pp-vandalism':case'pp-semi-vandalism':reason='vandalism';break;case'pp-template':case'pp-semi-template':reason='high-visibility template';break;case'pp-usertalk':case'pp-semi-usertalk':reason='user talk of blocked user';break;case'pp-semi-spambot':reason='spambot target';break;case 'pp-protected':case'pp-semi-protected':case'pp-move':case'pp-create':case'unprotect':default:reason=;break;}if(reason!=){reason=" "+reason+"";}if(params.reason){reason+=', '+params.reason;}if(reason!=''&&reason.charAt(reason.length-1)!='.'){reason+='.';}params.reason=reason;params.typename=typename;var query={'title':'Wikipedia:Requests for page protection','action':'submit'};Wikipedia.actionCompleted.redirect=query['title'];Wikipedia.actionCompleted.notice="Nomination completed, redirecting now to the discussion page";var wikipedia_wiki=new Wikipedia.wiki('Requesting protection of page',query,twinkleprotect.callbacks.user);wikipedia_wiki.params=params;wikipedia_wiki.followRedirect=true;wikipedia_wiki.get;}} twinkleprotect.callbacks={sysop:{taggingPage:function(self){var form=self.responseXML.getElementById('editform');var oldtag_re=/\s*(?: )?\s*\{\{\s*(pp-[^{}]*?|protected|(?:t|v|s|p-|usertalk-v|usertalk-s|sb|move)protected(?:2)?|protected template|privacy protection)\s*?\}\}\s*(?:<\/noinclude>)?\s*/gi;var text=form.wpTextbox1.value;text=text.replace(oldtag_re,);if(self.params.type!='unprotect'&&self.params.expiry!='indefinite'){self.params.tag+='|expiry={'+'{subst:#time:F j, Y|+'+self.params.expiry+'}}';if(self.params.small){self.params.tag+='|small=yes';}}var summary;if(self.params.type=='unprotect'){summary='removing protection template'+TwinkleConfig.summaryAd;}else{if(self.params.noinclude){text=" \{\{"+self.params.tag+"\}\} "+text;}else{text="\{\{"+self.params.tag+"\}\}\n"+text;}summary="adding \{\{"+self.params.tag+"\}\}"+TwinkleConfig.summaryAd;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':form.wpWatchthis.checked ?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSummary':summary,'wpTextbox1':text};self.post(postData);},protectingPage:function(self){var form=self.responseXML.getElementById('mw-Protect-Form');var postData;if(self.params.type=='pp-move'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-move':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?:undefined,'mwProtectWatch':form.mwProtectWatch.checked?'':undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+TwinkleConfig.protectionSummaryAd};}else if(self.params.type=='pp-create'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-create':self.params.create, 'wpProtectExpirySelection-create':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-create':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?:undefined,'mwProtectWatch':form.mwProtectWatch.checked?:undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+TwinkleConfig.protectionSummaryAd};}else if(self.params.type=='unprotect'){postData={'wpEditToken':form.wpEditToken.value,'mwProtect-level-edit':self.params.edit,'wpProtectExpirySelection-edit':'indefinite','mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':'indefinite','mwProtect-level-create':self.params.create,'wpProtectExpirySelection-create':'indefinite','mwProtect-cascade':self.params.cascade?:undefined,'mwProtectWatch':form.mwProtectWatch.checked?:undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+TwinkleConfig.protectionSummaryAd};}else{postData={'wpEditToken':form .wpEditToken.value,'mwProtect-level-edit':self.params.edit,'wpProtectExpirySelection-edit':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-edit':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-level-move':self.params.move,'wpProtectExpirySelection-move':self.params.expiry!='indefinite'?'othertime':'indefinite','mwProtect-expiry-move':self.params.expiry!='indefinite'?self.params.expiry:undefined,'mwProtect-cascade':self.params.cascade?:undefined,'mwProtectWatch':form.mwProtectWatch.checked?:undefined,'wpProtectReasonSelection':'other','mwProtect-reason':self.params.reason+TwinkleConfig.protectionSummaryAd};}self.post(postData);var query={'title':wgPageName,'action':'submit'};if(self.params.create==''){var wikipedia_wiki=new Wikipedia.wiki('Tagging page',query,twinkleprotect.callbacks.sysop.taggingPage);wikipedia_wiki.params=self.params;wikipedia_wiki.get;}}},user:function(self){var form=self.responseXML.getElementById('editform' );var text=form.wpTextbox1.value;var ns2tag={'0':'la','1':'lat','2':'lu','3':'lut','4':'lw','5':'lwt','6':'li','7':'lit','8':'lm','9':'lmt','10':'lt','11':'ltt','12':'lh','13':'lht','14':'lc','15':'lct','100':'lp','101':'lpt'};var rppRe=new RegExp('====\\s*\\{\\{\\s*'+ns2tag[wgNamespaceNumber]+'\\s*\\|\\s*'+RegExp.escape(wgTitle,true)+'\\s*\\}\\}\\s*====','m');var tag=rppRe.exec(text);if(tag){self.statelem.warn([htmlNode('strong',tag[0])," is already placed on the page."]) return false;}var newtag='==== \{\{'+ns2tag[wgNamespaceNumber]+'|'+wgTitle+'\}\} ===='+"\n";if((new RegExp('^'+RegExp.escape(newtag).replace(/\s+/g,'\\s*'),'m')).test(text)){self.statelem.error('There are already a protection request for this page, aborting.');return;}var words=[];switch(self.params.expiry){case'temporary':words.push("Temporary");break;case'indefinite':words.push("Indefinite");break;}if(self.params.cascade){words.push("cascading");}words.push(self.params.typename);newtag+=""+words.join(' ')+""+(self.params.reason!=?self.params.reason:)+" \~\~\~\~";if(self.params.type=='unprotect'){var reg=/(\n==\s*Current requests for unprotection\s*==\s*\n\s*\{\{[^\}\}]+\}\}\s*\n)/;}else{var reg=/(\n==\s*Current requests for protection\s*==\s*\n\s*\{\{[^\}\}]+\}\}\s*\n)/;}var originalTextLength=text.length;text=text.replace(reg,"$1"+newtag+"\n");if(text.length==originalTextLength){self.statelem.error( 'The marker that identifies where the protection request is supposed to be added on WP:RFPP could not be found. Aborting ...');return;}var postData={'wpMinoredit':undefined,'wpWatchthis':form.wpWatchthis.checked?:undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':,'wpSummary':"Requesting "+self.params.typename+' of '+wgPageName.replace(/_/g,' ')+'.'+TwinkleConfig.summaryAd,'wpTextbox1':text};self.post(postData);}} Twinkle.init.moduleReady("twinkleprotect",twinkleprotect);function twinklespeedy{if(wgNamespaceNumber<0||(wgArticleId==0&&(wgNamespaceNumber!=6||(document.getElementById("mw-imagepage-section-filehistory")&&!(document.getElementById("mw-sharedupload"))))))return;if(userIsInGroup('sysop')){twAddPortletLink("javascript:twinklespeedy.callback","CSD","tw-csd","Speedy delete according to WP:CSD","");}else if(Twinkle.authorizedUser){twAddPortletLink("javascript:twinklespeedy.callback","CSD","tw-csd","Request speedy deletion according to WP:CSD","");}else{twAddPortletLink('javascript:alert("Your account is too new to use Twinkle.");','CSD','tw-csd','Request speedy deletion according to WP:CSD','');}if(typeof(TwinkleConfig.deletionSummaryAd)=='undefined'){TwinkleConfig.deletionSummaryAd=TwinkleConfig.summaryAd;}if(typeof(TwinkleConfig.watchSpeedyPages)=='undefined'){TwinkleConfig.watchSpeedyPages=['g3','g5','g10','g11','g12'];}if(typeof(TwinkleConfig.markSpeedyPagesAsPatrolled)== 'undefined'){TwinkleConfig.markSpeedyPagesAsPatrolled=true;}if(typeof(TwinkleConfig.notifyUserOnSpeedyDeletionNomination)=='undefined'){TwinkleConfig.notifyUserOnSpeedyDeletionNomination=['db','g1','g2','g3','g4','g10','g11','g12','a1','a2','a3','a5','a7','a9','a10','f1','f2','f3','f7','f9','f10','u3','t2','t3','p1','p2'];}if(typeof(TwinkleConfig.welcomeUserOnSpeedyDeletionNotification)=='undefined'){TwinkleConfig.welcomeUserOnSpeedyDeletionNotification=TwinkleConfig.notifyUserOnSpeedyDeletionNomination;}if(typeof(TwinkleConfig.openUserTalkPageOnSpeedyDelete)=='undefined'){TwinkleConfig.openUserTalkPageOnSpeedyDelete=['db','g1','g2','g3','g4','g5','g10','g11','g12','a1','a3','a7','a9','a10','f3','f7','f9','u3','t2','p1'];}if(typeof(TwinkleConfig.userTalkPageMode)=='undefined'){TwinkleConfig.userTalkPageMode='window';}if(typeof(TwinkleConfig.deleteTalkPageOnDelete)=='undefined'){TwinkleConfig.deleteTalkPageOnDelete=false;}if(typeof(TwinkleConfig.orphanBacklinksOnSpeedyDelete)== 'undefined'){TwinkleConfig.orphanBacklinksOnSpeedyDelete={exclude:['g6'],orphan:true};}if(typeof(TwinkleConfig.speedyWindowWidth)=='undefined'){TwinkleConfig.speedyWindowWidth=800;}if(typeof(TwinkleConfig.speedyWindowHeight)=='undefined'){TwinkleConfig.speedyWindowHeight=500;}if(typeof(TwinkleConfig.deleteSysopDefaultToTag)=='undefined'){TwinkleConfig.deleteSysopDefaultToTag=true;}}twinklespeedy.callback=function twinklespeedyCallback{twinklespeedy.initDialog(userIsInGroup('sysop')?twinklespeedy.callback.evaluateSysop:twinklespeedy.callback.evaluateUser,true);} twinklespeedy.initDialog=function twinklespeedyInitDialog(callbackfunc,firstTime,content){var dialog;if(!content){dialog=new SimpleWindow(TwinkleConfig.speedyWindowWidth,TwinkleConfig.speedyWindowHeight);dialog.setTitle("Choose criteria for speedy deletion");}var form=new QuickForm(callbackfunc,'change');if(firstTime&&userIsInGroup('sysop')){form.append({type:'checkbox',list:[{label:'Tag page only, don\'t delete',value:'tag_only',name:'tag_only',tooltip:'If you just want to tag the page, instead of deleting it now',checked:TwinkleConfig.deleteSysopDefaultToTag,event:function(event){event.target.form.notify.disabled=!event.target.checked;event.target.form.notify.checked=event.target.checked;event.stopPropagation;}},{label:'unlink links to this page',value:'orphan_backlinks',name:'orphan_backlinks',tooltip:'If you want to orphan the current page. If checked, excludes will still apply',checked:TwinkleConfig.orphanBacklinksOnSpeedyDelete.orphan,event:function(event){TwinkleConfig. orphanBacklinksOnSpeedyDelete.orphan=event.target.checked;event.stopPropagation;}}]});}if(firstTime){form.append({type:'checkbox',list:[{label:'Notify if possible',value:'notify',name:'notify',tooltip:'If a notification is defined in the configuration, then notify if this is true, else no notification',checked:!userIsInGroup('sysop')||TwinkleConfig.deleteSysopDefaultToTag,disabled:userIsInGroup('sysop')&&!TwinkleConfig.deleteSysopDefaultToTag,event:function(event){event.stopPropagation;}}]});}else form.append({type:'header',label:'Tagging with \{\{db-multiple}}: Criterion '+(twinklespeedy.dbmultipleCriteria.length+1)});if(!userIsInGroup('sysop')){if(firstTime){form.append({type:'radio',name:'csd',list:[{label:'Tag with multiple criteria',value:'multiple',tooltip:'Opens a series of further dialogs, allowing you to specify all the criteria you want to tag this page with.'}]});}else if(twinklespeedy.dbmultipleCriteria.length>0){form.append({type:'radio',name:'csd',list:[{label: 'No more criteria apply - finish tagging',value:'multiple-finish'}]});}}if(wgNamespaceNumber==Namespace.IMAGE){form.append({type:'header',label:'Files'});form.append({type:'radio',name:'csd',list:twinklespeedy.getFileList(!firstTime)});form.append({type:'div',label:'Tagging for CSD F4 (no license), F5 (orphaned fair use), F6 (no fair use rationale), and F11 (no permission) can be done using Twinkle\'s "DI" tab.'});}if(wgNamespaceNumber==0||wgNamespaceNumber==1){form.append({type:'header',label:'Articles'});form.append({type:'radio',name:'csd',list:twinklespeedy.getArticleList(!firstTime)});}if(wgNamespaceNumber==14||wgNamespaceNumber==15){form.append({type:'header',label:'Categories'});form.append({type:'radio',name:'csd',list:twinklespeedy.categoryList});}if(wgNamespaceNumber==2||wgNamespaceNumber==3){form.append({type:'header',label:'User pages'});form.append({type:'radio',name:'csd',list:twinklespeedy.userList});}if(wgNamespaceNumber==10||wgNamespaceNumber==11){form.append({type: 'header',label:'Templates'});form.append({type:'radio',name:'csd',list:twinklespeedy.getTemplateList(!firstTime)});}if(wgNamespaceNumber==100||wgNamespaceNumber==101){form.append({type:'header',label:'Portals'});form.append({type:'radio',name:'csd',list:twinklespeedy.getPortalList(!firstTime)});}form.append({type:'header',label:'General criteria'});form.append({type:'radio',name:'csd',list:twinklespeedy.getGeneralList(!firstTime)});form.append({type:'header',label:'Redirects'});form.append({type:'radio',name:'csd',list:twinklespeedy.redirectList});var result=form.render;if(dialog){dialog.setContent(result);dialog.display;}else{content.textContent='';content.appendChild(result);}} twinklespeedy.getFileList=function twinklespeedyGetFileList(multiple){var result=[];result.push({label:'F1: Redundant file',value:'redundantimage',tooltip:'Any file that is a redundant copy, in the same file format and same or lower resolution, of something else on Wikipedia. Likewise, other media that is a redundant copy, in the same format and of the same or lower quality. This does not apply to files duplicated on Wikimedia Commons, because of licence issues; these should be tagged with \{\{subst:ncd|Image:newname.ext\}\} or \{\{subst:ncd\}\} instead'});result.push({label:'F2: Corrupt or blank file',value:'noimage',tooltip:'Before deleting this type of file, verify that the MediaWiki engine cannot read it by previewing a resized thumbnail of it. This also includes empty (i.e., no content) file description pages for Commons files'});if(!multiple)result.push({label:'F2: Unneeded file description page for a file on Commons',value:'fpcfail',tooltip: 'An image, hosted on Commons, but with tags or information on its English Wikipedia description page that are no longer needed. (For example, a failed featured picture candidate.)'});result.push({label:'F3: Improper license',value:'noncom',tooltip:'"Files licensed as "for non-commercial use only", "non-derivative use" or "used with permission" that were uploaded on or after 2005-05-19, except where they have been shown to comply with the limited standards for the use of non-free content. This includes files licensed under a "Non-commercial Creative Commons License". Such files uploaded before 2005-05-19 may also be speedily deleted if they are not used in any articles'});result.push({label:'F7: Invalid fair-use claim',value:'badfairuse',tooltip: 'Any file with a clearly invalid fair-use tag (such as a \{\{logo\}\} tag on a photograph of a mascot) may be deleted at any time. Media that fail any part of the non-free content criteria and were uploaded after 2006-07-13 may be deleted forty-eight hours after notification of the uploader. For media uploaded before 2006-07-13 or tagged with the \{\{Replaceable fair use\}\} template, the uploader will be given seven days to comply with this policy after being notified'});if(!multiple)result.push({label:'F8: Files available as identical or higher-resolution copies on Wikimedia Commons',value:'nowcommons',tooltip: 'Provided the following conditions are met: 1: The file format of both images is the same. 2: The file\'s license and source status is beyond reasonable doubt, and the license is undoubtedly accepted at Commons. 3: All information on the file description page is present on the Commons file description page. That includes the complete upload history with links to the uploader\'s local user pages. 4: The file is not protected, and the file description page does not contain a request not to move it to Commons. 5: If the file is available on Commons under a different name than locally, all local references to the file must be updated to point to the title used at Commons. 6: For \{\{c-uploaded\}\} files: They may be speedily deleted as soon as they are off the Main Page'});result.push({label:'F9: Unambiguous copyright infringement',value:'imgcopyvio',tooltip: 'The file was copied from a website or other source that does not have a license compatible with Wikipedia, and the uploader neither claims fair use nor makes a credible assertion of permission of free use. Sources that do not have a license compatible with Wikipedia include stock photo libraries such as Getty Images or Corbis. Non-blatant copyright infringements should be discussed at Wikipedia:Files for deletion'});result.push({label:'F10: Useless media file',value:'badfiletype',tooltip:'Files uploaded that are neither image, sound, nor video files (e.g. .doc, .pdf, or .xls files) which are not used in any article and have no foreseeable encyclopedic use'});result.push({label:'G8: File description page with no corresponding file',value:'imagepage',tooltip:'This is only for use when the file doesn\'t exist at all. Corrupt files, and local description pages for files on Commons, should use F2; implausible redirects should use R3; and broken Commons redirects should use G6.'});return result twinklespeedy.getArticleList=function twinklespeedyGetArticleList(multiple){var result=[];result.push({label:'A1: No context. Articles lacking sufficient context to identify the subject of the article.',value:'nocontext',tooltip:'Example: "He is a funny man with a red car. He makes people laugh." This applies only to very short articles. Context is different from content, treated in A3, below.'});result.push({label:'A2: Foreign language articles that exist on another Wikimedia project',value:'foreign',tooltip:'If the article in question does not exist on another project, the template \{\{notenglish\}\} should be used instead. All articles in a non-English language that do not meet this criteria (and do not meet any other criteria for speedy deletion) should be listed at Pages Needing Translation (PNT) for review and possible translation'});result.push({label:'A3: No content whatsoever',value:'nocontent',tooltip: 'Any article consisting only of links elsewhere (including hyperlinks, category tags and "see also" sections), a rephrasing of the title, and/or attempts to correspond with the person or group named by its title. This does not include disambiguation pages'});result.push({label:'A5: Transwikied articles',value:'transwiki',tooltip:'Any article that has been discussed at Articles for Deletion (et al), where the outcome was to transwiki, and where the transwikification has been properly performed and the author information recorded. Alternately, any article that consists of only a dictionary definition, where the transwikification has been properly performed and the author information recorded'});result.push({label:'A7: Unremarkable people, groups, companies and web content',value:'a7',tooltip: 'An article about a real person, group of people, band, club, company, or web content that does not assert the importance or significance of its subject. If controversial, or if there has been a previous AfD that resulted in the article being kept, the article should be nominated for AfD instead'});if(!multiple){result.push({label:'A7: Unremarkable person',value:'person',tooltip:'An article about a real person that does not assert the importance or significance of its subject. If controversial, or if there has been a previous AfD that resulted in the article being kept, the article should be nominated for AfD instead'});result.push({label:'A7: Unremarkable musician(s) or band',value:'band',tooltip:'Article about a band, singer, musician, or musical ensemble that does not assert the importance or significance of the subject'});result.push({label:'A7: Unremarkable club',value:'club',tooltip:'Article about a club that does not assert the importance or significance of the subject'});result .push({label:'A7: Unremarkable company or organization',value:'corp',tooltip:'Article about a company or organization that does not assert the importance or significance of the subject'});result.push({label:'A7: Unremarkable website or web content',value:'web',tooltip:'Article about a web site, blog, online forum, webcomic, podcast, or similar web content that does not assert the importance or significance of its subject'});}result.push({label:'A9: Unremarkable musical recording where artist\'s article doesn\'t exist',value:'a9',tooltip:'An article about a musical recording which does not indicate why its subject is important or significant, and where the artist\'s article has never existed or has been deleted'});if(!multiple)result.push({label:'A10: Recently created article that duplicates an existing topic',value:'a10',tooltip: 'A recently created article with no relevant page history that does not aim to expand upon, detail or improve information within any existing article(s) on the subject, and where the title is not a plausible redirect. This does not include content forks, split pages or any article that aims at expanding or detailing an existing one.'});return result;} twinklespeedy.categoryList=[{label:'C1: Empty categories',value:'catempty',tooltip:'(no articles or subcategories for at least four days) whose only content has consisted of links to parent categories. This does not apply to categories being discussed on WP:CFD or WP:SFD, or disambiguation categories. If the category isn\'t relatively new, it possibly contained articles earlier, and deeper investigation is needed'},{label:'G8: Categories populated by a deleted or retargeted template',value:'templatecat',tooltip:'If a template which includes pages in a category has been deleted, the associated category can be deleted. This excludes categories that are still in use.'}];twinklespeedy.userList=[{label:'U1: User request',value:'userreq',tooltip:'Personal subpages, upon request by their user. In some rare cases there may be administrative need to retain the page. Also, sometimes, main user pages may be deleted as well. See Wikipedia:User page for full instructions and guidelines'},{label: 'U2: Nonexistent user',value:'nouser',tooltip:'User pages of users that do not exist (Check Special:Listusers)'},{label:'U3: Non-free galleries',value:'gallery',tooltip:'Galleries in the userspace which consist mostly of "fair use" or non-free files. Wikipedia\'s non-free content policy forbids users from displaying non-free files, even ones they have uploaded themselves, in userspace. It is acceptable to have free files, GFDL-files, Creative Commons and similar licenses along with public domain material, but not "fair use" files'},];twinklespeedy.getTemplateList=function twinklespeedyGetTemplateList(multiple){var result=[];result.push({label:'T2: Templates that are blatant misrepresentations of established policy',value:'policy',tooltip:'This includes "speedy deletion" templates for issues that are not speedy deletion criteria and disclaimer templates intended to be used in articles'});if(!multiple)result.push({label:'T3: Templates that are not employed in any useful fashion',value: 't3',tooltip:'Templates that are either substantial duplications of another template or hardcoded instances of another template where the same functionality could be provided by that other template'});return result;} twinklespeedy.getPortalList=function twinklespeedyGetPortalList(multiple){var result=[];if(!multiple)result.push({label:'P1: Portal that would be subject to speedy deletion if it were an article',value:'p1',tooltip:'You must specify the article criterion that applies in this case (A1, A3, A7, or A10).'});result.push({label:'P2: Underpopulated portal',value:'emptyportal',tooltip:'Any Portal based on a topic for which there is not a non-stub header article, and at least three non-stub articles detailing subject matter that would be appropriate to discuss under the title of that Portal'});return result;} twinklespeedy.getGeneralList=function twinklespeedyGetGeneralList(multiple){var result=[];if(!multiple)result.push({label:'Custom rationale using {'+'{db}} template',value:'reason',tooltip:'{'+'{db}} is short for "delete because". One of the other deletion criteria must still apply to the page, and you should (must?) make mention of this in your rationale. This is not a "catch-all" for when you can\'t find the right criterion.'});result.push({label:'G1: Patent nonsense. Pages consisting purely of incoherent text or gibberish with no meaningful content or history.',value:'nonsense',tooltip:'This does not include poor writing, partisan screeds, obscene remarks, vandalism, fictional material, material not in English, poorly translated material, implausible theories, or hoaxes'});result.push({label:'G2: Test page',value:'test',tooltip:'e.g., "Can I really create a page here?"'});result.push({label:'G3: Pure vandalism',value:'vandalism',tooltip: 'Plain pure vandalism (including redirects left behind from pagemove vandalism)'});if(!multiple)result.push({label:'G3: Blatant hoax',value:'hoax',tooltip:'Blatant and obvious hoax, to the point of vandalism'});result.push({label:'G4: Recreation of deleted material',value:'repost',tooltip:'A copy, by any title, of a page that was deleted via an XfD process or Deletion review, provided that the copy is substantially identical to the deleted version and that any revisions made clearly do not address the reasons for which the page was deleted. This clause does not apply to content that has been "userfied", to content undeleted as a result of Deletion review, or if the prior deletions were proposed or speedy deletions, although in this last case, the previous speedy criterion, or other speedy deletion criteria, may apply'});result.push({label:'G5: Banned user',value:'banned',tooltip:'Pages created by banned users while they were banned'});if(!multiple){result.push({label: 'G6: History merge',value:'histmerge',tooltip:'Temporarily deleting a page in order to merge page histories'});result.push({label:'G6: Move',value:'move',tooltip:'Making way for a noncontroversial move like reversing a redirect'});result.push({label:'G6: XfD',value:'xfd',tooltip:'An admin has closed a deletion discussion (at AfD, FfD, RfD, TfD, CfD, SfD, or MfD) as "delete", but they didn\'t actually delete the page.'});}result.push({label:'G6: Housekeeping',value:'g6',tooltip:'Other non-controversial "housekeeping" tasks'});result.push({label:'G7: Author requests deletion, or author blanked',value:'author',tooltip:'Any page for which deletion is requested by the original author in good faith, provided the page\'s only substantial content was added by its author. If the author blanks the page, this can also be taken as a deletion request.'});result.push({label:'G8: Pages dependent on a non-existent or deleted page',value:'g8',tooltip: 'such as talk pages with no corresponding subject page; subpages with no parent page; file pages without a corresponding file; redirects to invalid targets, such as nonexistent targets, redirect loops, and bad titles; or categories populated by deleted or retargeted templates. This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.'});if(!multiple){result.push({label:'G8: Talk pages with no corresponding subject page',value:'talk',tooltip:'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.'});result. push({label:'G8: Subpages with no parent page',value:'subpage',tooltip:'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.'});}result.push({label:'G10: Attack page',value:'attack',tooltip:'Pages that serve no purpose but to disparage their subject or some other entity (e.g., "John Q. Doe is an imbecile"). This includes a biography of a living person that is negative in tone and unsourced, where there is no NPOV version in the history to revert to. Administrators deleting such pages should not quote the content of the page in the deletion summary!'});result.push({label:'G11: Unambiguous advertising',value:'spam',tooltip: 'Pages which exclusively promote a company, product, group, service, or person and which would need to be fundamentally rewritten in order to become encyclopedic. Note that simply having a company, product, group, service, or person as its subject does not qualify an article for this criterion; an article that is blatant advertising should have inappropriate content as well'});result.push({label:'G12: Unambiguous copyright infringement',value:'copyvio',tooltip:'Either: (1) Material was copied from another website that does not have a license compatible with Wikipedia, or is photography from a stock photo seller (such as Getty Images or Corbis) or other commercial content provider; (2) There is no non-infringing content in the page history worth saving; or (3) The infringement was introduced at once by a single person rather than created organically on wiki and then copied by another website such as one of the many Wikipedia mirrors'});return result;} twinklespeedy.redirectList=[{label:'R2: Redirects from mainspace to any other namespace except the Category:, Template:, Wikipedia:, Help: and Portal: namespaces',value:'rediruser',tooltip:'(this does not include the Wikipedia shortcut pseudo-namespaces). If this was the result of a page move, consider waiting a day or two before deleting the redirect'},{label:'R3: Redirects as a result of an implausible typo that were recently created',value:'redirtypo',tooltip:'However, redirects from common misspellings or misnomers are generally useful, as are redirects in other languages'},{label:'G8: Redirects to invalid targets, such as nonexistent targets, redirect loops, and bad titles',value:'redirnone',tooltip: 'This excludes any page that is useful to the project, and in particular: deletion discussions that are not logged elsewhere, user and user talk pages, talk page archives, plausible redirects that can be changed to valid targets, and file pages or talk pages for files that exist on Wikimedia Commons.'}];twinklespeedy.normalizeHash={'reason':'db','multiple':'multiple','multiple-finish':'multiple-finish','nonsense':'g1','test':'g2','vandalism':'g3','hoax':'g3','repost':'g4','banned':'g5','histmerge':'g6','move':'g6','xfd':'g6','g6':'g6','author':'g7','g8':'g8','talk':'g8','subpage':'g8','redirnone':'g8','templatecat':'g8','attack':'g10','spam':'g11','copyvio':'g12','nocontext':'a1','foreign':'a2','nocontent':'a3','transwiki':'a5','a7':'a7','person':'a7','corp':'a7','web':'a7','band':'a7','club':'a7','a9':'a9','a10':'a10','rediruser':'r2','redirtypo':'r3','redundantimage':'f1','noimage':'f2','noncom':'f3','badfairuse':'f7','nowcommons':'f8','imgcopyvio':'f9','badfiletype':'f10','catempty'
 * }
 * 'c1','userreq':'u1','nouser':'u2','gallery':'u3','policy':'t2','t3':'t3','p1':'p1','emptyportal':'p2'};twinklespeedy.reasonHash={'nonsense':'Patent nonsense, meaningless, or incomprehensible','test':'Test page','vandalism':'Vandalism','hoax':'Blatant hoax','repost':'Recreation of a page that was deleted per a deletion discussion','banned':'Creation by a blocked or banned user in violation of block or ban','histmerge':'Temporary deletion in order to merge page histories','move':'Making way for a non-controversial move','xfd':'Deleting page per result of deletion discussion','g6':'Housekeeping and routine (non-controversial) cleanup','author':'One author who has requested deletion or blanked the page','g8':'Page dependent on a deleted or nonexistent page','talk':'Talk page of a deleted or nonexistent page','subpage':

'Subpage of a deleted or nonexistent page','redirnone':'redirect to a deleted or nonexistent page','templatecat':'Populated by deleted or retargeted templates','attack':'Attack page or negative unsourced BLP','spam':'Unambiguous advertising or promotion','copyvio':'Unambiguous copyright infringement','nocontext':'Not enough context to identify article\'s subject','foreign':'Article in a foreign language that exists on another project','nocontent':'Article that has no meaningful, substantive content','transwiki':'Article that has been transwikied to another project','a7':'No explanation of the subject\'s significance (real person, animal, organization, or web content)','person':'No explanation of the subject\'s significance (real person)','web':'No explanation of the subject\'s significance (web content)','corp':'No explanation of the subject\'s significance (organization)','club': 'No explanation of the subject\'s significance (organization)','band':'No explanation of the subject\'s significance (band/musician)','a9':'Music recording by redlinked artist and no indication of importance or significance','a10':'Recently created article that duplicates an existing topic','redundantimage':'File redundant to another on Wikipedia','noimage':'Corrupt or empty file, or a file description page for a file on Commons','noncom':'File with improper license','badfairuse':'Invalid fair-use claim','nowcommons':'Media file available on Commons','imgcopyvio':'File copyright violation','badfiletype':'Useless media file','catempty':'Empty category','userreq':'User request to delete page in own userspace','nouser':'Userpage or subpage of a nonexistent user','gallery':'Non-free gallery','policy':'Template that unambiguously misrepresents established policy','t3':'Unused, redundant template','p1': 'Portal page that would be subject to speedy deletion as an article','emptyportal':'Portal without a substantial topic base','rediruser':'Cross-namespace redirect from mainspace','redirtypo':'Recently created, implausible redirect'};twinklespeedy.callbacks={sysop:{main:function(self){var xmlDoc=self.responseXML;var normal=xmlDoc.evaluate('//normalized/n/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(normal){wgPageName=normal;}var exists=xmlDoc.evaluate('boolean(//pages/page[not(@missing)])',xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(!exists){self.statelem.error("It seems that the page doesn't exist, perhaps it has already been deleted");return;}if(self.params.openusertalk){var query={'action':'query','prop':'revisions','titles':wgPageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'} var wikipedia_api=new Wikipedia.api('Grabbing username of initial contributor',query,twinklespeedy.callbacks.sysop.openUserTalkPage);wikipedia_api.params=self.params;wikipedia_api.post;}var query={'title':wgPageName,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting page',query,twinklespeedy.callbacks.sysop.deletePage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;if(TwinkleConfig.deleteTalkPageOnDelete&&self.params.normalized!='f8'&&wgNamespaceNumber%2==0&&wgNamespaceNumber!=Namespace.USER&&document.getElementById('ca-talk').className!='new'){var talk_page=namespaces[wgNamespaceNumber+1]+':'+wgTitle;var query=query={'title':talk_page,'action':'delete'};var wikipedia_wiki=new Wikipedia.wiki('Deleting talk page',query,twinklespeedy.callbacks.sysop.deleteTalkPage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}if(wgNamespaceNumber==6&&self.params.normalized!='f8'){var query={ 'action':'query','list':'imageusage','titles':wgPageName,'iulimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing file links',query,twinklespeedy.callbacks.sysop.unlinkImageInstancesMain);wikipedia_api.params=self.params;wikipedia_api.post;}var doOrphan=TwinkleConfig.orphanBacklinksOnSpeedyDelete;if(doOrphan.orphan&&doOrphan.exclude.indexOf(self.params.normalized.toLowerCase)==-1){var query={'action':'query','list':'backlinks','blfilterredir':'nonredirects','bltitle':wgPageName,'bllimit':userIsInGroup('sysop')?5000:500,'blnamespace':[0,100]};var wikipedia_api=new Wikipedia.api('Grabbing backlinks',query,twinklespeedy.callbacks.sysop.unlinkBacklinksMain);wikipedia_api.params=self.params;wikipedia_api.post;}var query={'action':'query','list':'backlinks','blfilterredir':'redirects','bltitle':wgPageName,'bllimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Grabbing redirects',query,twinklespeedy.callbacks.sysop. deleteRedirectsMain);wikipedia_api.params=self.params;wikipedia_api.post;},openUserTalkPage:function(self){var xmlDoc=self.responseXML;var user=xmlDoc.evaluate('//rev/@user',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var statusIndicator=new Status('Opening user talk page edit form for user '+user,'opening');var query={'title':'User talk:'+user,'action':'edit','preview':'yes','vanarticle':wgPageName.replace(/_/g,' ')};switch(TwinkleConfig.userTalkPageMode){case'tab':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_tab');break;case'blank':window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'_blank','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;case'window':default:window.open(mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?'+QueryString.create(query),'twinklewarnwindow','location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800');break;}statusIndicator.info( 'complete');},unlinkBacklinksMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Removing backlinks','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;params.page=wgPageName;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'} var wikipedia_wiki=new Wikipedia.wiki("Unlinking on "+title,query,twinklespeedy.callbacks.sysop.unlinkBacklinks);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get;}},unlinkBacklinks:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.removeLink(self.params.page);text=wikiPage.getText;if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':,'wpSummary':'Removing backlinks to '+self.params.page+" that has been speedily deleted per (CSD "+self.params. normalized.toUpperCase+")"+". "+TwinkleConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);},deleteRedirectsMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate('//backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var total=snapshot.snapshotLength*2;if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Deleting redirects','0%');var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'delete'} var wikipedia_wiki=new Wikipedia.wiki("Deleting "+title,query,twinklespeedy.callbacks.sysop.deleteRedirects);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;}},deleteRedirects:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':"G8: Redirect to deleted page \""+wgPageName+"\" "+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}else{var postData={'wpWatch':form.wpWatch.checked?'':undefined,'wpDeleteReasonList':'other','wpReason':"G8: Redirect to deleted page \""+wgPageName+"\" "+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value}}self.post(postData);},unlinkImageInstancesMain:function(self){var xmlDoc=self.responseXML;var snapshot=xmlDoc.evaluate( '//imageusage/iu/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(snapshot.snapshotLength==0){return;}var statusIndicator=new Status('Unlinking file instances ','0%');var total=snapshot.snapshotLength*2;var onsuccess=function(self){var obj=self.params.obj;var total=self.params.total;var now=parseInt(100*++(self.params.current)/total)+'%';obj.update(now);self.statelem.unlink;if(self.params.current>=total){obj.info(now+' (completed)');Wikipedia.removeCheckpoint;}} var onloaded=onsuccess;var onloading=function(self){} Wikipedia.addCheckpoint;if(snapshot.snapshotLength==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params=clone(self.params);params.current=0;params.total=total;params.obj=statusIndicator;params.image=wgTitle;for(var i=0;i<snapshot.snapshotLength;++i){var title=snapshot.snapshotItem(i).value;var query={'title':title,'action':'submit'} var wikipedia_wiki=new Wikipedia.wiki("Unlinking on "+title,query,twinklespeedy.callbacks.sysop.unlinkImageInstances);wikipedia_wiki.params=params;wikipedia_wiki.onloading=onloading;wikipedia_wiki.onloaded=onloaded;wikipedia_wiki.onsuccess=onsuccess;wikipedia_wiki.get;}},unlinkImageInstances:function(self){var form=self.responseXML.getElementById('editform');var text=form.wpTextbox1.value;var old_text=text;var wikiPage=new Mediawiki.Page(text);wikiPage.commentOutImage(self.params.image,'Commented out because file was deleted');text=wikiPage.getText;if(text==old_text){self.onsuccess(self);Wikipedia.actionCompleted(self);return;}var postData={'wpMinoredit':form.wpMinoredit.checked?:undefined,'wpWatchthis':undefined,'wpStarttime':form.wpStarttime.value,'wpEdittime':form.wpEdittime.value,'wpAutoSummary':form.wpAutoSummary.value,'wpEditToken':form.wpEditToken.value,'wpSection':,'wpSummary':'Removing instance of file '+self.params.image+" that has been speedily deleted per CSD "+self.params.normalized.toUpperCase+""+". "+TwinkleConfig.deletionSummaryAd,'wpTextbox1':text};self.post(postData);},deletePage:function(self){var form=this.responseXML.getElementById('deleteconfirm');if(!form){form=this.responseXML.getElementsByTagName('form')[0];var postData={'wpDeleteReasonList':'other','wpReason':""+self.params.normalized.toUpperCase+": "+self.params.reason+" "+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}else{var postData={'wpWatch':(self.params.watch||form.wpWatch.checked)?:undefined,'wpDeleteReasonList':'other','wpReason':""+self.params.normalized.toUpperCase+": "+self.params.reason+" "+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}},deleteTalkPage:function(self){form=this.responseXML.getElementById('deleteconfirm');var postData={'wpWatch':(self.params.watch||form.wpWatch.checked)?:undefined,'wpDeleteReasonList':'other','wpReason':"G8: Talk page of deleted page \""+wgPageName+"\" "+TwinkleConfig.deletionSummaryAd,'wpEditToken':form.wpEditToken.value} self.post(postData);}},user:{main:function(pageobj){var statelem=pageobj.getStatusElement;if(!pageobj.exists){statelem.error("It seems that the page doesn't exist; perhaps it has already been deleted");return;}var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;statelem.status('Checking for tags on the page...');var tag=/(\{\{\s*(?:db|delete|db-.*?)(?:\||\s*\}\}))/.exec(text);if(tag){statelem.error([htmlNode('strong',tag[0])," is already placed on the page."]) return;}var xfd=/(\{\{(?:[rsaiftcm]fd|md1)[^{}]*?\}\})/i.exec(text);if(xfd&&!confirm("The deletion related template "+xfd[0]+" is already present on the page, do you still want to apply CSD template?")){return;}var code;var parameters;if(params.normalized=='multiple'){code="\{\{db-multiple";for(var i in twinklespeedy.dbmultipleCriteria)if(typeof twinklespeedy.dbmultipleCriteria[i]=='string')code+="|"+twinklespeedy.dbmultipleCriteria[i].toUpperCase;for(var i in twinklespeedy.dbmultipleParameters)if(typeof twinklespeedy.dbmultipleParameters[i]=='string')code+="|"+i+"="+twinklespeedy.dbmultipleParameters[i];code+="\}\}";params.utparams=[];}else{parameters=twinklespeedy.getParameters(params.value,params.normalized,statelem);if(!parameters)return;code="\{\{db-"+params.value;for(var i in parameters)if(typeof parameters[i]=='string')code+="|"+i+"="+parameters[i];code+="\}\}";params.utparams=twinklespeedy.getUserTalkParameters(params.normalized,parameters);}if(TwinkleConfig. markSpeedyPagesAsPatrolled&&params.rcid!=''){var patrollinkmatch=/token=(.+)%2B%5C$/.exec($('.patrollink a').attr('href'));if(patrollinkmatch){var patroltoken=patrollinkmatch[1]+"+\\";var patrolstat=new Status("Marking page as patrolled","Doing...");(Wikipedia.numberOfActionsLeft)++;var query={'title':wgPageName,'action':'markpatrolled','rcid':params.rcid,'token':patroltoken};$.ajax({context:patrolstat,type:'GET',url:mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php',data:QueryString.create(query),dataType:'xml',success:function(xml,textStatus,jqXHR){this.info("Done");Wikipedia.actionCompleted;},error:function(jqXHR,textStatus,errorThrown){if(textStatus=="parsererror"){this.info("Done");Wikipedia.actionCompleted;}else{this.error(textStatus+': '+errorThrown+' occurred while trying to do this.');}}});}}if(params.usertalk){var thispage=new Wikipedia.page(wgPageName);var callback=function(pageobj){var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib, "Notifying initial contributor ("+initialContrib+")");var nowelcome=TwinkleConfig.welcomeUserOnSpeedyDeletionNotification.indexOf(params.normalized)==-1;var notifytext;switch(params.normalized){case'db':notifytext="\n\n\{\{subst:db-reason-notice|1="+wgPageName;break;case'multiple':notifytext="\n\n\{\{subst:db-notice-multiple|1="+wgPageName;break;default:notifytext="\n\n\{\{subst:db-csd-notice-custom|1="+wgPageName+"|2="+params.value;break;}for(var i in params.utparams)if(typeof params.utparams[i]=='string')notifytext+="|"+i+"="+params.utparams[i];notifytext+=(nowelcome?"|nowelcome=yes":"")+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: speedy deletion nomination of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');usertalkpage.setFollowRedirect(true);usertalkpage.append;};thispage.lookupCreator(callback);}if(params.wgCanonicalNamespace=="Template")code=" "+code+" ";text=text. replace(/{\{\s*(New unreviewed article|Userspace draft)\s*(\|(?:|[^{}])*)?}}\s*/ig,"");var editsummary;switch(params.normalized){case'db':editsummary='Requesting speedy deletion with rationale \"'+parameters["1"]+'\".';break;case'multiple':editsummary='Requesting speedy deletion (';for(var i in twinklespeedy.dbmultipleCriteria)if(typeof twinklespeedy.dbmultipleCriteria[i]=='string')editsummary+='CSD '+twinklespeedy.dbmultipleCriteria[i].toUpperCase+', ';editsummary=editsummary.substr(0,editsummary.length-2);editsummary+=').';break;default:editsummary="Requesting speedy deletion (CSD "+params.normalized.toUpperCase+").";break;}pageobj.setPageText(code+((params.normalized=='g10'||twinklespeedy.dbmultipleCriteria.indexOf('g10')!=-1)?'':("\n"+text)));pageobj.setEditSummary(editsummary+TwinkleConfig.summaryAd);pageobj.setWatchlist(params.watch);pageobj. setCreateOption('nocreate');pageobj.save;}}} twinklespeedy.getParameters=function twinklespeedyGetParameters(value,normalized,statelem){var parameters=[];switch(normalized){case'db':var rationale=prompt('Please enter a mandatory rationale.  \n\"This page qualifies for speedy deletion because:\"');if(rationale==null||rationale.replace(/^\s*/,"").replace(/\s*$/,"")==){statelem.error('You must specify a rationale.  Aborted by user.');return;}if(rationale!=)parameters["1"]=rationale;break;case'u1':var rationale=;if(wgNamespaceNumber==3&&!(/\//.test(wgTitle))){var rationale=prompt('Please provide a mandatory rationale to explain why this user talk page should be deleted:');if(rationale==null||rationale.replace(/^\s*/,"").replace(/\s*$/,"")==){statelem.error('You must specify a rationale.  Aborted by user.');return;}}if(rationale!='')parameters["rationale"]=rationale;break;case'f8':var pagenamespaces=wgPageName.replace('_',' ');var filename=prompt('Please enter the name of the file on Commons:',pagenamespaces);if(filename== null){statelem.error('Aborted by user.');return;}if(filename!=''&&filename!=pagenamespaces){if(filename.indexOf("Image:")==0||filename.indexOf("File:")==0){parameters["1"]=filename;}else{statelem.error("The File: prefix was missing from the image filename. Aborted.");return;}}parameters["date"]="\~\~\~\~\~";break;case'g6':var rationale=null;switch(value){case'histmerge':var title=prompt('Please enter the title to merge into:');if(title==null){statelem.error('Aborted by user.');return;}parameters["1"]=title;break;case'move':var title=prompt('Please enter the title of the page to be moved here:');if(title==null){statelem.error('Aborted by user.');return;}var reason=prompt('Please enter the reason for the page move:');if(reason==null){self.statelem.error('Aborted by user.');return;}parameters["1"]=title;parameters["2"]=reason;break;case'g6':rationale=prompt('Please provide an optional rationale (leave empty to skip):');if(rationale==null){statelem.error('Aborted by user.');return;}if( rationale!=)parameters["rationale"]=rationale;break;}break;case'g7':var rationale=prompt('Please provide an optional rationale (perhaps linking to where the author requested this deletion - leave empty to skip):');if(rationale==null){statelem.error('Aborted by user.');return;}if(rationale!=)parameters["rationale"]=rationale;break;case'f9':case'g12':var url=prompt('Please enter the URL if available, including the "http://":');if(url==null){statelem.error('Aborted by user.');return;}parameters["url"]=url;break;case'a2':var source=prompt('Enter an interwiki link to the article on the foreign-language wiki (for example, "fr:Bonjour"):');if(source==null){statelem.error('Aborted by user.');return;}parameters["source"]=source;break;case'a10':var title=prompt('Enter the article name that is duplicated:');if(title==null){statelem.error('Aborted by user.');return;}parameters["article"]=title;break;case'f1':var img=prompt( 'Enter the file this is redundant to, excluding the "Image:" or "File:" prefix:');if(img==null){statelem.error('Aborted by user.');return;}parameters["filename"]=img;break;case't3':var template=prompt('Enter the template this is redundant to, excluding the "Template:" prefix:');if(template==null){statelem.error('Aborted by user.');return;}parameters["1"]="\~\~\~\~\~";parameters["2"]=template;break;case'g10':parameters["blanked"]='yes';break;case'p1':var criterion=prompt('Enter the code of the article CSD criterion which this portal falls under:  \n\n(A1 = no context, A3 = no content, A7 = non-notable, A10 = duplicate)');if(criterion==null||criterion.replace(/^\s*/,"").replace(/\s*$/,"")==''){statelem.error('You must enter a criterion. Aborted by user.');return;}parameters["1"]=criterion;break;}return parameters;} twinklespeedy.getUserTalkParameters=function twinklespeedyGetUserTalkParameters(normalized,parameters){var utparams=[];switch(normalized){case'db':utparams["2"]=parameters["1"];break;case'a10':utparams["key1"]="article";utparams["value1"]=parameters["article"];break;}return utparams;} twinklespeedy.callback.evaluateSysop=function twinklespeedyCallbackEvaluateSysop(e){wgPageName=wgPageName.replace(/_/g,' ');var tag_only=e.target.form.tag_only;if(tag_only&&tag_only.checked){return twinklespeedy.callback.evaluateUser(e);}if(!confirm("Twinkle's admin CSD functionality has not been upgraded to use the API, and will probably not work. Do you want to try it anyway?"))return;var value=e.target.value;var normalized=twinklespeedy.normalizeHash[value];var params={value:value,normalized:normalized,watch:TwinkleConfig.watchSpeedyPages.indexOf(normalized)!=-1,reason:twinklespeedy.reasonHash[value],openusertalk:TwinkleConfig.openUserTalkPageOnSpeedyDelete.indexOf(normalized)!=-1};Status.init(e.target.form);var query={'action':'query','titles':wgPageName} var wikipedia_api=new Wikipedia.api('Checking if page exists',query,twinklespeedy.callbacks.sysop.main);wikipedia_api.params=params;wikipedia_api.post;} twinklespeedy.callback.evaluateUser=function twinklespeedyCallbackEvaluateUser(e){wgPageName=wgPageName.replace(/_/g,' ');var value=e.target.value;if(value=='multiple'){e.target.form.style.display="none";twinklespeedy.targetdialogcontent=e.target.form.parentNode;setTimeout("twinklespeedy.initDialog(twinklespeedy.callback.doMultiple, false, twinklespeedy.targetdialogcontent)",150);return;}if(value=='multiple-finish')value='multiple';else{twinklespeedy.dbmultipleCriteria=[];twinklespeedy.dbmultipleParameters=[];}var normalized=twinklespeedy.normalizeHash[value];var watchPage=false;if(value=='multiple'){for(var i in twinklespeedy.dbmultipleCriteria){if(typeof twinklespeedy.dbmultipleCriteria[i]=='string'&&TwinkleConfig.watchSpeedyPages.indexOf(twinklespeedy.dbmultipleCriteria[i])!=-1){watchPage=true;break;}}}else watchPage=TwinkleConfig.watchSpeedyPages.indexOf(normalized)!=-1;var notifyuser=false;if(value=='multiple'){for(var i in twinklespeedy.dbmultipleCriteria){if(typeof twinklespeedy .dbmultipleCriteria[i]=='string'&&TwinkleConfig.notifyUserOnSpeedyDeletionNomination.indexOf(twinklespeedy.dbmultipleCriteria[i])!=-1){notifyuser=true;break;}}}else notifyuser=(TwinkleConfig.notifyUserOnSpeedyDeletionNomination.indexOf(normalized)!=-1)&&e.target.form.notify.checked;var params={value:value,normalized:normalized,watch:watchPage,usertalk:notifyuser,rcid:QueryString.exists('rcid')?QueryString.get('rcid'):'',wgCanonicalNamespace:wgCanonicalNamespace};Status.init(e.target.form);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Tagging complete";var wikipedia_page=new Wikipedia.page(wgPageName,"Tagging page");wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklespeedy.callbacks.user.main);} twinklespeedy.dbmultipleCriteria=[];twinklespeedy.dbmultipleParameters=[];twinklespeedy.callback.doMultiple=function twinklespeedyCallbackDoMultiple(e){var value=e.target.value;var normalized=twinklespeedy.normalizeHash[value];if(value!='multiple-finish'){if(twinklespeedy.dbmultipleCriteria.indexOf(normalized)!=-1)alert('You already selected that criterion. Please choose another.');else{var parameters=twinklespeedy.getParameters(value,normalized,Status);if(parameters){for(var i in parameters)if(typeof parameters[i]=='string')twinklespeedy.dbmultipleParameters[i]=parameters[i];twinklespeedy.dbmultipleCriteria.push(normalized);}}e.target.form.style.display="none";twinklespeedy.targetdialogcontent=e.target.form.parentNode;setTimeout("twinklespeedy.initDialog(twinklespeedy.callback.doMultiple, false, twinklespeedy.targetdialogcontent)",150);}else{twinklespeedy.callback.evaluateUser(e);}} Twinkle.init.moduleReady("twinklespeedy",twinklespeedy);function twinkleundelete{if(wgNamespaceNumber<0||wgCurRevisionId!=false){return;}if(userIsInGroup('sysop')){addPortletLink('p-cactions',"javascript:twinkleundelete.callback","undel","tw-undel","Undelete em all","");}}twinkleundelete.callback=function twinkleundeleteCallback{var Window=new SimpleWindow(800,400);var div=document.createElement('div');Status.init(div);Window.setContent(div);Window.display;var query={'title':'Special:Undelete','target':'Wikipedia:NeverToBeRestored','action':'submit'};var wikipedia_wiki=new Wikipedia.wiki('Undeleting page',query,twinkleundelete.callbacks.undeletePage);wikipedia_wiki.params=self.params;wikipedia_wiki.followRedirect=false;wikipedia_wiki.get;} twinkleundelete.callbacks={undeletePage:function(self){var form=self.responseXML.getElementById('undelete');var postData={'wpComment':"Speedly undeleted."+TwinkleConfig.deletionSummaryAd,'target':wgPageName,'wpEditToken':form.wpEditToken.value,'restore':1} self.post(postData);}};Twinkle.init.moduleReady("twinkleundelete",twinkleundelete);function twinkleunlink{if(wgNamespaceNumber<0){return;}twAddPortletLink("javascript:twinkleunlink.callback","Unlink","tw-unlink","Unlink backlinks","");if(typeof(TwinkleConfig.unlinkNamespaces)=='undefined'){TwinkleConfig.unlinkNamespaces=[0,100];}}function getChecked2(nodelist){if(!(nodelist instanceof NodeList)){return nodelist.checked?[nodelist.value]:[];}var result=[];for(var i=0;i<nodelist.length;++i){if(nodelist[i].checked){result.push(nodelist[i].value);}}return result;}twinkleunlink.callback=function twinkleunlinkCallback{var Window=new SimpleWindow(800,400);Window.setTitle("Unlink backlinks");var form=new QuickForm(twinkleunlink.callback.evaluate);form.append({type:'textarea',name:'reason',label:'Reason: '});if(wgNamespaceNumber==Namespace.IMAGE){var query={'action':'query','list':['backlinks','imageusage'],'bltitle':wgPageName,'iutitle':wgPageName,'bllimit':userIsInGroup('sysop')?5000:500 ,'iulimit':userIsInGroup('sysop')?5000:500,'blnamespace':TwinkleConfig.unlinkNamespaces};}else{var query={'action':'query','list':'backlinks','bltitle':wgPageName,'blfilterredir':'nonredirects','bllimit':userIsInGroup('sysop')?5000:500,'blnamespace':TwinkleConfig.unlinkNamespaces};}var wikipedia_api=new Wikipedia.api('Grabbing backlinks',query,twinkleunlink.callbacks.display.backlinks);wikipedia_api.params={form:form,Window:Window,image:wgNamespaceNumber==Namespace.IMAGE};wikipedia_api.post;var root=document.createElement('div');Status.init(root);Window.setContent(root);Window.display;} twinkleunlink.callback.evaluate=function twinkleunlinkCallbackEvaluate(event){wgPageName=wgPageName.replace(/_/g,' ');twinkleunlink.backlinksdone=0;twinkleunlink.imageusagedone=0;function processunlink(pages,imageusage){var statusIndicator=new Status((imageusage?'Unlinking instances of image usage':'Unlinking instances'),'0%');var total=pages.length;Wikipedia.addCheckpoint;if(pages.length==0){statusIndicator.info('100% (completed)');Wikipedia.removeCheckpoint;return;}var params={reason:reason,imageusage:imageusage,globalstatus:statusIndicator,current:0,total:total};for(var i=0;i<pages.length;++i){var myparams=clone(params);var articlepage=new Wikipedia.page(pages[i],'Unlinking in article "'+pages[i]+'"');articlepage.setCallbackParameters(myparams);articlepage.load(imageusage?twinkleunlink.callbacks.unlinkImageInstances:twinkleunlink.callbacks.unlinkBacklinks);}}var reason=event.target.reason.value;if(event.target.backlinks){var backlinks=getChecked(event.target.backlinks);}if(event .target.imageusage){var imageusage=getChecked(event.target.imageusage);}Status.init(event.target);if(backlinks)processunlink(backlinks,false);if(imageusage)processunlink(imageusage,true);} twinkleunlink.backlinksdone=0;twinkleunlink.imageusagedone=0;twinkleunlink.callbacks={display:{backlinks:function twinkleunlinkCallbackDisplayBacklinks(apiobj){var xmlDoc=apiobj.responseXML;var havecontent=false;if(apiobj.params.image){var imageusage=xmlDoc.evaluate('//query/imageusage/iu/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);var list=[];for(var i=0;i<imageusage.snapshotLength;++i){var title=imageusage.snapshotItem(i).value;list.push({label:title,value:title,checked:true});}if(list.length==0){apiobj.params.form.append({type:'header',label:'No instances of image usage found.'});}else{apiobj.params.form.append({type:'header',label:'Image usage'});apiobj.params.form.append({type:'checkbox',name:'imageusage',list:list});havecontent=true;}}var backlinks=xmlDoc.evaluate('//query/backlinks/bl/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(backlinks.snapshotLength>0){var list=[];for(var i=0;i<backlinks.snapshotLength;++i){var title=backlinks. snapshotItem(i).value;list.push({label:title,value:title,checked:true});}apiobj.params.form.append({type:'header',label:'Backlinks'});apiobj.params.form.append({type:'checkbox',name:'backlinks',list:list});havecontent=true;}else{apiobj.params.form.append({type:'header',label:'No backlinks found.'});}if(havecontent)apiobj.params.form.append({type:'submit'});var result=apiobj.params.form.render;apiobj.params.Window.setContent(result);}},unlinkBacklinks:function twinkleunlinkCallbackUnlinkBacklinks(pageobj){var text,oldtext;text=oldtext=pageobj.getPageText;var params=pageobj.getCallbackParameters;var wikiPage=new Mediawiki.Page(text);wikiPage.removeLink(wgPageName);text=wikiPage.getText;if(text==oldtext){twinkleunlink.callbacks.success(pageobj);Wikipedia.actionCompleted;return;}pageobj.setPageText(text);pageobj.setEditSummary("Removing link(s) to \""+wgPageName+"\": "+params.reason+"."+TwinkleConfig.summaryAd);pageobj.setCreateOption('nocreate');pageobj.save(twinkleunlink. callbacks.success);},unlinkImageInstances:function twinkleunlinkCallbackUnlinkImageInstances(pageobj){var text,oldtext;text=oldtext=pageobj.getPageText;var params=pageobj.getCallbackParameters;var wikiPage=new Mediawiki.Page(text);wikiPage.commentOutImage(wgTitle,'Commented out');text=wikiPage.getText;if(text==oldtext){twinkleunlink.callbacks.success(pageobj);Wikipedia.actionCompleted;return;}pageobj.setPageText(text);pageobj.setEditSummary("Commenting out use(s) of image \""+wgPageName+"\": "+params.reason+"."+TwinkleConfig.summaryAd);pageobj.setCreateOption('nocreate');pageobj.save(twinkleunlink.callbacks.success);},success:function twinkleunlinkCallbackSuccess(pageobj){var statelem=pageobj.getStatusElement;statelem.info('done');var params=pageobj.getCallbackParameters;var total=params.total;var now=parseInt(100*(params.imageusage?++(twinkleunlink.imageusagedone):++(twinkleunlink.backlinksdone))/total)+'%';params.globalstatus.update(now);if((params.imageusage? twinkleunlink.imageusagedone:twinkleunlink.backlinksdone)>=total){params.globalstatus.info(now+' (completed)');Wikipedia.removeCheckpoint;}}} Twinkle.init.moduleReady("twinkleunlink",twinkleunlink);function twinklewarn{if(wgNamespaceNumber==3){twAddPortletLink((Twinkle.authorizedUser?"javascript:twinklewarn.callback":'javascript:alert("Your account is too new to use Twinkle.");'),"Warn","tw-warn","Warn/Notify user","");if(typeof(TwinkleConfig.defaultWarningGroup)=='undefined'){TwinkleConfig.defaultWarningGroup=1;}if(typeof(TwinkleConfig.showSharedIPNotice)=='undefined'){TwinkleConfig.showSharedIPNotice=true;}if(typeof(TwinkleConfig.watchWarnings)=='undefined'){TwinkleConfig.watchWarnings=true;}if(typeof(TwinkleConfig.blankTalkpageOnIndefBlock)=='undefined'){TwinkleConfig.blankTalkpageOnIndefBlock=false;}}}twinklewarn.callback=function twinklewarnCallback{var Window=new SimpleWindow(600,400);Window.setTitle("Warn/Notify user");var form=new QuickForm(twinklewarn.callback.evaluate);var main_select=form.append({type:'field',label:'Choose type of warning/notice to issue',tooltip: 'First choose a main warning group, then the specific warning to issue.'});var main_group=main_select.append({type:'select',name:'main_group',event:twinklewarn.callback.change_category});main_group.append({type:'option',label:'General Note (1)',value:'level1',selected:(TwinkleConfig.defaultWarningGroup==1||TwinkleConfig.defaultWarningGroup<1||(userIsInGroup('sysop')?TwinkleConfig.defaultWarningGroup>8:TwinkleConfig.defaultWarningGroup>7))});main_group.append({type:'option',label:'Caution (2)',value:'level2',selected:(TwinkleConfig.defaultWarningGroup==2)});main_group.append({type:'option',label:'Warning (3)',value:'level3',selected:(TwinkleConfig.defaultWarningGroup==3)});main_group.append({type:'option',label:'Final warning (4)',value:'level4',selected:(TwinkleConfig.defaultWarningGroup==4)});main_group.append({type:'option',label:'Only warning (4im)',value:'level4im',selected:(TwinkleConfig.defaultWarningGroup==5)});main_group.append({type:'option',label:'Single issue notices',value: 'singlenotice',selected:(TwinkleConfig.defaultWarningGroup==6)});main_group.append({type:'option',label:'Single issue warnings',value:'singlewarn',selected:(TwinkleConfig.defaultWarningGroup==7)});if(userIsInGroup('sysop')){main_group.append({type:'option',label:'Blocking',value:'block',selected:(TwinkleConfig.defaultWarningGroup==8)});}main_select.append({type:'select',name:'sub_group',event:twinklewarn.callback.change_subcategory});form.append({type:'input',name:'article',label:'Linked article',value:(QueryString.exists('vanarticle')?QueryString.get('vanarticle'):''),tooltip:'An article might be linked to the notice, either it was a revert to said article that dispatched this notice. Leave empty for no article to be linked'});var more=form.append({type:'field',label:'Fill in an optional reason and hit \"Submit\"'});more.append({type:'textarea',label:'More:',name:'reason',tooltip:'Perhaps a reason, or that a more detailed notice must be appended'});more.append({type:'submit',label: 'Submit'});var result=form.render;Window.setContent(result);Window.display;result.main_group.root=result;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.main_group.dispatchEvent(evt);} twinklewarn.messages={level1:{"uw-vandalism1":{label:"Vandalism",summary:"General note: Nonconstructive editing"},"uw-test1":{label:"Editing tests",summary:"General note: Editing tests"},"uw-delete1":{label:"Page blanking, removal of content",summary:"General note: Page blanking, removal of content"},"uw-redirect1":{label:"Creating malicious redirects",summary:"General note: Creating malicious redirects"},"uw-tdel1":{label:"Removal of maintenance templates",summary:"General note: Removal of maintenance templates"},"uw-joke1":{label:"Using improper humor",summary:"General note: Using improper humor"},"uw-create1":{label:"Creating inappropriate pages",summary:"General note: Creating inappropriate pages"},"uw-upload1":{label:"Uploading inappropriate images",summary:"General note: Uploading inappropriate images"},"uw-image1":{label:"Image-related vandalism",summary:"General note: Image-related vandalism"},"uw-ics1":{label:"Uploading files missing copyright status",summary: "General note: Uploading files missing copyright status"},"uw-idt1":{label:"Removing file deletion tags",summary:"General note: Removing file deletion tags"},"uw-spam1":{label:"Adding spam links",summary:"General note: Adding spam links"},"uw-advert1":{label:"Using Wikipedia for advertising or promotion",summary:"General note: Using Wikipedia for advertising or promotion"},"uw-npov1":{label:"Not adhering to neutral point of view",summary:"General note: Not adhering to neutral point of view"},"uw-unsourced1":{label:"Addition of unsourced or improperly cited material",summary:"General note: Addition of unsourced or improperly cited material"},"uw-error1":{label:"Introducing deliberate factual errors",summary:"General note: Introducing factual errors"},"uw-nor1":{label:"Adding original research, including unpublished syntheses of sourced material",summary:"General note: Adding original research, including unpublished syntheses of sourced material"},"uw-biog1":{label: "Adding unreferenced controversial information about living persons",summary:"General note: Adding unreferenced controversial information about living persons"},"uw-defam1":{label:"Defamation not specifically directed",summary:"General note: Defamation not specifically directed"},"uw-uncen1":{label:"Censorship of material",summary:"General note: Censorship of material"},"uw-mos1":{label:"Manual of style",summary:"General note: Formatting, date, language, etc (Manual of style)"},"uw-move1":{label:"Page moves",summary:"General note: Page moves"},"uw-chat1":{label:"Using talk page as forum",summary:"General note: Using talk page as forum"},"uw-tpv1":{label:"Refactoring others' talk page comments",summary:"General note: Refactoring others' talk page comments"},"uw-afd1":{label:"Removing \{\{afd\}\} templates",summary:"General note: Removing \{\{afd\}\} templates"},"uw-speedy1":{label:"Removing \{\{speedy deletion\}\} templates",summary: "General note: Removing \{\{speedy deletion\}\} templates"},"uw-blpprod1":{label:"Removing \{\{blp prod\}\} templates",summary:"General note: Removing \{\{blp prod\}\} templates"},"uw-npa1":{label:"Personal attack directed at a specific editor",summary:"General note: Personal attack directed at a specific editor"},"uw-agf1":{label:"Not assuming good faith",summary:"General note: Not assuming good faith"},"uw-own1":{label:"Ownership of articles",summary:"General note: Ownership of articles"},"uw-tempabuse1":{label:"Improper use of warning or blocking template",summary:"General note: Improper use of warning or blocking template"},"uw-genre1":{label:"Frequent or mass changes to genres without consensus or references",summary:"General note: Frequent or mass changes to genres without consensus or references"}},level2:{"uw-vandalism2":{label:"Vandalism",summary:"Caution: Vandalism"},"uw-test2":{label:"Editing tests",summary:"Caution: Editing tests"},"uw-delete2":{label: "Page blanking, removal of content",summary:"Caution: Page blanking, removal of content"},"uw-redirect2":{label:"Creating malicious redirects",summary:"Caution: Creating malicious redirects"},"uw-tdel2":{label:"Removal of maintenance templates",summary:"Caution: Removal of maintenance templates"},"uw-joke2":{label:"Using improper humor",summary:"Caution: Using improper humor"},"uw-create2":{label:"Creating inappropriate pages",summary:"Caution: Creating inappropriate pages"},"uw-upload2":{label:"Uploading inappropriate images",summary:"Caution: Uploading inappropriate images"},"uw-image2":{label:"Image-related vandalism",summary:"Caution: Image-related vandalism"},"uw-ics2":{label:"Uploading files missing copyright status",summary:"Caution: Uploading files missing copyright status"},"uw-idt2":{label:"Removing file deletion tags",summary:"Caution: Removing file deletion tags"},"uw-spam2":{label:"Adding spam links",summary:"Caution: Adding spam links"},"uw-advert2":{label: "Using Wikipedia for advertising or promotion",summary:"Caution: Using Wikipedia for advertising or promotion"},"uw-npov2":{label:"Not adhering to neutral point of view",summary:"Caution: Not adhering to neutral point of view"},"uw-unsourced2":{label:"Addition of unsourced or improperly cited material",summary:"Caution: Addition of unsourced or improperly cited material"},"uw-error2":{label:"Introducing deliberate factual errors",summary:"Caution: Introducing factual errors"},"uw-nor2":{label:"Adding original research, including unpublished syntheses of sourced material",summary:"Caution: Adding original research, including unpublished syntheses of sourced material"},"uw-biog2":{label:"Adding unreferenced controversial information about living persons",summary:"Caution: Adding unreferenced controversial information about living persons"},"uw-defam2":{label:"Defamation not specifically directed",summary:"Caution: Defamation not specifically directed"},"uw-uncen2":{label: "Censorship of material",summary:"Caution: Censorship of material"},"uw-mos2":{label:"Manual of style",summary:"Caution: Formatting, date, language, etc (Manual of style)"},"uw-move2":{label:"Page moves",summary:"Caution: Page moves"},"uw-chat2":{label:"Using talk page as forum",summary:"Caution: Using talk page as forum"},"uw-tpv2":{label:"Refactoring others' talk page comments",summary:"Caution: Refactoring others' talk page comments"},"uw-afd2":{label:"Removing \{\{afd\}\} templates",summary:"Caution: Removing \{\{afd\}\} templates"},"uw-speedy2":{label:"Removing \{\{speedy deletion\}\} templates",summary:"Caution: Removing \{\{speedy deletion\}\} templates"},"uw-blpprod2":{label:"Removing \{\{blp prod\}\} templates",summary:"Caution: Removing \{\{blp prod\}\} templates"},"uw-npa2":{label:"Personal attack directed at a specific editor",summary:"Caution: Personal attack directed at a specific editor"},"uw-agf2":{label:"Not assuming good faith",summary: "Caution: Not assuming good faith"},"uw-own2":{label:"Ownership of articles",summary:"Caution: Ownership of articles"},"uw-tempabuse2":{label:"Improper use of warning or blocking template",summary:"Caution: Improper use of warning or blocking template"},"uw-genre2":{label:"Frequent or mass changes to genres without consensus or references",summary:"Caution: Frequent or mass changes to genres without consensus or references"}},level3:{"uw-vandalism3":{label:"Vandalism",summary:"Warning: Vandalism"},"uw-test3":{label:"Editing tests",summary:"Warning: Editing tests"},"uw-delete3":{label:"Page blanking, removal of content",summary:"Warning: Page blanking, removal of content"},"uw-redirect3":{label:"Creating malicious redirects",summary:"Warning: Creating malicious redirects"},"uw-tdel3":{label:"Removal of maintenance templates",summary:"Warning: Removal of maintenance templates"},"uw-joke3":{label:"Using improper humor",summary:"Warning: Using improper humor"},"uw-create3":{label: "Creating inappropriate pages",summary:"Warning: Creating inappropriate pages"},"uw-upload3":{label:"Uploading inappropriate images",summary:"Warning: Uploading inappropriate images"},"uw-image3":{label:"Image-related vandalism",summary:"Warning: Image-related vandalism"},"uw-ics3":{label:"Uploading files missing copyright status",summary:"Warning: Uploading files missing copyright status"},"uw-idt3":{label:"Removing file deletion tags",summary:"Warning: Removing file deletion tags"},"uw-spam3":{label:"Adding spam links",summary:"Warning: Adding spam links"},"uw-advert3":{label:"Using Wikipedia for advertising or promotion",summary:"Warning: Using Wikipedia for advertising or promotion"},"uw-npov3":{label:"Not adhering to neutral point of view",summary:"Warning: Not adhering to neutral point of view"},"uw-unsourced3":{label:"Addition of unsourced or improperly cited material",summary:"Warning: Addition of unsourced or improperly cited material"},"uw-error3":{label: "Introducing deliberate factual errors",summary:"Warning: Introducing deliberate factual errors"},"uw-nor3":{label:"Adding original research, including unpublished syntheses of sourced material",summary:"Warning: Adding original research, including unpublished syntheses of sourced material"},"uw-biog3":{label:"Adding unreferenced controversial or defamatory information about living persons",summary:"Warning: Adding unreferenced controversial information about living persons"},"uw-defam3":{label:"Defamation not specifically directed",summary:"Warning: Defamation not specifically directed"},"uw-uncen3":{label:"Censorship of material",summary:"Warning: Censorship of material"},"uw-mos3":{label:"Manual of style",summary:"Warning: Formatting, date, language, etc (Manual of style)"},"uw-move3":{label:"Page moves",summary:"Warning: Page moves"},"uw-chat3":{label:"Using talk page as forum",summary:"Warning: Using talk page as forum"},"uw-tpv3":{label:"Refactoring others' talk page comments", summary:"Warning: Refactoring others' talk page comments"},"uw-afd3":{label:"Removing \{\{afd\}\} templates",summary:"Warning: Removing \{\{afd\}\} templates"},"uw-speedy3":{label:"Removing \{\{speedy deletion\}\} templates",summary:"Warning: Removing \{\{speedy deletion\}\} templates"},"uw-blpprod3":{label:"Removing \{\{blpprod\}\} templates",summary:"Warning: Removing \{\{blpprod\}\} templates"},"uw-npa3":{label:"Personal attack directed at a specific editor",summary:"Warning: Personal attack directed at a specific editor"},"uw-agf3":{label:"Not assuming good faith",summary:"Warning: Not assuming good faith"},"uw-own3":{label:"Ownership of articles",summary:"Warning: Ownership of articles"},"uw-genre3":{label:"Frequent or mass changes to genres without consensus or reference",summary:"Warning: Frequent or mass changes to genres without consensus or reference"}},level4:{"uw-vandalism4":{label:"Vandalism",summary:"Final warning: Vandalism"},"uw-test4":{label:"Editing tests",summary: "Final warning: Editing tests"},"uw-delete4":{label:"Page blanking, removal of content",summary:"Final warning: Page blanking, removal of content"},"uw-redirect4":{label:"Creating malicious redirects",summary:"Final warning: Creating malicious redirects"},"uw-tdel4":{label:"Removal of maintenance templates",summary:"Final warning: Removal of maintenance templates"},"uw-joke4":{label:"Using improper humor",summary:"Final warning: Using improper humor"},"uw-create4":{label:"Creating inappropriate pages",summary:"Final warning: Creating inappropriate pages"},"uw-upload4":{label:"Uploading inappropriate images",summary:"Final warning: Uploading inappropriate images"},"uw-image4":{label:"Image-related vandalism",summary:"Final warning: Image-related vandalism"},"uw-ics4":{label:"Uploading files missing copyright status",summary:"Final warning: Uploading files missing copyright status"},"uw-idt4":{label:"Removing file deletion tags",summary:"Final warning: Removing file deletion tags"}, "uw-spam4":{label:"Adding spam links",summary:"Final warning: Adding spam links"},"uw-advert4":{label:"Using Wikipedia for advertising or promotion",summary:"Final warning: Using Wikipedia for advertising or promotion"},"uw-npov4":{label:"Not adhering to neutral point of view",summary:"Final warning: Not adhering to neutral point of view"},"uw-error4":{label:"Introducing deliberate factual errors",summary:"Final Warning: Introducing deliberate factual errors"},"uw-nor4":{label:"Adding original research, including unpublished syntheses of sourced material",summary:"Final Warning: Adding original research, including unpublished syntheses of sourced material"},"uw-biog4":{label:"Adding unreferenced defamatory information about living persons",summary:"Final warning: Adding unreferenced controversial information about living persons"},"uw-defam4":{label:"Defamation not specifically directed",summary:"Final warning: Defamation not specifically directed"},"uw-uncen4":{label: "Censorship of material",summary:"Final warning: Censorship of material"},"uw-mos4":{label:"Manual of style",summary:"Final warning: Formatting, date, language, etc (Manual of style)"},"uw-move4":{label:"Page moves",summary:"Final warning: Page moves"},"uw-chat4":{label:"Using talk page as forum",summary:"Final warning: Using talk page as forum"},"uw-tpv4":{label:"Refactoring others' talk page comments",summary:"Final warning: Refactoring others' talk page comments"},"uw-afd4":{label:"Removing \{\{afd\}\} templates",summary:"Final warning: Removing \{\{afd\}\} templates"},"uw-speedy4":{label:"Removing \{\{speedy deletion\}\} templates",summary:"Final warning: Removing \{\{speedy deletion\}\} templates"},"uw-blpprod4":{label:"Removing \{\{blpprod\}\} templates",summary:"Final warning: Removing \{\{blpprod\}\} templates"},"uw-npa4":{label:"Personal attack directed at a specific editor",summary:"Final warning: Personal attack directed at a specific editor"}},level4im:{"uw-vandalism4im":{ label:"Vandalism",summary:"Only warning: Vandalism"},"uw-delete4im":{label:"Page blanking, removal of content",summary:"Only warning: Page blanking, removal of content"},"uw-redirect4im":{label:"Creating malicious redirects",summary:"Only warning: Creating malicious redirects"},"uw-joke4im":{label:"Using improper humor",summary:"Only warning: Using improper humor"},"uw-create4im":{label:"Creating inappropriate pages",summary:"Only warning: Creating inappropriate pages"},"uw-upload4im":{label:"Uploading inappropriate images",summary:"Only warning: Uploading inappropriate images"},"uw-image4im":{label:"Image-related vandalism",summary:"Only warning: Image-related vandalism"},"uw-spam4im":{label:"Adding spam links",summary:"Only warning: Adding spam links"},"uw-advert4im":{label:"Using Wikipedia for advertising or promotion",summary:"Only warning: Using Wikipedia for advertising or promotion"},"uw-biog4im":{label:"Adding unreferenced defamatory information about living persons",summary: "Only warning: Adding unreferenced controversial information about living persons"},"uw-defam4im":{label:"Defamation not specifically directed",summary:"Only warning: Defamation not specifically directed"},"uw-move4im":{label:"Page moves",summary:"Only warning: Page moves"},"uw-npa4im":{label:"Personal attack directed at a specific editor",summary:"Only warning: Personal attack directed at a specific editor"}},singlenotice:{"uw-2redirect":{label:"Creating double redirects through bad page moves",summary:"Notice: Creating double redirects through bad page moves"},"uw-aiv":{label:"Bad AIV report",summary:"Notice: Bad AIV report"},"uw-articlesig":{label:"Adding signatures to article space",summary:"Notice: Adding signatures to article space"},"uw-autobiography":{label:"Creating autobiographies",summary:"Notice: Creating autobiographies"},"uw-badcat":{label:"Adding incorrect categories",summary:"Notice: Adding incorrect categories"},"uw-badlistentry":{label: "Adding inappropriate entries to lists",summary:"Notice: Adding inappropriate entries to lists"},"uw-bite":{label:"\"Biting\" newcomers",summary:"Notice: \"Biting\" newcomers"},"uw-coi":{label:"Conflict of Interest",summary:"Notice: Conflict of Interest"},"uw-copying":{label:"Copying text to another page",summary:"Notice: Copying text to another page"},"uw-crystal":{label:"Adding speculative or unconfirmed information",summary:"Notice: Adding speculative or unconfirmed information"},"uw-csd":{label:"Speedy deletion declined",summary:"Notice: Speedy deletion declined"},"uw-c&pmove":{label:"Cut and paste moves",summary:"Notice: Cut and paste moves"},"uw-dab":{label:"Incorrect edit to a disambiguation page",summary:"Notice: Incorrect edit to a disambiguation page"},"uw-date":{label:"Unnecessarily changing date formats",summary:"Notice: Unnecessarily changing date formats"},"uw-deadlink":{label:"Removing proper sources containing dead links",summary: "Notice: Removing proper sources containing dead links"},"uw-draftfirst":{label:"Draft in userspace without the risk of speedy deletion",summary:"Notice: Consider drafting your article in userspace"},"uw-editsummary":{label:"Not using edit summary",summary:"Notice: Not using edit summary"},"uw-english":{label:"Not communicating in English",summary:"Notice: Not communicating in English"},"uw-fuir":{label:"Fair use image has been removed from your userpage",summary:"Notice: A fair use image has been removed from your userpage"},"uw-hangon":{label:"User forgets to place a hang-on reasoning to the talk page",summary:"Notice: User forgets to place a hang-on reasoning to the talk page"},"uw-hasty":{label:"Hasty addition of speedy deletiontags",summary:"Notice: Allow creators time to improve their articles before tagging them for deletion"},"uw-imageuse":{label:"Incorrect image linking",summary:"Notice: Incorrect image linking"},"uw-incompleteAFD":{label: "Incomplete AFD",summary:"Notice: Incomplete AFD"},"uw-italicize":{label:"Italicize books, films, albums, magazines, TV series, etc within articles",summary:"Notice: Italicize books, films, albums, magazines, TV series, etc within articles"},"uw-lang":{label:"Unnecessarily changing between British and American English",summary:"Notice: Unnecessarily changing between British and American English"},"uw-linking":{label:"Excessive addition of redlinks or repeated blue links",summary:"Notice: Excessive addition of redlinks or repeated blue links"},"uw-minor":{label:"Incorrect use of minor edits check box",summary:"Notice: Incorrect use of minor edits check box"},"uw-nonfree":{label:"Uploading replaceable non-free images",summary:"Notice: Uploading replaceable non-free images"},"uw-notaiv":{label:"Do not report complex abuse to AIV",summary:"Notice: Do not report complex abuse to AIV"},"uw-notenglish":{label:"Creating non-English articles",summary:"Notice: Creating non-English articles"}, "uw-notifysd":{label:"Notify authors of speedy deletion tagged articles",summary:"Notice: Please notify authors of articles tagged for speedy deletion"},"uw-notvote":{label:"We use consensus, not voting",summary:"Notice: We use consensus, not voting"},"uw-patrolled":{label:"Mark newpages as patrolled when patrolling",summary:"Notice: Mark newpages as patrolled when patrolling"},"uw-preview":{label:"Use preview button to avoid mistakes",summary:"Notice: Use preview button to avoid mistakes"},"uw-probation":{label:"Article is on probation",summary:"Notice: Article is on probation"},"uw-refimprove":{label:"Creating unverifiable articles",summary:"Notice: Creating unverifiable articles"},"uw-removevandalism":{label:"Incorrect vandalism removal",summary:"Notice: Incorrect vandalism removal"},"uw-repost":{label:"Recreating material previously deleted via XfD process",summary:"Notice: Recreating previously deleted material"},"uw-salt":{label: "Recreating salted articles under a different title",summary:"Notice: Recreating salted articles under a different title"},"uw-samename":{label:"Rename request impossible",summary:"Notice: Rename request impossible"},"uw-selfrevert":{label:"Reverting self tests",summary:"Notice: Reverting self tests"},"uw-skype":{label:"Skype interfering with editing",summary:"Notice: Skype interfering with editing"},"uw-socialnetwork":{label:"Wikipedia is not a social network",summary:"Notice: Wikipedia is not a social network"},"uw-sofixit":{label:"Be bold and fix things yourself",summary:"Notice: You can be bold and fix things yourself"},"uw-spoiler":{label:"Censoring spoiler alerts",summary:"Notice: Don't remove spoilers or add spoiler alerts"},"uw-subst":{label:"Remember to subst: templates",summary:"Notice: Remember to subst: templates"},"uw-talkinarticle":{label:"Talk in article",summary:"Notice: Talk in article"},"uw-tilde":{label:"Not signing posts",summary:"Notice: Not signing posts"}, "uw-uaa":{label:"Reporting of username to WP:UAA not accepted",summary:"Notice: Reporting of username to WP:UAA not accepted"},"uw-userspacenoindex":{label:"User page isn't appropriate for search engine indexing",summary:"Notice: User page isn't appropriate for search engine indexing"},"uw-vgscope":{label:"Adding video game walkthroughs, cheats or instructions",summary:"Notice: Adding video game walkthroughs, cheats or instructions"},"uw-warn":{label:"Warning vandals",summary:"Notice: Warning vandals"}},singlewarn:{"uw-3rr":{label:"Potentially violating the three revert rule",summary:"Warning: Potentially violating the three revert rule"},"uw-affiliate":{label:"Affiliate marketing",summary:"Warning: Affiliate marketing"},"attack":{label:"Personal attacks",summary:"Warning: Personal attacks"},"uw-attempt":{label:"Triggering the edit filter",summary:"Warning: Triggering the edit filter"},"uw-bizlist":{label:"Business promotion",summary:"Warning: Promoting a business"},"uw-botun":{label: "Bot username",summary:"Warning: Bot username"},"uw-canvass":{label:"Canvassing",summary:"Warning: Canvassing"},"uw-copyright":{label:"Copyright violation",summary:"Warning: Copyright violation"},"uw-copyright-link":{label:"Linking to copyrighted works violation",summary:"Warning: Linking to copyrighted works violation"},"uw-efsummary":{label:"Edit summary triggering the edit filter",summary:"Warning: Edit summary triggering the edit filter"},"uw-hoax":{label:"Creating hoaxes",summary:"Warning: Creating hoaxes"},"uw-legal":{label:"Making legal threats",summary:"Warning: Making legal threats"},"uw-longterm":{label:"Long term pattern of vandalism",summary:"Warning: Long term pattern of vandalism"},"uw-multipleIPs":{label:"Usage of multiple IPs",summary:"Warning: Usage of multiple IPs"},"uw-pinfo":{label:"Personal info",summary:"Warning: Personal info"},"uw-socksuspect":{label:"Sockpuppetry",summary:"Warning: Sockpuppetry"},"uw-upv":{label:"Userpage vandalism",summary: "Warning: Userpage vandalism"},"uw-username":{label:"Username is against policy",summary:"Warning: Your username might be against policy"},"uw-coi-username":{label:"Username is against policy, and conflict of interest",summary:"Warning: Username and conflict of interest policy"},"uw-userpage":{label:"Userpage or subpage is against policy",summary:"Warning: Userpage or subpage is against policy"},"uw-wrongsummary":{label:"Using inaccurate or inappropriate edit summaries",summary:"Warning: Using inaccurate or inappropriate edit summaries"}},block:{"uw-block":{'label':"Block",'summary':"You have been blocked from editing"},"uw-blocknotalk":{'label':"Block (talk page disabled)",'summary':"You have been blocked from editing and your user talk page has been disabled"},"uw-blockindef":{'label':"Block (indefinite)",'summary':"You have been indefinitely blocked from editing"},"uw-ablock":{'label':"Anonymous block",'summary':"Your IP address has been blocked from editing"},"uw-aeblock":{'label': "Arbitration enforcement block",'summary':"You have been blocked from editing for violating an arbitration decision with your edits"},"uw-adblock":{'label':"Advertising block",'summary':"You have been blocked from editing for advertising or self-promotion"},"uw-sblock":{'label':"Spam block",'summary':"You have been blocked from editing for continuing to add spam links"},"uw-soablock":{'label':"Spam/advertising-only account block",'summary':"You have been indefinitely blocked from editing because your account is being used only for spam, advertising, or promotion"},"uw-vblock":{'label':"Vandalism block",'summary':"You have been blocked from editing for persistent vandalism"},"uw-voablock":{'label':"Vandalism-only account block",'summary':"You have been indefinitely blocked from editing because your account is being used only for vandalism"},"uw-bioblock":{'label':"BLP violations",'summary': "You have been blocked from editing for violations of Wikipedia's biographies of living persons policy"},"uw-npblock":{'label':"Creating nonsense pages block",'summary':"You have been blocked from editing for creating nonsense pages"},"uw-myblock":{'label':"Social networking block",'summary':"You have been blocked from editing for using user and/or article pages as a blog, web host, social networking site or forum"},"uw-copyrightblock":{'label':"Copyright violation block",'summary':"You have been blocked from editing for continued copyright infringement"},"uw-dblock":{'label':"Deletion/removal of content block",'summary':"You have been blocked from editing for continued removal of material"},"uw-efblock":{'label':"Edit filter-related block",'summary':"You have been blocked from editing for making disruptive edits that repeatedly triggered the edit filter"},"uw-ewblock":{'label':"Edit warring block",'summary': "You have been blocked from editing to prevent further disruption caused by your engagement in an edit war"},"uw-3block":{'label':"Three-revert rule violation block",'summary':"You have been blocked from editing for your disruption caused by edit warring and violation of the three-revert rule"},"uw-botblock":{'label':"Unapproved bot block",'summary':"You have been blocked from editing because it appears you are running a bot script without approval"},"uw-ublock":{'label':"Username soft block",'summary':"You have been indefinitely blocked from editing because your username is a violation of the username policy"},"uw-uhblock":{'label':"Username hard block",'summary':"You have been indefinitely blocked from editing because your username is a blatant violation of the username policy"},"uw-softerblock":{'label':"Promotional username soft block",'summary': "You have been indefinitely blocked from editing because your username gives the impression that the account represents a group, organization or website"},"uw-causeblock":{'label':"Promotional username soft block, for charitable causes and social service organizations",'summary':"You have been indefinitely blocked from editing because your username gives the impression that the account represents a group, organization or website"},"uw-botublock":{'label':"Bot username soft block",'summary':"You have been indefinitely blocked from editing because your username indicates this is a bot account, which is currently not approved"},"uw-memorialblock":{'label':"Memorial username soft block",'summary':"You have been indefinitely blocked from editing because your username indicates this account may be used as a memorial or tribute to someone"},"uw-ublock-famous":{'label':"Famous username soft block",'summary': "You have been indefinitely blocked from editing because your username matches the name of a well-known living individual"},"uw-ublock-double":{'label':"Similar username soft block",'summary':"You have been indefinitely blocked from editing because your username is too similar to the username of another Wikipedia user"},"uw-uhblock-double":{'label':"Username impersonation hard block",'summary':"You have been indefinitely blocked from editing because your username appears to impersonate another Wikipedia user"},"uw-vaublock":{'label':"Vandalism-only account and username hard block",'summary':"You have been indefinitely blocked from editing because your account is being used only for vandalism and your username is a blatant violation of the username policy"},"uw-spamublock":{'label':"Spam/advertising-only account and promotional username hard block",'summary': "You have been indefinitely blocked from editing because your account is being used only for spam or advertising and your username is a violation of the username policy"},"uw-compblock":{'label':"Possible compromised account block",'summary':"You have been indefinitely blocked from editing because it is believed that your account has been compromised"},"uw-lblock":{'label':"Legal threat block",'summary':"You have been blocked from editing for making legal threats or taking legal action"},"uw-hblock":{'label':"Harassment block",'summary':"You have been blocked from editing for attempting to harass other users"},"uw-pinfoblock":{'label':"Personal information exposure block",'summary':"You have been blocked from editing for posting personal information of another editor"},"uw-deoablock":{'label':"Disruption/trolling only account block",'summary': "You have been indefinitely blocked from editing because your account is being used only for trolling, disruption or harassment"},"uw-block-onlyfor":{'label':"Bad-faith single purpose account",'summary':"You have been indefinitely blocked from editing because your account is a single purpose account being used only for disruptive editing"},"uw-spoablock":{'label':"Sockpuppet account block",'summary':"You have been indefinitely blocked from editing because your account is being used only for sock puppetry or meat puppetry"}}};twinklewarn.indefBlockHash={'uw-block':false,'uw-3block':false,'uw-ablock':false,'uw-adblock':false,'uw-aeblock':false,'uw-bioblock':false,'uw-blocknotalk':false,'uw-botblock':false,'uw-copyrightblock':false,'uw-dblock':false,'uw-efblock':false,'uw-ewblock':false,'uw-hblock':false,'uw-myblock':false,'uw-npblock':false,'uw-pinfoblock':false,'uw-sblock':false,'uw-pblock':false,'uw-blockindef':true,'uw-block-onlyfor':true, 'uw-botublock':true,'uw-causeblock':true,'uw-compblock':true,'uw-deoablock':true,'uw-lblock':true,'uw-memorialblock':true,'uw-soablock':true,'uw-softerblock':true,'uw-spamublock':true,'uw-spoablock':true,'uw-ublock':true,'uw-ublock-famous':true,'uw-uhblock':true,'uw-uhblock-double':true,'uw-ublock-double':true,'uw-vaublock':true,'uw-voablock':true};twinklewarn.pageHash={'uw-block':true,'uw-3block':true,'uw-ablock':true,'uw-adblock':true,'uw-aeblock':true,'uw-bioblock':true,'uw-blocknotalk':true,'uw-botblock':true,'uw-copyrightblock':true,'uw-dblock':true,'uw-efblock':true,'uw-ewblock':true,'uw-hblock':true,'uw-myblock':true,'uw-npblock':true,'uw-pinfoblock':true,'uw-sblock':true,'uw-vblock':true,'uw-blockindef':true,'uw-block-onlyfor':true,'uw-botublock':false,'uw-causeblock':false,'uw-compblock':true,'uw-deoablock':true,'uw-lblock':true,'uw-memorialblock':false,'uw-soablock':true,'uw-softerblock':false,'uw-spamublock':false,'uw-spoablock':true,'uw-ublock':false,'uw-ublock-famous': false,'uw-uhblock':false,'uw-uhblock-double':false,'uw-ublock-double':false,'uw-vaublock':true,'uw-voablock':true};twinklewarn.reasonHash={'uw-block':true,'uw-3block':false,'uw-ablock':true,'uw-adblock':false,'uw-aeblock':true,'uw-bioblock':false,'uw-blocknotalk':true,'uw-botblock':false,'uw-copyrightblock':false,'uw-dblock':false,'uw-efblock':false,'uw-ewblock':false,'uw-hblock':false,'uw-myblock':false,'uw-npblock':false,'uw-pinfoblock':true,'uw-sblock':false,'uw-vblock':false,'uw-blockindef':true,'uw-block-onlyfor':true,'uw-botublock':true,'uw-causeblock':false,'uw-compblock':false,'uw-deoablock':false,'uw-lblock':false,'uw-memorialblock':false,'uw-soablock':false,'uw-softerblock':false,'uw-spamublock':false,'uw-spoablock':false,'uw-ublock':true,'uw-ublock-famous':false,'uw-uhblock':true,'uw-uhblock-double':false,'uw-ublock-double':false,'uw-vaublock':false,'uw-voablock':false};twinklewarn.prev_block_timer=null;twinklewarn.prev_article=null;twinklewarn.prev_reason=null;twinklewarn. callback.change_category=function twinklewarnCallbackChangeCategory(e){var value=e.target.value;var sub_group=e.target.root.sub_group;var messages=twinklewarn.messages[value];sub_group.main_group=value;var old_subvalue=sub_group.value;if(old_subvalue){old_subvalue=old_subvalue.replace(/\d*(im)?$/,'');var old_subvalue_re=new RegExp(RegExp.escape(old_subvalue)+"(\\d*(?:im)?)$");}while(sub_group.hasChildNodes){sub_group.removeChild(sub_group.firstChild);}for(var i in messages){var selected=false;if(old_subvalue&&old_subvalue_re.test(i)){selected=true;}var elem=new QuickForm.element({type:'option',label:"["+i+"]: "+messages[i].label,value:i,selected:selected});sub_group.appendChild(elem.render);}if(value=='block'){var more=new QuickForm.element({type:'input',name:'block_timer',label:'Period of blocking: ',tooltip:'The period the blocking is due for, for example 24 hours, 2 weeks, indefinite etc...'});e.target.root.insertBefore(more.render,e.target.root.lastChild);if(!(twinklewarn. prev_block_timer===null)){e.target.root.block_timer.value=twinklewarn.prev_block_timer;twinklewarn.prev_block_timer=null;}if(twinklewarn.prev_article===null){twinklewarn.prev_article=e.target.root.article.value;}e.target.root.article.disabled=true;e.target.root.article.value='';}else if(e.target.root.block_timer){if(!e.target.root.block_timer.disabled&&twinklewarn.prev_block_timer===null){twinklewarn.prev_block_timer=e.target.root.block_timer.value;}e.target.root.removeChild(e.target.root.block_timer.parentNode);if(e.target.root.article.disabled&&!(twinklewarn.prev_article===null)){e.target.root.article.value=twinklewarn.prev_article;twinklewarn.prev_article=null;}e.target.root.article.disabled=false;if(e.target.root.reason.disabled&&!(twinklewarn.prev_reason===null)){e.target.root.reason.value=twinklewarn.prev_reason;twinklewarn.prev_reason=null;}e.target.root.reason.disabled=false;}} twinklewarn.callback.change_subcategory=function twinklewarnCallbackChangeSubcategory(e){var main_group=e.target.main_group;var value=e.target.value;if(main_group=='singlewarn'){if(value=='uw-username'){if(twinklewarn.prev_article===null){twinklewarn.prev_article=e.target.form.article.value;}e.target.form.article.disabled=true;e.target.form.article.value='';}else if(e.target.form.article.disabled){if(!(twinklewarn.prev_article===null)){e.target.form.article.value=twinklewarn.prev_article;twinklewarn.prev_article=null;}e.target.form.article.disabled=false;}}else if(main_group=='block'){if(twinklewarn.indefBlockHash[value]){if(twinklewarn.prev_block_timer===null){twinklewarn.prev_block_timer=e.target.form.block_timer.value;}e.target.form.block_timer.disabled=true;e.target.form.block_timer.value='indef';}else if(e.target.form.block_timer.disabled){if(!(twinklewarn.prev_block_timer===null)){e.target.form.block_timer.value=twinklewarn.prev_block_timer;twinklewarn.prev_block_timer=null;}e. target.form.block_timer.disabled=false;}if(twinklewarn.pageHash[value]){if(!(twinklewarn.prev_article===null)){e.target.form.article.value=twinklewarn.prev_article;twinklewarn.prev_article=null;}e.target.form.article.disabled=false;}else if(!e.target.form.article.disabled){if(twinklewarn.prev_article===null){twinklewarn.prev_article=e.target.form.article.value;}e.target.form.article.disabled=true;e.target.form.article.value=;}if(twinklewarn.reasonHash[value]){if(!(twinklewarn.prev_reason===null)){e.target.form.reason.value=twinklewarn.prev_reason;twinklewarn.prev_reason=null;}e.target.form.reason.disabled=false;}else if(!e.target.form.reason.disabled){if(twinklewarn.prev_reason===null){twinklewarn.prev_reason=e.target.form.reason.value;}e.target.form.reason.disabled=true;e.target.form.reason.value=;}}} twinklewarn.callbacks={main:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var history_re=/\<\!\-\-\ Template\:(uw\-.*?)\ \-\-\>.*?(\d{1,2}:\d{1,2}, \d{1,2} \w+ \d{4}) \(UTC\)/g;var history={};var latest={date:new Date(0),type:''};var current;while((current=history_re.exec(text))!=undefined){var current_date=new Date(current[2]+' UTC');if(!(current[1]in history)||history[current[1]]latest.date){latest.date=current_date;latest.type=current[1];}}var date=new Date;if(params.sub_group in history){var temp_time=new Date(history[params.sub_group]);temp_time.setUTCHours(temp_time.getUTCHours+24);if(temp_time>date){Status.info('Info',"an identical "+params.sub_group+" has been issued in the last 24 hours");if(!confirm("Would you still like to add a warning/notice?")){pageobj.statelem.info('aborted per user request');return;}}}latest.date.setUTCMinutes(latest.date.getUTCMinutes+1) getUTCMonthName+" "+date.getUTCFullYear+" ==\n";}if(params.article&&twinklewarn.pageHash[params.sub_group]){article='|page='+params.article;}if(params.reason&&twinklewarn.reasonHash[params.sub_group]){reason='|reason='+params.reason;}if(/te?mp|^\s*$|min/.exec(params.block_timer)||twinklewarn.indefBlockHash[params.sub_group]){time=;}else if(/indef|\*|max/.exec(params.block_timer)){time='|indef=yes';}else{time='|time='+params.block_timer;}text+="\{\{subst:"+params.sub_group+article+time+reason+"|sig=true|subst=subst:\}\}";}else{if(!headerRe.exec(text)){Status.info('Info','Will create a new level 2 heading for the date, as none was found for this month');text+="== "+date.getUTCMonthName+" "+date.getUTCFullYear+" ==\n";}if(params.sub_group=='uw-username'){text+="\{\{subst:"+params.sub_group+(params.reason?'|1='+params.reason:)+"|subst=subst:\}\} \~\~\~\~";}else{text+="\{\{subst:"+params.sub_group+(params.article?'|1='+params.article:'')+"|subst=subst:\}\}"+(params.reason?" "+ params.reason+" ":' ')+"\~\~\~\~";}}if(TwinkleConfig.showSharedIPNotice&&isIPAddress(wgTitle)){Status.info('Info','Adding a shared ip notice');switch(QueryString.get('type')){case'vand':text+="\n:If this is a shared IP address, and you didn't make any unconstructive edits, consider creating an account for yourself so you can avoid further irrelevant warnings. ";break;default:text+="\n:If this is a shared IP address, and you didn't make the edit, consider creating an account for yourself so you can avoid further irrelevant notices. ";break;}}pageobj.setPageText(text);pageobj.setEditSummary(twinklewarn.messages[params.main_group][params.sub_group].summary+(params.article?' on '+params.article+:)+'.'+TwinkleConfig.summaryAd);pageobj.setWatchlist(TwinkleConfig.watchWarnings);pageobj.save;}} twinklewarn.callback.evaluate=function twinklewarnCallbackEvaluate(e){if(e.target.sub_group.value=='uw-username'&&e.target.reason.value.trim==''){alert("You must supply a reason for the \{\{uw-username}} template");return;}var params={reason:e.target.reason.value,main_group:e.target.main_group.value,sub_group:e.target.sub_group.value,article:e.target.article.value.replace(/^(Image|Category):/i,':$1:'),block_timer:e.target.block_timer?e.target.block_timer.value:null} Status.init(e.target);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Warning complete, reloading talk page in a few seconds";var wikipedia_page=new Wikipedia.page(wgPageName,'User talk page modification');wikipedia_page.setCallbackParameters(params);wikipedia_page.setFollowRedirect(true);wikipedia_page.load(twinklewarn.callbacks.main);} Twinkle.init.moduleReady("twinklewarn",twinklewarn);function twinklexfd{if(wgNamespaceNumber<0||wgCurRevisionId==false){return;}if(Twinkle.authorizedUser){twAddPortletLink("javascript:twinklexfd.callback","XFD","tw-xfd","Anything for deletion","");}else{twAddPortletLink('javascript:alert("Your account is too new to use Twinkle.");','XFD','tw-xfd','Anything for deletion',);}if(typeof(TwinkleConfig.xfdWatchDiscussion)=='undefined'){TwinkleConfig.xfdWatchDiscussion="default";}if(typeof(TwinkleConfig.xfdWatchPage)=='undefined'){TwinkleConfig.xfdWatchPage="default";}if(typeof(TwinkleConfig.xfdWatchUser)=='undefined'){TwinkleConfig.xfdWatchUser="default";}if(typeof(TwinkleConfig.xfdWatchList)=='undefined'){TwinkleConfig.xfdWatchList="no";}}function num2order(num){switch(num){case 1:return;case 2:return'2nd';case 3:return'3rd';default:return num+'th';}}twinklexfd.callback=function twinklexfdCallback{var Window=new SimpleWindow(600,350);Window.setTitle("Anything for deletion");var form=new QuickForm(twinklexfd.callback.evaluate);var categories=form.append({type:'select',name:'category',label:'Select wanted type of category: ',tooltip:'When activated, a default choice is made, based on what namespace you are in. This default should be the most appropriate',event:twinklexfd.callback.change_category});categories.append({type:'option',label:'AfD (Articles for deletion)',selected:wgNamespaceNumber==Namespace.MAIN,value:'afd'});categories.append({type:'option',label:'TfD (Templates for discussion)',selected:wgNamespaceNumber==Namespace.TEMPLATE,value:'tfd'});categories.append({type:'option',label:'FfD (Files for deletion)/PUF (Possibly unfree files)',selected:wgNamespaceNumber==Namespace.IMAGE,value:'ffd'});categories.append({type:'option',label:'CfD (Categories for discussion)',selected:wgNamespaceNumber==Namespace.CATEGORY,value:'cfd'});categories.append({type:'option',label:'MfD (Miscellany for deletion)',selected:[Namespace.IMAGE,Namespace.MAIN,Namespace.TEMPLATE, Namespace.CATEGORY].indexOf(wgNamespaceNumber)==-1,value:'mfd'});categories.append({type:'option',label:'RfD (Redirects for discussion)',selected:QueryString.equals('redirect','no')&&(document.evaluate("//span[@class='redirectText']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0),value:'rfd'});form.append({type:'checkbox',list:[{label:'Notify if possible',value:'notify',name:'notify',tooltip:'If a notification if defined in the configuration, then notify the page creator if this is true, else no notify',checked:true}]});form.append({type:'field',label:'Work area',name:'work_area'});var result=form.render;Window.setContent(result);Window.display;var evt=document.createEvent("Event");evt.initEvent('change',true,true);result.category.dispatchEvent(evt);} twinklexfd.callback.change_category=function twinklexfdCallbackChangeCategory(e){var value=e.target.value;var root=e.target.form;var old_area;var childNodes=root.childNodes;for(var i=0;i<childNodes.length;++i){var node=childNodes[i];if(node instanceof Element&&node.getAttribute('name')=='work_area'){old_area=node;break;}}var work_area=null;var oldreasontextbox=e.target.form.getElementsByTagName('textarea')[0];var oldreason=(oldreasontextbox?oldreasontextbox.value:'');switch(value){case'afd':work_area=new QuickForm.element({type:'field',label:'Articles for deletion',name:'work_area'});work_area.append({type:'checkbox',list:[{label:'Wrap deletion tag with ',value:'noinclude',name:'noinclude',tooltip:'Will wrap the deletion tag in tags, so that it won\'t transclude. This option is not normally required.'}]});var afd_category=work_area.append({type:'select',name:'xfdcat',label:'Choose what category this nomination belongs in'});afd_category.append({type:'option', label:'Unknown',value:'?',selected:true});afd_category.append({type:'option',label:'Media and music',value:'M'});afd_category.append({type:'option',label:'Organisation, corporation, or product',value:'O'});afd_category.append({type:'option',label:'Biographical',value:'B'});afd_category.append({type:'option',label:'Society topics',value:'S'});afd_category.append({type:'option',label:'Web or internet',value:'W'});afd_category.append({type:'option',label:'Games or sports',value:'G'});afd_category.append({type:'option',label:'Science and technology',value:'T'});afd_category.append({type:'option',label:'Fiction and the arts',value:'F'});afd_category.append({type:'option',label:'Places and transportation',value:'P'});afd_category.append({type:'option',label:'Indiscernible or unclassifiable topic',value:'I'});afd_category.append({type:'option',label:'Debate not yet sorted',value:'U'});work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type: 'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'tfd':work_area=new QuickForm.element({type:'field',label:'Templates for discussion',name:'work_area'});var linknode=document.createElement('a');linknode.setAttribute("href","/wiki/WP:SFD");linknode.appendChild(document.createTextNode('WP:SFD'));work_area.append({type:'div',label:['Stub templates and userboxes are not eligible for TfD. Stub templates go to ',linknode,', and userboxes go to MfD.']});work_area.append({type:'checkbox',list:[{label:'Inline deletion tag',value:'tfdinline',name:'tfdinline',tooltip:'Use \{\{tfd|type=inline\}\} to tag the page instead of \{\{tfd\}\}. Good for inline templates (those that appear amongst the words of text).',checked:false}]});work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'mfd': work_area=new QuickForm.element({type:'field',label:'Miscellany for deletion',name:'work_area'});work_area.append({type:'checkbox',list:[{label:'Wrap deletion tag with ',value:'noinclude',name:'noinclude',tooltip:'Will wrap the deletion tag in tags, so that it won\'t transclude. Select this option for userboxes.'}]});if(wgNamespaceNumber==Namespace.USER||wgNamespaceNumber==Namespace.USER_TALK){work_area.append({type:'checkbox',list:[{label:'Also notify owner of userspace if they are not the page creator',value:'notifyuserspace',name:'notifyuserspace',tooltip:'If the user in whose userspace this page is located, is not the page creator (for example, the page is a rescued article stored as a userspace draft), notify the userspace owner as well.',checked:true}]});}work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area); break;case'ffd':work_area=new QuickForm.element({type:'field',label:'Files for deletion',name:'work_area'});work_area.append({type:'checkbox',name:'puf',list:[{label:'Possibly unfree file',value:'puf',tooltip:'File has disputed source or licensing information'}]});work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'cfd':work_area=new QuickForm.element({type:'field',label:'Categories for discussion',name:'work_area'});var cfd_category=work_area.append({type:'select',label:'Choose type of action wanted: ',name:'xfdcat',event:function(e){var value=e.target.value;var target=e.target.form.xfdtarget;if(value=='cfd'){target.disabled=true;}else{target.disabled=false;}}});cfd_category.append({type:'option',label:'Deletion',value:'cfd',selected:true});cfd_category.append({type:'option',label:'Merge',value:'cfm'});cfd_category.append({ type:'option',label:'Renaming',value:'cfr'});cfd_category.append({type:'option',label:'Convert into article',value:'cfc'});work_area.append({type:'input',name:'xfdtarget',label:'Target page: ',disabled:true,value:''});work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;case'rfd':work_area=new QuickForm.element({type:'field',label:'Redirects for discussion',name:'work_area'});work_area.append({type:'textarea',name:'xfdreason',label:'Reason: ',value:oldreason});work_area.append({type:'submit'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;default:work_area=new QuickForm.element({type:'field',label:'Nothing for anything',name:'work_area'});work_area=work_area.render;old_area.parentNode.replaceChild(work_area,old_area);break;}} twinklexfd.callbacks={afd:{main:function(apiobj){var xmlDoc=apiobj.responseXML;var titles=xmlDoc.evaluate('//allpages/p/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(titles.snapshotLength<=0){apiobj.params.numbering=apiobj.params.number=;}else{var number=0;for(var i=0;i<titles.snapshotLength;++i){var title=titles.snapshotItem(i).value;if(title=='Wikipedia:Articles for deletion/'+wgPageName){number=Math.max(number,1);continue;}var order_re=new RegExp('^'+RegExp.escape('Wikipedia:Articles for deletion/'+wgPageName,true)+'\\s*\\(\\s*(\\d+)(?:(?:th|nd|rd|st) nom(?:ination)?)?\\s*\\)\\s*$');var match=order_re.exec(title);if(match==null){continue;}number=Math.max(number,Number(match[1]));}apiobj.params.number=num2order(parseInt(number)+1);apiobj.params.numbering=number>0?' ('+apiobj.params.number+' nomination)':;}apiobj.params.discussionpage='Wikipedia:Articles for deletion/'+wgPageName+apiobj.params.numbering;Status.info("Next discussion page",""+apiobj.params. discussionpage+"");Wikipedia.actionCompleted.redirect=apiobj.params.discussionpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to the discussion page";var wikipedia_page=new Wikipedia.page(wgPageName,"Adding deletion tag to article");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(apiobj.params);wikipedia_page.load(twinklexfd.callbacks.afd.taggingArticle);},taggingArticle:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var textNoAfd=text.replace(/{\{\s*(Article for deletion\/dated|AfDM)\s*(\|(?:|[^{}])*)?}}\s*/g,"");if(text!=textNoAfd){if(confirm("An AfD tag was found on this article. Maybe someone beat you to it. \nClick OK to replace the current AfD tag (not recommended), or Cancel to abandon your nomination.")){text=textNoAfd;}else{statelem.error("Article already tagged with AfD tag, and you chose to abort");window.location.reload /{\{\s*(db(-\w*)?|delete|(?:hang|hold)[- ]?on)\s*(\|(?:|[^{}])*)?}}\s*/ig,"");if(text!=textNoSd&&confirm("A speedy deletion tag was found on this page. Should it be removed?")){text=textNoSd;}pageobj.setPageText((params.noinclude?" \{\{":"\{\{")+(params.number==''?"subst:afd|help=off":('subst:afdx|'+params.number+"|help=off"))+(params.noinclude?"}} \n":"}}\n")+text);pageobj.setEditSummary("Nominated for deletion; see "+params.discussionpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('nocreate');pageobj.save;},discussionPage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{subst:afd2|pg="+wgPageName+"|cat="+params.xfdcat+"|text="+params.reason+" \~\~\~\~\}\}\n");pageobj.setEditSummary ("Creating deletion discussion page for "+wgPageName+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('createonly');pageobj.save;},todaysList:function(pageobj){var old_text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var text=old_text.replace(/(<\!-- Add new entries to the TOP of the following list -->\n+)/,"$1\{\{subst:afd3|pg="+wgPageName+params.numbering+"\}\}\n");if(text==old_text){statelem.error('failed to find target spot for the discussion');return;}pageobj.setPageText(text);pageobj.setEditSummary("Adding "+params.discussionpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchList){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj. setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var params=pageobj.getCallbackParameters;var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:AFDWarning|1="+wgPageName+(params.numbering!=?'|order=&#32;'+params.numbering:)+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at articles for deletion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}},tfd:{taggingTemplate:function(pageobj){var text=pageobj. getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{tfd"+(params.tfdinline?"|type=inline":"")+"|"+wgTitle+"\}\}\n"+text);pageobj.setEditSummary("Nominated for deletion; see "+params.logpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('nocreate');pageobj.save;},todaysList:function(pageobj){var old_text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var text=old_text.replace('-->',"-->\n\{\{subst:tfd2|"+wgTitle+"|text="+params.reason+" \~\~\~\~\}\}");if(text==old_text){statelem.error('failed to find target spot for the discussion');return;}pageobj.setPageText(text);pageobj.setEditSummary("Adding Template:"+wgTitle+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig. xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:tfdnotice|1="+wgTitle+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: nomination at templates for discussion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}},mfd:{main:function (apiobj){var xmlDoc=apiobj.responseXML;var titles=xmlDoc.evaluate('//allpages/p/@title',xmlDoc,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);if(titles.snapshotLength<=0){apiobj.params.numbering=apiobj.params.number=;numbering=number=;}else{var number=0;for(var i=0;i<titles.snapshotLength;++i){var title=titles.snapshotItem(i).value;if(title=='Wikipedia:Miscellany for deletion/'+wgPageName){number=Math.max(number,1);continue;}var order_re=new RegExp('^'+RegExp.escape('Wikipedia:Miscellany for deletion/'+wgPageName,true)+'\\s*\\(\\s*(\\d+)(?:(?:th|nd|rd|st) nom(?:ination)?)?\\s*\\)\\s*$');var match=order_re.exec(title);if(match==null){continue;}number=Math.max(number,Number(match[1]));}apiobj.params.number=num2order(parseInt(number)+1);apiobj.params.numbering=number>0?' ('+apiobj.params.number+' nomination)':;}apiobj.params.discussionpage="Wikipedia:Miscellany for deletion/"+wgPageName+apiobj.params.numbering;apiobj.statelem.info("next in order is "+apiobj.params. discussionpage+);var wikipedia_page=new Wikipedia.page(wgPageName,"Tagging page with deletion tag");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(apiobj.params);wikipedia_page.load(twinklexfd.callbacks.mfd.taggingPage);Wikipedia.actionCompleted.redirect=apiobj.params.discussionpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to the discussion page";wikipedia_page=new Wikipedia.page(apiobj.params.discussionpage,"Creating deletion discussion page");wikipedia_page.setCallbackParameters(apiobj.params);wikipedia_page.load(twinklexfd.callbacks.mfd.discussionPage);wikipedia_page=new Wikipedia.page("Wikipedia:Miscellany for deletion","Adding discussion to today's list");wikipedia_page.setCallbackParameters(apiobj.params);wikipedia_page.load(twinklexfd.callbacks.mfd.todaysList);if(apiobj.params.usertalk){var thispage=new Wikipedia.page(wgPageName);thispage.setCallbackParameters(apiobj.params);thispage.lookupCreator(twinklexfd. callbacks.mfd.userNotification);}},taggingPage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText((params.noinclude?" ":"")+"\{\{"+((params.number=='')?"mfd\}\}\n":('mfdx|'+params.number+"}}\n"))+(params.noinclude?" ":"")+text);pageobj.setEditSummary("Nominated for deletion; see "+params.discussionpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('nocreate');pageobj.save;},discussionPage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{subst:mfd2|pg="+wgPageName+"|text="+params.reason+" \~\~\~\~\}\}\n");pageobj.setEditSummary("Creating deletion discussion page for "+wgPageName+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig. xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('createonly');pageobj.save;},todaysList:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var date=new Date;var date_header="==="+date.getUTCMonthName+' '+date.getUTCDate+', '+date.getUTCFullYear+"===";var date_header_regex=new RegExp("(===\\s*"+date.getUTCMonthName+'\\s+'+date.getUTCDate+',\\s+'+date.getUTCFullYear+"\\s*===)");var new_data="\{\{subst:mfd3|pg="+wgPageName+params.numbering+"\}\}";if(date_header_regex.test(text)){statelem.info('Found today\'s section, proceeding to add new entry');text=text.replace(date_header_regex,"$1\n"+new_data);}else{statelem.info('No section for today found, proceeding to create one');text=text.replace("===",date_header+new_data+"\n\n===");}pageobj. setPageText(text);pageobj.setEditSummary("Adding "+params.discussionpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchList){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var initialContrib=pageobj.getCreator;var params=pageobj.getCallbackParameters;twinklexfd.callbacks.mfd.userNotificationMain(params,initialContrib,"Notifying initial contributor");if(params.notifyuserspace){var userspaceOwner=((wgTitle.indexOf('/')==-1)?wgTitle:wgTitle.substring(0,wgTitle.indexOf('/')));if(userspaceOwner!=initialContrib){twinklexfd.callbacks.mfd.userNotificationMain(params,userspaceOwner,"Notifying owner of userspace");}}},userNotificationMain:function(params,initialContrib,actionName){var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,actionName+" ("+initialContrib+")"); var notifytext="\n\{\{subst:MFDWarning|1="+wgPageName+(params.numbering!=?'|order=&#32;'+params.numbering:)+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at miscellany for deletion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}},ffd:{main:function(pageobj){var params=pageobj.getCallbackParameters;params.uploader=initialContrib;wikipedia_page=new Wikipedia.page(params.logpage,"Adding discussion to today's list");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.ffd.todaysList);var usertalkpage=new Wikipedia.page('User talk:'+ initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:idw|1="+wgTitle+"\}\}";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at files for deletion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;},taggingImage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{ffd|log="+params.date+"\}\}\n"+text);pageobj.setEditSummary("Nominated for deletion at "+params.logpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj. setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},todaysList:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText(text+"\n\{\{subst:ffd2|1="+wgTitle+"|Uploader="+params.uploader+"|Reason="+params.reason+"\}\} \~\~\~\~");pageobj.setEditSummary("Adding "+wgPageName+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;}},puf:{taggingImage:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{puf|help=off|log="+params.date+"\}\}\n"+text);pageobj.setEditSummary("Listed at possibly unfree files: "+params.logpage+"."+ TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},todaysList:function(pageobj){var old_text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText(text+"\n\{\{subst:puf2|image="+wgTitle+"|reason="+params.reason+"\}\} \~\~\~\~");pageobj.setEditSummary("Adding "+wgPageName+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")") "Category being considered for merging in accordance with CDP.";break;case'cfr':added_data="\{\{subst:cfr|"+params.target.replace('Category:','')+"\}\}";editsummary="Category being considered for renaming in accordance with CDP.";break;case'cfc':added_data="\{\{subst:cfc|"+params.target+"\}\}";editsummary="Category being considered for conversion to an article in accordance with CDP.";break;}pageobj.setPageText(added_data+"\n"+text);pageobj.setEditSummary(editsummary+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},todaysList:function(pageobj){var old_text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var added_data="";var editsummary="";switch(params.xfdcat){case'cfd': added_data="\{\{subst:cfd2|1="+wgTitle+"|text="+params.reason+" \~\~\~\~\}\}";editsummary="Added delete nomination of "+wgPageName+".";break;case'cfm':added_data="\{\{subst:cfm2|1="+wgTitle+"|2="+params.target+"|text="+params.reason+" \~\~\~\~\}\}";editsummary="Added merge nomination of "+wgPageName+".";break;case'cfr':added_data="\{\{subst:cfr2|1="+wgTitle+"|2="+params.target+"|text="+params.reason+" \~\~\~\~\}\}";editsummary="Added rename nomination of "+wgPageName+".";break;case'cfc':added_data="\{\{subst:cfc2|1="+wgTitle+"|2="+params.target+"|text="+params.reason+" \~\~\~\~\}\}";editsummary="Added convert nomination of "+wgPageName+".";break;}text=old_text.replace('below this line -->',"below this line -->\n"+added_data);if(text==old_text){statelem.error('failed to find target spot for the discussion');return;}pageobj.setPageText(text);pageobj.setEditSummary(editsummary+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchDiscussion){case'yes':pageobj. setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var initialContrib=pageobj.getCreator;var params=pageobj.getCallbackParameters;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:CFDNote|1="+wgPageName+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at categories for discussion of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}},rfd:{main: function(apiobj){var xmlDoc=apiobj.responseXML;var target=xmlDoc.evaluate('//redirects/r/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(!target){apiobj.statelem.error("This page is currently not a redirect, aborting");return;}apiobj.params.target=target;var date=new Date;apiobj.params.logpage='Wikipedia:Redirects for discussion/Log/'+date.getUTCFullYear+' '+date.getUTCMonthName+' '+date.getUTCDate;var wikipedia_page=new Wikipedia.page(wgPageName,"Adding deletion tag to redirect");wikipedia_page.setFollowRedirect(false);wikipedia_page.setCallbackParameters(apiobj.params);wikipedia_page.load(twinklexfd.callbacks.rfd.taggingRedirect);Wikipedia.actionCompleted.redirect=apiobj.params.logpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to today's log";wikipedia_page=new Wikipedia.page(apiobj.params.logpage,"Adding discussion to today's log");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(apiobj.params); wikipedia_page.load(twinklexfd.callbacks.rfd.todaysList);if(apiobj.params.usertalk){var thispage=new Wikipedia.page(wgPageName);thispage.setCallbackParameters(apiobj.params);thispage.lookupCreator(twinklexfd.callbacks.rfd.userNotification);}},taggingRedirect:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;pageobj.setPageText("\{\{rfd\}\}\n"+text);pageobj.setEditSummary("Listed for discussion at "+params.logpage+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchPage){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('nocreate');pageobj.save;},todaysList:function(pageobj){var old_text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var statelem=pageobj.getStatusElement;var text=old_text.replace(/(<\!-- Add new entries directly below this line -->)/, "$1\n\{\{subst:rfd2|redirect="+wgPageName+"|target="+params.target+"|text="+params.reason.toUpperCaseFirstChar+"\}\} \~\~\~\~\n");if(text==old_text){statelem.error('failed to find target spot for the discussion');return;}pageobj.setPageText(text);pageobj.setEditSummary("Adding "+wgPageName+"."+TwinkleConfig.summaryAd);switch(TwinkleConfig.xfdWatchDiscussion){case'yes':pageobj.setWatchlist(true);break;case'no':pageobj.setWatchlistFromPreferences(false);break;default:pageobj.setWatchlistFromPreferences(true);break;}pageobj.setCreateOption('recreate');pageobj.save;},userNotification:function(pageobj){var initialContrib=pageobj.getCreator;var usertalkpage=new Wikipedia.page('User talk:'+initialContrib,"Notifying initial contributor ("+initialContrib+")");var notifytext="\n\{\{subst:RFDNote|1="+wgPageName+"\}\} \~\~\~\~";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at redirects for discussion of "+wgPageName+"."+ TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}}} twinklexfd.callback.evaluate=function(e){wgPageName=wgPageName.replace(/_/g,' ');var type=e.target.category.value;var usertalk=e.target.notify.checked;var reason=e.target.xfdreason.value;if(type in{'afd':,'cfd':}){var xfdcat=e.target.xfdcat.value;}if(type=='ffd'){var puf=e.target.puf.checked;}if(type in{'afd':,'mfd':}){var noinclude=e.target.noinclude.checked;}if(type=='tfd'){var tfdinline=e.target.tfdinline.checked;}if(type=='mfd'){var notifyuserspace=e.target.notifyuserspace.checked;}Status.init(e.target);if(type==null){Status.error('Error','no action given');return;}switch(type){case'afd':var query={'action':'query','list':'allpages','apprefix':'Articles for deletion/'+wgPageName,'apnamespace':4,'apfilterredir':'nonredirects','aplimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api('Tagging article with deletion tag',query,twinklexfd.callbacks.afd.main);wikipedia_api.params={usertalk:usertalk,reason:reason,noinclude:noinclude,xfdcat:xfdcat}; wikipedia_api.post;break;case'tfd':Wikipedia.addCheckpoint;var date=new Date;var logpage='Wikipedia:Templates for discussion/Log/'+date.getUTCFullYear+' '+date.getUTCMonthName+' '+date.getUTCDate;var wikipedia_page=new Wikipedia.page(wgPageName,"Tagging template with deletion tag");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters({tfdinline:tfdinline,logpage:logpage});wikipedia_page.load(twinklexfd.callbacks.tfd.taggingTemplate);Wikipedia.actionCompleted.redirect=logpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to today's log";wikipedia_page=new Wikipedia.page(logpage,"Adding discussion to today's log");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters({reason:reason});wikipedia_page.load(twinklexfd.callbacks.tfd.todaysList);if(usertalk){var thispage=new Wikipedia.page(wgPageName);thispage.lookupCreator(twinklexfd.callbacks.tfd.userNotification);}Wikipedia.removeCheckpoint;break;case'mfd': var query={'action':'query','list':'allpages','apprefix':'Miscellany for deletion/'+wgPageName,'apnamespace':4,'apfilterredir':'nonredirects','aplimit':userIsInGroup('sysop')?5000:500};var wikipedia_api=new Wikipedia.api("Looking for prior nominations of this page",query,twinklexfd.callbacks.mfd.main);wikipedia_api.params={usertalk:usertalk,notifyuserspace:notifyuserspace,reason:reason,noinclude:noinclude,xfdcat:xfdcat};wikipedia_api.post;break;case'ffd':var date=new Date;var dateString=date.getUTCFullYear+' '+date.getUTCMonthName+' '+date.getUTCDate;var logpage='Wikipedia:Files for deletion/'+dateString;var params={usertalk:usertalk,reason:reason,date:dateString,logpage:logpage};Wikipedia.addCheckpoint;if(puf){params.logpage=logpage='Wikipedia:Possibly unfree files/'+dateString;Wikipedia.actionCompleted.redirect=logpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to today's list";var wikipedia_page=new Wikipedia.page(wgPageName, "Tagging file with PUF tag");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.puf.taggingImage);wikipedia_page=new Wikipedia.page(params.logpage,"Adding discussion to today's list");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.puf.todaysList);if(usertalk){wikipedia_page=new Wikipedia.page(wgPageName);wikipedia_page.setCallbackParameters(params);wikipedia_page.lookupCreator(twinklexfd.callbacks.puf.userNotification);}Wikipedia.removeCheckpoint;}else{Wikipedia.actionCompleted.redirect=logpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to the discussion page";var wikipedia_page=new Wikipedia.page(wgPageName,"Adding deletion tag to file page");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.ffd.taggingImage);wikipedia_page=new Wikipedia.page(wgPageName);wikipedia_page.setCallbackParameters(params);wikipedia_page.lookupCreator(twinklexfd.callbacks.ffd.main);}Wikipedia.removeCheckpoint;break;case'cfd':Wikipedia.addCheckpoint;if(e.target.xfdtarget){var target=e.target.xfdtarget.value.replace(/^\:?Category\:/,);}else{var target=;}var date=new Date;var logpage='Wikipedia:Categories for discussion/Log/'+date.getUTCFullYear+' '+date.getUTCMonthName+' '+date.getUTCDate;var params={reason:reason,xfdcat:xfdcat,target:target,logpage:logpage};Wikipedia.actionCompleted.redirect=logpage;Wikipedia.actionCompleted.notice="Nomination completed, now redirecting to today's log";var wikipedia_page=new Wikipedia.page(wgPageName,"Tagging category with deletion tag");wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.cfd.taggingCategory);wikipedia_page=new Wikipedia.page(logpage,"Adding discussion to today's list");wikipedia_page.setCallbackParameters(params);wikipedia_page.load( twinklexfd.callbacks.cfd.todaysList);if(usertalk){wikipedia_page=new Wikipedia.page(wgPageName);wikipedia_page.setCallbackParameters(params);wikipedia_page.lookupCreator(twinklexfd.callbacks.cfd.userNotification);}Wikipedia.removeCheckpoint;break;case'rfd':var query={'action':'query','titles':wgPageName,'redirects':true};var wikipedia_api=new Wikipedia.api("Finding target of redirect",query,twinklexfd.callbacks.rfd.main);wikipedia_api.params={usertalk:usertalk,reason:reason};wikipedia_api.post;break;}} Twinkle.init.moduleReady("twinklexfd",twinklexfd);Twinkle.morebits=function{switch(skin){case'vector':if(typeof(TwinkleConfig.portletArea)=='undefined')TwinkleConfig.portletArea='right-navigation';if(typeof(TwinkleConfig.portletId)=='undefined')TwinkleConfig.portletId='p-twinkle';if(typeof(TwinkleConfig.portletName)=='undefined')TwinkleConfig.portletName='TW';if(typeof(TwinkleConfig.portletType)=='undefined')TwinkleConfig.portletType='menu';if(typeof(TwinkleConfig.portletNext)=='undefined')TwinkleConfig.portletNext='p-search';break;default:if(typeof(TwinkleConfig.portletId)=='undefined')TwinkleConfig.portletId='p-cactions';break;}if(typeof(TwinkleConfig.summaryAd)==='undefined'){TwinkleConfig.summaryAd=" (TW)";}Twinkle.authorizedUser=userIsInGroup('autoconfirmed')||userIsInGroup('confirmed');} function userIsInGroup(group){return(wgUserGroups!=null&&wgUserGroups.indexOf(group)!=-1)||(wgUserGroups==null&&group=='anon');}function userIsAnon{return wgUserGroups==null;}function twAddPortlet(navigation,id,text,type,nextnodeid){var root=document.getElementById(navigation);if(!root)return null;var item=document.getElementById(id);if(item){if(item.parentNode&&item.parentNode==root)return item;return null;}var nextnode;if(nextnodeid)nextnode=document.getElementById(nextnodeid);if(!twAddPortlet.styleAdded){if(skin=="vector")appendCSS("div div.extraMenu h5 span { background-position: 90% 50%;} div.extraMenu h5 a { padding-left: 0.4em; padding-right: 0.4em; width:auto; } div.extraMenu h5 a span {display:inline-block; font-size:0.8em; height:2.5em; font-weight: normal; padding-top: 1.25em; margin-right:14px; }");else if(skin=="modern")appendCSS( "#mw_contentwrapper div.portlet { overflow:hidden; height:1.5em; margin:0 0 0 14em; padding:0; } #mw_contentwrapper div.portlet h5 {display:none;} #mw_contentwrapper div.portlet div.pBody {margin:0; padding:0;} #mw_contentwrapper div.portlet div.pBody ul { display:inline; margin:0; } #mw_contentwrapper div.portlet div.pBody ul li { display:block; float:left; height:1.5em; margin:0 0.5em; padding:0 0.2em; text-transform:lowercase; } #mw_contentwrapper div.portlet div.pBody ul li a { text-decoration:underline;} #mw_contentwrapper div.portlet div.pBody ul li.selected a { text-decoration:none;}");twAddPortlet.styleAdded=true;}type=skin=="vector"&&type=="menu"&&(navigation=="left-navigation"||navigation=="right-navigation")?"menu":"";var outerDivClass;var innerDivClass;switch(skin){case"vector":if(navigation!="portal"&&navigation!="left-navigation"&&navigation!="right-navigation")navigation="mw-panel";outerDivClass=navigation=="mw-panel"?"portal":(type=="menu"?"vectorMenu extraMenu": "vectorTabs extraMenu");innerDivClass=navigation=="mw-panel"?'body':(type=='menu'?'menu':'');break;case"modern":if(navigation!="mw_portlets"&&navigation!="mw_contentwrapper")navigation="mw_portlets";outerDivClass="portlet";innerDivClass="pBody";break;default:navigation="column-one";outerDivClass="portlet";innerDivClass="pBody";break;}var outerDiv=document.createElement('div');outerDiv.className=outerDivClass+" emptyPortlet";outerDiv.id=id;var nextnode;if(nextnode&&nextnode.parentNode==root)root.insertBefore(outerDiv,nextnode);else root.appendChild(outerDiv);var h5=document.createElement('h5');if(type=='menu'){var span=document.createElement('span');span.appendChild(document.createTextNode(text));h5.appendChild(span);var a=document.createElement('a');a.href="#";var span=document.createElement('span');span.appendChild(document.createTextNode(text));a.appendChild(span);h5.appendChild(a);}else h5.appendChild(document.createTextNode(text));outerDiv.appendChild(h5);var innerDiv=document. createElement('div');innerDiv.className=innerDivClass;outerDiv.appendChild(innerDiv);var ul=document.createElement('ul');innerDiv.appendChild(ul);return outerDiv;}function twAddPortletLink(href,text,id,tooltip,accesskey,nextnode){if(TwinkleConfig.portletArea)twAddPortlet(TwinkleConfig.portletArea,TwinkleConfig.portletId,TwinkleConfig.portletName,TwinkleConfig.portletType,TwinkleConfig.portletNext);addPortletLink(TwinkleConfig.portletId,href,text,id,tooltip,accesskey,nextnode);}Cookies={create:function(name,value,max_age,path){if(Cookies.exists(name)){throw"cookie "+name+" already exists";}Cookies.set(name,value,max_age,path);},set:function(name,value,max_age,path){var cookie=name+"="+encodeURIComponent(value);if(max_age){cookie+="; max-age="+max_age;}cookie+="; path="+path||"/";document.cookie=cookie;},read:function(name){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;++i){var current=cookies[i];current=current.trim;if(current.indexOf(name+"=")==0){return decodeURIComponent (current.substring(name.length+1));}}return null;},exists:function(name){var re=new RegExp(";\\s*"+name+"=");return re.test(document.cookie);},remove:function(name){Cookies.set(name,'',-1);}} QuickForm=function QuickForm(event,eventType){this.root=new QuickForm.element({type:'form',event:event,eventType:eventType});var cssNode=document.createElement('style');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(cssNode);var styles=cssNode.sheet?cssNode.sheet:cssNode.stylesSheet;styles.insertRule("form.quickform { width: 96%; margin:auto; padding: .5em; vertical-align: middle}",0);styles.insertRule("form.quickform * { font-family: sans-serif; vertical-align: middle}",0);styles.insertRule("form.quickform select { width: 30em; border: 1px solid gray; font-size: 1.1em}",0);styles.insertRule("form.quickform h5 { border-top: 1px solid gray;}",0);styles.insertRule("form.quickform textarea { width: 100%; height: 6em }",0);styles.insertRule("form.quickform .tooltipButtonContainer { position: relative; width: 100%; }",0);styles.insertRule( "form.quickform .tooltipButton { padding: .2em; color: blue; font-weight: bold; cursor:help;}",0);styles.insertRule(".quickformtooltip { z-index: 200; position: absolute; padding: .1em; border: 1px dotted red; background-color: Linen; font: caption; font-size: 10pt; max-width: 800px}",0);} QuickForm.prototype.render=function QuickFormRender{var ret=this.root.render;ret.names={};return ret;} QuickForm.prototype.append=function QuickFormAppend(data){return this.root.append(data);} QuickForm.element=function QuickFormElement(data){this.data=data;this.childs=[];this.id=QuickForm.element.id++;} QuickForm.element.id=0;QuickForm.element.prototype.append=function QuickFormElementAppend(data){if(data instanceof QuickForm.element){var child=data;}else{var child=new QuickForm.element(data);}this.childs.push(child);return child;} QuickForm.element.prototype.render=function QuickFormElementRender{var currentNode=this.compute(this.data);for(var i=0;i<this.childs.length;++i){currentNode[1].appendChild(this.childs[i].render);}return currentNode[0];} QuickForm.element.prototype.compute=function QuickFormElementCompute(data,in_id){var node;var childContainder=null;var label;var id=(in_id?in_id+'_':'')+'node_'+this.id;if(data.adminonly&&!userIsInGroup('sysop')){data.type=hidden;}switch(data.type){case'form':node=document.createElement('form');node.setAttribute('name','id');node.className="quickform";node.setAttribute('action','javascript:void(0);');if(data.event){node.addEventListener(data.eventType||'submit',data.event,false);}break;case'select':node=document.createElement('div');node.setAttribute('id','div_'+id);if(data.label){label=node.appendChild(document.createElement('label'));label.setAttribute('for',id);label.appendChild(document.createTextNode(data.label));}var select=node.appendChild(document.createElement('select'));if(data.event){select.addEventListener('change',data.event,false);}if(data.multiple){select.setAttribute('multiple','multiple');}if(data.size){select.setAttribute('size',data.size);}select.setAttribute('name', data.name);if(data.list){for(var i=0;i<data.list.length;++i){var current=data.list[i];if(current.list){current.type='optgroup';}else{current.type='option';}var res=this.compute(current);select.appendChild(res[0]);}}childContainder=select;break;case'option':node=document.createElement('option');node.values=data.value;node.setAttribute('value',data.value);if(data.selected){node.setAttribute('selected','selected');}if(data.disabled){node.setAttribute('disabled','disabled');}node.setAttribute('label',data.label);node.appendChild(document.createTextNode(data.label));break;case'optgroup':node=document.createElement('optgroup');node.setAttribute('label',data.label);if(data.list){for(var i=0;i<data.list.length;++i){var current=data.list[i];current.type='option';var res=this.compute(current);node.appendChild(res[0]);}}break;case'field':node=document.createElement('fieldset');label=node.appendChild(document.createElement('legend'));label.appendChild(document.createTextNode(data.label));if(data. name){node.setAttribute('name',data.name);}break;case'checkbox':case'radio':node=document.createElement('div');if(data.list){for(var i=0;i<data.list.length;++i){var cur_id=id+'_'+i;var current=data.list[i];if(current.type=='header'){cur_node=node.appendChild(document.createElement('h6'));cur_node.appendChild(document.createTextNode(current.label));if(current.tooltip){QuickForm.element.generateTooltip(cur_node,current);}continue;}cur_node=node.appendChild(document.createElement('div'));var input=cur_node.appendChild(document.createElement('input'));input.values=current.value;input.setAttribute('value',current.value);input.setAttribute('name',current.name||data.name);input.setAttribute('type',data.type);input.setAttribute('id',cur_id);if(current.checked){input.setAttribute('checked','checked');}if(current.disabled){input.setAttribute('disabled','disabled');}if(data.event){input.addEventListener('change',data.event,false);}else if(current.event){input.addEventListener('change',current. event,true);}var label=cur_node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(current.label));label.setAttribute('for',cur_id);if(current.tooltip){QuickForm.element.generateTooltip(label,current);}if(current.subgroup){var tmpgroup=current.subgroup;if(!tmpgroup.type){tmpgroup.type=data.type;}tmpgroup.name=(current.name||data.name)+'.'+tmpgroup.name;var subgroup=this.compute(current.subgroup,cur_id)[0];subgroup.style.marginLeft='3em';input.subgroup=subgroup;input.shown=false;var event=function(e){if(e.target.checked){e.target.parentNode.appendChild(e.target.subgroup);if(e.target.type=='radio'){var name=e.target.name;if(typeof(e.target.form.names[name])!='undefined'){e.target.form.names[name].parentNode.removeChild(e.target.form.names[name].subgroup);}e.target.form.names[name]=e.target;}}else{e.target.parentNode.removeChild(e.target.subgroup);}} input.addEventListener('change',event,true);if(current.checked){input.parentNode.appendChild(subgroup);}}else if(data.type=='radio'){var event=function(e){if(e.target.checked){var name=e.target.name;if(typeof(e.target.form.names[name])!='undefined'){e.target.form.names[name].parentNode.removeChild(e.target.form.names[name].subgroup);}delete e.target.form.names[name];}} input.addEventListener('change',event,true);}}}break;case'input':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}var input=node.appendChild(document.createElement('input'));if(data.value){input.setAttribute('value',data.value);}input.setAttribute('name',data.name);input.setAttribute('type','text');if(data.size){input.setAttribute('size',data.size);}if(data.disabled){input.setAttribute('disabled','disabled');}if(data.readonly){input.setAttribute('readonly','readonly');}if(data.maxlength){input.setAttribute('maxlength',data.maxlength);}if(data.event){input.addEventListener('keyup',data.event,false);}break;case'dyninput':var min=data.min||1;var max=data.max||Infinity;node=document.createElement('div');label=node.appendChild(document.createElement('h5'));label.appendChild(document.createTextNode(data.label));var listNode=node.appendChild(document. createElement('div'));var more=this.compute({type:'button',label:'more',disabled:min>=max,event:function(e){var area=e.target.area;var new_node=new QuickForm.element(e.target.sublist);e.target.area.appendChild(new_node.render);if(++e.target.counter>=e.target.max){e.target.setAttribute('disabled','disabled');}e.stopPropagation;}});node.appendChild(more[0]);moreButton=more[1];var sublist={type:'_dyninput_element',label:data.sublabel||data.label,name:data.name,value:data.value,size:data.size,remove:false,maxlength:data.maxlength,event:data.event} for(var i=0;i<min;++i){var elem=new QuickForm.element(sublist);listNode.appendChild(elem.render);}sublist.remove=true;sublist.morebutton=moreButton;sublist.listnode=listNode;moreButton.sublist=sublist;moreButton.area=listNode;moreButton.max=max-min;moreButton.counter=0;break;case'_dyninput_element':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('label'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}var input=node.appendChild(document.createElement('input'));if(data.value){input.setAttribute('value',data.value);}input.setAttribute('name',data.name);input.setAttribute('type','text');if(data.size){input.setAttribute('size',data.size);}if(data.maxlength){input.setAttribute('maxlength',data.maxlength);}if(data.event){input.addEventListener('keyup',data.event,false);}if(data.remove){var remove=this.compute({type:'button',label:'remove',event:function(e){var list=e.target.listnode;var node=e.target. inputnode;var more=e.target.morebutton;list.removeChild(node);--more.counter;more.removeAttribute('disabled');e.stopPropagation;}});node.appendChild(remove[0]);removeButton=remove[1];removeButton.inputnode=node;removeButton.listnode=data.listnode;removeButton.morebutton=data.morebutton;}break;case'hidden':var node=document.createElement('input');node.setAttribute('type','hidden');node.values=data.value;node.setAttribute('value',data.value);node.setAttribute('name',data.name);break;case'header':node=document.createElement('h5');node.appendChild(document.createTextNode(data.label));break;case'div':node=document.createElement('div');if(data.label){if(!(data.label instanceof Array)){data.label=[data.label];}var result=document.createDocumentFragment;for(var i=0;i<data.label.length;++i){if(typeof(data.label[i])==='string'){result.appendChild(document.createTextNode(data.label[i]));}else if(data.label[i]instanceof Element){result.appendChild(data.label[i]);}}node.appendChild(result);} break;case'submit':node=document.createElement('span');childContainder=node.appendChild(document.createElement('input'));childContainder.setAttribute('type','submit');if(data.label){childContainder.setAttribute('value',data.label);}childContainder.setAttribute('name',data.name||'submit');if(data.disabled){childContainder.setAttribute('disabled','disabled');}break;case'button':node=document.createElement('span');childContainder=node.appendChild(document.createElement('input'));childContainder.setAttribute('type','button');if(data.label){childContainder.setAttribute('value',data.label);}childContainder.setAttribute('name',data.name);if(data.disabled){childContainder.setAttribute('disabled','disabled');}if(data.event){childContainder.addEventListener('click',data.event,false);}break;case'textarea':node=document.createElement('div');if(data.label){label=node.appendChild(document.createElement('h5'));label.appendChild(document.createTextNode(data.label));label.setAttribute('for',id);}node. appendChild(document.createElement('br'));textarea=node.appendChild(document.createElement('textarea'));textarea.setAttribute('name',data.name);if(data.cols){textarea.setAttribute('cols',data.cols);}if(data.rows){textarea.setAttribute('rows',data.rows);}if(data.disabled){textarea.setAttribute('disabled','disabled');}if(data.readonly){textarea.setAttribute('readonly','readonly');}if(data.value){textarea.value=data.value;}break;}if(childContainder==null){childContainder=node;}if(data.tooltip){QuickForm.element.generateTooltip(label||node,data);}if(data.extra){childContainder.extra=extra;}childContainder.setAttribute('id',data.id||id);return[node,childContainder];} QuickForm.element.generateTooltip=function QuickFormElementGenerateTooltip(node,data){var tooltipButtonContainer=node.appendChild(document.createElement('span'));tooltipButtonContainer.className='tooltipButtonContainer';var tooltipButton=tooltipButtonContainer.appendChild(document.createElement('span'));tooltipButton.className='tooltipButton';tooltipButton.appendChild(document.createTextNode('?'));var tooltip=document.createElement('div');tooltip.className='quickformtooltip';tooltip.appendChild(document.createTextNode(data.tooltip));tooltipButton.tooltip=tooltip;tooltipButton.showing=false;tooltipButton.interval=null;tooltipButton.addEventListener('mouseover',QuickForm.element.generateTooltip.display,false);tooltipButton.addEventListener('mouseout',QuickForm.element.generateTooltip.fade,false);} QuickForm.element.generateTooltip.display=function QuickFormElementGenerateTooltipDisplay(e){window.clearInterval(e.target.interval);e.target.tooltip.style.setProperty('-moz-opacity',1,null);e.target.tooltip.style.setProperty('opacity',1,null);e.target.tooltip.style.left=(e.pageX-e.layerX+24)+"px";e.target.tooltip.style.top=(e.pageY-e.layerY+12)+"px";document.body.appendChild(e.target.tooltip);e.target.showing=true;} QuickForm.element.generateTooltip.fade=function QuickFormElementGenerateTooltipFade(e){e.target.opacity=1.2;e.target.interval=window.setInterval(function(e){e.target.tooltip.style.setProperty('-moz-opacity',e.target.opacity,null);e.target.tooltip.style.setProperty('opacity',e.target.opacity,null);e.target.opacity-=0.1;if(e.target.opacity<=0){window.clearInterval(e.target.interval);document.body.removeChild(e.target.tooltip);e.target.showing=false;}},50,e);} HTMLFormElement.prototype.getChecked=function(name,type){var elements=this.elements[name];if(!elements){return null;}var return_array=[];if(elements instanceof HTMLSelectElement){var options=elements.options;for(var i=0;i<options.length;++i){if(options[i].selected){if(options[i].values){return_array.push(options[i].values);}else{return_array.push(options[i].value);}}}}else if(elements instanceof HTMLInputElement){if(type!=null&&elements.type!=type){return[];}else if(elements.checked){return[elements.value];}}else{for(var i=0;i<elements.length;++i){if(elements[i].checked){if(type!=null&&elements[i].type!=type){continue;}if(elements[i].values){return_array.push(elements[i].values);}else{return_array.push(elements[i].value);}}}}return return_array;} HTMLFormElement.prototype.getTexts=function(name,type){type==type||'text';var elements=this.elements[name];if(!elements){return null;}var return_array=[];for(var i=0;i<elements.length;++i){if(elements[i].value!=''){return_array.push(elements[i].value);}}return return_array;} RegExp.escape=function(text,space_fix){if(!arguments.callee.sRE){arguments.callee.sRE=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^)/g;}text=text.replace(arguments.callee.sRE,'\\$1');if(space_fix){text=text.replace(/ |_/g,'[_ ]');}return text;} function sprintf{if(arguments.length==0){throw"Not enough arguments for sprintf";}var result="";var format=arguments[0];var index=1;var current_index=1;var flags={};var in_operator=false;var relative=false;var precision=false;var fixed=false;var vector=false;var vector_delimiter='.';for(var i=0;i<format.length;++i){var current_char=format.charAt(i);if(in_operator){switch(current_char){case'i':current_char='d';break;case'F':current_char='f';break;case'%':case'c':case's':case'd':case'u':case'o':case'x':case'e':case'f':case'g':case'X':case'E':case'G':case'b':var value=arguments[current_index];if(vector){r=value.toString.split();result+=value.toString.split().map(function(value){return sprintf.format(current_char,value.charCodeAt,flags);}).join(vector_delimiter);}else{result+=sprintf.format(current_char,value,flags);}if(!fixed){++index;}current_index=index;flags={};relative=false;in_operator=false;precision=false;fixed=false;vector=false;vector_delimiter='.';break;case'v': vector=true;break;case' ':case'0':case'-':case'+':case'#':flags[current_char]=true;break;case'*':relative=true;break;case'.':precision=true;break;}if(/\d/.test(current_char)){var num=parseInt(format.substr(i));var len=num.toString.length;i+=len-1;var next=format.charAt(i+1);if(next=='$'){if(num<=0||num>=arguments.length){throw"out of bound";}if(relative){if(precision){flags['precision']=arguments[num];precision=false;}else if(format.charAt(i+2)=='v'){vector_delimiter=arguments[num];}else{flags['width']=arguments[num];}relative=false;}else{fixed=true;current_index=num;}++i;}else if(precision){flags['precision']=num;precision=false;}else{flags['width']=num;}}else if(relative&&!/\d/.test(format.charAt(i+1))){if(precision){flags['precision']=arguments[current_index];precision=false;}else if(format.charAt(i+1)=='v'){vector_delimiter=arguments[current_index];}else{flags['width']=arguments[current_index];}++index;if(!fixed){current_index++;}relative=false;}}else{if(current_char=='%'){ in_operator=true;continue;}else{result+=current_char;continue;}}}return result;}sprintf.format=function sprintfFormat(type,value,flags){if(value==undefined){if(type=='s'){return;}else{return'0';}}var result;var prefix=;var fill='';var fillchar=' ';switch(type){case'%':result='%';break;case'c':result=String.fromCharCode(parseInt(value));break;case's':result=value.toString;break;case'd':result=parseInt(value).toString;break;case'u':result=Math.abs(parseInt(value)).toString;break;case'o':result=(new Number(Math.abs(parseInt(value)))).toString(8);break;case'x':result=(new Number(Math.abs(parseInt(value)))).toString(16);break;case'b':result=(new Number(Math.abs(parseInt(value)))).toString(2);break;case'e':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toExponential(digits).toString;break;case'f':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toFixed(digits).toString;case'g':var digits=flags['precision']?flags[ 'precision']:6;result=(new Number(value)).toPrecision(digits).toString;break;case'X':result=(new Number(Math.abs(parseInt(value)))).toString(16).toUpperCase;break;case'E':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toExponential(digits).toString.toUpperCase;break;case'G':var digits=flags['precision']?flags['precision']:6;result=(new Number(value)).toPrecision(digits).toString.toUpperCase;break;}if(flags['+']&&parseFloat(value)>0&&['d','e','f','g','E','G'].indexOf(type)!=-1){prefix='+';}if(flags[' ']&&parseFloat(value)>0&&['d','e','f','g','E','G'].indexOf(type)!=-1){prefix=' ';}if(flags['#']&&parseInt(value)!=0){switch(type){case'o':prefix='0';break;case'x':case'X':prefix='0x';break;case'b':prefix='0b';break;}}if(flags['0']&&!flags['-']){fillchar='0';}if(flags['width']&&flags['width']>(result.length+prefix.length)){var tofill=flags['width']-result.length-prefix.length;for(var i=0;i<tofill;++i){fill+=fillchar;}}if(flags['-']&&!flags['0']){ result+=fill;}else{result=fill+result;}return prefix+result;} Bytes=function(value){if(typeof(value)=='string'){var res=/(\d+) ?(\w?)(i?)B?/.exec(value);var number=res[1];var mag=res[2];var si=res[3];if(!number){this.number=0;return;}if(!si){this.value=number*Math.pow(10,Bytes.magnitudes[mag]*3);}else{this.value=number*Math.pow(2,Bytes.magnitudes[mag]*10);}}else{this.value=value;}} Bytes.magnitudes={'':0,'K':1,'M':2,'G':3,'T':4,'P':5,'E':6,'Z':7,'Y':8} Bytes.rmagnitudes={0:'',1:'K',2:'M',3:'G',4:'T',5:'P',6:'E',7:'Z',8:'Y'} Bytes.prototype.valueOf=function{return this.value;} Bytes.prototype.toString=function(magnitude){var tmp=this.value;if(magnitude){var si=/i/.test(magnitude);var mag=magnitude.replace(/.*?(\w)i?B?.*/g,'$1');if(si){tmp/=Math.pow(2,Bytes.magnitudes[mag]*10);}else{tmp/=Math.pow(10,Bytes.magnitudes[mag]*3);}if(parseInt(tmp)!=tmp){tmp=(new Number(tmp)).toPrecision(4);}return tmp+' '+mag+(si?'i':'')+'B';}else{var current=0;while(tmp>=1024){tmp/=1024;++current;}tmp=this.value/Math.pow(2,current*10);if(parseInt(tmp)!=tmp){tmp=(new Number(tmp)).toPrecision(4);}return tmp+' '+Bytes.rmagnitudes[current]+(current>0?'iB':'B');}} String.prototype.ltrim=function stringPrototypeLtrim(chars){chars=chars||"\\s*";return this.replace(new RegExp("^["+chars+"]+","g"),"");} String.prototype.rtrim=function stringPrototypeRtrim(chars){chars=chars||"\\s*";return this.replace(new RegExp("["+chars+"]+$","g"),"");} String.prototype.trim=function stringPrototypeTrim(chars){return this.rtrim(chars).ltrim(chars);} String.prototype.splitWeightedByKeys=function stringPrototypeSplitWeightedByKeys(start,end,skip){if(start.length!=end.length){throw'start marker and end marker must be of the same length';}var level=0;var initial=null;var result=[];if(!(skip instanceof Array)){if(typeof(skip)=='undefined'){skip=[];}else if(typeof(skip)=='string'){skip=[skip];}else{throw"non-applicable skip parameter";}}for(var i=0;i<this.length;++i){for(var j=0;j<skip.length;++j){if(this.substr(i,skip[j].length)==skip[j]){i+=skip[j].length-1;continue;}}if(this.substr(i,start.length)==start){if(initial==null){initial=i;}++level;i+=start.length-1;}else if(this.substr(i,end.length)==end){--level;i+=end.length-1;}if(level==0&&initial!=null){result.push(this.substring(initial,i+1));initial=null;}}return result;} String.prototype.toUpperCaseFirstChar=function{return this.substr(0,1).toUpperCase+this.substr(1);} String.prototype.toLowerCaseFirstChar=function{return this.substr(0,1).toLowerCase+this.substr(1);} String.prototype.toUpperCaseEachWord=function(delim){delim=delim?delim:' ';return this.split(delim).map(function(v){return v.toUpperCaseFirstChar}).join(delim);} String.prototype.toLowerCaseEachWord=function(delim){delim=delim?delim:' ';return this.split(delim).map(function(v){return v.toLowerCaseFirstChar}).join(delim);} Array.prototype.uniq=function arrayPrototypeUniq{var result=[];for(var i=0;i<this.length;++i){var current=this[i];if(result.indexOf(current)==-1){result.push(current);}}return result;} Array.prototype.dups=function arrayPrototypeUniq{var uniques=[];var result=[];for(var i=0;i<this.length;++i){var current=this[i];if(uniques.indexOf(current)==-1){uniques.push(current);}else{result.push(current);}}return result;} Array.prototype.chunk=function arrayChunk(size){if(typeof(size)!='number'||size<=0){return[this];}var result=[];var current;for(var i=0;i<this.length;++i){if(i%size==0){current=[];result.push(current);}current.push(this[i]);}return result;} Unbinder=function unbinder(string){if(typeof(string)!='string'){throw"not a string";}this.content=string;this.counter=0;this.history={};this.prefix='%UNIQ::'+Math.random+'::';this.postfix='::UNIQ%';} Unbinder.prototype={unbind:function UnbinderUnbind(prefix,postfix){var re=new RegExp(prefix+'(.*?)'+postfix,'g');this.content=this.content.replace(re,Unbinder.getCallback(this));},rebind:function UnbinderRebind{var content=this.content;content.self=this;for(var current in this.history)if(this.history.hasOwnProperty(current))content=content.replace(current,this.history[current]);return content;},prefix:null,postfix:null,content:null,counter:null,history:null};Unbinder.getCallback=function UnbinderGetCallback(self){return function UnbinderCallback(match,a,b){var current=self.prefix+self.counter+self.postfix;self.history[current]=match;++self.counter;return current;};};function clone(obj,deep){var objectClone=new obj.constructor;for(var property in obj)if(!deep){objectClone[property]=obj[property];}else if(typeof obj[property]=='object'){objectClone[property]=clone(obj[property],deep);}else{objectClone[property]=obj[property];}return objectClone;}namespaces={'-2':'Media','-1': 'Special','0':'','1':'Talk','2':'User','3':'User_talk','4':'Project','5':'Project talk','6':'Image','7':'Image talk','8':'MediaWiki','9':'MediaWiki talk','10':'Template','11':'Template talk','12':'Help','13':'Help talk','14':'Category','15':'Category talk','100':'Portal','101':'Portal talk'};function ln(ns,title){var ns2ln={'0':'la','1':'lat','2':'lu','3':'lut','4':'lw','5':'lwt','6':'li','7':'lit','8':'lm','9':'lmt','10':'lt','11':'ltt','12':'lh','13':'lht','14':'lc','15':'lct','100':'lp','101':'lpt'};return"\{\{"+ns2ln[ns]+"|"+title+"\}\}";}Namespace={MAIN:0,TALK:1,USER:2,USER_TALK:3,PROJECT:4,PROJECT_TALK:5,IMAGE:6,IMAGE_TALK:7,FILE:6,FILE_TALK:7,MEDIAWIKI:8,MEDIAWIKI_TALK:9,TEMPLATE:10,TEMPLATE_TALK:11,HELP:12,HELP_TALK:13,CATEGORY:14,CATEGORY_TALK:15,PORTAL:100,PORTAL_TALK:101,MEDIA:-2,SPECIAL:-1,"":0,WIKIPEDIA:4,WIKIPEDIA_TALK:5,WP:4,WT:5};Date.monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'];Date. monthNamesAbbrev=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];Date.prototype.getMonthName=function{return Date.monthNames[this.getMonth];} Date.prototype.getMonthNameAbbrev=function{return Date.monthNamesAbbrev[this.getMonth];} Date.prototype.getUTCMonthName=function{return Date.monthNames[this.getUTCMonth];} Date.prototype.getUTCMonthNameAbbrev=function{return Date.monthNamesAbbrev[this.getUTCMonth];} Wikipedia={};Wikipedia.dump=[];Wikipedia.numberOfActionsLeft=0;Wikipedia.nbrOfCheckpointsLeft=0;Wikipedia.actionCompleted=function(self){if(--Wikipedia.numberOfActionsLeft<=0&&Wikipedia.nbrOfCheckpointsLeft<=0){Wikipedia.actionCompleted.event(self);}} Wikipedia.actionCompleted.event=function{new Status(Wikipedia.actionCompleted.notice,Wikipedia.actionCompleted.postfix,'info');if(Wikipedia.actionCompleted.redirect!=null){if(!/^\w+\:\/\//.test(Wikipedia.actionCompleted.redirect)){Wikipedia.actionCompleted.redirect=mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace('$1',encodeURIComponent(Wikipedia.actionCompleted.redirect).replace(/\%2F/g,'/'));if(Wikipedia.actionCompleted.followRedirect===false)Wikipedia.actionCompleted.redirect+="?redirect=no";}window.setTimeout(function{window.location=Wikipedia.actionCompleted.redirect},Wikipedia.actionCompleted.timeOut);}} wpActionCompletedTimeOut=typeof(wpActionCompletedTimeOut)=='undefined'?5000:wpActionCompletedTimeOut;wpMaxLag=typeof(wpMaxLag)=='undefined'?10:wpMaxLag;Wikipedia.editCount=10;Wikipedia.actionCompleted.timeOut=wpActionCompletedTimeOut;Wikipedia.actionCompleted.redirect=null;Wikipedia.actionCompleted.notice='Action';Wikipedia.actionCompleted.postfix='completed';Wikipedia.addCheckpoint=function{++Wikipedia.nbrOfCheckpointsLeft;} Wikipedia.removeCheckpoint=function{if(--Wikipedia.nbrOfCheckpointsLeft<=0&&Wikipedia.numberOfActionsLeft<=0){Wikipedia.actionCompleted.event;}} Wikipedia.api=function(currentAction,query,onSuccess,statusElement,onError){this.currentAction=currentAction;this.query=query;this.query['format']='xml';this.onSuccess=onSuccess;this.onError=onError;if(statusElement){this.statelem=statusElement;this.statelem.status(currentAction);}else{this.statelem=new Status(currentAction);}} Wikipedia.api.prototype={currentAction:'',onSuccess:null,onError:null,parent:window,query:null,responseXML:null,setParent:function(parent){this.parent=parent;},statelem:null,statusText:null,errorCode:null,errorText:null,post:function(callerAjaxParameters){++Wikipedia.numberOfActionsLeft;var ajaxparams=$.extend({},{context:this,type:'POST',url:mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php',data:QueryString.create(this.query),datatype:'xml',success:function(xml,statusText,jqXHR){this.statusText=statusText;this.responseXML=xml;this.errorCode=$(xml).find('error').attr('code');this.errorText=$(xml).find('error').attr('info');if(typeof(this.errorCode)==="string"){this.returnError;return;}if(this.onSuccess){this.onSuccess.call(this.parent,this);}else{this.statelem.info("Done");}Wikipedia.actionCompleted;},error:function(jqXHR,statusText,errorThrown){this.statusText=statusText;this.errorThrown=errorThrown;this.errorText=statusText+' "'+jqXHR.statusText+'" occurred while contacting the API.';this. returnError;}},callerAjaxParameters);return $.ajax(ajaxparams);},returnError:function{if(this.onError){this.onError.call(this.parent,this);}else{this.statelem.error(this.errorText);}},getStatusElement:function{return this.statelem;},getErrorCode:function{return this.errorCode;},getErrorText:function{return this.errorText;},getXML:function{return this.responseXML;}} Wikipedia.page=function(pageName,currentAction){this.getPageName=function{return ctx.pageName;};this.getPageText=function{return ctx.pageText;};this.setPageText=function(pageText){ctx.editMode='all';ctx.pageText=pageText;};this.setAppendText=function(appendText){ctx.editMode='append';ctx.appendText=appendText;};this.setPrependText=function(prependText){ctx.editMode='prepend';ctx.prependText=prependText;};this.setEditSummary=function(summary){ctx.editSummary=summary;};this.setCreateOption=function(createOption){ctx.createOption=createOption;};this.setMinorEdit=function(minorEdit){ctx.minorEdit=minorEdit;};this.setPageSection=function(pageSection){ctx.pageSection=pageSection;};this.setMaxConflictRetries=function(maxRetries){ctx.maxConflictRetries=maxRetries;};this.setMaxRetries=function(maxRetries){ctx.maxRetries=maxRetries;};this.setCallbackParameters=function(callbackParameters){ctx.callbackParameters=callbackParameters;};this.getCallbackParameters=function{return ctx. callbackParameters;};this.getCreator=function{return ctx.creator;};this.getStatusElement=function{return ctx.statusElement;};this.setFollowRedirect=function(followRedirect){if(ctx.pageLoaded){ctx.statusElement.error("Internal error: cannot change redirect setting after the page has been loaded!");return;}ctx.followRedirect=followRedirect;};this.setWatchlist=function(flag){if(flag)ctx.watchlistOption='watch';else ctx.watchlistOption='nochange';};this.setWatchlistFromPreferences=function(flag){if(flag)ctx.watchlistOption='preferences';else ctx.watchlistOption='nochange';};this.exists=function{return ctx.pageExists;};this.load=function(onSuccess,onFailure){ctx.onLoadSuccess=onSuccess;ctx.onLoadFailure=onFailure;if(onSuccess==null){ctx.statusElement.error("Internal error: no onSuccess callback provided to load!");return;}if(ctx.pageSection&&ctx.followRedirect){ctx.statusElement.error("Internal error: cannot use followRedirect=true when using pageSection!! Sorry about that.");return notminor=true;}switch(ctx.editMode){case'append':query.appendtext=ctx.appendText;break;case'prepend':query.prependtext=ctx.prependText;break;default:query.text=ctx.pageText;if(ctx.lastEditTime){query.basetimestamp=ctx.lastEditTime;}query.starttimestamp=ctx.loadTime;break;}if(['recreate','createonly','nocreate'].indexOf(ctx.createOption)!=-1){query[ctx.createOption]='';}ctx.saveApi=new Wikipedia.api("Saving page...",query,fnSaveSuccess,ctx.statusElement,fnSaveError);ctx.saveApi.setParent(this);ctx.saveApi.post;};this.append=function(onSuccess,onFailure){ctx.editMode='append';ctx.onSaveSuccess=onSuccess;ctx.onSaveFailure=onFailure;this.load(fnAutoSave,onFailure);};this.prepend=function(onSuccess,onFailure){ctx.editMode='prepend';ctx.onSaveSuccess=onSuccess;ctx.onSaveFailure=onFailure;this.load(fnAutoSave,onFailure);};this.lookupCreator=function(onSuccess){if(onSuccess==null){ctx.statusElement.error("Internal error: no onSuccess callback provided to lookupCreator!");return;}ctx. onLookupCreatorSuccess=onSuccess;var query={'action':'query','prop':'revisions','titles':ctx.pageName,'rvlimit':1,'rvprop':'user','rvdir':'newer'};if(ctx.followRedirect){query.redirects='';}ctx.lookupCreatorApi=new Wikipedia.api("Retrieving page creator information",query,fnLookupCreatorSuccess);ctx.lookupCreatorApi.setParent(this);ctx.lookupCreatorApi.post;};if(currentAction==null)currentAction='Opening page "'+pageName+'"';var ctx={pageName:pageName,pageText:null,editMode:'all',appendText:null,prependText:null,editSummary:null,createOption:null,minorEdit:false,pageSection:null,maxConflictRetries:2,maxRetries:2,callbackParameters:null,statusElement:new Status(currentAction),followRedirect:false,watchlistOption:'nochange',pageExists:false,creator:null,pageLoaded:false,editToken:null,loadTime:null,lastEditTime:null,conflictRetries:0,retries:0,onLoadSuccess:null,onLoadFailure:null,onSaveSuccess:null,onSaveFailure:null,onLookupCreatorSuccess:null,loadQuery:null,loadApi:null,saveApi:null ,lookupCreatorApi:null};var fnAutoSave=function(pageobj){pageobj.save(ctx.onSaveSuccess,ctx.onSaveFailure);};var fnLoadSuccess=function{var xml=ctx.loadApi.getXML;if(!fnCheckPageName(xml)){return;}ctx.pageExists=!($(xml).find('page').attr('missing'));if(ctx.pageExists){ctx.pageText=$(xml).find('rev').text;}else{ctx.pageText='';}ctx.editToken=$(xml).find('page').attr('edittoken');if(!ctx.editToken){ctx.statusElement.error("Failed to retrieve edit token.");return;}ctx.loadTime=$(xml).find('page').attr('starttimestamp');if(!ctx.loadTime){ctx.statusElement.error("Failed to retrieve start timestamp.");return;}ctx.lastEditTime=$(xml).find('page').attr('touched');ctx.pageLoaded=true;ctx.onLoadSuccess(this);};var fnCheckPageName=function(xml){if($(xml).find('page').attr('invalid')){ctx.statusElement.error("Attempt to edit a page with invalid title: "+ctx.pageName);return false;}if($(xml).find('page').attr('title')){ctx.pageName=$(xml).find('page').attr('title');if($(xml).find('redirects' )){ctx.statusElement.info("Redirected to "+ctx.pageName);}}else{ctx.statusElement.error("Could not resolve redirects for: "+ctx.pageName);return false;}return true;};var fnSaveSuccess=function{ctx.editMode='all';var xml=ctx.saveApi.getXML;if($(xml).find('edit').attr('result')=="Success"){if(ctx.onSaveSuccess){ctx.onSaveSuccess(this);}else{var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',ctx.pageName));link.appendChild(document.createTextNode(ctx.pageName));ctx.statusElement.info(['completed (',link,')']);}return;}var blacklist=$(xml).find('edit').attr('spamblacklist');var captcha=$(xml).find('captcha');if(blacklist){var code=document.createElement('code');code.style.fontFamily="monospace";code.appendChild(document.createTextNode(blacklist));ctx.statusElement.error(['Could not save the edit because the URL ',code,' is on the spam blacklist.']);}else if(captcha){ctx.statusElement.error( "Could not save the edit because the wiki server wanted you to fill out a CAPTCHA.");}else{ctx.statusElement.error("Unknown error saving page");}++Wikipedia.numberOfActionsLeft;};var fnSaveError=function{var errorCode=ctx.saveApi.getErrorCode;if(errorCode=="editconflict"&&ctx.conflictRetries++<ctx.maxConflictRetries){ctx.statusElement.info("Edit conflict detected, retrying...");--Wikipedia.numberOfActionsLeft;ctx.loadApi.post;}else if(errorCode=="notoken"&&ctx.conflictRetries++<ctx.maxConflictRetries){ctx.statusElement.info("Edit token is invalid, retrying...");--Wikipedia.numberOfActionsLeft;ctx.loadApi.post;}else if(errorCode=="undefined"&&ctx.retries++<ctx.maxRetries){ctx.statusElement.info("Save failed, retrying...");--Wikipedia.numberOfActionsLeft;ctx.saveApi.post;}else{ctx.statusElement.error("Failed to save edit: "+ctx.saveApi.getErrorText);ctx.editMode='all';if(ctx.onSaveFailure){ctx.onSaveFailure(this);}}};var fnLookupCreatorSuccess=function{var xml=ctx. lookupCreatorApi.getXML;if(!fnCheckPageName(xml)){return;}ctx.creator=$(xml).find('rev').attr('user');if(!ctx.creator){ctx.statusElement.error("Could not find name of page creator");return;}ctx.onLookupCreatorSuccess(this);};} wikiRevert=function(currentAction,title,oldid,summary,onsuccess,onfailure){var query={'action':'query','prop':'info|revisions','intoken':'edit','titles':title};var statelem=new Status(currentAction);var wikipedia_api=new Wikipedia.api("Retrieving revert data...",query,Wikipedia.page.callbacks.revert.request,statelem);wikipedia_api.params=params;wikipedia_api.title=title;wikipedia_api.oldid=oldid;wikipedia_api.summary=summary;wikipedia_api.onsuccess=(onsuccess?onsuccess:function(self){self.statelem.info("Done")});wikipedia_api.onfailure=onfailure;wikipedia_api.post;} wikiRevertCallback=function(self){var xmlDoc=self.responseXML;var revid=xmlDoc.evaluate('//rev/@revid',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var edittoken=self.responseXML.evaluate('//page/@edittoken',self.responseXML,null,XPathResult.STRING_TYPE,null).stringValue;if(!edittoken){self.statelem.error("Failed to retrieve edit token.");return;}var basetimestamp=xmlDoc.evaluate('//page/@touched',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;var query={'action':'edit','title':self.title,'token':edittoken,'basetimestamp':basetimestamp,'summary':self.summary,'undo':oldid,'undoafter':revid};var wikipedia_api=new Wikipedia.api("Sending revert data...",result,Wikipedia.page.callbacks.edit.success,self.statelem);wikipedia_api.params=self.params;wikipedia_api.title=self.title;wikipedia_api.post;} Wikipedia.wiki=function(currentAction,query,oninit,onsuccess,onerror,onretry){alert('The action "'+currentAction+'" is still using the "Wikipedia.wiki" class.');this.currentAction=currentAction;this.query=query;this.oninit=oninit;this.onsuccess=onsuccess;this.onerror=onerror;this.onretry=onretry;this.statelem=new Status(currentAction);++Wikipedia.numberOfActionsLeft;} Wikipedia.wiki.prototype={currentAction:'',onsuccess:null,onerror:null,onretry:null,oninit:null,query:null,postData:null,responseXML:null,statelem:null,counter:0,post:function(data){this.postData=data;if(Wikipedia.editCount<=0){this.query['maxlag']=wpMaxLag;}else{--Wikipedia.editCount;}var xmlhttp=sajax_init_object;Wikipedia.dump.push(xmlhttp);xmlhttp.obj=this;xmlhttp.overrideMimeType('text/xml');xmlhttp.open('POST',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?useskin=monobook&'+QueryString.create(this.query),true);xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlhttp.onerror=function(e){var self=this.obj;self.statelem.error("Error "+this.status+" occurred while posting the document.");} xmlhttp.onload=function(e){var self=this.obj;var status=this.status;if(status!=200){if(status==503){var retry=this.getResponseHeader('Retry-After');var lag=this.getResponseHeader('X-Database-Lag');if(lag){self.statelem.warn("current lag of "+lag+" seconds is more than our defined maximum lag of "+wpMaxLag+" seconds, will retry in "+retry+" seconds");window.setTimeout(function(self){self.post(self.postData);},retry*1000,self);return;}else{self.statelem.error("Error "+status+" occurred while posting the document.");}}return;}var xmlDoc;xmlDoc=self.responseXML=this.responseXML;var xpathExpr='boolean(//div[@class=\'previewnote\']/p/strong[contains(.,\'Sorry! We could not process your edit due to a loss of session data\')])';var nosession=xmlDoc.evaluate(xpathExpr,xmlDoc,null,XPathResult.BOOLEAN_TYPE,null).booleanValue;if(nosession){var new_token=xmlDoc.evaluate('//input[@name="wfEditToken"]/@value',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;self.postData['wfEditToken']=new_token var wikipedia_api=new Wikipedia.api("resolving eventual redirect",redirect_query,this.postget,this.statelem);wikipedia_api.parent=this;wikipedia_api.post;},postget:function{var xmlDoc=self.responseXML=this.responseXML;var to=xmlDoc.evaluate('//redirects/r/@to',xmlDoc,null,XPathResult.STRING_TYPE,null).stringValue;if(!this.parent.followRedirect){this.parent.statelem.info('ignoring eventual redirect');}else if(to){this.parent.query['title']=to;}this.parent.onloading(this);var xmlhttp=sajax_init_object;Wikipedia.dump.push(xmlhttp);xmlhttp.obj=this.parent;xmlhttp.overrideMimeType('text/xml');xmlhttp.open('GET',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/index.php?useskin=monobook&'+QueryString.create(this.parent.query),true);xmlhttp.onerror=function{var self=this.obj;self.statelem.error("Error "+this.status+" occurred while receiving the document.");} xmlhttp.onload=function{this.obj.onloaded(this.obj);this.obj.responseXML=this.responseXML;this.obj.responseText=this.responseText;this.obj.oninit(this.obj);};xmlhttp.send(null);},onloading:function{this.statelem.status('loading data...');},onloaded:function{this.statelem.status('data loaded...');}} Number.prototype.zeroFill=function(length){var str=this.toFixed;if(!length){return str;}while(str.length<length){str='0'+str;}return str;} Mediawiki={};Mediawiki.Template={parse:function(text,start){var count=-1;var level=-1;var equals=-1;var current=;var result={name:,parameters:{}};for(var i=start;i<text.length;++i){var test3=text.substr(i,3);if(test3=='\{\{\{'){current+='\{\{\{';i+=2;++level;continue;}if(test3=='\}\}\}'){current+='\}\}\}';i+=2;--level;continue;}var test2=text.substr(i,2);if(test2=='\{\{'||test2=='\[\['){current+=test2;++i;++level;continue;}if(test2=='\]\]'){current+=test2;++i;--level;continue;}if(test2=='\}\}'){current+=test2;++i;--level;if(level<=0){if(count==-1){result.name=current.substring(2).trim;++count;}else{if(equals!=-1){var key=current.substring(0,equals).trim;var value=current.substring(equals).trim;result.parameters[key]=value;equals=-1;}else{result.parameters[count]=current;++count;}}break;}continue;}if(text.charAt(i)=='|'&&level<=0){if(count==-1){result.name=current.substring(2).trim;++count;}else{if(equals!=-1){var key=current.substring(0,equals).trim;var value=current. substring(equals+1).trim;result.parameters[key]=value;equals=-1;}else{result.parameters[count]=current;++count;}}current='';}else if(equals==-1&&text.charAt(i)=='='&&level<=0){equals=current.length;current+=text.charAt(i);}else{current+=text.charAt(i);}}return result;}} Mediawiki.Page=function mediawikiPage(text){this.text=text;} Mediawiki.Page.prototype={text:,removeLink:function(link_target){var first_char=link_target.substr(0,1);var link_re_string="["+first_char.toUpperCase+first_char.toLowerCase+']'+RegExp.escape(link_target.substr(1),true);var link_simple_re=new RegExp("\\[\\[:?("+link_re_string+")\\|?\\]\\]",'g');var link_named_re=new RegExp("\\[\\[:?"+link_re_string+"\\|(.+?)\\]\\]",'g');if(link_simple_re.test(this.text)){this.text=this.text.replace(link_simple_re,"$1");}else{this.text=this.text.replace(link_named_re,"$1");}},commentOutImage:function(image,reason){var unbinder=new Unbinder(this.text);unbinder.unbind();reason=reason?' '+reason+': ':;var first_char=image.substr(0,1);var image_re_string="["+first_char.toUpperCase+first_char.toLowerCase+']'+RegExp.escape(image.substr(1),true);var links_re=new RegExp("\\[\\[(?:[Ii]mage|[Ff]ile):\\s*"+image_re_string);var allLinks=unbinder.content.splitWeightedByKeys(,'').uniq;for(var i=0;i<allLinks.length;++i){if(links_re.test( allLinks[i])){var replacement=;unbinder.content=unbinder.content.replace(allLinks[i],replacement,'g');}}unbinder.unbind();var gallery_image_re=new RegExp("(^\\s*(?:[Ii]mage|[Ff]ile):\\s*"+image_re_string+".*?$)",'mg');unbinder.content.replace(gallery_image_re,"");unbinder.unbind();var free_image_re=new RegExp("(\\|\\s*(?:[\\w\\s]+\\=)?\\s*(?:(?:[Ii]mage|[Ff]ile):\\s*)?"+image_re_string+")",'mg');unbinder.content.replace(free_image_re,"");this.text=unbinder.rebind;},addToImageComment:function(image,data){var first_char=image.substr(0,1);var image_re_string="(?:[Ii]mage|[Ff]ile):\\s*["+first_char.toUpperCase+first_char.toLowerCase+']'+RegExp.escape(image.substr(1),true);var links_re=new RegExp("\\[\\["+image_re_string);var allLinks=this.text.splitWeightedByKeys(,'').uniq;for(var i=0;i<allLinks.length;++i){if(links_re.test(allLinks[i])){var replacement=allLinks[i];replacement= replacement.replace(/\]\]$/,'|'+data+']]');this.text=this.text.replace(allLinks[i],replacement,'g');}}var gallery_re=new RegExp("^(\\s*"+image_re_string+'.*?)\\|?(.*?)$','mg');var replacement="$1|$2 "+data;this.text=this.text.replace(gallery_re,replacement);},removeTemplate:function(template){var first_char=template.substr(0,1);var template_re_string="(?:[Tt]emplate:)?\\s*["+first_char.toUpperCase+first_char.toLowerCase+']'+RegExp.escape(template.substr(1),true);var links_re=new RegExp("\\\{\\\{"+template_re_string);var allTemplates=this.text.splitWeightedByKeys('{\{','}}',[]).uniq;for(var i=0;i<allTemplates.length;++i){if(links_re.test(allTemplates[i])){this.text=this.text.replace(allTemplates[i],,'g');}}},getText:function{return this.text;}} function isInNetwork(ipaddress,network){var iparr=ipaddress.split('.');var ip=(parseInt(iparr[0])<<24)+(parseInt(iparr[1])<<16)+(parseInt(iparr[2])<<8)+(parseInt(iparr[3]));var netmask=0xffffffff<<network.split('/')[1];var netarr=network.split('/')[0].split('.');var net=(parseInt(netarr[0])<<24)+(parseInt(netarr[1])<<16)+(parseInt(netarr[2])<<8)+(parseInt(netarr[3]));return(ip&netmask)==net;}function isIPAddress(string){var res=/(\d{1,4})\.(\d{1,3})\.(\d{1,3})\.(\d{1,4})/.exec(string);return res!=null&&res.slice(1,5).every(function(e){return e<256;});}function QueryString(qString){this.string=qString;this.params={};if(qString.length==0){return;}qString.replace(/\+/,' ');var args=qString.split('&');for(var i=0;i<args.length;++i){var pair=args[i].split('=');var key=decodeURIComponent(pair[0]),value=key;if(pair.length==2){value=decodeURIComponent(pair[1]);}this.params[key]=value;}}QueryString.static=null;QueryString.staticInit=function{if(QueryString.static==null){QueryString.static=new QueryString(location.search.substring(1));}} QueryString.get=function(key){QueryString.staticInit;return QueryString.static.get(key);};QueryString.prototype.get=function(key){return this.params[key]?this.params[key]:null;};QueryString.exists=function(key){QueryString.staticInit;return QueryString.static.exists(key);} QueryString.prototype.exists=function(key){return this.params[key]?true:false;} QueryString.equals=function(key,value){QueryString.staticInit;return QueryString.static.equals(key,value);} QueryString.prototype.equals=function(key,value){return this.params[key]==value?true:false;} QueryString.toString=function{QueryString.staticInit;return QueryString.static.toString;} QueryString.prototype.toString=function{return this.string?this.string:null;} QueryString.create=function(arr){var resarr=Array;var editToken;for(var i in arr){if(typeof arr[i]=='undefined'){continue;}var res;if(arr[i]instanceof Array){var v=Array;for(var j=0;j<arr[i].length;++j){v[j]=encodeURIComponent(arr[i][j]);}res=v.join('|');}else{res=encodeURIComponent(arr[i]);}if(i=='wpEditToken'){editToken=res;}else{resarr.push(encodeURIComponent(i)+'='+res);}}if(typeof editToken!='undefined'){resarr.push('wpEditToken='+editToken);}return resarr.join('&');} QueryString.prototype.create=QueryString.create;Exception=function(message){this.message=message||'';this.name="Exception";} Exception.prototype.what=function{return this.message;} function Status(text,stat,type){this.text=this.codify(text);this.stat=this.codify(stat);this.type=type||'status';if(type=='error')Wikipedia.numberOfActionsLeft=1000;this.generate;if(stat){this.render;}}Status.init=function(root){if(!(root instanceof Element)){throw new Exception('object not an instance of Element');}while(root.hasChildNodes){root.removeChild(root.firstChild);}Status.root=root;var cssNode=document.createElement('style');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(cssNode);var styles=cssNode.sheet?cssNode.sheet:cssNode.stylesSheet;styles.insertRule(".tw_status_status { color: SteelBlue; }",0);styles.insertRule(".tw_status_info { color: ForestGreen; }",0);styles.insertRule(".tw_status_warn { color: OrangeRed; }",0);styles.insertRule(".tw_status_error { color: OrangeRed; font-weight: bold; }",0);} Status.root=null;Status.prototype={stat:null,text:null,type:'status',target:null,node:null,linked:false,link:function{if(!this.linked&&Status.root){Status.root.appendChild(this.node);this.linked=true;}},unlink:function{if(this.linked){Status.root.removeChild(this.node);this.linked=false;}},codify:function(obj){if(!(obj instanceof Array)){obj=[obj];}var result;result=document.createDocumentFragment;for(var i=0;i<obj.length;++i){if(typeof obj[i]=='string'){result.appendChild(document.createTextNode(obj[i]));}else if(obj[i]instanceof Element){result.appendChild(obj[i]);}}return result;},update:function(status,type){this.stat=this.codify(status);if(type){this.type=type;if(type=='error')Wikipedia.numberOfActionsLeft=1000;}this.render;},generate:function{this.node=document.createElement('div');this.node.appendChild(document.createElement('span')).appendChild(this.text);this.node.appendChild(document.createElement('span')).appendChild(document.createTextNode(': '));this.target=this. node.appendChild(document.createElement('span'));this.target.appendChild(document.createTextNode(''));},render:function{this.node.className='tw_status_'+this.type;while(this.target.hasChildNodes){this.target.removeChild(this.target.firstChild);}this.target.appendChild(this.stat);this.link;},status:function(status){this.update(status,'status');},info:function(status){this.update(status,'info');},warn:function(status){this.update(status,'warn');},error:function(status){this.update(status,'error');}} Status.status=function(text,status){return new Status(text,status,'status');} Status.info=function(text,status){return new Status(text,status,'info');} Status.warn=function(text,status){return new Status(text,status,'warn');} Status.error=function(text,status){return new Status(text,status,'error');} function htmlNode(type,content,color){var node=document.createElement(type);if(color){node.style.color=color;}node.appendChild(document.createTextNode(content));return node;}function SimpleWindow(width,height){var stylesheet=document.createElement('style');stylesheet.type='text/css';stylesheet.rel='stylesheet';stylesheet.appendChild(document.createTextNode(""));document.getElementsByTagName("head")[0].appendChild(stylesheet);var styles=stylesheet.sheet?stylesheet.sheet:stylesheet.styleSheet;styles.insertRule(".simplewindow { "+"font: x-small sans-serif;"+"position: fixed; "+"background-color: AliceBlue; "+"border: 2px ridge Black; "+"z-index: 100; "+"}",0);styles.insertRule(".simplewindow .content { "+"position: absolute; "+"top: 22px; "+"bottom: 0; "+"overflow: auto; "+"width: 100%; "+"}",0);styles.insertRule(".simplewindow .resizebuttonhorizontal { "+"position: absolute; "+"background-color: MediumPurple; "+"opacity: 0.5; "+"right: -2px; "+"bottom: -2px; "+"width: 20px; "+ "height: 4px; "+"cursor: se-resize; "+"}",0);styles.insertRule(".simplewindow .resizebuttonvertical { "+"position: absolute; "+"opacity: 0.5; "+"background-color: MediumPurple; "+"right: -2px; "+"bottom: -2px; "+"width: 4px; "+"height: 20px; "+"cursor: se-resize; "+"}",0);styles.insertRule(".simplewindow .closebutton {"+"position: absolute; "+"font: 100 0.8em sans-serif; "+"top: 1px; "+"left: 1px; "+"height: 100%; "+"cursor: pointer; "+"}",0);styles.insertRule(".simplewindow .topbar { "+"position: absolute; "+"background-color: LightSteelBlue; "+"font: bold 1.2em sans-serif; "+"vertical-align: baseline; "+"text-align: center; "+"width: 100%; "+"height: 20px; "+"padding-top: 2px;"+"cursor: move; "+"}",0);this.width=width;this.height=height;var frame=document.createElement('div');var content=document.createElement('div');var topbar=document.createElement('div');var title=document.createElement('span');var closeButton=document.createElement('span');var resizeButton2=document.createElement ('div');var resizeButton1=document.createElement('div');this.frame=frame;this.title=title;this.content=content;frame.className='simplewindow';content.className='content';topbar.className='topbar';resizeButton1.className='resizebuttonvertical';resizeButton2.className='resizebuttonhorizontal';closeButton.className='closebutton';title.className='title';topbar.appendChild(closeButton);topbar.appendChild(title);frame.appendChild(topbar);frame.appendChild(content);frame.appendChild(resizeButton1);frame.appendChild(resizeButton2);frame.style.width=Math.min(parseInt(window.innerWidth),parseInt(width))+'px';frame.style.height=Math.min(parseInt(window.innerHeight),parseInt(height))+'px';frame.style.top=Math.max(0,parseInt(window.innerHeight-this.height)/2)+'px';frame.style.left=Math.max(0,parseInt(window.innerWidth-this.width)/2)+'px';var img=document.createElement('img');img.src= "http://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Crystal_button_cancel.svg/18px-Crystal_button_cancel.svg.png";img.setAttribute("alt","[close]");closeButton.appendChild(img);var self=this;frame.addEventListener('mousedown',function(event){self.focus(event);},false);closeButton.addEventListener('click',function(event){self.close(event);},false);topbar.addEventListener('mousedown',function(event){self.initMove(event);},false);resizeButton1.addEventListener('mousedown',function(event){self.initResize(event);},false);resizeButton2.addEventListener('mousedown',function(event){self.initResize(event);},false);window.addEventListener('mouseover',function(event){self.handleEvent(event);},false);window.addEventListener('mousemove',function(event){self.handleEvent(event);},false);window.addEventListener('mouseup',function(event){self.handleEvent(event);},false);this.currentState=this.initialState;}SimpleWindow.prototype={focusLayer:100,width:800,height:600,initialState:"Inactive", currentState:null,focus:function(event){this.frame.style.zIndex=++this.focusLayer;},close:function(event){event.preventDefault;document.body.removeChild(this.frame);},initMove:function(event){event.preventDefault;this.initialX=parseInt(event.clientX-this.frame.offsetLeft);this.initialY=parseInt(event.clientY-this.frame.offsetTop);this.frame.style.opacity='0.5';this.currentState='Move';},initResize:function(event){event.preventDefault;this.frame.style.opacity='0.5';this.currentState='Resize';},handleEvent:function(event){event.preventDefault;var actionTransitionFunction=this.actionTransitionFunctions[this.currentState][event.type];if(!actionTransitionFunction){actionTransitionFunction=this.unexpectedEvent;}var nextState=actionTransitionFunction.call(this,event);if(!nextState){nextState=this.currentState;}if(!this.actionTransitionFunctions[nextState]){nextState=this.undefinedState(event,nextState);}this.currentState=nextState;event.stopPropagation;},unexpectedEvent:function( event){throw("Handled unexpected event '"+event.type+"' in state '"+this.currentState);return this.initialState;},undefinedState:function(event,state){throw("Transitioned to undefined state '"+state+"' from state '"+this.currentState+"' due to event '"+event.type);return this.initialState;},actionTransitionFunctions:{Inactive:{mouseover:function(event){return this.currentState;},mousemove:function(event){return this.currentState;},mouseup:function(event){return this.currentState;}},Move:{mouseover:function(event){this.moveWindow(event.clientX,event.clientY);return this.currentState;},mousemove:function(event){return this.doActionTransition("Move","mouseover",event);},mouseup:function(event){this.frame.style.opacity='1';return'Inactive';}},Resize:{mouseover:function(event){this.resizeWindow(event.clientX,event.clientY);return this.currentState;},mousemove:function(event){return this.doActionTransition("Resize","mouseover",event);},mouseup:function(event){this.frame.style.opacity='1'; return'Inactive';}}},doActionTransition:function(anotherState,anotherEventType,event){return this.actionTransitionFunctions[anotherState][anotherEventType].call(this,event);},display:function{document.body.appendChild(this.frame);},setTitle:function(title){this.title.textContent=title;},setWidth:function(width){this.frame.style.width=width;},setHeight:function(height){this.frame.style.height=height;},setContent:function(content){this.purgeContent;this.addContent(content);},addContent:function(content){this.content.appendChild(content);},purgeContent:function(content){while(this.content.hasChildNodes){this.content.removeChild(this.content.firstChild);}},moveWindow:function(x,y){this.frame.style.left=x-this.initialX+'px';this.frame.style.top=y-this.initialY+'px';},resizeWindow:function(x,y){this.frame.style.height=Math.max(parseInt(y-this.frame.offsetTop),200)+'px';this.frame.style.width=Math.max(parseInt(x-this.frame.offsetLeft),200)+'px';}} if(typeof(Twinkle.init.moduleReady)==="function"){Twinkle.init.moduleReady("morebits",Twinkle.morebits);}if((wgAction=='view'&&skin=='vector')){mw.loader.using('jquery.ui',function{morebitsTest={launchDialog:function(interface){interface.dialog('open');},initSimpleWindow:function{var Window=new SimpleWindow(600,400);Window.setTitle("Test morebits.js");Window.display;var form=new QuickForm(null);var main_group=form.append({type:'select',name:'main_group',event:null});var result=form.render;Window.setContent(result);Window.display;result.main_group.root=result;Status.init(result);Wikipedia.actionCompleted.redirect=wgPageName;Wikipedia.actionCompleted.notice="Test complete, reloading talk page in a few seconds";},setPageOptions:function(page){page.setEditSummary($('#editSummary').val);if($('#runTestForm input[name="followRedirect"]').attr('checked')){page.setFollowRedirect(true);}if($('#runTestForm input[name="minorEdit"]').attr('checked')){page.setMinorEdit(true);}if($ ('#runTestForm input[name="watchlist"]').attr('checked')){page.setWatchlist(true);}if($('#runTestForm input[name="watchlistFromPreferences"]').attr('checked')){page.setWatchlistFromPreferences(true);}if($('#runTestForm input[name="noRetries"]').attr('checked')){page.setMaxConflictRetries(0);page.setMaxRetries(0);}var section=$('#runTestForm input[name="sectionNumber"]').val;if(section!=""){page.setPageSection(Number(section));}page.setCreateOption(morebits_test_createOption);if($('#runTestForm input[name="lookupCreator"]').attr('checked')){page.lookupCreator(morebitsTest.lookupCreatorCallback);}},loadCallbackInsert:function(page){var params=page.getCallbackParameters;var text=page.getPageText;var pos=text.indexOf(params['beforeText']);if(pos==-1){alert('Search text "'+params['beforeText']+'" not found!');return;}page.setPageText(text.substr(0,pos)+params['newText']+text.substr(pos));page.save(morebitsTest.finalSaveCallback);},loadCallbackReplace:function(page){var params=page. getCallbackParameters;page.setPageText(params['newText']);page.save(morebitsTest.finalSaveCallback);},lookupCreatorCallback:function(page){alert("Page was created by: "+page.getCreator);},finalSaveCallback:function(page){Wikipedia.actionCompleted.redirect=page.getPageName;},initialize:function{morebits_test_createOption=null;$runTests=$(' ').append($(' ').html('Text to be added: ').append($(' '))).append($(' ').html('Insert text before (for insert mode only): ').append($(' '))).append($(' ').html('Edit summary: ').append($(' '))).append($( ' ').html('Section number: ')).append($(' ').html(' Follow redirect')).append($(' ').html(' Minor edit')).append($(' ').html(' Add to watchlist')).append($(' ').html(' Add to watchlist based on preference settings')).append($(' ').html(' Disable retries')).append($(' ').html(' Lookup page creator ')).append($(' ').html( ' Create page if needed, unless deleted since loaded ')).append($(' ').html(' Create page if needed ')).append($(' ').html(' Only create a new page ')).append($(' ').html(' Do not create a new page ')).dialog({width:500,autoOpen:false,title:'Test Wikipedia.page class',modal:true,buttons:{"Append":function{$(this).dialog('close');morebitsTest.initSimpleWindow;var page=new Wikipedia.page(wgPageName);page.setAppendText($('#message').val);morebitsTest.setPageOptions( page);page.append(morebitsTest.finalSaveCallback);},"Prepend":function(e){$(this).dialog('close');morebitsTest.initSimpleWindow;var page=new Wikipedia.page(wgPageName);page.setPrependText($('#message').val);morebitsTest.setPageOptions(page);page.prepend(morebitsTest.finalSaveCallback);},"Insert":function(e){if($('#beforeText').val==""){alert("Text to insert before must be specified!");return;}$(this).dialog('close');morebitsTest.initSimpleWindow;var page=new Wikipedia.page(wgPageName);page.setCallbackParameters({beforeText:$('#beforeText').val,newText:$('#message').val});morebitsTest.setPageOptions(page);page.load(morebitsTest.loadCallbackInsert);},"Replace":function(e){$(this).dialog('close');morebitsTest.initSimpleWindow;var page=new Wikipedia.page(wgPageName);page.setCallbackParameters({newText:$('#message').val});morebitsTest.setPageOptions(page);page.load(morebitsTest.loadCallbackReplace);}}});}} morebitsTest.initialize;}) function morebits_test_init{twAddPortletLink(("javascript:morebitsTest.launchDialog($runTests)"),"Test","tw-test","Test morebits.js","");}}Twinkle.init.moduleReady("morebits-test",morebits_test_init);;mediaWiki.loader.state({"user":"ready"});
 * if(latest.date>date){Status.info('Info',"a "+latest.type+" has been issued in the last minute");if(!confirm("Would you still like to add a warning/notice?")){pageobj.statelem.info('aborted per user request');return;}}var mainheaderRe=/==+\\s*Warnings\\s*==+/;var headerRe=new RegExp("^==+\\s*(?:"+date.getUTCMonthName+'|'+date.getUTCMonthNameAbbrev+")\\s+"+date.getUTCFullYear+"\\s*==+",'m');if(text.length>0){text+="\n\n";}if(params.main_group=='block'){var article=,reason=,time=null;if(TwinkleConfig.blankTalkpageOnIndefBlock&&params.sub_group!='uw-lblock'&&(twinklewarn.indefBlockHash[params.sub_group]||/indef|\*|max/.exec(params.block_timer))){Status.info('Info','Blanking talk page per preferences and createing a new level 2 heading for the date');text="== "+date.getUTCMonthName+" "+date.getUTCFullYear+" ==\n";}else if(!headerRe.exec(text)){Status.info('Info','Will create a new level 2 heading for the date, as none was found for this month');text+="== "+date.
 * return;}}var wikipedia_page=new Wikipedia.page(params.discussionpage,"Creating article deletion discussion page");wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.afd.discussionPage);var date=new Date;wikipedia_page=new Wikipedia.page('Wikipedia:Articles for deletion/Log/'+date.getUTCFullYear+' '+date.getUTCMonthName+' '+date.getUTCDate,"Adding discussion to today's list");wikipedia_page.setFollowRedirect(true);wikipedia_page.setCallbackParameters(params);wikipedia_page.load(twinklexfd.callbacks.afd.todaysList);if(params.usertalk){var thispage=new Wikipedia.page(wgPageName);thispage.setCallbackParameters(params);thispage.lookupCreator(twinklexfd.callbacks.afd.userNotification);}text=text.replace(/{\{\s*(dated prod|dated prod blp|Prod blp\/dated|Proposed deletion\/dated|prod2|Proposed deletion endorsed|New unreviewed article|Userspace draft)\s*(\|(?:|[^{}])*)?}}\s*/ig,"");var textNoSd=text.replace(
 * var notifytext="\n\{\{subst:idw-puf|1="+wgTitle+"\}\}";usertalkpage.setAppendText(notifytext);usertalkpage.setEditSummary("Notification: listing at possibly unfree files of "+wgPageName+"."+TwinkleConfig.summaryAd);usertalkpage.setCreateOption('recreate');switch(TwinkleConfig.xfdWatchUser){case'yes':usertalkpage.setWatchlist(true);break;case'no':usertalkpage.setWatchlistFromPreferences(false);break;default:usertalkpage.setWatchlistFromPreferences(true);break;}usertalkpage.setFollowRedirect(true);usertalkpage.append;}},cfd:{taggingCategory:function(pageobj){var text=pageobj.getPageText;var params=pageobj.getCallbackParameters;var added_data="";var editsummary="";switch(params.xfdcat){case'cfd':added_data="\{\{subst:cfd\}\}";editsummary="Category being considered for deletion in accordance with CDP.";break;case'cfm':added_data="\{\{subst:cfm|"+params.target.replace('Category:','')+"\}\}";editsummary=
 * }ctx.loadQuery={action:'query',prop:'info|revisions',intoken:'edit',titles:ctx.pageName};if(ctx.followRedirect){ctx.loadQuery.redirects='';}if(typeof(ctx.pageSection)==='number'){ctx.loadQuery.rvsection=ctx.pageSection;}if(ctx.editMode=='all')ctx.loadQuery.rvprop='content';ctx.loadApi=new Wikipedia.api("Retrieving page...",ctx.loadQuery,fnLoadSuccess,ctx.statusElement);ctx.loadApi.setParent(this);ctx.loadApi.post;};this.save=function(onSuccess,onFailure){if(!ctx.pageLoaded){ctx.statusElement.error("Internal error: attempt to save a page that has not been loaded!");return;}if(!ctx.editSummary){ctx.statusElement.error("Internal error: edit summary not set before save!");return;}ctx.onSaveSuccess=onSuccess;ctx.onSaveFailure=onFailure;ctx.retries=0;var query={action:'edit',title:ctx.pageName,summary:ctx.editSummary,token:ctx.editToken,watchlist:ctx.watchlistOption};if(typeof(ctx.pageSection)==='number'){query.section=ctx.pageSection;}if(ctx.minorEdit){query.minor=true;}else{query.
 * self.post(self.postData);}else{if(self.onsuccess){self.onsuccess(self);}else{var link=document.createElement('a');link.setAttribute('href',wgArticlePath.replace('$1',self.query['title']));link.setAttribute('title',self.query['title']);link.appendChild(document.createTextNode(self.query['title']));self.statelem.info(['completed (',link,')']);}Wikipedia.actionCompleted;}};xmlhttp.send(QueryString.create(this.postData));},get:function{this.onloading(this);var redirect_query={'action':'query','titles':this.query['title'],'redirects':''}

/* cache key: enwiki:resourceloader:filter:minify-js:5:e4dc5ae1af60c167c6989fbd6914ec35 */