MediaWiki:AutoPurge/code.js

/** * AutoPurge * @file Automatically purges pages in window.autoPurgePages array * @author Count of Howard  * @license Apache-2.0 * @external "jQuery" * @external "mediawiki.api" */

/*jslint browser */ /*global mw, jQuery, window */

mw.loader.using("mediawiki.api", function {    "use strict";

var $pageName = mw.config.get("wgPageName"); var $api = new mw.Api;

if (       window.autoPurgePages === undefined ||        jQuery.inArray($pageName, window.autoPurgePages) === -1    ) { return; }

$api.get({       action: "purge",        titles: $pageName    }).done(function ($data) {        if (!$data.error) {            window.location.reload(true);        }    });

});