User:X-Spider2/monobook.js

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
Line 18: Line 18:
   var time = new Date();
   var time = new Date();
   var hours = time.getUTCHours();
   var hours = time.getUTCHours();
-
   if (hours < 00) { hours = "0" + hours; }
+
   if (hours < 00) { hours = "10" + hours; }
   var minutes = time.getUTCMinutes();
   var minutes = time.getUTCMinutes();
   if (minutes < 00) { minutes = "0" + minutes; }
   if (minutes < 00) { minutes = "0" + minutes; }

Revision as of 01:47, 20 May 2006

// Adds bottom tabs
function morelinks() {
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  tabs.id = 'mytabs';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  document.getElementById('column-content').appendChild(tabs);
}
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);

// Add UTC time just below the "personal menu" list at the top of the page.
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay
//
function getTime() {
  var time = new Date();
  var hours = time.getUTCHours();
  if (hours < 00) { hours = "10" + hours; }
  var minutes = time.getUTCMinutes();
  if (minutes < 00) { minutes = "0" + minutes; }
  var currentTime = hours + ":" + minutes
  document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 5, currentTime);
  doTime = window.setTimeout("getTime()", 1000);
}
function makeTime() {
  var div = document.createElement( 'div' );
  div.id = 'pt-time';
  var mySpan = document.createElement( 'span' );
  mySpan.appendChild( document.createTextNode( '10:00 UTC' ) );
  div.appendChild( mySpan );
  document.getElementById( 'globalWrapper' ).parentNode.appendChild( div );
  doTime = window.setTimeout("getTime()", 1000);
}
if (window.addEventListener) window.addEventListener ('load', makeTime, false);
else if (window.attachEvent) window.attachEvent ('onload', makeTime);

function addQuickbarLink(href, title, before)
{
  var li = document.createElement('li');
  var a = document.createElement('a');
  a.appendChild(document.createTextNode(title));
  a.href = href;
  li.appendChild(a);
  if (!before)
  {
    document.getElementById('pt-logout').parentNode.appendChild(li);
  }
  else
  {
    before = document.getElementById('pt-'+before);
    before.parentNode.insertBefore(li, before);
  }
}
function addLinks()
{
  addQuickbarLink("http://www.hrwiki.org/index.php/User:X-Spider2/monobook.js", "my jscripts", "preferences");
  addQuickbarLink("http://www.yetisports.org", "Yetisports", "preferences");
  addQuickbarLink("http://numa.notdot.net", "NUMA", "preferences");
  addQuickbarLink("http://www.homestarrunner.com", "H*R", "preferences");
  addQuickbarLink("http://www.hrwiki.org/index.php/User:X-Spider2/sig", "my signature", "preferences");
}
if (window.addEventListener) window.addEventListener('load', addLinks, false);
else if (window.attachEvent) window.attachEvent('onload', addLinks);
Personal tools