Bone Overlord.gif The Roost of the Graveborn Quest Spoiler!
Domine Graveborn: todos os bosses e mecânicas ilustradas!
Saiba mais ➔
Winter Tree.png Winter Update 2025
Acompanhe tudo sobre o Winter Update 2025!
Saiba mais ➔
Stag.gif The Order of the Stag Quest Spoiler!
Conheça Isle of Ada: sua quest, missões secundárias e todos os bosses!
Saiba mais ➔

MediaWiki:Tibiadrome.js: mudanças entre as edições

De Tibia Wiki - A Enciclopédia do Tibia
Ir para navegação Ir para pesquisar
Master Player
Master Player (discussão | contribs) (Tibiadrome calendar)
 
m
 
(36 revisões intermediárias por 2 usuários não estão sendo mostradas)
Linha 1: Linha 1:
$(document).ready(function () {
if (typeof mw !== 'undefined') {
   const secondRotation = new Date(1627372800 * 1000) // Tuesday July 27, 2021 10:00:00 (am) in time zone Europe/Berlin (CEST)
   mw.loader.addScriptTag('/index.php?title=MediaWiki:luxon.min.js&action=raw&ctype=text/javascript', ready)
}


function ready () {
   $('#tibiadrome_cal').html('' +
   $('#tibiadrome_cal').html('' +
     '<table class="wikitable">' +
     '<table style="width:100%; margin:0px;">' +
     '<tbody>' +
     '<tbody>' +
     '<tr>' +
     '<tr>' +
     '<td><b>Rotação Atual</b></td>' +
     '<td colspan="2" style="font-size:14px; width:100%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Rotação Número&nbsp;<span id="tibiadrome_rot"></span></b></td>' +
    '<td id="tibiadrome_rot">-</td>' +
     '</tr>' +
     '</tr>' +
     '<tr>' +
     '<tr>' +
     '<td><b>Iniciou em</b></td>' +
     '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Início:</b></td>' +
     '<td id="tibiadrome_start">-</td>' +
     '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Fim:</b></td>' +
     '</tr>' +
     '</tr>' +
     '<tr>' +
     '<tr>' +
     '<td><b>Terminará em</b></td>' +
     '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;" id="tibiadrome_start">-</td>' +
     '<td id="tibiadrome_end">-</td>' +
     '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;" id="tibiadrome_end">-</td>' +
     '</tr>' +
     '</tr>' +
     '</td></tr></tbody></table>')
     '</td></tr></tbody></table>')
   setInterval(UpdateTibiadrome, 1000)
  updateTibiadrome()
   setInterval(updateTibiadrome, 60 * 1000)
}


  function UpdateTibiadrome () {
function updateTibiadrome () {
    const now = new Date()
  const secondRotation = luxon.DateTime.fromSeconds(1627459200).setZone('Europe/Berlin') // July 28, 2021 10:00:00 (CEST)
    let rot = 2
  const now = luxon.DateTime.now().setZone('Europe/Berlin')
    for (let i = 0; secondRotation + i * 14 * 24 * 60 * 60 * 1000 < now; i++) {
  let rot = 2
      rot = 2 + i
  for (let i = 0; secondRotation.plus({ days: i * 14 }) < now; i++) {
    }
    rot = 2 + i
    $('#tibiadrome_rot').text(rot)
    $('#tibiadrome_start').text(secondRotation + (rot - 2) * 14 * 24 * 60 * 60 * 1000)
    $('#tibiadrome_end').text(secondRotation + (rot - 1) * 14 * 24 * 60 * 60 * 1000)
   }
   }
})
 
  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() + ')')
}

Edição atual tal como às 13h53min de 28 de novembro de 2023

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 colspan="2" style="font-size:14px; width:100%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Rotação Número&nbsp;<span id="tibiadrome_rot"></span></b></td>' +
    '</tr>' +
    '<tr>' +
    '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Início:</b></td>' +
    '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;"><b>Fim:</b></td>' +
    '</tr>' +
    '<tr>' +
    '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;" id="tibiadrome_start">-</td>' +
    '<td style="width:50%; text-align:center; vertical-align:top; border-bottom:1px dashed #999;" id="tibiadrome_end">-</td>' +
    '</tr>' +
    '</td></tr></tbody></table>')
  updateTibiadrome()
  setInterval(updateTibiadrome, 60 * 1000)
}

function updateTibiadrome () {
  const secondRotation = luxon.DateTime.fromSeconds(1627459200).setZone('Europe/Berlin') // July 28, 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() + ')')
}