Jump to content

User:Jerry/quicklinks.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
//Please leave this link: [[User:Jerry/quicklinks.js]]
//<pre><nowiki>

// Quicklinks
// To install this, you can copy it into your monobook.js or use a script-inclusion
// method (see WikiProject User Scripts). It produces hypertext anchor links at the
// top of pages to purge the current page's cahce, and to several category pages of
// particular use to administrators.  You can copy this script to your own userspace
// modify or remove the quicklinks if you don't like the ones I included.
// by User:Jerry

addOnloadHook(function () {
  // if this is preview page or generated page, stop
  if(
    document.getElementById("wikiPreview") ||
    document.getElementById("histlegend‎") ||
    document.getElementById("difference‎") ||
    document.getElementById("watchdetails") ||
    document.getElementById("ca-viewsource") ||
    window.location.href.indexOf("/wiki/Special:") != -1
  ) {
    if(window.location.href.indexOf("&action=edit&section=0") != -1) {
      document.getElementById("wpSummary").value = "/* Intro */ ";
    }
    return;
  };

  // get the page title
  var pageTitle = wgPageName;

  // create div and set innerHTML to link
  var divContainer2 = document.createElement("div");
  divContainer2.innerHTML = '<div>[<a href="/wiki/'+pageTitle+'?action=purge">purge cache</a>] [<a href="/wiki/Wikipedia:Usernames_for_administrator_attention?action=purge">WP:UAA</a>] [<a href="/wiki/Wikipedia:Requests for page protection?action=purge">WP:RFPP</a>] [<a href="/wiki/Wikipedia:Administrator_intervention_against_vandalism?action=purge">WP:AIV</a>] [<a href="/wiki/Category:Candidates_for_speedy_deletion?action=purge">WP:CSD</a>] [<a href="/wiki/Wikipedia:Stub types for deletion?action=purge">WP:SFD</a>] [<a href="/wiki/Wikipedia:Administrators%27_noticeboard?action=purge">WP:AN</a>] [<a href="/wiki/User:Jerry/Maint?action=purge">Maint</a>] [<a href="/wiki/Wikipedia:Articles_for_deletion/Old/Open_AfDs?action=purge">WP:AFDO</a>] [<a href="http://tools.wikimedia.de/~agony/orphantalk/index.php?l=en">OrGen</a>] [<a href="/wiki/Special:NewPages">New</a>] [<a href="/wiki/Wikipedia:WikiProject_Deletion_sorting/Schools?action=purge">School</a>]</div>';

  // insert divContainer2 into the DOM below the h1
  if(window.location.href.indexOf("&action=edit") == -1) {
    document.getElementById("content").insertBefore(divContainer2, document.getElementsByTagName("h1")[0]);

 }

});