Widget:InitPageMerchantScript
<script> document.addEventListener('DOMContentLoaded', function () {
const url = window.location.origin; const date = new Date(); const merchantCard = document.getElementById('merchant-card');
if(date.getDay() === 1) { if(date.getHours() < 7 && date.getMinutes() < 40) date.setDate(date.getDate() - 1); }
const weekDay = date.getDay();
// Indice 0 == Domingo -> Indice 6 == Sábado const positions = [ { alt : 'Merchant em Cerulean', image : '/images/8/86/Card_Merchant-Cerulean.png' }, { alt : 'Merchant em Pewter', image : '/images/1/1c/Card_Merchant-Pewter.png' }, { alt : 'Merchant em Viridian', image : '/images/c/c0/Card_Merchant-Viridian.png' }, { alt : 'Merchant em Fuchsia', image : '/images/a/aa/Card_Merchant-Fuchsia.png' }, { alt : 'Merchant em Cinnabar', image : '/images/1/1c/Card_Merchant-Cinnabar.png' }, { alt : 'Merchant em Pallet', image : '/images/6/6d/Card_Merchant-Pallet.png' }, { alt : 'Merchant em Lavender', image : '/images/2/2b/Card_Merchant-Lavender.png' } ];
merchantCard.src = url + positions[weekDay].image; merchantCard.alt = positions[weekDay].alt;
}); </script>