Jump to content

MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 34: Line 34:
     document.getElementById("p-cactions").getElementsByTagName("ul")[0].appendChild(node);
     document.getElementById("p-cactions").getElementsByTagName("ul")[0].appendChild(node);
}
}
var mainListFirstElement = document.getElementById("p-namespaces").getElementsByTagName("a")[0];
var myString = mainListFirstElement.innerText;
myString = myString.substring(0, myString.lastIndexOf(" "));
var span = document.getElementById("p-namespaces").getElementsByTagName("span")[0];
console.log(span);
var textnodeHref = document.createElement("a");
if (myString.length > 0) {
    textnodeHref.innerText = myString;
} else {
    textnodeHref.innerText = mainListFirstElement.innerText;
}
textnodeHref.href = mainListFirstElement.href;
textnodeHref.title = mainListFirstElement.title;
span.appendChild(textnodeHref);