Jump to content

User:Quarl/wikipage.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Quarl (talk | contribs) at 00:18, 4 January 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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.
// from http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Get_Page_Name

// <pre>

function getPname() {
  z=document.getElementById("content").childNodes;
  for (var n=0;n<z.length;n++) { 
    if (z[n].className=="firstHeading") return z[n].textContent;
  };
}

/* This code may be problematic when it comes to titles with ampersands, etc, which are stored as ''& amp ;'' in HTML (without the spaces).
  A solution that solves this is the following:
    return document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
*/

//</pre>