User:Quarl/addlilink.js

// THIS SCRIPT HAS BEEN MOVED TO User:Quarl/wikitabs.js

// User:Quarl/addlilink.js

// based on http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Add_LI_link

//

function getTabActions() {

return document.getElementById('p-cactions').getElementsByTagName('ul')[0];

}

function getToolbox() {

return document.getElementById('p-tb').getElementsByTagName('ul')[0];

}

function getNavigationBox() {

return document.getElementById('p-navigation').getElementsByTagName('ul')[0];

}

function addTab(url, name, id, title, key) {

addlilink(getTabActions(), url, name, id, title, key);

}

function addToolboxLink(url, name, id, title, key) {

addlilink(getToolbox(), url, name, id, title, key);

}

function addNavigationLink(url, name, id, title, key) {

addlilink(getNavigationBox(), url, name, id, title, key);

}

function addlilinkX(tabs, entry, id, title, key){

var li = document.createElement('li');

if(id) li.id = id;

if (typeof(entry) == 'string') {

li.innerHTML = entry;

} else {

li.appendChild(entry);

}

tabs.appendChild(li);

if(id && (key || title) && window.ta) {

ta[id] = [(key||), (title||)];

}

// re-render the title and accesskeys from existing code in wikibits.js

akeytt();

return li;

}

function addlilink(tabs, url, name, id, title, key){

var na = document.createElement('a');

na.href = url;

na.appendChild(document.createTextNode(name));

return addlilinkX(tabs, na, id, title, key);

}

//