From d60cf95724adaba63b3f9ed1400ae7c219899284 Mon Sep 17 00:00:00 2001 From: Omar Najjar Date: Tue, 18 Jun 2024 05:44:59 +1000 Subject: [PATCH] xxx --- index.html | 89 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index ae75dad..69842b8 100644 --- a/index.html +++ b/index.html @@ -262,6 +262,46 @@ body { .stream-btn:hover { background-color: #28a745; } + +.share-btn { + background-color: #FFD700; /* Gold color */ + color: white; + padding: 5px 10px; + margin: 5px; + border: none; + border-radius: 4px; + cursor: pointer; + font-weight: bold; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Adding shadow to text */ + display: inline-flex; + align-items: center; + justify-content: center; +} + +.share-btn:hover { + background-color: #FFC107; /* Slightly lighter gold for hover effect */ +} + +.popcorn { + margin-left: 5px; /* Adds space between the text and emoji */ + display: inline-block; /* Allows transformation effects */ + animation: popcornBounce 1s ease-in-out infinite; +} + +@keyframes popcornBounce { + 0%, 100% { + transform: translateY(0) rotate(0deg); + filter: drop-shadow(0 0 0 transparent); + } + 50% { + transform: translateY(-10px) rotate(360deg); + filter: drop-shadow(0 5px 5px rgba(0,0,0,0.4)); /* Add a shadow to enhance the effect */ + } +} + + + + @@ -291,6 +331,11 @@ body {
× + + +
@@ -329,8 +374,8 @@ body { } - function displaySearchResults(results, containerSee) { - const container = document.getElementById(containerSee); + function displaySearchResults(results, containerId) { + const container = document.getElementById(containerId); container.innerHTML = ''; // Clear previous results results.forEach(result => { if ((result.media_type === 'movie' || result.media_type === 'tv') && result.poster_path) { @@ -338,13 +383,15 @@ body { const imdbId = result.id; // Assuming it fetches the correct ID const posterPath = `https://image.tmdb.org/t/p/w500${result.poster_path}`; const overview = result.overview || 'No description available.'; + const mediaType = result.media_type; + const movieTile = document.createElement('div'); movieTile.className = 'movie-tile'; movieTile.innerHTML = ` Poster for ${title}

${title}

${overview}

- + `; container.appendChild(movieTile); } @@ -372,10 +419,26 @@ body { } } - function openModal(videoUrl) { - modal.style.display = "block"; - videoIframe.src = videoUrl; - } + function openModal(mediaType, imdbId) { + let baseUrl = 'https://vidsrc.to/embed/'; + if (mediaType === 'movie') { + baseUrl += 'movie/'; + } else if (mediaType === 'tv') { + baseUrl += 'tv/'; + } else { + console.error('Unsupported media type'); + return; + } + const videoUrl = baseUrl + imdbId; + modal.style.display = "block"; + videoIframe.src = videoUrl; + + // Update the URL in the address bar + const newUrl = `${window.location.pathname}?type=${mediaType}&id=${imdbId}`; + window.history.pushState({ path: newUrl }, '', newUrl); +} + + document.addEventListener('DOMContentLoaded', function() { fetchMovies(); // Fetches upcoming movies for the Coming Soon section fetchRandomMovies(); // Fetches random movies for display on page load @@ -389,6 +452,14 @@ body { document.querySelector('[name="search"]').focus(); } }); + + // Check URL parameters and open modal if applicable + const urlParams = new URLSearchParams(window.location.search); + const mediaType = urlParams.get('type'); + const imdbId = urlParams.get('id'); + if (mediaType && imdbId) { + openModal(mediaType, imdbId); + } }); function fetchRandomMovies() { @@ -424,8 +495,8 @@ function fetchRandomMovies() { slider.appendChild(movieCard); }); container.appendChild(slider); -} +} function displayMovies(movies, containerId) { const container = document.getElementById(containerId); container.innerHTML = ''; // Clear previous results @@ -437,7 +508,7 @@ function displayMovies(movies, containerId) { ${movie.title}

${movie.title}

${movie.overview || 'No description available.'}

- + `; container.appendChild(movieTile); }