MediaWiki:Common.js
From A Pillar An Icon A Relic A Ruin
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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function() {
var knownNewMoon = new Date('2000-01-06').getTime();
var lunarCycle = 29.53058867 * 86400000;
var phase = ((Date.now() - knownNewMoon) % lunarCycle) / lunarCycle;
var moons = ['π','π','π','π','π','π','π','π'];
var labels = ['New Moon','Waxing Crescent','First Quarter','Waxing Gibbous',
'Full Moon','Waning Gibbous','Last Quarter','Waning Crescent'];
var idx = Math.round(phase * 8) % 8;
var div = $('<div>').css({padding:'8px',textAlign:'center',fontSize:'1.4em'})
.html(moons[idx] + '<br><small>' + labels[idx] + '</small>');
$('#mw-panel').prepend(div); // or .append() to put it at the bottom
});