Template:Bot policy
Appearance
From Meta, a Wikimedia project coordination wiki
Usage
{{bot policy|ie.wikipedia}}
Returns information about the implementation of the standard bot policy on a given wiki as one of the following strings. This template is intended to be used in other templates, particularly {{sr-request}}.
Please update Bot policy/Implementation#Where it is policy instead of this template, which is updated using a script.
aaa,gb
allows both automatic approval and global bots.
aaa
allows automatic approval, but not global bots.
gb
allows global bots, but not automatic approval.
does not use the bot policy.
Updating this template
This template is semi-automatically updated using the following JavaScript. You can run it on any Meta page (e.g., by pasting it into your browser's console window). This will parse the latest data from Bot policy/Implementation, and output the results and instructions on what to do at the top of the page.
if(!window.pathoschild){ varpathoschild={}; } /** * This is a specialized wiki script. It queries the content of [[m:Bot policy/Implementation]], and generates an * updated {{#switch}} statement used in [[m:Template:Bot policy]]. * @author Pathoschild; http://meta.wikimedia.org/wiki/User_talk:Pathoschild * @version 0.2 */ pathoschild.UpdateBotPolicyTemplate={ /*######## ## Properties ########*/ /** * @field {string} The URL to the page containing the bot policy implementation details to extract. * @private */ _url:'//meta.wikimedia.org/wiki/Bot_policy/Implementation?action=render', /** * The unique ID associated with the log element. * @private */ _logID:'pathoschild-update-bot-policy-template-result', /** * The element to which output is written. * @private */ _$log:null, /*######## ## Internal methods ########*/ /** * Get an element to which output can be written for the user. * @return {Element} The DOM element to which output can be written. * @private */ _GetLog:function(){ /* already created */ varlog=$('#'+this._logID).first(); if(log.length){ returnlog.empty(); } /* create */ log=$(document.createElement('pre')) .attr('id',this._logID) .css({'font-size':'0.8em'}); $('#wpTextbox1, #bodyContent').first().before(log); returnlog; }, /** * Append a message to the output log. * @param {string} message The message to append. * @private */ _Log:function(message){ this._LogRaw( $(document.createElement('div')).text(message) ); }, _LogRaw:function(message){ if(!this._$log){ this._$log=this._GetLog(); } this._$log.append(message); }, /*######## ## Public methods ########*/ /** * Execute the update script. * @param $ {jQuery} The jQuery instance used for AJAX and DOM manipulation. */ Execute:function($){ var_this=this; _this._LogRaw('Fetching details from <a href="'+this._url+'" title="Bot policy/Implementation">the implementation table</a>...'); $.ajax({ url:this._url, error:function(xhr,status,error){ _this._Log('Could not retrieve implementation page: '+status+': '+error); }, success:function(data){ data=$(data); /* extract implementation details */ varaa=[]; vargb=[]; varaagb=[]; varwikiset=[]; data.find('.is-wiki-row').each(function(i,item){ item=$(item); varsubdomain=item.find('.is-data-subdomain').first().text(); vardomain=item.find('.is-data-domain').first().text(); varallowsApproval=item.hasClass('is-aa-1'); varallowsGlobal=item.hasClass('is-gb-1'); /* save the wikiset ID (eg, "enwiki") */ if(allowsGlobal){ varwikisetID=subdomain.replace(/-/g,'_'); switch(domain){ case'meta': wikisetID='metawiki'; break; case'wikipedia': wikisetID+='wiki'; break; default: wikisetID+=domain; } wikiset.push(wikisetID); } /* save the template ID (eg, "en.wikipedia") */ vartemplateID=subdomain+'.'+domain; if(templateID=='.meta'){ templateID='meta.wikimedia'; } if(allowsApproval&&allowsGlobal){ aagb.push(templateID); } elseif(allowsApproval){ aa.push(templateID); } elseif(allowsGlobal){ gb.push(templateID); } else{ _this._Log('Cannot determine implementation status for wiki "'+templateID+'".'); } }); aa.sort(); gb.sort(); aagb.sort(); wikiset.sort(); /* output template */ _this._LogRaw('Done! I suggest the following code. If this looks fine, just replace the {{#switch}} statement in <a href="//meta.wikimedia.org/wiki/Template:Bot_policy" title="Template:Bot policy">the template text</a> with this one.'); _this._LogRaw( $(document.createElement('pre')) .css({'height':'20em','overflow':'auto'}) .text( '{{#switch:{{{1}}}\n' +'<!-- automatic-approval *and* global bot wikis -->\n' +' |'+aagb.join('\n |')+' = aa,gb\n\n' +'<!-- automatic-approval only wikis -->\n' +' |'+aa.join('\n |')+' = aaa\n\n' +'<!-- global bot only wikis -->\n' +' |'+gb.join('\n |')+' = gb\n' +'}}' ) ); /* output wikiset */ _this._LogRaw('<div>I suggest these wikis for the wikiset. If this look fine, just replace the list on <a href="//meta.wikimedia.org/wiki/Special:Wikisets/2" title="Edit global bot list">Special:EditWikiset/2</a>. (You might also want to <a href="https://quickdiff.net/" title="Quick Diff Online Tool">compare the differences</a> in case a wiki wasn\'t added to the table.)</div>'); _this._LogRaw( $(document.createElement('pre')) .css({'height':'20em','overflow':'auto'}) .text(wikiset.join('\n')) ); } }); } }; pathoschild.UpdateBotPolicyTemplate.Execute(jQuery);
The above documentation is transcluded from Template:Bot policy/doc. (edit | history)
Editors can experiment in this template’s sandbox (create | mirror) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this template.
Editors can experiment in this template’s sandbox (create | mirror) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this template.