Jump to content

User:Ashlux/personallinks.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//////////////////////////////////////////
//
// 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='WP:OK RC TALK'><a href='http://en.wikipedia.org/w/index.php?title=Special:Recentchangeslinked&target=Category%3AWikiProject_Oklahoma'>WP:WPOK RC TALK</a></li>" + 
      "<li id='WP:OK RC'<a href='/wiki/Special:Recentchangeslinked/Wikipedia:WikiProject_Oklahoma/Oklahoma_recent_changes'>WP:WPOK RC</a></li>" +
      "<li id='Portal:Oklahoma'><a href='/wiki/Portal:Oklahoma'>Portal:OK</a></li>" + 
      "<li id='Wikinews Portal:Oklahoma'><a href='http://www.wikinews.org/wiki/Portal:Oklahoma'>Portal:OK NEWS</a></li>" + 
      "<li id='editcount'><a href='/wiki/User:Interiot/Tool2/code.js'>Edit Count</a></li>";

    // add clock to top right hand corner
    addClock();
}

addOnloadHook(changePersonalLinks);