Widget:InitPageBossScript: mudanças entre as edições
Ir para navegação
Ir para pesquisar
Sem resumo de edição Etiqueta: Reversão manual |
Sem resumo de edição |
||
(13 revisões intermediárias por 2 usuários não estão sendo mostradas) | |||
Linha 10: | Linha 10: | ||
const url = window.location.origin; | 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 bossCard = document.getElementById('boss-card'); | const bossCard = document.getElementById('boss-card'); | ||
const bosses = [ | const bosses = [ | ||
{ | { | ||
name: ' | name: 'Raikou', | ||
image: '/images/ | image: '/images/2/28/Card_Boss-Fight-Raikou.png', | ||
}, | link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Raikou" | ||
}, | |||
{ | { | ||
name: ' | name: 'Suicune', | ||
image: '/images/ | image: '/images/8/8b/Card_Boss-Fight-Suicune.png', | ||
link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune" | |||
}, | }, | ||
{ | { | ||
name: ' | name: 'Entei', | ||
image: '/images/ | image: '/images/c/c4/Card_Boss-Fight-Entei.png', | ||
link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Entei" | |||
}, | }, | ||
]; | ]; | ||
Linha 33: | Linha 42: | ||
3° Suicune | 3° Suicune | ||
*/ | */ | ||
console.log(actualWeekNumber) | |||
bossCard.src = url + bosses[actualWeekNumber % 3].image; | bossCard.src = url + bosses[actualWeekNumber % 3].image; | ||
document.getElementById("boss-link").href = bosses[actualWeekNumber % 3].link; | |||
bossCard.alt = bosses[actualWeekNumber % 3].name; | bossCard.alt = bosses[actualWeekNumber % 3].name; | ||
}); | }); | ||
</script> | </script> |
Edição atual tal como às 00h09min de 15 de janeiro 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 bossCard = document.getElementById('boss-card');
const bosses = [ { name: 'Raikou', image: '/images/2/28/Card_Boss-Fight-Raikou.png', link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Raikou" }, { name: 'Suicune', image: '/images/8/8b/Card_Boss-Fight-Suicune.png', link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Suicune" }, { name: 'Entei', image: '/images/c/c4/Card_Boss-Fight-Entei.png', link: "https://wiki.pokexgames.com/index.php/Boss_Fight_-_Entei" }, ];
/* 1° Entei 2° Raikou 3° Suicune */ 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>