// [[:w:en:User:Lupin/popups.js]]
document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
function debugging_change_displaytitle()
{
alert("aok");
var dstitle = document.getElementById("displaytitle");
alert(dstitle);
var ntab = document.getElementById("p-cactions");
alert(ntab);
var text, title, titlename;
if (dstitle && ntab) {
alert("dstitle && ntab");
ntab = ntab.getElementsByTagName("a");
alert(ntab);
if (ntab) ntab = ntab[0].firstChild;
alert(ntab);
if (!ntab) return;
alert("not null");
if (dstitle.hasAttribute("title")) {
alert("hasAttribute(title)");
text = dstitle.getAttribute("title");
alert(text);
} else {
alert("!!!hasAttribute(title)");
text = dstitle.firstChild;
alert(text);
while (text != null) {
if (text.nodeType == Node.TEXT_NODE) {
text = text.nodeValue;
alert(text);
break;
}
text = text.firstChild || text.nextSibling || (text.parentNode != dstitle ? text.parentNode.nextSilbing : null);
alert(text);
}
if (typeof text != "string")
return;
alert("text is string...");
}
text = text.match("(?:tab:\\s*([^|]+)\\|?)?\\s*(?:title:\\s*(.+))?");
if (text && text[1]) {
alert("multipart");
if (ntab.nodeValue)
ntab.nodeValue = text[1];
else if (ntab.innerText)
ntab.innerText = text[1];
else if (ntab.innerHTML)
ntab.innerHTML = text[1];
}
if (!text || !text[2])
return;
title = document.getElementsByTagName("h1");
alert(title);
for (var i = 0; i < title.length; i++) {
if (hasClass(title[i], "firstHeading") || hasClass(title[i], "pagetitle")) {
alert("found heading");
titlename = title[i].firstChild;
alert(titlename);
while (titlename != null) {
if (titlename.nodeType == Node.TEXT_NODE) {
alert("TEXT_NODE");
if (titlename.nodeValue)
titlename.nodeValue = text[2];
else if (titlename.innerText)
titlename.innerText = text[2];
else if (titlename.innerHTML)
titlename.innerHTML = text[2];
return;
}
titlename = titlename.firstChild || titlename.nextSibling || (titlename.parentNode != title[i] ? titlename.parentNode.nextSilbing : null);
}
break;
}
}
}
}