Browse Source

🐛 Fix sponsor display issue by hiding element on image error

pull/14097/head
Alejandra 10 months ago
parent
commit
32793c3a02
  1. 18
      docs/en/docs/js/custom.js

18
docs/en/docs/js/custom.js

@ -135,10 +135,28 @@ async function showRandomAnnouncement(groupId, timeInterval) {
}
}
function hideSponsorOnImageError() {
const sponsorImages = document.querySelectorAll('.sponsor-image');
const announceRight = document.getElementById('announce-right');
function hideAnnounceRight() {
if (announceRight) {
announceRight.style.display = 'none';
}
}
sponsorImages.forEach(function(img) {
img.addEventListener('error', function() {
hideAnnounceRight();
});
});
}
async function main() {
setupTermynal();
showRandomAnnouncement('announce-left', 5000)
showRandomAnnouncement('announce-right', 10000)
hideSponsorOnImageError();
}
document$.subscribe(() => {
main()

Loading…
Cancel
Save