// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
/***** DavidClock **************************************************
Puts an UTC clock in the upper right corner of all pages.
See full documentation at [[User:Davidgothberg/clock]].
*/
$( function() {
var static = true;
var tick = 60;
/* If the user has not declared "window.davidClock = x;"
then none of these if-cases become true, and the defaults
above will be used. */
if( window.davidClock >= 0 ) {
tick = window.davidClock;
}
else if( window.davidClock < 0 ) {
static = false;
tick = 0 - window.davidClock;
}
/* Optimised ticker for 60 seconds or longer tick intervals. */
function updateTimeMinutes() {
var now = new Date();
linkNode.innerHTML = now.toUTCString().substring(17,22);
setTimeout( updateTimeMinutes, tick * 1000 );
};
/* Optimised ticker for 1-59 seconds tick intervals. */
function updateTimeSeconds() {
var now = new Date();
linkNode.innerHTML = now.toUTCString().substring(17,25);
setTimeout( updateTimeSeconds, tick * 1000 );
};
/* Start the ticking clock. */
if( tick ) {
var tabNode = mw.util.addPortletLink( 'p-personal', wgScriptPath
+ '/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName'))
+ '&action=purge', '', 'pt-utcticker', 'Purge the page' );
tabNode.style.fontWeight = 'bolder';
var linkNode = tabNode.getElementsByTagName("a")[0];
if( tick >= 60 ) {
updateTimeMinutes();
}
else {
updateTimeSeconds();
}
}
/* Create the static clock. */
if( static ) {
if( tick ) { /* Make it an edit section 0 link. */
var link = wgScriptPath + '/index.php?title='
+ encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit§ion=0';
var linkTooltip = 'Edit section 0';
}
else { /* Make it a purge link. */
var link = wgScriptPath + '/index.php?title='
+ encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge';
var linkTooltip = 'Purge the page';
}
var now = new Date();
var linkText = now.toUTCString().substring(17,22);
mw.util.addPortletLink( 'p-personal', link, linkText, 'pt-utcstatic', linkTooltip );
}
} ); /* End DavidClock */
var dateNode = liveClock.node;
if( !dateNode ) {
return;
}
var now = new Date();
var hh = now.getUTCHours();
var mm = now.getUTCMinutes();
var ss = now.getUTCSeconds();
var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild );
window.setTimeout(showTime, 1000);
}