Nota: Após publicar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Internet Explorer/Edge: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
if (typeof mw !== 'undefined') {
mw.loader.addScriptTag('/index.php?title=MediaWiki:luxon.min.js&action=raw&ctype=text/javascript', ready)
}
function ready () {
$('#tibiadrome_cal').html('' +
'<table style="width:100%; margin:0px;">' +
'<tbody>' +
'<tr>' +
'<td style="width:20%; text-align:right;"><b>Rotação:</b></td>' +
'<td style="width:80%; text-align:left; vertical-align:top;" id="tibiadrome_rot">-</td>' +
'</tr>' +
'<tr>' +
'<td style="width:20%; text-align:right;"><b>Início:</b></td>' +
'<td style="width:80%; text-align:left; vertical-align:top;" id="tibiadrome_start">-</td>' +
'</tr>' +
'<tr>' +
'<td style="width:20%; text-align:right;"><b>Fim:</b></td>' +
'<td style="width:80%; text-align:left; vertical-align:top;" id="tibiadrome_end">-</td>' +
'</tr>' +
'</td></tr></tbody></table>')
updateTibiadrome()
setInterval(updateTibiadrome, 60 * 1000)
}
function updateTibiadrome () {
const secondRotation = luxon.DateTime.fromSeconds(1627372800).setZone('Europe/Berlin') // July 27, 2021 10:00:00 (CEST)
const now = luxon.DateTime.now().setZone('Europe/Berlin')
let rot = 2
for (let i = 0; secondRotation.plus({ days: i * 14 }) < now; i++) {
rot = 2 + i
}
const start = luxon.DateTime.fromSeconds(secondRotation.plus({ days: (rot - 2) * 14 }).toUnixInteger())
const end = luxon.DateTime.fromSeconds(secondRotation.plus({ days: (rot - 1) * 14 }).toUnixInteger())
const f = luxon.DateTime.DATETIME_SHORT
f.timeZoneName = 'short'
$('#tibiadrome_rot').text('#' + rot)
$('#tibiadrome_start').text(start.toLocaleString(f) + ' (' + start.toRelative() + ')')
$('#tibiadrome_end').text(end.toLocaleString(f) + ' (' + end.toRelative() + ')')
}