MediaWiki:Status/code.js

/* created by Curiouscrab */

if(wgNamespaceNumber == 2) { var date = new Date; $.get('/api.php?action=query&list=usercontribs&ucuser=' + wgPageName.split('User:')[1] + '&ucend=' + date.getUTCFullYear + '-' + (date.getUTCMonth < 10 ? '0' + (date.getUTCMonth + 1) : (date.getUTCMonth + 1)) + '-' + (date.getUTCDate < 10 ? '0' + date.getUTCDate : date.getUTCDate) + 'T' + ((date.getUTCHours - 1) < 10 ? '0' + (date.getUTCHours - 1) : (date.getUTCHours - 1)) + ':' + (date.getUTCMinutes < 10 ? '0' + date.getUTCMinutes : date.getUTCMinutes) + ':00Z&format=json',function(data){		var recentEdits = data.query.usercontribs.length;		var status;		var color;		var image;		if(recentEdits > 0 && recentEdits < 10) {			status = 'Online';		} else if(recentEdits > 0) {			status = 'Busy';		} else {			status = 'Offline';		}		switch(status) {			case 'Online':				color = 'green';				image = 'http://vignette3.wikia.nocookie.net/scratchpad/images/5/58/Ledgreen.png/revision/latest/scale-to-width-down/20?cb=20150625011746';				break;			case 'Busy':				color = 'orange';				image = 'http://vignette2.wikia.nocookie.net/scratchpad/images/8/80/Ledorange.png/revision/latest/scale-to-width-down/20?cb=20160306192359';				break;			case 'Offline':				color = 'red';				image = 'http://vignette3.wikia.nocookie.net/scratchpad/images/6/6d/Ledred.png/revision/latest/scale-to-width-down/20?cb=20160307035557&format=webp'; }		switch(skin) { case 'monobook': $('.status').appendTo('#firstHeading').css({float: 'right', fontSize: '12px', marginRight: '10px'}).prepend('Status: ' + status + ' ').css('font-weight','bold'); break; case 'oasis': case 'wikia': $(' Status ').prependTo('.masthead-info .details'); $('.details li:first').append(' ' + status + ' '); break; }	}); }