MediaWiki:Gadget-CargoSidebar.js

/* addToSidebar code based on code from https://www.mediawiki.org/wiki/Manual:Interface/Sidebar#Add_or_remove_toolbox_sections_(JavaScript)

function addToSidebar(action, section, name, link) { switch (section) { case 'languages': var target = 'p-lang'; break; case 'toolbox': var target = 'p-tb'; break; case 'navigation': var target = 'p-navigation'; break; default: var target = 'p-' + section; break; }   var node = document.getElementById(target) .getElementsByTagName('div')[0] .getElementsByTagName('ul')[0];

var aNode = document.createElement('a'); var liNode = document.createElement('li');

aNode.appendChild(document.createTextNode(name)); aNode.setAttribute('href', link); liNode.appendChild(aNode); liNode.className = 'plainlinks'; node.appendChild(liNode); }

addToSidebar('add', 'toolbox', 'Cargo tables', 'https://en.wikipedia.org/wiki/Special:CargoTables'); addToSidebar('add', 'toolbox', 'Cargo query', 'https://en.wikipedia.org/wiki/Special:CargoQuery'); addToSidebar('add', 'toolbox', 'Cargo drilldown', 'https://en.wikipedia.org/wiki/Special:Drilldown');