From 32793c3a02644cb3ace34ec72ba42fb0518c5a52 Mon Sep 17 00:00:00 2001 From: Alejandra Date: Sun, 21 Sep 2025 16:02:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20sponsor=20display=20issue?= =?UTF-8?q?=20by=20hiding=20element=20on=20image=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/docs/js/custom.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/en/docs/js/custom.js b/docs/en/docs/js/custom.js index 4c0ada312e..425b7fce7f 100644 --- a/docs/en/docs/js/custom.js +++ b/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()