User:Stonecold5987/monobook.js

From Homestar Runner Wiki

< User:Stonecold5987(Difference between revisions)
Jump to: navigation, search
(CLOCK'D!)
(Change Clock)
 
Line 1: Line 1:
-
// Add time to the "personal menu" at the top of the page.
+
// Add UTC time just below the "personal menu" list at the top of the page.
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay
-
//
 
-
// Indicate where you would like the time to appear:
 
-
//  pt-userpage, pt-mytalk, pt-preferences,
 
-
//  pt-watchlist, pt-mycontris, pt-logout
 
-
//
 
-
gsTimeInsertBefore = ; // leave blank to append after "logout"
 
//
//
function getTime() {
function getTime() {
Line 19: Line 13:
}
}
function makeTime() {
function makeTime() {
-
   var li = document.createElement('li');
+
   var div = document.createElement( 'div' );
-
   li.id = 'pt-time';
+
   div.id = 'pt-time';
-
   var mySpan = document.createElement('span');
+
   var mySpan = document.createElement( 'span' );
   mySpan.appendChild( document.createTextNode( '00:00 UTC' ) );
   mySpan.appendChild( document.createTextNode( '00:00 UTC' ) );
-
   li.appendChild(mySpan);
+
   div.appendChild( mySpan );
-
   if (gsTimeInsertBefore) {
+
   document.getElementById( 'globalWrapper' ).parentNode.appendChild( div );
-
    var before = document.getElementById(gsTimeInsertBefore);
+
-
    before.appendChild( li, before );
+
-
  }
+
-
  else {
+
-
    document.getElementById('pt-logout').parentNode.appendChild(li);
+
-
  }
+
   doTime = window.setTimeout("getTime()", 1000);
   doTime = window.setTimeout("getTime()", 1000);
}
}
 +
if (window.addEventListener) window.addEventListener ('load', makeTime, false);
 +
else if (window.attachEvent) window.attachEvent ('onload', makeTime);

Current revision as of 18:43, 25 April 2006

// 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 < 10) { hours = "0" + hours; }
  var minutes = time.getUTCMinutes();
  if (minutes < 10) { 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( '00: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);
Personal tools