User:MC10/Purge.js

From Wikipedia, the free encyclopedia
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.
// Add a "purge" tab to pages
// [[User:MC10/Purge.js]]

(function ($, undefined) { // Wrap with jQuery
    // Purge
    $(function () {
        if (mw.config.get("wgCanonicalNamespace") === "Special") // No special pages
            return;

        var url = mw.config.get("wgServer") + mw.config.get("wgScript") + "?title=" + mw.config.get("wgPageName") + "&action=purge";
        mw.util.addPortletLink('p-cactions', url, 'Purge', 'ca-purge', 'Purge server cache for this page', '0');
    });
}(jQuery)) // End wrap with jQuery

// [[Category:Wikipedia scripts]]