User:Camulogene77/global.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// Activer le gadget OngletPurge sur tous les wikis
mw.loader.load('//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-OngletPurge.js&action=raw&ctype=text/javascript');
// Horloge
function liveClock(){
if (typeof(window.UTCLiveClockConfig)=='undefined') window.UTCLiveClockConfig = {};
var portletId = window.UTCLiveClockConfig.portletId || 'p-personal';
var nextNode = window.UTCLiveClockConfig.nextNodeId ? document.getElementById(window.UTCLiveClockConfig.nextNodeId) : undefined;
liveClock.node = mw.util.addPortletLink( portletId, mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', '', 'utcdate', undefined, undefined, nextNode );
liveClock.node.style.fontSize = 'larger';
liveClock.node.style.fontWeight = 'bolder';
showTime();
}
$(liveClock);
function showTime(){
var dateNode = liveClock.node;
if( !dateNode ) {
return;
}
var now = new Date();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getSeconds();
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);
}