MediaWiki:Gadget-PurgeTab.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Add a tab to purge the page cache (with extended skin support) */
$(function() {
if ($('#ca-purge').length || !mw.config.get('wgIsArticle')) return;
var purgeTip = 'Purge the server cache of this page';
var purgeUrl = mw.config.get('wgArticlePath').replace('$1', encodeURIComponent(mw.config.get('wgPageName')) + '?action=purge');
mw.util.addPortletLink('p-cactions', purgeUrl, 'Purge', 'ca-purge', purgeTip, '*');
if (mw.config.get('skin') === 'nimbus')
$('#more-tab').after('<a id="ca-purge" class="mw-skin-nimbus-actiontab tab-off" href="' + purgeUrl + '" rel="nofollow"><span>Purge</span></a>');
else if (mw.config.get('skin') === 'onyx')
$('#onyx-actionsList-list').append('<li id="ca-purge" class="mw-purgelink mw-list-item"><a href="' + purgeUrl + '" data-mw="interface" title="' + purgeTip + ' [Alt+Shift+*]" accesskey="*">Purge</a></li>');
$('#ca-purge').on('click', function(e) {
new mw.Api().post({ action: 'purge', titles: mw.config.get('wgPageName') }).then(function() {
location.reload();
}, function() {
location = purgeUrl;
});
e.preventDefault();
});
});