|
|
@ -136,19 +136,23 @@ async function showRandomAnnouncement(groupId, timeInterval) { |
|
|
|
} |
|
|
|
|
|
|
|
function handleSponsorImages() { |
|
|
|
const sponsorImages = document.querySelectorAll('.sponsor-image'); |
|
|
|
const announceRight = document.getElementById('announce-right'); |
|
|
|
if(!announceRight) return; |
|
|
|
|
|
|
|
if (announceRight) { |
|
|
|
announceRight.style.display = 'none'; |
|
|
|
} |
|
|
|
const sponsorImages = document.querySelectorAll('.sponsor-image'); |
|
|
|
|
|
|
|
const imagePromises = Array.from(sponsorImages).map(img => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (img.complete) { |
|
|
|
if (img.complete && img.naturalHeight !== 0) { |
|
|
|
resolve(); |
|
|
|
} else { |
|
|
|
img.addEventListener('load', resolve); |
|
|
|
img.addEventListener('load', () => { |
|
|
|
if (img.naturalHeight !== 0) { |
|
|
|
resolve(); |
|
|
|
} else { |
|
|
|
reject(); |
|
|
|
} |
|
|
|
}); |
|
|
|
img.addEventListener('error', reject); |
|
|
|
} |
|
|
|
}); |
|
|
@ -156,10 +160,8 @@ function handleSponsorImages() { |
|
|
|
|
|
|
|
Promise.all(imagePromises) |
|
|
|
.then(() => { |
|
|
|
if (announceRight) { |
|
|
|
announceRight.style.display = 'block'; |
|
|
|
showRandomAnnouncement('announce-right', 10000); |
|
|
|
} |
|
|
|
announceRight.style.display = 'block'; |
|
|
|
showRandomAnnouncement('announce-right', 10000); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
// do nothing
|
|
|
|