User:Tampo/monobook.js

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(Feel free to copy anything here)
(dunno what happened)
Line 1: Line 1:
-
********** Feel free to copy anything here. **********
 
-
 
-
 
-
 
-
 
-
 
   function addPurgeButton()
   function addPurgeButton()
   {
   {

Revision as of 22:01, 11 June 2006

  function addPurgeButton()
   {
       var href = document.location.href;
       {    
           var historyHref = document.getElementById( "ca-history" ).firstChild.href;
           var div = document.getElementById( "p-cactions" );
           var ul = div.getElementsByTagName( "ul" )[0];
           var newLi = document.createElement( "li" );
           var newA = document.createElement( "a" );
           newA.setAttribute( "href" , historyHref.replace( "=history" , "=purge" ) );
           var text = document.createTextNode( "purge" );
           newA.appendChild( text );
           newLi.appendChild( newA );
           ul.appendChild( newLi );
       }
   }
  if ( window.addEventListener ) window.addEventListener( "load" , addPurgeButton , false );
  else if ( window.attachEvent ) window.attachEvent( "onload", addPurgeButton );

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