User:Lifebaka/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.
//This script adds a tab up at the top of every page to purge the server cache
//To use this script, just add "importScript('User:Lifebaka/purge.js');" to your monobook.js page
//The code is based very loosely off of [[Wikipedia:WikiProject User scripts/Scripts/CloseAFD.js]] written by [[User:Johnleemk]]

function add_purge_tab()
{
  // Only add for pages with the right string somewhere in the title
  if ((wgCanonicalNamespace != "Special") && (document.title.indexOf("Editing ") == -1))
    {
      var URL = 'http://en.wikipedia.org/w/index.php?title=' + wgCanonicalNamespace + ':' + wgTitle + '&action=purge'
      mw.util.addPortletLink('p-cactions', URL, "purge");
    }
}

addOnloadHook(add_purge_tab);