Ctrl+K
- 1.52 kB initial commit
- 207 Bytes sistema il codice permettendo che dopo aver fatto l'accesso, cambia la scheda e vai a una dedicata completamente ai film, il resto lasscia tutto uguale. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Netflix Clone</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> .hero { background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://assets.nflxext.com/ffe/siteui/vlv3/9d3533b2-0e2b-40b2-95e0-ecd7979cc88b/a3873901-5b7c-46eb-b9fa-12fea5197bd3/IN-en-20240311-popsignuptwoweeks-perspective_alpha_website_large.jpg'); background-size: cover; background-position: center; } .movie-card:hover { transform: scale(1.05); transition: transform 0.3s ease; } .hidden { display: none; } /* Custom scrollbar */ .custom-scrollbar::-webkit-scrollbar { height: 8px; } .custom-scrollbar::-webkit-scrollbar-track { background: #1a1a1a; } .custom-scrollbar::-webkit-scrollbar-thumb { background: #e50914; border-radius: 4px; } </style> </head> <body class="bg-black text-white"> <!-- Navigation --> <nav class="flex justify-between items-center p-4 z-50 relative"> <div class="text-red-600 font-bold text-4xl">NETFLIX</div> <div class="flex space-x-4"> <button id="signInBtn" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded">Sign In</button> <button id="registerBtn" class="bg-transparent border border-white hover:bg-white hover:text-black text-white px-4 py-2 rounded">Register</button> </div> </nav> <!-- Hero Section --> <section class="hero h-screen flex flex-col justify-center items-center text-center px-4"> <h1 class="text-5xl font-bold mb-4">Unlimited movies, TV shows, and more.</h1> <p class="text-2xl mb-8">Watch anywhere. Cancel anytime.</p> <p class="text-xl mb-8">Ready to watch? Enter your email to create or restart your membership.</p> <div class="flex flex-col md:flex-row gap-2 w-full md:w-2/3"> <input type="email" placeholder="Email address" class="bg-white bg-opacity-70 p-4 rounded flex-grow text-black"> <button class="bg-red-600 hover:bg-red-700 text-white px-8 py-4 rounded text-xl font-bold">Get Started <i class="fas fa-chevron-right"></i></button> </div> </section> <!-- Content Sections --> <div id="contentSections" class="hidden"> <!-- Navigation for logged in users --> <nav class="flex justify-between items-center p-4 bg-black bg-opacity-90 sticky top-0 z-50"> <div class="flex items-center space-x-8"> <div class="text-red-600 font-bold text-4xl">NETFLIX</div> <div class="hidden md:flex space-x-6"> <a href="#" class="hover:text-gray-300">Home</a> <a href="#" class="hover:text-gray-300">TV Shows</a> <a href="#" class="hover:text-gray-300">Movies</a> <a href="#" class="hover:text-gray-300">New & Popular</a> <a href="#" class="hover:text-gray-300">My List</a> </div> </div> <div class="flex items-center space-x-4"> <div class="relative"> <input type="text" placeholder="Search" class="bg-black bg-opacity-70 border border-gray-600 rounded px-4 py-1 text-white"> <i class="fas fa-search absolute right-3 top-2 text-gray-400"></i> </div> <div class="flex items-center space-x-2 cursor-pointer"> <img src="https://via.placeholder.com/40" alt="Profile" class="rounded"> <span id="usernameDisplay" class="hidden md:block"></span> <i class="fas fa-caret-down"></i> </div> </div> </nav> <!-- Main Content --> <main class="pb-16"> <!-- Featured Movie --> <section class="relative h-[70vh]"> <div class="absolute inset-0 bg-gradient-to-t from-black via-transparent to-transparent z-10"></div> <img src="https://via.placeholder.com/1920x1080" alt="Featured Movie" class="w-full h-full object-cover"> <div class="absolute bottom-20 left-10 z-20 max-w-2xl"> <h2 class="text-5xl font-bold mb-4">Featured Movie Title</h2> <p class="text-lg mb-6">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <div class="flex space-x-4"> <button class="bg-white hover:bg-opacity-80 text-black px-8 py-2 rounded flex items-center"> <i class="fas fa-play mr-2"></i> Play </button> <button class="bg-gray-600 hover:bg-opacity-80 bg-opacity-70 text-white px-8 py-2 rounded flex items-center"> <i class="fas fa-info-circle mr-2"></i> More Info </button> </div> </div> </section> <!-- Movie Rows --> <section class="mt-8 px-10"> <h3 class="text-xl font-bold mb-4">Popular on Netflix</h3> <div class="flex overflow-x-auto space-x-4 pb-4 custom-scrollbar" id="popularMovies"> <!-- Movies will be added here by JavaScript --> </div> </section> <section class="mt-8 px-10"> <h3 class="text-xl font-bold mb-4">Trending Now</h3> <div class="flex overflow-x-auto space-x-4 pb-4 custom-scrollbar" id="trendingMovies"> <!-- Movies will be added here by JavaScript --> </div> </section> <section class="mt-8 px-10"> <h3 class="text-xl font-bold mb-4">New Releases</h3> <div class="flex overflow-x-auto space-x-4 pb-4 custom-scrollbar" id="newReleases"> <!-- Movies will be added here by JavaScript --> </div> </section> </main> </div> <!-- Admin Panel --> <div id="adminPanel" class="hidden p-8 bg-gray-900 min-h-screen"> <div class="flex justify-between items-center mb-8"> <h2 class="text-2xl font-bold">Admin Dashboard</h2> <button id="logoutAdminBtn" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded">Logout</button> </div> <div class="grid grid-cols-1 md:grid-cols-3 gap-8"> <!-- Add Movie Form --> <div class="bg-gray-800 p-6 rounded-lg col-span-1"> <h3 class="text-xl font-bold mb-4">Add New Movie</h3> <form id="addMovieForm"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Title</label> <input type="text" id="movieTitle" class="w-full p-2 rounded bg-gray-700 text-white" required> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Description</label> <textarea id="movieDescription" class="w-full p-2 rounded bg-gray-700 text-white" rows="3" required></textarea> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Image URL</label> <input type="url" id="movieImage" class="w-full p-2 rounded bg-gray-700 text-white" required> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Category</label> <select id="movieCategory" class="w-full p-2 rounded bg-gray-700 text-white" required> <option value="popular">Popular</option> <option value="trending">Trending</option> <option value="new">New Releases</option> </select> </div> <button type="submit" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded w-full">Add Movie</button> </form> </div> <!-- Current Movies --> <div class="bg-gray-800 p-6 rounded-lg col-span-2"> <h3 class="text-xl font-bold mb-4">Current Movies</h3> <div class="overflow-x-auto"> <table class="w-full text-left"> <thead> <tr class="border-b border-gray-700"> <th class="p-3">Title</th> <th class="p-3">Category</th> <th class="p-3">Actions</th> </tr> </thead> <tbody id="moviesList"> <!-- Movies will be listed here --> </tbody> </table> </div> </div> </div> </div> <!-- Sign In Modal --> <div id="signInModal" class="fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50 hidden"> <div class="bg-gray-900 p-8 rounded-lg w-full max-w-md"> <h2 class="text-3xl font-bold mb-6">Sign In</h2> <form id="signInForm"> <div class="mb-4"> <input type="text" id="signInUsername" placeholder="Username or email" class="w-full p-3 rounded bg-gray-800 text-white" required> </div> <div class="mb-6"> <input type="password" id="signInPassword" placeholder="Password" class="w-full p-3 rounded bg-gray-800 text-white" required> </div> <button type="submit" class="w-full bg-red-600 hover:bg-red-700 text-white p-3 rounded mb-4">Sign In</button> <div class="flex items-center justify-between mb-4"> <div class="flex items-center"> <input type="checkbox" id="rememberMe" class="mr-2"> <label for="rememberMe">Remember me</label> </div> <a href="#" class="text-gray-400 hover:text-white">Need help?</a> </div> </form> <div class="text-center mt-4"> <p class="text-gray-400">New to Netflix? <button id="switchToRegister" class="text-white hover:underline">Sign up now</button>.</p> </div> </div> </div> <!-- Register Modal --> <div id="registerModal" class="fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50 hidden"> <div class="bg-gray-900 p-8 rounded-lg w-full max-w-md"> <h2 class="text-3xl font-bold mb-6">Register</h2> <form id="registerForm"> <div class="mb-4"> <input type="text" id="registerUsername" placeholder="Username" class="w-full p-3 rounded bg-gray-800 text-white" required> </div> <div class="mb-4"> <input type="email" id="registerEmail" placeholder="Email" class="w-full p-3 rounded bg-gray-800 text-white" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" title="Please enter a valid email address"> </div> <div class="mb-4"> <input type="email" id="registerEmailConfirm" placeholder="Confirm Email" class="w-full p-3 rounded bg-gray-800 text-white" required> </div> <div class="mb-6"> <input type="password" id="registerPassword" placeholder="Password" class="w-full p-3 rounded bg-gray-800 text-white" required minlength="6"> </div> <button type="submit" class="w-full bg-red-600 hover:bg-red-700 text-white p-3 rounded mb-4">Register</button> </form> <div class="text-center mt-4"> <p class="text-gray-400">Already have an account? <button id="switchToSignIn" class="text-white hover:underline">Sign in now</button>.</p> </div> </div> </div> <script> // Database simulation let users = JSON.parse(localStorage.getItem('users')) || []; let movies = JSON.parse(localStorage.getItem('movies')) || [ { id: 1, title: "Stranger Things", description: "When a young boy vanishes, a small town uncovers a mystery involving secret experiments, terrifying supernatural forces, and one strange little girl.", image: "https://via.placeholder.com/300x450?text=Stranger+Things", category: "popular" }, { id: 2, title: "The Witcher", description: "Geralt of Rivia, a mutated monster-hunter for hire, journeys toward his destiny in a turbulent world where people often prove more wicked than beasts.", image: "https://via.placeholder.com/300x450?text=The+Witcher", category: "popular" }, { id: 3, title: "Breaking Bad", description: "A high school chemistry teacher diagnosed with inoperable lung cancer turns to manufacturing and selling methamphetamine in order to secure his family's future.", image: "https://via.placeholder.com/300x450?text=Breaking+Bad", category: "trending" }, { id: 4, title: "Money Heist", description: "An unusual group of robbers attempt to carry out the most perfect robbery in Spanish history - stealing 2.4 billion euros from the Royal Mint of Spain.", image: "https://via.placeholder.com/300x450?text=Money+Heist", category: "trending" }, { id: 5, title: "The Queen's Gambit", description: "Orphaned at the tender age of nine, prodigious introvert Beth Harmon discovers and masters the game of chess in 1960s USA. But child stardom comes at a price.", image: "https://via.placeholder.com/300x450?text=Queen's+Gambit", category: "new" }, { id: 6, title: "Squid Game", description: "Hundreds of cash-strapped players accept a strange invitation to compete in children's games. Inside, a tempting prize awaits — with deadly high stakes.", image: "https://via.placeholder.com/300x450?text=Squid+Game", category: "new" } ]; // Add admin user if not exists if (!users.some(user => user.username === "admin")) { users.push({ username: "admin", email: "admin@netflix.com", password: "admin", isAdmin: true }); localStorage.setItem('users', JSON.stringify(users)); } let currentUser = null; // DOM Elements const signInBtn = document.getElementById('signInBtn'); const registerBtn = document.getElementById('registerBtn'); const signInModal = document.getElementById('signInModal'); const registerModal = document.getElementById('registerModal'); const switchToRegister = document.getElementById('switchToRegister'); const switchToSignIn = document.getElementById('switchToSignIn'); const signInForm = document.getElementById('signInForm'); const registerForm = document.getElementById('registerForm'); const contentSections = document.getElementById('contentSections'); const adminPanel = document.getElementById('adminPanel'); const usernameDisplay = document.getElementById('usernameDisplay'); const logoutAdminBtn = document.getElementById('logoutAdminBtn'); const addMovieForm = document.getElementById('addMovieForm'); const moviesList = document.getElementById('moviesList'); const popularMovies = document.getElementById('popularMovies'); const trendingMovies = document.getElementById('trendingMovies'); const newReleases = document.getElementById('newReleases'); // Event Listeners signInBtn.addEventListener('click', () => { signInModal.classList.remove('hidden'); registerModal.classList.add('hidden'); }); registerBtn.addEventListener('click', () => { registerModal.classList.remove('hidden'); signInModal.classList.add('hidden'); }); switchToRegister.addEventListener('click', () => { registerModal.classList.remove('hidden'); signInModal.classList.add('hidden'); }); switchToSignIn.addEventListener('click', () => { signInModal.classList.remove('hidden'); registerModal.classList.add('hidden'); }); // Close modals when clicking outside window.addEventListener('click', (e) => { if (e.target === signInModal) { signInModal.classList.add('hidden'); } if (e.target === registerModal) { registerModal.classList.add('hidden'); } }); // Sign In Form Submission signInForm.addEventListener('submit', (e) => { e.preventDefault(); const username = document.getElementById('signInUsername').value; const password = document.getElementById('signInPassword').value; const user = users.find(u => (u.username === username || u.email === username) && u.password === password); if (user) { currentUser = user; signInModal.classList.add('hidden'); if (user.isAdmin) { // Show admin panel adminPanel.classList.remove('hidden'); renderMoviesList(); } else { // Show regular content contentSections.classList.remove('hidden'); usernameDisplay.textContent = user.username; renderMovies(); } } else { alert('Invalid username or password'); } }); // Register Form Submission registerForm.addEventListener('submit', (e) => { e.preventDefault(); const username = document.getElementById('registerUsername').value; const email = document.getElementById('registerEmail').value; const emailConfirm = document.getElementById('registerEmailConfirm').value; const password = document.getElementById('registerPassword').value; // Check email confirmation if (email !== emailConfirm) { alert('Email addresses do not match'); return; } // Check if username or email already exists if (users.some(u => u.username === username)) { alert('Username already exists'); return; } // Validate email format const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; if (!emailRegex.test(email)) { alert('Please enter a valid email address'); return; } if (users.some(u => u.email === email)) { alert('Email already registered'); return; } // Add new user users.push({ username, email, password, isAdmin: false }); localStorage.setItem('users', JSON.stringify(users)); alert('Registration successful! Please sign in.'); registerModal.classList.add('hidden'); signInModal.classList.remove('hidden'); }); // Logout Admin logoutAdminBtn.addEventListener('click', () => { currentUser = null; adminPanel.classList.add('hidden'); }); // Add Movie Form Submission addMovieForm.addEventListener('submit', (e) => { e.preventDefault(); const title = document.getElementById('movieTitle').value; const description = document.getElementById('movieDescription').value; const image = document.getElementById('movieImage').value; const category = document.getElementById('movieCategory').value; // Generate new ID const newId = movies.length > 0 ? Math.max(...movies.map(m => m.id)) + 1 : 1; // Add new movie movies.push({ id: newId, title, description, image, category }); localStorage.setItem('movies', JSON.stringify(movies)); // Clear form addMovieForm.reset(); // Update movies list renderMoviesList(); alert('Movie added successfully!'); }); // Render movies in admin panel function renderMoviesList() { moviesList.innerHTML = ''; movies.forEach(movie => { const row = document.createElement('tr'); row.className = 'border-b border-gray-700'; row.innerHTML = ` <td class="p-3">${movie.title}</td> <td class="p-3">${movie.category}</td> <td class="p-3"> <button onclick="deleteMovie(${movie.id})" class="bg-red-600 hover:bg-red-700 text-white px-3 py-1 rounded text-sm">Delete</button> </td> `; moviesList.appendChild(row); }); } // Delete movie window.deleteMovie = function(id) { if (confirm('Are you sure you want to delete this movie?')) { movies = movies.filter(movie => movie.id !== id); localStorage.setItem('movies', JSON.stringify(movies)); renderMoviesList(); } }; // Render movies for users function renderMovies() { popularMovies.innerHTML = ''; trendingMovies.innerHTML = ''; newReleases.innerHTML = ''; movies.forEach(movie => { const card = document.createElement('div'); card.className = 'movie-card flex-shrink-0 w-48 h-72 bg-gray-800 rounded overflow-hidden cursor-pointer'; card.innerHTML = ` <img src="${movie.image}" alt="${movie.title}" class="w-full h-full object-cover"> <div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-60 transition-all duration-300 flex items-center justify-center"> <i class="fas fa-play text-4xl opacity-0 hover:opacity-100 transition-opacity duration-300"></i> </div> `; if (movie.category === 'popular') { popularMovies.appendChild(card); } else if (movie.category === 'trending') { trendingMovies.appendChild(card); } else if (movie.category === 'new') { newReleases.appendChild(card); } }); } // Check if user is already logged in function checkLoggedIn() { const loggedInUser = localStorage.getItem('currentUser'); if (loggedInUser) { currentUser = JSON.parse(loggedInUser); if (currentUser.isAdmin) { adminPanel.classList.remove('hidden'); renderMoviesList(); } else { contentSections.classList.remove('hidden'); usernameDisplay.textContent = currentUser.username; renderMovies(); } } } // Initialize checkLoggedIn(); </script> </body> </html> - Initial Deployment
- 35.6 kB serve la funxione di agfgiunfereun url dentro al fulm che reindirizza al player mio personale tramite un link, voglio che appena si schaccia su un film, si reindirizza al link, inoltre serve la funzione nella pagina di admin per il link - Follow Up Deployment
- 388 Bytes initial commit