User:Extremecircuitz/toolbarTweaks.js
Appearance
From Wikipedia, the free encyclopedia
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
This code will be executed when previewing this page.
Documentation for this user script can be added at User:Extremecircuitz/toolbarTweaks.
// function to get toolbar by id for variables functiontoolbar(toolbarId,isSearchbox){ if(isSearchBox=='true'){ document.getElementById(toolbarId); }else{ document.getElementById(toolbarId).getElementsByTagName('ul')[0]; } } // Toolbar variables userLinks=toolbar('p-personal','false');// The links at the top right side of the page userLinks.userpage=userLinks.getElementById('pt-userpage'); userLinks.talk=userLinks.getElementById('pt-mytalk'); userLinks.prefs=userLinks.getElementById('pt-preferences'); userLinks.watch=userLinks.getElementById('pt-watchlist'); userLinks.contribs=userLinks.getElementById('pt-mycontris'); userLinks.logout=userLinks.getElementById('pt-logout'); nav=toolbar('p-navigation','false');// The navigation box nav.randLink=nav.getElementById('n-randompage'); int=toolbar('p-interaction','false');// The interaction box int.recent=int.getElementById('n-recentchanges'); int.help=int.getElementById('n-help'); int.donate=int.getElementById('n-support'); search=toolbar('p-search','true');// Search box toolbox=toolbar('p-tb','false');// toolbox sidebar=nav+int+search+toolbox;// the entire sidebar minus the language box tabs=toolbar('p-cactions','false');// the tabs // The page tab's id depends on the page's namespace, so it will not be added here until later tabs.talk=tabs.getElementById('ca-talk'); tabs.edit=tabs.getElementById('ca-edit'); tabs.hist=tabs.getElementById('ca-history'); tabs.move=tabs.getElementById('ca-move'); tabs.watch=tabs.getElementById('ca-watch'); // Functions to add tabs to top and add links functionaddTab(name,title,url,accessKey,id){ vartabLink=document.createNode('a'); tabLink.setAttribute('href',url); tabLink.setAttribute('title',title); if(accessKey!=null)tabLink.setAttribute('accesskey',accessKey); tabName=document.createTextNode(name); tabLink.childNode(tabName); varnewTab=document.createNode('li'); if(id!=null)newTab.setAttribute('id',id); newTab.childNode(tabLink); tabs.appendChild(newTab); } functionaddNavLink(name,url,accessKey,id){ varnavLink=document.createNode('a'); navLink.setAttribute('href',url); if(accessKey!=null)navLink.setAttribute('accesskey',accessKey); varnavLinkText=document.createTextNode(name); navLink.childNode(navLinkText); varn=document.createNode('li'); if(id!=null)n.setAttribute('id',id); n.childNode(navLink); nav.appendChild(n); } functionaddIntLink(name,url,accessKey,id){ varintLink=document.createNode('a'); intLink.setAttribute('href',url); if(accessKey!=null)intLink.setAttribute('accesskey',accessKey); varintLinkText=document.createTextNode(name); intLink.childNode(intLinkText); vari=document.createNode('li'); if(id!=null)i.setAttribute('id',id); i.childNode(intLink); int.appendChild(i); } functionaddUserLink(name,url,accessKey,id,isUBXLink){ varuserLink=document.createNode('a'); userLink.setAttribute('href',url); if(accessKey!=null)userLink.setAttribute('accesskey',accessKey); varuserLinkText=document.createTextNode(name); userLink.childNode(userLinkText); varu=document.createNode('li'); if(id!=null)u.setAttribute('id',id); u.childNode(userLink); if(isUBXLink=='true'){ userLinks.talk.appendNode(n); }else{ userLinks.appendChild(n); } } // Some rearrangment to a couple of the links in sidebar, as well as some added links nav.randLink.appendNode(int.recent).appendNode(int.help); addIntLink('Department of Fun','/wiki/WP:FUN'); addIntLink('The MS-DOS Game','/wiki/WP:MSDOS'); addIntLink('Wikiholic Test','/wiki/WP:HOLIC'); addUserLink('My Userboxes','/wiki/User:Extremecircuitz/more_userboxes',,,'true');