MediaWiki:Skywatcher
Note: After saving, 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: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
calculateForecastTarget: function(lDate) {
// Thanks to Rogueadyn's SaintCoinach library for this calculation.
// lDate is the current local time.
var unixSeconds = parseInt(lDate.getTime() / 1000);
// Get Eorzea hour for weather start
var bell = unixSeconds / 175;
// Do the magic 'cause for calculations 16:00 is 0, 00:00 is 8 and 08:00 is 16
var increment = (bell + 8 - (bell % 8)) % 24;
// Take Eorzea days since unix epoch
var totalDays = unixSeconds / 4200;
totalDays = (totalDays << 32) >>> 0; // Convert to uint
// 0x64 = 100
var calcBase = totalDays * 100 + increment;
// 0xB = 11
var step1 = (calcBase << 11) ^ calcBase;
var step2 = (step1 >>> 8) ^ step1;
// 0x64 = 100
return step2 % 100;
}
</script>