Difference between revisions of "MediaWiki:Monobook2.js"
From EncyclopAtys
(Created page with '→<nowiki>: →Any JavaScript here will be loaded for users using the MonoTryker skin: →* additional monobook scripts *: var timerParent = document.getElementById( 'serve…') |
|||
Line 2: | Line 2: | ||
/* Any JavaScript here will be loaded for users using the MonoTryker skin */ | /* Any JavaScript here will be loaded for users using the MonoTryker skin */ | ||
/** additional monobook scripts **/ | /** additional monobook scripts **/ | ||
− | + | function displayTimer () | |
− | var timerParent = document.getElementById( ' | + | { |
+ | if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false ) | ||
+ | return; | ||
+ | |||
+ | var date; | ||
+ | var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0]; | ||
var timerLink = document.createElement( 'a' ); | var timerLink = document.createElement( 'a' ); | ||
var timerObj = document.createElement( 'li' ); | 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 ); | ||
var ariimg = document.createElement('img'); | var ariimg = document.createElement('img'); | ||
Line 35: | Line 48: | ||
+ | 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>*/ | /*</nowiki>*/ |
Revision as of 12:03, 9 June 2010
/*<nowiki>*/
/* Any JavaScript here will be loaded for users using the MonoTryker skin */
/** additional monobook scripts **/
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 );
var ariimg = document.createElement('img');
var ari = document.createElement( 'li' );
ariimg.src = "http://www.3025-game.de/special/Realmstatus_ryzom.php?shard=ari&rnd"+Math.random();
ariimg.style.height = "13px";
var aritext = document.createTextNode(" Arispotle");
ari.appendChild(ariimg);
ari.appendChild(aritext);
timerParent.insertBefore( ari, timerParent.firstChild );
var leaimg = document.createElement('img');
var lea = document.createElement( 'li' );
leaimg.src = "http://www.3025-game.de/special/Realmstatus_ryzom.php?shard=lea&rnd"+Math.random();
leaimg.style.height = "13px";
var leatext = document.createTextNode(" Leanon");
lea.appendChild(leaimg);
lea.appendChild(leatext);
timerParent.insertBefore( lea, timerParent.firstChild );
var aniimg = document.createElement('img');
var ani = document.createElement( 'li' );
aniimg.src = "http://www.3025-game.de/special/Realmstatus_ryzom.php?shard=ani&rnd"+Math.random();
aniimg.style.height = "13px";
var anitext = document.createTextNode(" Aniro");
ani.appendChild(aniimg);
ani.appendChild(anitext);
timerParent.insertBefore( ani, 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>*/