User:Vildricianus/navbox.js

//

// NAVBOX EXPANSION - from Connel // oldest part of code // add "favourites" to navigation box function addToNav { var pagetitle = document.getElementById('p-cactions').getElementsByTagName('ul').item(0).getElementsByTagName('li').item(0).firstChild.href;

var lastnav = document.getElementById('n-sitesupport'); var newnav; var newa; var tidyname = document.getElementById('ca-history').getElementsByTagName('a')[0].href; tidyname = tidyname.substring(tidyname.indexOf('title=') + 6, tidyname.lastIndexOf('&action=history')); tidyname = tidyname.substring(tidyname.indexOf(':') + 1); var slloc = tidyname.indexOf('/'); if(slloc > 0) tidyname = tidyname.substring(0, slloc);

// get page title var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; if (pagetitle.search(/Search/) != -1) { pagetitle = document.getElementById('contentSub').firstChild.nodeValue; pagetitle = pagetitle.replace(/For query /g, ""); pagetitle = pagetitle.replace(/\"/g, ""); }  pagetitle = pagetitle.replace(/Editing /g, "");  var pageexternal = pagetitle.replace(/\ /g, "_");  var pageext =      pagetitle.replace(/\ /g, "+");

// Interiot's What links here? newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='http://tools.wikimedia.de/~interiot/cgi-bin/queries/whatlinkshere?article=' + pagetitle + '&dbname=enwiktionary';

newa.appendChild(document.createTextNode('What links here?')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// w: newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/w:Special:Search/' + pagetitle; newa.appendChild(document.createTextNode('Wikipedia')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// wz: newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='http://www.wiktionaryz.org/WiktionaryZ:' + pagetitle; newa.appendChild(document.createTextNode('WiktionaryZ')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

}

function reformatMyPage { addToNav; }

window.myAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); }

myAddOnload(reformatMyPage);