From 1185bfc3afa561f7d64c5611b521a67d9d194cc4 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Mon, 15 Sep 2025 06:15:15 +0000 Subject: [PATCH] Restored to 'fece380e79bc6a9f228eab122f91603a7f302684' Replit-Restored-To: fece380e79bc6a9f228eab122f91603a7f302684 --- client/src/components/adsense-ad.tsx | 28 +++++++++----------------- client/src/components/netflix-grid.tsx | 4 ++-- server/bunny.ts | 20 ++++-------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/client/src/components/adsense-ad.tsx b/client/src/components/adsense-ad.tsx index 6c66d16..961ba7e 100644 --- a/client/src/components/adsense-ad.tsx +++ b/client/src/components/adsense-ad.tsx @@ -18,25 +18,15 @@ export default function AdSenseAd({ const adRef = useRef(null); useEffect(() => { - const timer = setTimeout(() => { - try { - // Ensure adsbygoogle is loaded - if (typeof window !== 'undefined' && adRef.current) { - // Check if element has width before initializing ad - const elementWidth = adRef.current.offsetWidth; - if (elementWidth > 0) { - // @ts-ignore - (window.adsbygoogle = window.adsbygoogle || []).push({}); - } else { - console.warn('AdSense element has no width, skipping initialization'); - } - } - } catch (error) { - console.error('AdSense initialization error:', error); + try { + // Ensure adsbygoogle is loaded + if (typeof window !== 'undefined') { + // @ts-ignore + (window.adsbygoogle = window.adsbygoogle || []).push({}); } - }, 100); // Small delay to ensure DOM is rendered - - return () => clearTimeout(timer); + } catch (error) { + console.error('AdSense initialization error:', error); + } }, []); const adStyle: React.CSSProperties = { @@ -52,7 +42,7 @@ export default function AdSenseAd({ } return ( -
+
(