User:Sky2042/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.
// <pre>
// only show [[special:search]]
addOnloadHook(function() {
var 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";
}
});
// changes the personal links (at the top) to include direct links to
// the customized CSS and JS pages, shortens the other links
function changePersonal() {
var divs = document.getElementsByTagName('div');
document.getElementById('p-personal').innerHTML = "<h5>Personal tools</h5><div class='pBody'><ul><li id='pt-userpage'><a href='/User:Sky2042'>Sky2042</a></li><li id='pt-mytalk'><a href='/User_talk:Sky2042'>talk</a></li><li id='pt-mycss'><a href='/User:Sky2042/wowwiki.css'>css</a></li><li id='pt-myjs'><a href='/User:Sky2042/wowwiki.js'>js</a></li><li id='pt-xfd'><a href='/Category:Articles_for_speedy_deletion'>xfd</a></li><li id='pt-preferences'><a href='/Special:Preferences'>prefs</a></li><li id='pt-watchlist'><a href='/Special:Watchlist'>watch</a></li><li id='pt-contributions'><a href='/Special:Contributions/Sky2042'>con</a></li><li id='pt-logout'><a href='/Special:Userlogout'>log</a></li></ul></div>";
}
addOnloadHook(changePersonal);
document.write('<script src="http://www.wowhead.com/widgets/power.js"></scr' + 'ipt>');
// adds delete? links to category namespace
if(wgNamespaceNumber == 14) addOnloadHook(categoryEditLinks)
function categoryEditLinks() {
var pagediv = document.getElementById('mw-pages');
if(!pagediv) return
var pages = pagediv.getElementsByTagName('a');
if(pages.length == 0) return
for(var i=pages.length-1;i>0;i--) {
if(!pages[i].href) continue;
var li = pages[i].parentNode;
li.appendChild(document.createTextNode(' ['));
var ea = document.createElement('a');
ea.appendChild(document.createTextNode('del'));
var url = (pages[i].href.indexOf('?') != -1) ? '&' : '?'
url = pages[i].href + url + 'action=delete';
ea.setAttribute('href',url);
li.appendChild(ea);
li.appendChild(document.createTextNode(']'));
}
}
// </pre>[[Category:User JS|Sky2042]]
