Jump to content

User:Wayward/Sandbox

From Wikipedia, the free encyclopedia

/*

 */

/**** Initialize on window load ****/

if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
    window.previousLoadFunction = window.onload;
    window.onload = function()
    {
        window.previousLoadFunction();
        myLoadFuncs();
    }
}

/**** Load custom functions ****/

function myLoadFuncs()
{   
    // cause the personal menu looks bad
    changeLinks();

}

/**** Add generic tab ****/

function addlilink(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

/**** Make the top links look better ****/

function changeLinks()
{
    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 a clock
    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
    addlilink(toplinks, '#', '', 'utcdate');
    showtime();
}

/**** Get a clock that autoupdates! ****/

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);
}

/* 

*/