MediaWiki:Gadget-Purge.js: Difference between revisions

From Zelda Dungeon Wiki
Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
mNo edit summary
Line 3: Line 3:
// adds a "purge" tab (after "watch")
// adds a "purge" tab (after "watch")
// --------------------------------------------------------
// --------------------------------------------------------
addOnloadHook(function () {
$( function() {
     if (wgAction != 'edit' && wgCanonicalNamespace != 'Special' && wgAction != 'history' && wgAction != 'delete' && wgAction != 'watch' && wgAction
     if ( !$( '#ca-purge' ).length && mw.config.get( 'wgIsArticle' ) ) {
    != 'unwatch' && wgAction != 'protect' && wgAction != 'markpatrolled' && wgAction != 'rollback' && document.URL.indexOf('diff=') <= 0
        mw.util.addPortletLink(
    && document.URL.indexOf('oldid=') <=0)
            'p-cactions',
    { var hist; var url;
            mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) + '?action=purge',
    if (!(hist = document.getElementById('ca-history') )) return;
            mw.config.get( 'skin' ) == 'vector' ? 'Purge' : '*',
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
            'ca-purge',
    if (!(url = url.href )) return;
            'Purge the server cache of this page',
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
            '*'
                  'Purge', 'ca-purge', 'Purge server cache for this page', '0');
        );
}
    }
});
});
//
//

Revision as of 01:28, October 24, 2011

// --------------------------------------------------------
// addPurge
// adds a "purge" tab (after "watch")
// --------------------------------------------------------
$( function() {
    if ( !$( '#ca-purge' ).length && mw.config.get( 'wgIsArticle' ) ) {
        mw.util.addPortletLink(
            'p-cactions',
            mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ) + '?action=purge',
            mw.config.get( 'skin' ) == 'vector' ? 'Purge' : '*',
            'ca-purge',
            'Purge the server cache of this page',
            '*'
        );
    }
});
//