diff --git a/client/src/components/adsense-ad.tsx b/client/src/components/adsense-ad.tsx index 961ba7e..6abd647 100644 --- a/client/src/components/adsense-ad.tsx +++ b/client/src/components/adsense-ad.tsx @@ -19,13 +19,26 @@ export default function AdSenseAd({ useEffect(() => { try { - // Ensure adsbygoogle is loaded - if (typeof window !== 'undefined') { - // @ts-ignore - (window.adsbygoogle = window.adsbygoogle || []).push({}); + // Only initialize if the ad container has proper dimensions + if (typeof window !== 'undefined' && adRef.current) { + const adContainer = adRef.current; + const rect = adContainer.getBoundingClientRect(); + + // Wait for proper dimensions before initializing + if (rect.width > 0 && rect.height > 0) { + // Small delay to ensure DOM is fully ready + setTimeout(() => { + try { + // @ts-ignore + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (error) { + console.warn('AdSense initialization skipped:', error); + } + }, 100); + } } } catch (error) { - console.error('AdSense initialization error:', error); + console.warn('AdSense initialization error:', error); } }, []); diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 1295e59..917f9c2 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -49,10 +49,15 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() ); - // FOLX STADL videos - const folxStadlVideos = videos.filter(video => - video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL") - ); + // FOLX STADL videos - updated patterns to catch more variations + const folxStadlVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + return title.includes("folx stadl") || + title.includes("folxstadl") || + title.includes("folx-stadl") || + title.includes("volx stadl") || + title.includes("folx_stadl"); + }); return [ { @@ -100,10 +105,13 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { { title: "GIPFELSTAMMTISCH", videos: (() => { - // Filter videos that specifically contain "Gipfelstammtisch" in title - const gipfelVideos = videos.filter(video => - video.title.includes("Gipfelstammtisch") - ); + // Filter videos that contain "Gipfelstammtisch" in various forms + const gipfelVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + return title.includes("gipfelstammtisch") || + title.includes("gipfel stammtisch") || + title.includes("gipfel-stammtisch"); + }); // Shuffle the Gipfelstammtisch videos randomly const shuffled = [...gipfelVideos].sort(() => Math.random() - 0.5); @@ -115,11 +123,16 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { { title: "DIE Geschichte des Liedes", videos: (() => { - // Filter videos that specifically contain "Geschichte des Liedes" in title or description - const gdlVideos = videos.filter(video => - video.title.toLowerCase().includes("geschichte des liedes") || - video.description?.toLowerCase().includes("geschichte des liedes") - ); + // Filter videos that contain "Geschichte des Liedes" in various forms + const gdlVideos = videos.filter(video => { + const title = video.title.toLowerCase(); + const desc = video.description?.toLowerCase() || ""; + return title.includes("geschichte des liedes") || + title.includes("gschichte des liedes") || + title.includes("die geschichte des liedes") || + desc.includes("geschichte des liedes") || + desc.includes("gschichte des liedes"); + }); // If no specific "Geschichte des Liedes" videos found, fallback to general filter if (gdlVideos.length === 0) { diff --git a/client/src/main.tsx b/client/src/main.tsx index d5e5d0f..b1ee6d7 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -80,10 +80,8 @@ function initApp() { `; - // Auto-refresh on error - setTimeout(() => { - location.reload(); - }, 3000); + // Remove auto-refresh to prevent loops + console.warn('Auto-refresh disabled to prevent reload loops'); } } }