// [[User:Quarl/nav_custom.js]] - customizations for navigation box
// requires: wikipage.js, wikitabs.js
// - adds links:
// [[User:Quarl/todo]]
// [[User:Quarl/sandbox]]
// [[User:Quarl/monobook]]
// - removes links:
// [[Help:Contents]]
// [[Wikipedia:Contact us]]
// [http://wikimediafoundation.org/wiki/Fundraising#Donation_methods]
// <pre><nowiki>
navcustom = new Object();
navcustom.addNavLink = function(pagename, editpagename, descr, id, key) {
var wp = WikiPage(null, pagename);
var wpe = editpagename ? WikiPage(null, editpagename) : wp;
var urlN = wp.url, urlE = wpe.qurl+'&action=edit';
descr = descr || wp.article;
var e = "<a style='display:inline' href='" + urlN + "'>" + descr + "</a> (<a style='display:inline' href='"+urlE+"'>edit</a>)";
return wikitabs.addLiLinkX(getNavigationBox(), e, id, null, key);
}
navcustom.delNavLink = function(id) {
var node = document.getElementById(id);
//node.style.display = 'none';
node.className += ' hiddenStructure';
}
navcustom.alterLinkText = function(id, newText) {
var node = document.getElementById(id);
if (!node) return;
node.firstChild.innerHTML = newText;
}
navcustom.customizeNavBox = function() {
navcustom.addNavLink("User talk:"+wikiDoc.username+"/todo");
navcustom.addNavLink("User:"+wikiDoc.username+"/sandbox");
navcustom.addNavLink("User:"+wikiDoc.username+"/monobook", "User:"+wikiDoc.username+"/monobook.js");
navcustom.delNavLink('n-help');
navcustom.delNavLink('n-contact');
navcustom.delNavLink('n-sitesupport');
}
navcustom.customizePersonal = function() {
navcustom.alterLinkText('pt-mytalk', 'Talk');
navcustom.alterLinkText('pt-preferences', 'Prefs');
navcustom.alterLinkText('pt-watchlist', 'Watchlist');
navcustom.alterLinkText('pt-mycontris', 'Contribs');
var homeUrl = WikiPage(null,'User:'+wikiDoc.username+'/home').url;
wikitabs.addLiLink({after: document.getElementById('pt-userpage')}, homeUrl, 'Home', 'pt-userhome', null);
}
navcustom.customizeTabActions = function() {
navcustom.alterLinkText('ca-edit', 'Edit');
}
navcustom._load = function() {
navcustom.customizePersonal();
navcustom.customizeTabActions();
navcustom.customizeNavBox();
}
$(navcustom._load);
// </nowiki></pre>