Wikipedia:WikiProject User scripts/Scripts/Get Page Name: Difference between revisions

Content deleted Content added
m normalize nowiki comment
Lupin (talk | contribs)
this script is now obselete; one-line version for transitional purposes
Line 3:
// <pre><nowiki>
function getPname() {
return textwgTitle;
z=document.getElementById("content").childNodes;
for (var n=0;n<z.length;n++) {
if (z[n].className=="firstHeading") {
var text = z[n].textContent ? z[n].textContent : z[n].innerText;
return text;
}
}
}
 
/* 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'));
*/
// </nowiki></pre>
 
/*
This code was taken from the [[Wikipedia:WikiProject User scripts/Scripts/Show last diff|Show last diff]] code.
*/
 
[[Category:Wikipedia tools]]