Difference between revisions of "MediaWiki:Monobook.js"

From EncyclopAtys

Jump to: navigation, search
(Blanked the page)
Line 1: Line 1:
βˆ’
/*<nowiki>*/
 
βˆ’
/* Any JavaScript here will be loaded for users using the MonoBook skin */
 
βˆ’
/** additional monobook scripts **/
 
βˆ’
hookEvent( 'load', displayTimer );
 
  
βˆ’
/**** function displayTimer.js
 
βˆ’
* by Patrick Westerhoff [poke]
 
βˆ’
*/
 
βˆ’
function displayTimer ()
 
βˆ’
{
 
βˆ’
  if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false )
 
βˆ’
    return;
 
βˆ’
 
 
βˆ’
  var date;
 
βˆ’
  var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0];
 
βˆ’
  var timerLink  = document.createElement( 'a' );
 
βˆ’
  var timerObj    = document.createElement( 'li' );
 
βˆ’
  timerLink.href              = '/wiki/' + wgPageName + '?action=purge';
 
βˆ’
  timerLink.title              = 'Purge the server cache and update the contents of this page.'
 
βˆ’
  timerObj.id                  = 'pt-timer';
 
βˆ’
  timerObj.style.textTransform = 'none';
 
βˆ’
  timerObj.style.fontWeight    = 'bold';
 
βˆ’
  timerObj.style.fontSize      = '110%';
 
βˆ’
  timerObj.appendChild( timerLink );
 
βˆ’
  timerParent.insertBefore( timerObj, timerParent.firstChild );
 
βˆ’
 
 
βˆ’
  function actualizeUTC ()
 
βˆ’
  {
 
βˆ’
    timerDate          = new Date();
 
βˆ’
    timerLink.innerHTML = ( timerDate.getUTCHours()  < 10 ? '0' : '' ) + timerDate.getUTCHours()  + ':'
 
βˆ’
                        + ( timerDate.getUTCMinutes() < 10 ? '0' : '' ) + timerDate.getUTCMinutes() + ':'
 
βˆ’
                        + ( timerDate.getUTCSeconds() < 10 ? '0' : '' ) + timerDate.getUTCSeconds() + ' (UTC)';
 
βˆ’
  }
 
βˆ’
 
 
βˆ’
  function actualizeCustom ()
 
βˆ’
  {
 
βˆ’
    timerDate          = new Date();
 
βˆ’
    timerDate.setMinutes( timerDate.getMinutes() + timerDate.getTimezoneOffset() + timerTimezone * 60 );
 
βˆ’
    timerLink.innerHTML = ( timerDate.getHours()  < 10 ? '0' : '' ) + timerDate.getHours()  + ':'
 
βˆ’
                        + ( timerDate.getMinutes() < 10 ? '0' : '' ) + timerDate.getMinutes() + ':'
 
βˆ’
                        + ( timerDate.getSeconds() < 10 ? '0' : '' ) + timerDate.getSeconds()
 
βˆ’
                        + ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')';
 
βˆ’
  }
 
βˆ’
 
 
βˆ’
  // start
 
βˆ’
  if ( typeof( timerTimezone ) !== 'number' )
 
βˆ’
  {
 
βˆ’
    actualizeUTC();
 
βˆ’
    setInterval( actualizeUTC, 1000 );
 
βˆ’
  }
 
βˆ’
  else
 
βˆ’
  {
 
βˆ’
    actualizeCustom();
 
βˆ’
    setInterval( actualizeCustom, 1000 );
 
βˆ’
  }
 
βˆ’
}
 
βˆ’
/*</nowiki>*/
 

Revision as of 22:03, 30 December 2009