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.
(load mediawiki.util)
 
(2 intermediate revisions by 2 users not shown)
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.loader.using(['mediawiki.util']).then(function() {
    && document.URL.indexOf('oldid=') <=0)
        mw.util.addPortletLink(
    { var hist; var url;
            'p-cactions',
    if (!(hist = document.getElementById('ca-history') )) return;
            mw.util.getUrl( mw.config.get( 'wgPageName' ) ) + '?action=purge',
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
            mw.config.get( 'skin' ) == 'vector' ? 'Purge' : '*',
    if (!(url = url.href )) return;
            'ca-purge',
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
            'Purge the server cache of this page',
                  'Purge', 'ca-purge', 'Purge server cache for this page', '0');
            '*'
}
        );
      });
    }
});
});
//
//

Latest revision as of 19:20, June 20, 2020

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