MediaWiki:Gadget-PurgeTab.js: Difference between revisions
From Halopedia, the Halo wiki
(Created page with "→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') $('#mor...") |
(No difference)
|
Latest revision as of 18:18, April 3, 2024
/* 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();
});
});