Widget:Test3
Ir para navegação
Ir para pesquisar
<script> document.addEventListener('DOMContentLoaded', function () {
Date.prototype.getWeekNumber = function () { let d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate())); d.setDate(d.getDate() + 2); let dayNum = d.getUTCDay() || 7; 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 dzCard = document.getElementById('dz-card'); const today = new Date();
// Ajuste: se for sexta-feira e for após as 07:00, incrementa o número da semana if (today.getDay() === 5 && (today.getHours() >= 7)) { // Friday after 7:00 AM actualWeekNumber++; }
const dzWeeks = [ { name: 'Décima segunda semana', image: '/images/1/11/Card_DZ_D%C3%A9cima-Segunda-Semana.png' }, { name: 'Primeira semana', image: '/images/b/b2/Card_DZ_Primeira-Semana.png' }, { name: 'Segunda semana', image: '/images/9/97/Card_DZ_Segunda-Semana.png' }, { name: 'Terceira semana', image: '/images/f/fd/Card_DZ_Terceira-Semana.png' }, { name: 'Quarta semana', image: '/images/1/17/Card_DZ_Quarta-Semana.png' }, { name: 'Quinta semana', image: '/images/4/40/Card_DZ_Quinta-Semana.png' }, { name: 'Sexta semana', image: '/images/2/23/Card_DZ_Sexta-Semana.png' }, { name: 'Sétima semana', image: '/images/f/f2/Card_DZ_S%C3%A9tima-Semana.png' }, { name: 'Oitava semana', image: '/images/9/97/Card_DZ_Oitava-Semana.png' }, { name: 'Nona semana', image: '/images/b/b3/Card_DZ_Nona-Semana.png' }, { name: 'Décima semana', image: '/images/3/30/Card_DZ_D%C3%A9cima-Semana.png' }, { name: 'Décima primeira semana', image: '/images/4/49/Card_DZ_D%C3%A9cima-Primeira-Semana.png' }, ];
let weekIndex = actualWeekNumber % 12;
dzCard.src = url + dzWeeks[actualWeekNumber % 12].image; dzCard.alt = dzWeeks[actualWeekNumber % 12].name;
});
</script>