User:DarkRyder/wowwiki.js
From WoWWiki
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac)
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5
- Konqueror: simply click the Reload button, or press F5
- Opera users may need to completely clear the cache in Tools→Preferences.
/*
<nowiki> */
function includeJS(article) {
document.write('<script type="text/javascript" src="/index.php?title=' + article + '&action=raw&ctype=text/javascript&dontcountme=s"></scr'+'ipt>');
}
includeJS('User:Pcj/talent.js');
addOnloadHook(function() {
var getTitle = /title=([^&]+)&/;
var elm = document.getElementById("ca-history");
if (elm) for (var i in elm.childNodes) {
if (elm.childNodes[i].href) {
var title = getTitle.exec(elm.childNodes[i].href);
if (title) title = title[1];
}
}
if (title) {
var before = document.getElementById("ca-talk").nextSibling;
var slash = title.lastIndexOf("/");
if (title.substring(0,5) == "User:" || title.substring(0, 10) == "User_talk:") {
if (slash == -1) elm = addPortletLink("p-cactions", "/Special:Contributions/" + title.substring(title.indexOf(":") + 1), "contribs", "ca-contribs", null, null, before);
else elm = addPortletLink("p-cactions", "/Special:Contributions/" + title.substring(title.indexOf(":") + 1, title.indexOf("/")), "contribs", "ca-contribs", null, null, before);
if (elm) elm.parentNode.insertBefore(document.createTextNode("\n"), elm);
}
if (slash != -1) {
elm = addPortletLink("p-cactions", "/" + title.substring(0, slash), "\u25B2", "ca-parent", null, null, before);
if (elm) elm.parentNode.insertBefore(document.createTextNode("\n"), elm);
}
elm = addPortletLink("p-cactions", "/Special:Prefixindex/" + title + "/", "\u25BC", "ca-sub", null, null, before);
if (elm) elm.parentNode.insertBefore(document.createTextNode("\n"), elm); // Stupid freaky whitespace-addled formatting...
before.previousSibling.style.marginRight = "1.6em";
elm = addPortletLink("p-cactions", "/index.php?title=" + title + "&diff=cur&oldid=prev", "Last", "ca-last", null, null, document.getElementById("ca-history").nextSibling);
if (elm) elm.parentNode.insertBefore(document.createTextNode("\n"), elm);
}
elm = document.getElementById("ca-edit");
if (elm) elm.innerHTML = elm.innerHTML.replace(" this page", "");
elm = document.getElementById("pt-mycontris");
if (elm) elm.innerHTML = elm.innerHTML.replace("contributions", "contribs");
elm = addPortletLink("p-personal", "/index.php?title=User:DarkRyder/wowwiki.css&action=edit", "My CSS", "pt-css", null, null, document.getElementById("pt-watchlist"));
if (elm) addPortletLink("p-personal", "/index.php?title=User:DarkRyder/wowwiki.js&action=edit", "My JS", "pt-js", null, null, elm);
elm = document.getElementById("p-personal");
if (elm) {
elm.innerHTML = elm.innerHTML.replace(/My\b/g, "");
elm = elm.appendChild(document.createElement("div"));
elm.className = "pBody";
elm = elm.appendChild(document.createElement("ul"));
// pt-userpage
elm = elm.appendChild(document.createElement("li"));
elm.id = "pt2-userpage";
elm.appendChild(document.createElement("a"));
elm.firstChild.href = "/User:ArmoryProfileBot";
elm.firstChild.appendChild(document.createTextNode("ArmoryProfileBot"));
// pt-mytalk
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.appendChild(document.createElement("a"));
elm.firstChild.href = "/User talk:ArmoryProfileBot";
elm.firstChild.appendChild(document.createTextNode(" talk"));
// pt-preferences
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.className = "pt2-disabled";
elm.appendChild(document.createTextNode(" preferences"));
// pt-js
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.className = "pt2-disabled";
elm.appendChild(document.createTextNode(" js"));
// pt-css
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.className = "pt2-disabled";
elm.appendChild(document.createTextNode(" css"));
// pt-watchlist
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.className = "pt2-disabled";
elm.appendChild(document.createTextNode(" watchlist"));
// pt-mycontris (sic)
elm = elm.parentNode.appendChild(document.createElement("li"));
elm.appendChild(document.createElement("a"));
elm.firstChild.href = "/Special:Contributions/ArmoryProfileBot";
elm.firstChild.appendChild(document.createTextNode(" contribs"));
}
elm = document.getElementById("searchBody");
if (elm) {
while (elm.lastChild) elm.removeChild(elm.lastChild);
elm = elm.appendChild(document.createElement("form"));
elm.id = "searchform";
elm.action = "/Special:Search";
elm.method = "get";
for (var i = 0; i < 16; i++) {
elm = elm.appendChild(document.createElement("input"));
elm.type = "hidden";
elm.name = "ns" + i;
elm.value = 1;
elm = elm.parentNode;
}
elm = elm.appendChild(document.createElement("input"));
elm.id = "searchInput";
elm.accesskey = "f";
elm.name = "search";
elm.size = "25";
elm.style.width = "125px";
elm = elm.parentNode.appendChild(document.createElement("input"));
elm.id = "searchGoButton";
elm.type = "submit";
elm.className = "searchButton";
elm.name = "go";
elm.value = "Go";
elm = elm.parentNode.appendChild(document.createTextNode(" "));
elm = elm.parentNode.appendChild(document.createElement("input"));
elm.id = "mw-searchButton";
elm.type = "submit";
elm.className = "searchButton";
elm.name = "fulltext";
elm.value = "Search";
}
});
// </nowiki> [[Category:User JS|DarkRyder]]
