User:Petietpj/monobook.js

/* Any JavaScript here will be loaded for all users on every page load.*/

function bottomPers { // Duplicate the top "personal toolbox" at the end of the content area. var pers = document.getElementById('p-personal');//.cloneNode(true); //var one = document.getElementById('column-one'); // Give all the named items new ids to avoid id clashes with the existing top "tabs". pers.id = 'mypers'; pers.style.width = '100%'; // remove the top "personal toolbox" pers.parentNode.removeChild (pers); var listitems = pers.getElementsByTagName('LI'); for (i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mypers-' + listitems[i].id; } //one.insertbefore(pers,one.firstChild); document.getElementById('column-content').appendChild(pers); }

function topTabsToRightPlace { // Remove the top "tabs" from the .portlet side column (why were they ever put there?) // and put them at the top of the content area, // where they belong! (This allows me to use simple relative positioning to get a proper layout. I don't have to mess around with  // absolute positioning. This is necessary for my language links at the top to work properly, but it is cleaner anyway.   var contents  = document.getElementById('column-content');   var tabs      = document.getElementById('p-cactions');

if (tabs != null) { tabs.parentNode.removeChild (tabs); contents.insertBefore(tabs, contents.firstChild); } }

function ModifySidebar(action, section, name, link) { try { 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; }       if (action == "add") { 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); }       if (action == "remove") { var list = document.getElementById(target) .getElementsByTagName('div')[0] .getElementsByTagName('ul')[0]; var listelements = list.getElementsByTagName('li'); for (var i = 0; i < listelements.length; i++) { if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||                   listelements[i].getElementsByTagName('a')[0].href == link) { list.removeChild(listelements[i]); }           }        }    } catch(e) { // lets just ignore what's happened return; } } function CustomizeModificationsOfSidebar { //removes "Related changes" from toolbox ModifySidebar("remove", "toolbox", "Related changes", "http://en.wikipedia.org/wiki/Special:Upload"); //removes "Permanent link" from toolbox ModifySidebar("remove", "toolbox", "Permanent link", "http://en.wikipedia.org/wiki/Special:Permanent_link");

//removes "Browse properties" from toolbox ModifySidebar("remove", "toolbox", "Browse properties", "http://en.wikipedia.org/wiki/Special:Browse_properties");

//removes "Browse properties" from toolbox ModifySidebar("remove", "toolbox", "Printable version", "http://en.wikipedia.org/wiki/Special:Printable_version"); } addOnloadHook(function {  bottomPers;  topTabsToRightPlace;    CustomizeModificationsOfSidebar; });