17281728 init ( ) ;
17291729 }
17301730 }
1731- // Load movie posters for landing page background
1732- function loadMoviePosters ( ) {
1733- const postersGrid = document . getElementById ( 'moviePostersGrid' ) ;
1734- if ( ! postersGrid ) return ;
1735-
1736- // Create a timeout promise to prevent hanging
1737- const timeoutPromise = new Promise ( ( _ , reject ) =>
1738- setTimeout ( ( ) => reject ( new Error ( 'Request timeout' ) ) , 5000 )
1739- ) ;
1740-
1741- // Fetch movies from Atomtickets API with timeout
1742- // Use a proxy endpoint to hide the actual API URL
1743- const apiEndpoint = window . MOVIE_API_ENDPOINT || '/api/movies' || 'data:application/json,{"productions":[]}' ;
1744-
1745- Promise . race ( [
1746- fetch ( apiEndpoint ) ,
1747- timeoutPromise
1748- ] )
1749- . then ( response => {
1750- if ( ! response . ok ) throw new Error ( 'API response not ok' ) ;
1751- return response . json ( ) ;
1752- } )
1753- . then ( data => {
1754- if ( ! data ?. productions || ! Array . isArray ( data . productions ) || data . productions . length === 0 ) {
1755- throw new Error ( 'No productions data' ) ;
1756- }
1757-
1758- // Create poster tiles for first 30 movies
1759- const movies = data . productions . slice ( 0 , 30 ) ;
1760- const postersHTML = movies . map ( ( movie , index ) => {
1761- const posterUrl = movie . coverImages ?. LARGE || movie . coverImages ?. SMALL || '' ;
1762- const title = movie . title || '' ;
1763- const rating = movie . mpaaRating || 'NR' ;
1764- const releaseDate = movie . releaseDate ? new Date ( movie . releaseDate ) . getFullYear ( ) : '' ;
1765- const shareLink = movie . shareLink || '#' ;
1766-
1767- // Skip if no poster image
1768- if ( ! posterUrl ) {
1769- return `<div class="movie-poster-tile fallback" style="background: hsl(${ index * 12 } , 70%, 50%); animation-delay: ${ ( index % 10 ) * 0.1 } s"></div>` ;
1770- }
1771-
1772- // Add animation delay for staggered appearance
1773- const delay = ( index % 10 ) * 0.1 ;
1774-
1775- return `
1776- <a href="${ shareLink } " target="_blank" rel="noopener" class="movie-poster-tile" style="animation-delay: ${ delay } s">
1777- <img src="${ posterUrl } " alt="${ title } " loading="lazy" onerror="this.parentElement.style.background='hsl(${ index * 12 } , 70%, 50%)'">
1778- <div class="poster-overlay">
1779- <div class="poster-title">${ title } </div>
1780- <div class="poster-meta">
1781- <span class="poster-rating">${ rating } </span>
1782- <span class="poster-year">${ releaseDate } </span>
1783- </div>
1784- </div>
1785- </a>
1786- ` ;
1787- } ) . join ( '' ) ;
1788-
1789- postersGrid . innerHTML = postersHTML ;
1790-
1791- // Clone for infinite scroll effect
1792- postersGrid . innerHTML += postersHTML ;
1793- } )
1794- . catch ( error => {
1795- console . log ( 'Using fallback movie poster grid:' , error . message ) ;
1796- // Create a beautiful fallback gradient grid
1797- const fallbackTiles = [
1798- { color : '#FF6B6B' , title : 'Action' } ,
1799- { color : '#4ECDC4' , title : 'Comedy' } ,
1800- { color : '#45B7D1' , title : 'Drama' } ,
1801- { color : '#96CEB4' , title : 'Thriller' } ,
1802- { color : '#FFEAA7' , title : 'Romance' } ,
1803- { color : '#DDA0DD' , title : 'Sci-Fi' } ,
1804- { color : '#98D8C8' , title : 'Horror' } ,
1805- { color : '#FFD700' , title : 'Adventure' } ,
1806- { color : '#FF69B4' , title : 'Fantasy' } ,
1807- { color : '#00CED1' , title : 'Mystery' }
1808- ] ;
1809-
1810- const fallbackHTML = Array ( 30 ) . fill ( 0 ) . map ( ( _ , i ) => {
1811- const tile = fallbackTiles [ i % fallbackTiles . length ] ;
1812- return `
1813- <div class="movie-poster-tile fallback" style="background: linear-gradient(135deg, ${ tile . color } 0%, ${ tile . color } 88 100%); animation-delay: ${ ( i % 10 ) * 0.1 } s">
1814- <div style="display: flex; align-items: center; justify-content: center; height: 100%; color: white; font-weight: 600; font-size: 14px; text-shadow: 0 2px 4px rgba(0,0,0,0.3);">
1815- ${ tile . title }
1816- </div>
1817- </div>
1818- ` ;
1819- } ) . join ( '' ) ;
1820-
1821- postersGrid . innerHTML = fallbackHTML + fallbackHTML ;
1822- } ) ;
1731+ // Initialize background gradient (removed movie poster functionality)
1732+ function initializeBackground ( ) {
1733+ // Background is now handled by pure CSS gradient
1734+ // No external API calls needed
1735+ console . log ( 'Background initialized' ) ;
18231736 }
18241737
18251738 // Call on page load
18261739 if ( document . readyState === 'loading' ) {
1827- document . addEventListener ( 'DOMContentLoaded' , loadMoviePosters ) ;
1740+ document . addEventListener ( 'DOMContentLoaded' , initializeBackground ) ;
18281741 } else {
1829- loadMoviePosters ( ) ;
1742+ initializeBackground ( ) ;
18301743 }
18311744} ) ( ) ;
0 commit comments