Widget:Test: mudanças entre as edições

De PokeXGames
Ir para navegação Ir para pesquisar
Sem resumo de edição
Etiqueta: Revertido
Sem resumo de edição
Etiqueta: Revertido
Linha 1: Linha 1:
[[Arquivo:Card_Merchant-Pallet.png|Torneio Global 24|link=https://forum.pokexgames.com/threads/243773]]
<script>
document.addEventListener('DOMContentLoaded', function () {
  Date.prototype.getWeekNumber = function () {
    let d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()));
    let dayNum = d.getUTCDay() || 7;
    d.setUTCDate(d.getUTCDate() + 4 - dayNum);
    let yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
    return Math.ceil((((d - yearStart) / 86400000) + 1) / 7)
  };
 
  const url = window.location.origin;
  let actualWeekNumber = new Date().getWeekNumber();
  const today = new Date();
 
  if(today.getDay() === 1) {
    if(today.getHours() < 7 && today.getMinutes() < 40) actualWeekNumber--;
  }
 
  const bossCard2 = document.getElementById('boss-card2');
 
  const bosses2 = [  
    {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
    },
    {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
    },
    {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
    },
  ];
 
  /*
    1° Aniversario
    2° Aniversario
    1° Aniversario
  */
  console.log(actualWeekNumber) 
 
  bossCard.src = url + bosses[actualWeekNumber % 3].image;
  document.getElementById("boss-link").href = bosses[actualWeekNumber % 3].link;
  bossCard.alt = bosses[actualWeekNumber % 3].name;
});
</script>

Edição das 19h38min de 9 de fevereiro de 2024

<script> document.addEventListener('DOMContentLoaded', function () {

 Date.prototype.getWeekNumber = function () {
   let d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()));
   let dayNum = d.getUTCDay() || 7;
   d.setUTCDate(d.getUTCDate() + 4 - dayNum);
   let yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
   return Math.ceil((((d - yearStart) / 86400000) + 1) / 7)
 };
 const url = window.location.origin;
 let actualWeekNumber = new Date().getWeekNumber();
 const today = new Date();
 if(today.getDay() === 1) {
   if(today.getHours() < 7 && today.getMinutes() < 40) actualWeekNumber--;
 }
 const bossCard2 = document.getElementById('boss-card2');
 const bosses2 = [    
   {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
   },
   {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
   },
   {
    name: 'Suicune',
    image: '/images/8/8b/Card_Boss-Fight-Suicune.png',
    link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune"
   },
 ];
 /*
   1° Aniversario
   2° Aniversario
   1° Aniversario
 */
 console.log(actualWeekNumber)  
 bossCard.src = url + bosses[actualWeekNumber % 3].image;
 document.getElementById("boss-link").href = bosses[actualWeekNumber % 3].link;
 bossCard.alt = bosses[actualWeekNumber % 3].name;

}); </script>