Template:Bot policy
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:
if (!window.pathoschild) { var pathoschild = {}; } /** * 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.1a */ pathoschild.UpdateBotPolicyTemplate = { /*######## ## Properties ########*/ /** * @field {string} The URL to the page containing the bot policy implementation details to extract. * @private */ _url: 'http://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 */ var log = $('#' + this._logID).first(); if (log.length) { return log.empty(); } /* create */ log = $(document.createElement('pre')) .attr('id', this._logID) .css({ 'font-size': '0.8em' }); $('#wpTextbox1, #bodyContent').first().before(log); return log; }, /** * 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._Log('Fetching details from ' + this._url + '...'); $.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 */ var aa = []; var gb = []; var aagb = []; var wikiset = []; data.find('.is-wiki-row').each(function (i, item) { item = $(item); var subdomain = item.find('.is-data-subdomain').first().text(); var domain = item.find('.is-data-domain').first().text(); var allowsApproval = item.hasClass('is-aa-1'); var allowsGlobal = item.hasClass('is-gb-1'); /* save the wikiset ID (eg, "enwiki") */ if (allowsGlobal) { var wikisetID = 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") */ var templateID = subdomain + '.' + domain; if (templateID == '.meta') { templateID = 'meta.wikimedia'; } if (allowsApproval && allowsGlobal) { aagb.push(templateID); } else if (allowsApproval) { aa.push(templateID); } else if (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._Log('The update script recommends the following updated details. If these look fine, simply replace the {{#switch}} statement in the template text 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>The update script recommends the following wikiset; if these look fine, simply replace the list on <a href="http://meta.wikimedia.org/wiki/Special:Wikisets/2" title="Edit global bot list">Special:EditWikiset/2</a>.</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) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |