User:Nmajdan/personallinks.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//////////////////////////////////////////
//
// Modify personal links, add clock
//
//////////////////////////////////////////
 
 
function showTime()
{
    var timerID;
    var now = new Date();
    var timeValue = now.toUTCString().replace(/GMT/, "UTC");
    document.getElementById('utcdate').firstChild.innerHTML = timeValue;
    timerID = setTimeout('showTime()', 100);
}
 
function addClock()
{
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(toplinks, '#', '', 'utcdate');
    showTime();
}
 
function changePersonalLinks()
{
    if(!document.getElementById) return;
 
    // remove the "my" bits
    document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
    document.getElementById('pt-preferences').firstChild.innerHTML = 'preferences';
    document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
    document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
 
    // add links to navigation box
    document.getElementById('n-sitesupport').parentNode.innerHTML += 
      "<li id='Portal:CFB'<a href='/wiki/Portal:College football'>Portal:CFB</a></li>" +
      "<li id='Portal:Oklahoma'><a href='/wiki/Portal:Oklahoma'>Portal:OK</a></li>" + 
      "<li id='University of Oklahoma'><a href='/wiki/University of Oklahoma'>OU</a></li>" +
      "<li id='Oklahoma Sooners football'><a href='/wiki/Oklahoma Sooners football'>OU Football</a></li>" +
      "<li id='WP:CFB'<a href='/wiki/WP:CFB'>WP:CFB</a></li>" +
      "<li id='WP:CFB RC'<a href='/wiki/Special:Recentchangeslinked/Category:College_football'>WP:CFB RC</a></li>" +
      "<li id='2006 Sooners'<a href='/wiki/2006_Oklahoma_Sooners_football_team'>2006 OU Sooners</a></li>" +
      "<li id='2007 Sooners'<a href='/wiki/2007_Oklahoma_Sooners_football_team'>2007 OU Sooners</a></li>" +
      "<li id='WP:OU'<a href='/wiki/WP:OU'>WP:OU</a></li>" +
      "<li id='editcount'><a href='http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate'>Edit Count</a></li>";
 
    // add clock to top right hand corner
    //addClock();
}
 
addOnloadHook(changePersonalLinks);