Difference between revisions of "User:Nx/monobook.js"
< User:Nx
Jump to navigation
Jump to search
(trying out Pi's sigchanger) |
(fix) |
||
Line 15: | Line 15: | ||
bads[i].innerHTML = "<sup>talk</sup>"; | bads[i].innerHTML = "<sup>talk</sup>"; | ||
} | } | ||
− | if (bads[i].getAttribute("title")=="User talk:Π" && bads[i].childNodes.length > 0 && bads[i].childNodes[0].nodeName == "IMG") { | + | if (bads[i].getAttribute("title")=="User talk:Π" && bads[i].childNodes.length > 0 && (bads[i].childNodes[0].nodeName == "IMG" || bads[i].childNodes[0].nodeName == "SPAN")) { |
bads[i].innerHTML = "п"; | bads[i].innerHTML = "п"; | ||
} | } |
Revision as of 11:16, 25 January 2009
/*
CUR Signature Exchanger
*/
function curse() {
var bads = document.getElementsByTagName("a");
var i;
for (i=0;i<bads.length;++i)
{
if (bads[i].getAttribute("title")=="User:ConservapediaUndergroundResistor" && bads[i].childNodes.length > 0 && bads[i].childNodes[0].nodeName == "FONT") {
bads[i].innerHTML = "CUR";
}
if (bads[i].getAttribute("title")=="User talk:ConservapediaUndergroundResistor" && bads[i].childNodes.length > 0
&& bads[i].childNodes[0].childNodes.length > 0 && bads[i].childNodes[0].childNodes[0].nodeName == "FONT") {
bads[i].innerHTML = "<sup>talk</sup>";
}
if (bads[i].getAttribute("title")=="User talk:Π" && bads[i].childNodes.length > 0 && (bads[i].childNodes[0].nodeName == "IMG" || bads[i].childNodes[0].nodeName == "SPAN")) {
bads[i].innerHTML = "п";
}
}
}
addOnloadHook(curse);
/*
getElementsByClass
needed by bottomedit
*/
function getElementsByClass(classname,node)
{
function _recGet(out, element, cname)
{
while(element)
{
if (element.nodeType == 1)
{
if (element.className)
{
if (element.className == cname)
{
out.push(element);
}
}
_recGet(out,element.firstChild,cname)
}
element = element.nextSibling;
}
}
if (!node) node = document.documentElement;
var res = new Array();
_recGet(res,node,classname);
return res;
}
/*
bottomedit
Add an edit section link to the bottom of a section
*/
function bottomedit() {
if (!(document.getElementById("ca-addsection"))) return;
var bodyContent = document.getElementById("bodyContent");
var headings = getElementsByClass("mw-headline",bodyContent);
var i;
var editsection2;
var editsection;
for (i=1;i<headings.length;++i)
{
editsection2 = document.createElement("span");
editsection = headings[i-1].parentNode.firstChild.firstChild.nextSibling;
editsection2.innerHTML = "<a " + "href=\"" + editsection.getAttribute("href") +
"\" title=\"" + editsection.getAttribute("title") + "\" >Add comment</a>"
bodyContent.insertBefore(editsection2,headings[i].parentNode);
}
if (headings.length > 0)
{
editsection2 = document.createElement("span");
editsection = headings[headings.length-1].parentNode.firstChild.firstChild.nextSibling;
editsection2.innerHTML = "<a " + "href=\"" + editsection.getAttribute("href") +
"\" title=\"" + editsection.getAttribute("title") + "\" >Add comment</a>"
bodyContent.appendChild(editsection2);
}
}
addOnloadHook(bottomedit);