Jump to content

MediaWiki:Gadget-purgetab.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Krinkle (talk | contribs) at 19:10, 16 February 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * Action link: Purge
 *
 * @source: http://www.mediawiki.org/wiki/Snippets/Purge_action
 * @rev: 2
 */
if ( $( '#ca-purge' ).size() ) {
        $( '#ca-purge' ).remove();
}
if ( mw.config.get('wgCanonicalNamespace') != 'Special' && mw.config.get('wgArticleId') > 0 ) {
        var target = mw.config.get('skin') == 'vector' ? 'p-views' : 'p-cactions';
        mw.util.addPortletLink( target, mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode( mw.config.get('wgPageName') ) + '&action=purge',
                'Purge', 'ca-purge', 'Purge the server cache of this page', null,
                $( '#ca-watch' ).length > 0 ? $( '#ca-watch' )[0] : $( '#ca-unwatch' )[0] );

        $( '#ca-purge' ).addClass( 'collapsible' );
}
if ( mw.config.get('wgAction') == 'purge' ) {
        $( '#ca-purge' ).addClass( 'selected' );
}