|
<!DOCTYPE html> |
|
<html lang="pt-BR"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Crianças de Cristo - Conteúdo Infantil Cristão</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> |
|
|
|
.video-container { |
|
position: relative; |
|
padding-bottom: 56.25%; |
|
height: 0; |
|
overflow: hidden; |
|
} |
|
|
|
.video-container iframe { |
|
position: absolute; |
|
top: 0; |
|
left: 0; |
|
width: 100%; |
|
height: 100%; |
|
border: none; |
|
} |
|
|
|
|
|
.video-container iframe { |
|
pointer-events: none; |
|
} |
|
|
|
|
|
.carousel-container { |
|
scrollbar-width: none; |
|
-ms-overflow-style: none; |
|
} |
|
|
|
.carousel-container::-webkit-scrollbar { |
|
display: none; |
|
} |
|
|
|
|
|
.modal { |
|
transition: opacity 0.3s ease; |
|
} |
|
|
|
|
|
.auth-form { |
|
animation: fadeIn 0.5s ease; |
|
} |
|
|
|
@keyframes fadeIn { |
|
from { opacity: 0; transform: translateY(20px); } |
|
to { opacity: 1; transform: translateY(0); } |
|
} |
|
|
|
|
|
.spinner { |
|
animation: spin 1s linear infinite; |
|
} |
|
|
|
@keyframes spin { |
|
0% { transform: rotate(0deg); } |
|
100% { transform: rotate(360deg); } |
|
} |
|
</style> |
|
</head> |
|
<body class="bg-gray-900 text-white"> |
|
|
|
<div id="authModal" class="fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center p-4 modal hidden"> |
|
<div class="bg-gray-800 rounded-lg p-8 max-w-md w-full auth-form"> |
|
<div class="flex justify-between items-center mb-6"> |
|
<h2 class="text-2xl font-bold">Entrar</h2> |
|
<button id="closeAuthModal" class="text-gray-400 hover:text-white"> |
|
<i class="fas fa-times"></i> |
|
</button> |
|
</div> |
|
|
|
<form id="loginForm" class="space-y-4"> |
|
<div> |
|
<label for="email" class="block text-sm font-medium mb-1">Email</label> |
|
<input type="email" id="email" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<div> |
|
<label for="password" class="block text-sm font-medium mb-1">Senha</label> |
|
<input type="password" id="password" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<button type="submit" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded font-medium transition duration-200"> |
|
Entrar |
|
</button> |
|
|
|
<div class="text-center text-sm text-gray-400"> |
|
Não tem uma conta? <button type="button" id="switchToRegister" class="text-blue-400 hover:underline">Cadastre-se</button> |
|
</div> |
|
</form> |
|
|
|
<form id="registerForm" class="space-y-4 hidden"> |
|
<div> |
|
<label for="regName" class="block text-sm font-medium mb-1">Nome</label> |
|
<input type="text" id="regName" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<div> |
|
<label for="regEmail" class="block text-sm font-medium mb-1">Email</label> |
|
<input type="email" id="regEmail" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<div> |
|
<label for="regPassword" class="block text-sm font-medium mb-1">Senha</label> |
|
<input type="password" id="regPassword" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<div> |
|
<label for="regConfirmPassword" class="block text-sm font-medium mb-1">Confirmar Senha</label> |
|
<input type="password" id="regConfirmPassword" class="w-full bg-gray-700 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required> |
|
</div> |
|
|
|
<button type="submit" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded font-medium transition duration-200"> |
|
Cadastrar |
|
</button> |
|
|
|
<div class="text-center text-sm text-gray-400"> |
|
Já tem uma conta? <button type="button" id="switchToLogin" class="text-blue-400 hover:underline">Faça login</button> |
|
</div> |
|
</form> |
|
</div> |
|
</div> |
|
|
|
|
|
<div id="videoModal" class="fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center p-4 modal hidden"> |
|
<div class="w-full max-w-4xl"> |
|
<div class="flex justify-between items-center mb-4"> |
|
<h2 id="videoModalTitle" class="text-xl font-bold"></h2> |
|
<button id="closeVideoModal" class="text-gray-400 hover:text-white text-2xl"> |
|
<i class="fas fa-times"></i> |
|
</button> |
|
</div> |
|
|
|
<div class="video-container rounded-lg overflow-hidden"> |
|
<iframe id="videoPlayer" src="" frameborder="0" allowfullscreen></iframe> |
|
</div> |
|
|
|
<div class="mt-4 flex justify-between items-center"> |
|
<button id="toggleFavorite" class="text-gray-300 hover:text-red-500"> |
|
<i class="far fa-heart"></i> <span class="ml-1">Favoritar</span> |
|
</button> |
|
|
|
<div class="text-gray-400 text-sm"> |
|
Conteúdo infantil cristão |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div id="pdfModal" class="fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center p-4 modal hidden"> |
|
<div class="w-full max-w-4xl bg-gray-800 rounded-lg overflow-hidden"> |
|
<div class="flex justify-between items-center bg-gray-900 p-4"> |
|
<h2 id="pdfModalTitle" class="text-xl font-bold"></h2> |
|
<button id="closePdfModal" class="text-gray-400 hover:text-white text-2xl"> |
|
<i class="fas fa-times"></i> |
|
</button> |
|
</div> |
|
|
|
<div class="h-96 md:h-[80vh] w-full"> |
|
<iframe id="pdfViewer" src="" frameborder="0" class="w-full h-full"></iframe> |
|
</div> |
|
|
|
<div class="bg-gray-900 p-4 flex justify-between items-center"> |
|
<button id="togglePdfFavorite" class="text-gray-300 hover:text-red-500"> |
|
<i class="far fa-heart"></i> <span class="ml-1">Favoritar</span> |
|
</button> |
|
|
|
<div class="text-gray-400 text-sm"> |
|
Conteúdo infantil cristão |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
|
|
<div id="loadingScreen" class="fixed inset-0 bg-gray-900 flex items-center justify-center z-50"> |
|
<div class="text-center"> |
|
<div class="spinner inline-block w-16 h-16 border-4 border-red-600 border-t-transparent rounded-full mb-4"></div> |
|
<h2 class="text-xl font-bold">Carregando conteúdo...</h2> |
|
</div> |
|
</div> |
|
|
|
|
|
<div id="app" class="hidden"> |
|
|
|
<header class="fixed top-0 left-0 right-0 z-40 bg-gradient-to-b from-black to-transparent p-4 transition-all duration-300"> |
|
<div class="flex justify-between items-center"> |
|
<div class="flex items-center"> |
|
<h1 class="text-red-600 font-bold text-2xl md:text-3xl">Crianças de Cristo</h1> |
|
</div> |
|
|
|
<div class="flex items-center space-x-4"> |
|
<button id="favoritesBtn" class="text-gray-300 hover:text-white"> |
|
<i class="fas fa-heart mr-1"></i> Favoritos |
|
</button> |
|
<button id="logoutBtn" class="bg-red-600 hover:bg-red-700 px-4 py-1 rounded transition duration-200"> |
|
Sair |
|
</button> |
|
</div> |
|
</div> |
|
</header> |
|
|
|
|
|
<main class="pt-20 pb-16 px-4"> |
|
|
|
<section id="featured" class="mb-12"> |
|
<h2 class="text-xl font-bold mb-4">Destaque</h2> |
|
<div id="featuredContent" class="relative rounded-xl overflow-hidden h-64 md:h-96 w-full bg-gray-800"> |
|
|
|
</div> |
|
</section> |
|
|
|
|
|
<section id="videoCarousels" class="space-y-10"> |
|
|
|
<div> |
|
<h2 class="text-xl font-bold mb-4">Recentes</h2> |
|
<div id="recentCarousel" class="carousel-container flex space-x-4 overflow-x-auto pb-4"> |
|
|
|
</div> |
|
</div> |
|
|
|
|
|
<div> |
|
<h2 class="text-xl font-bold mb-4">Histórias Bíblicas</h2> |
|
<div id="bibleStoriesCarousel" class="carousel-container flex space-x-4 overflow-x-auto pb-4"> |
|
|
|
</div> |
|
</div> |
|
|
|
|
|
<div> |
|
<h2 class="text-xl font-bold mb-4">Milagres de Jesus</h2> |
|
<div id="miraclesCarousel" class="carousel-container flex space-x-4 overflow-x-auto pb-4"> |
|
|
|
</div> |
|
</div> |
|
|
|
|
|
<div> |
|
<h2 class="text-xl font-bold mb-4">Músicas</h2> |
|
<div id="songsCarousel" class="carousel-container flex space-x-4 overflow-x-auto pb-4"> |
|
|
|
</div> |
|
</div> |
|
</section> |
|
|
|
|
|
<section id="pdfContent" class="mt-16"> |
|
<h2 class="text-xl font-bold mb-4">Conteúdo para Baixar</h2> |
|
<div id="pdfGrid" class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
|
|
|
</div> |
|
</section> |
|
</main> |
|
|
|
|
|
<footer class="fixed bottom-0 left-0 right-0 bg-gray-900 p-4 text-center text-gray-400 text-sm"> |
|
<p>© 2023 Crianças de Cristo - Conteúdo Infantil Cristão</p> |
|
</footer> |
|
</div> |
|
|
|
<script> |
|
|
|
const state = { |
|
authenticated: false, |
|
currentUser: null, |
|
videos: [], |
|
pdfs: [], |
|
favorites: JSON.parse(localStorage.getItem('favorites')) || { videos: [], pdfs: [] } |
|
}; |
|
|
|
|
|
const authModal = document.getElementById('authModal'); |
|
const loginForm = document.getElementById('loginForm'); |
|
const registerForm = document.getElementById('registerForm'); |
|
const switchToRegister = document.getElementById('switchToRegister'); |
|
const switchToLogin = document.getElementById('switchToLogin'); |
|
const closeAuthModal = document.getElementById('closeAuthModal'); |
|
const app = document.getElementById('app'); |
|
const loadingScreen = document.getElementById('loadingScreen'); |
|
const videoModal = document.getElementById('videoModal'); |
|
const videoPlayer = document.getElementById('videoPlayer'); |
|
const videoModalTitle = document.getElementById('videoModalTitle'); |
|
const closeVideoModal = document.getElementById('closeVideoModal'); |
|
const toggleFavorite = document.getElementById('toggleFavorite'); |
|
const pdfModal = document.getElementById('pdfModal'); |
|
const pdfViewer = document.getElementById('pdfViewer'); |
|
const pdfModalTitle = document.getElementById('pdfModalTitle'); |
|
const closePdfModal = document.getElementById('closePdfModal'); |
|
const togglePdfFavorite = document.getElementById('togglePdfFavorite'); |
|
const logoutBtn = document.getElementById('logoutBtn'); |
|
const favoritesBtn = document.getElementById('favoritesBtn'); |
|
|
|
|
|
const featuredContent = document.getElementById('featuredContent'); |
|
const recentCarousel = document.getElementById('recentCarousel'); |
|
const bibleStoriesCarousel = document.getElementById('bibleStoriesCarousel'); |
|
const miraclesCarousel = document.getElementById('miraclesCarousel'); |
|
const songsCarousel = document.getElementById('songsCarousel'); |
|
const pdfGrid = document.getElementById('pdfGrid'); |
|
|
|
|
|
function init() { |
|
|
|
loadingScreen.classList.remove('hidden'); |
|
|
|
|
|
const user = JSON.parse(localStorage.getItem('currentUser')); |
|
if (user) { |
|
state.authenticated = true; |
|
state.currentUser = user; |
|
app.classList.remove('hidden'); |
|
loadContent(); |
|
} else { |
|
loadingScreen.classList.add('hidden'); |
|
authModal.classList.remove('hidden'); |
|
} |
|
|
|
|
|
setupEventListeners(); |
|
} |
|
|
|
|
|
function setupEventListeners() { |
|
|
|
switchToRegister.addEventListener('click', () => { |
|
loginForm.classList.add('hidden'); |
|
registerForm.classList.remove('hidden'); |
|
}); |
|
|
|
switchToLogin.addEventListener('click', () => { |
|
registerForm.classList.add('hidden'); |
|
loginForm.classList.remove('hidden'); |
|
}); |
|
|
|
closeAuthModal.addEventListener('click', () => { |
|
if (!state.authenticated) return; |
|
authModal.classList.add('hidden'); |
|
}); |
|
|
|
|
|
loginForm.addEventListener('submit', (e) => { |
|
e.preventDefault(); |
|
const email = document.getElementById('email').value; |
|
const password = document.getElementById('password').value; |
|
|
|
|
|
if (email && password) { |
|
|
|
state.currentUser = { email, name: email.split('@')[0] }; |
|
state.authenticated = true; |
|
localStorage.setItem('currentUser', JSON.stringify(state.currentUser)); |
|
|
|
authModal.classList.add('hidden'); |
|
loadContent(); |
|
app.classList.remove('hidden'); |
|
loadingScreen.classList.add('hidden'); |
|
} |
|
}); |
|
|
|
|
|
registerForm.addEventListener('submit', (e) => { |
|
e.preventDefault(); |
|
const name = document.getElementById('regName').value; |
|
const email = document.getElementById('regEmail').value; |
|
const password = document.getElementById('regPassword').value; |
|
const confirmPassword = document.getElementById('regConfirmPassword').value; |
|
|
|
|
|
if (name && email && password && password === confirmPassword) { |
|
|
|
state.currentUser = { email, name }; |
|
state.authenticated = true; |
|
localStorage.setItem('currentUser', JSON.stringify(state.currentUser)); |
|
|
|
authModal.classList.add('hidden'); |
|
loadContent(); |
|
app.classList.remove('hidden'); |
|
loadingScreen.classList.add('hidden'); |
|
|
|
|
|
registerForm.classList.add('hidden'); |
|
loginForm.classList.remove('hidden'); |
|
} |
|
}); |
|
|
|
|
|
closeVideoModal.addEventListener('click', () => { |
|
videoModal.classList.add('hidden'); |
|
videoPlayer.src = ''; |
|
}); |
|
|
|
|
|
closePdfModal.addEventListener('click', () => { |
|
pdfModal.classList.add('hidden'); |
|
pdfViewer.src = ''; |
|
}); |
|
|
|
|
|
logoutBtn.addEventListener('click', () => { |
|
state.authenticated = false; |
|
state.currentUser = null; |
|
localStorage.removeItem('currentUser'); |
|
app.classList.add('hidden'); |
|
authModal.classList.remove('hidden'); |
|
}); |
|
|
|
|
|
favoritesBtn.addEventListener('click', showFavorites); |
|
} |
|
|
|
|
|
async function loadContent() { |
|
try { |
|
|
|
|
|
|
|
|
|
state.videos = [ |
|
{ |
|
titulo: "A Criação do Mundo", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Histórias Bíblicas", |
|
destaque: true |
|
}, |
|
{ |
|
titulo: "Noé e o Dilúvio", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Histórias Bíblicas", |
|
destaque: false |
|
}, |
|
{ |
|
titulo: "Jesus Acalma a Tempestade", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Milagres de Jesus", |
|
destaque: true |
|
}, |
|
{ |
|
titulo: "A Multiplicação dos Pães", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Milagres de Jesus", |
|
destaque: false |
|
}, |
|
{ |
|
titulo: "Cristo Me Ama", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Músicas", |
|
destaque: false |
|
}, |
|
{ |
|
titulo: "A Arca de Noé", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Histórias Bíblicas", |
|
destaque: false |
|
}, |
|
{ |
|
titulo: "Jesus Cura o Cego", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Milagres de Jesus", |
|
destaque: false |
|
}, |
|
{ |
|
titulo: "Deus é Tão Bom", |
|
video: "https://www.youtube.com/embed/dQw4w9WgXcQ", |
|
imagem: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", |
|
categoria: "Músicas", |
|
destaque: false |
|
} |
|
]; |
|
|
|
|
|
state.pdfs = [ |
|
{ |
|
titulo: "História de Noé para Colorir", |
|
pdf: "https://example.com/sample.pdf", |
|
imagem: "https://via.placeholder.com/300x424/333/fff?text=PDF+1", |
|
categoria: "Histórias Bíblicas" |
|
}, |
|
{ |
|
titulo: "Jesus e as Crianças", |
|
pdf: "https://example.com/sample.pdf", |
|
imagem: "https://via.placeholder.com/300x424/333/fff?text=PDF+2", |
|
categoria: "Histórias Bíblicas" |
|
}, |
|
{ |
|
titulo: "Atividades Bíblicas", |
|
pdf: "https://example.com/sample.pdf", |
|
imagem: "https://via.placeholder.com/300x424/333/fff?text=PDF+3", |
|
categoria: "Atividades" |
|
}, |
|
{ |
|
titulo: "Músicas Cristãs Infantis", |
|
pdf: "https://example.com/sample.pdf", |
|
imagem: "https://via.placeholder.com/300x424/333/fff?text=PDF+4", |
|
categoria: "Músicas" |
|
} |
|
]; |
|
|
|
|
|
renderContent(); |
|
|
|
} catch (error) { |
|
console.error('Error loading content:', error); |
|
loadingScreen.classList.add('hidden'); |
|
app.innerHTML = ` |
|
<div class="text-center"> |
|
<i class="fas fa-exclamation-triangle text-red-500 text-4xl mb-4"></i> |
|
<h2 class="text-xl font-bold">Erro ao carregar conteúdo</h2> |
|
<p class="text-gray-400 mt-2">Por favor, tente novamente mais tarde.</p> |
|
<button id="retryBtn" class="mt-4 bg-red-600 hover:bg-red-700 px-4 py-2 rounded transition duration-200"> |
|
Tentar Novamente |
|
</button> |
|
</div> |
|
`; |
|
|
|
document.getElementById('retryBtn').addEventListener('click', loadContent); |
|
} |
|
} |
|
|
|
|
|
function renderContent() { |
|
renderFeaturedContent(); |
|
renderVideoCarousels(); |
|
renderPDFContent(); |
|
loadingScreen.classList.add('hidden'); |
|
app.classList.remove('hidden'); |
|
} |
|
|
|
|
|
function renderFeaturedContent() { |
|
const featuredVideos = state.videos.filter(video => video.destaque); |
|
|
|
if (featuredVideos.length > 0) { |
|
const video = featuredVideos[0]; |
|
|
|
featuredContent.innerHTML = ` |
|
<div class="absolute inset-0 bg-gradient-to-t from-black to-transparent z-10 flex items-end p-6"> |
|
<div> |
|
<h3 class="text-2xl md:text-4xl font-bold mb-2">${video.titulo}</h3> |
|
<p class="text-gray-300 mb-4">Assista agora a esta história bíblica especial para crianças</p> |
|
<button class="play-featured bg-red-600 hover:bg-red-700 px-6 py-2 rounded font-medium transition duration-200 flex items-center" data-video="${video.video}" data-title="${video.titulo}"> |
|
<i class="fas fa-play mr-2"></i> Assistir |
|
</button> |
|
</div> |
|
</div> |
|
<img src="${video.imagem}" alt="${video.titulo}" class="absolute inset-0 w-full h-full object-cover"> |
|
`; |
|
|
|
|
|
document.querySelector('.play-featured').addEventListener('click', function() { |
|
openVideoModal(this.dataset.video, this.dataset.title); |
|
}); |
|
} else { |
|
featuredContent.innerHTML = ` |
|
<div class="absolute inset-0 flex items-center justify-center"> |
|
<p class="text-gray-400">Nenhum conteúdo em destaque disponível</p> |
|
</div> |
|
`; |
|
} |
|
} |
|
|
|
|
|
function renderVideoCarousels() { |
|
|
|
renderCarousel(recentCarousel, state.videos, 'Recentes'); |
|
|
|
|
|
const bibleStories = state.videos.filter(video => video.categoria === 'Histórias Bíblicas'); |
|
renderCarousel(bibleStoriesCarousel, bibleStories, 'Histórias Bíblicas'); |
|
|
|
|
|
const miracles = state.videos.filter(video => video.categoria === 'Milagres de Jesus'); |
|
renderCarousel(miraclesCarousel, miracles, 'Milagres de Jesus'); |
|
|
|
|
|
const songs = state.videos.filter(video => video.categoria === 'Músicas'); |
|
renderCarousel(songsCarousel, songs, 'Músicas'); |
|
} |
|
|
|
|
|
function renderCarousel(container, videos, category) { |
|
container.innerHTML = ''; |
|
|
|
if (videos.length === 0) { |
|
container.innerHTML = ` |
|
<div class="flex items-center justify-center w-full h-32 text-gray-400"> |
|
Nenhum vídeo disponível na categoria ${category} |
|
</div> |
|
`; |
|
return; |
|
} |
|
|
|
videos.forEach(video => { |
|
const isFavorite = state.favorites.videos.includes(video.video); |
|
|
|
const videoCard = document.createElement('div'); |
|
videoCard.className = 'flex-none w-48 md:w-56 lg:w-64 rounded-lg overflow-hidden bg-gray-800 hover:scale-105 transition-transform duration-200'; |
|
videoCard.innerHTML = ` |
|
<div class="relative"> |
|
<img src="${video.imagem}" alt="${video.titulo}" class="w-full h-28 md:h-32 lg:h-36 object-cover"> |
|
<button class="play-btn absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 opacity-0 hover:opacity-100 transition-opacity duration-200" data-video="${video.video}" data-title="${video.titulo}"> |
|
<i class="fas fa-play text-white text-3xl"></i> |
|
</button> |
|
<button class="favorite-btn absolute top-2 right-2 text-white bg-black bg-opacity-60 rounded-full p-2" data-video="${video.video}" data-title="${video.titulo}"> |
|
<i class="${isFavorite ? 'fas' : 'far'} fa-heart ${isFavorite ? 'text-red-500' : ''}"></i> |
|
</button> |
|
</div> |
|
<div class="p-3"> |
|
<h3 class="font-medium truncate">${video.titulo}</h3> |
|
</div> |
|
`; |
|
|
|
container.appendChild(videoCard); |
|
|
|
|
|
videoCard.querySelector('.play-btn').addEventListener('click', function() { |
|
openVideoModal(this.dataset.video, this.dataset.title); |
|
}); |
|
|
|
videoCard.querySelector('.favorite-btn').addEventListener('click', function() { |
|
toggleVideoFavorite(this.dataset.video, this.dataset.title); |
|
this.querySelector('i').classList.toggle('far'); |
|
this.querySelector('i').classList.toggle('fas'); |
|
this.querySelector('i').classList.toggle('text-red-500'); |
|
}); |
|
}); |
|
} |
|
|
|
|
|
function renderPDFContent() { |
|
pdfGrid.innerHTML = ''; |
|
|
|
if (state.pdfs.length === 0) { |
|
pdfGrid.innerHTML = ` |
|
<div class="col-span-full flex items-center justify-center h-32 text-gray-400"> |
|
Nenhum conteúdo PDF disponível |
|
</div> |
|
`; |
|
return; |
|
} |
|
|
|
state.pdfs.forEach(pdf => { |
|
const isFavorite = state.favorites.pdfs.includes(pdf.pdf); |
|
|
|
const pdfCard = document.createElement('div'); |
|
pdfCard.className = 'bg-gray-800 rounded-lg overflow-hidden hover:scale-105 transition-transform duration-200'; |
|
pdfCard.innerHTML = ` |
|
<div class="relative"> |
|
<img src="${pdf.imagem}" alt="${pdf.titulo}" class="w-full h-40 object-cover"> |
|
<button class="view-pdf-btn absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 opacity-0 hover:opacity-100 transition-opacity duration-200" data-pdf="${pdf.pdf}" data-title="${pdf.titulo}"> |
|
<i class="fas fa-eye text-white text-3xl"></i> |
|
</button> |
|
<button class="favorite-pdf-btn absolute top-2 right-2 text-white bg-black bg-opacity-60 rounded-full p-2" data-pdf="${pdf.pdf}" data-title="${pdf.titulo}"> |
|
<i class="${isFavorite ? 'fas' : 'far'} fa-heart ${isFavorite ? 'text-red-500' : ''}"></i> |
|
</button> |
|
</div> |
|
<div class="p-3"> |
|
<h3 class="font-medium truncate">${pdf.titulo}</h3> |
|
<p class="text-gray-400 text-sm mt-1">${pdf.categoria}</p> |
|
</div> |
|
`; |
|
|
|
pdfGrid.appendChild(pdfCard); |
|
|
|
|
|
pdfCard.querySelector('.view-pdf-btn').addEventListener('click', function() { |
|
openPdfModal(this.dataset.pdf, this.dataset.title); |
|
}); |
|
|
|
pdfCard.querySelector('.favorite-pdf-btn').addEventListener('click', function() { |
|
togglePdfFavorite(this.dataset.pdf, this.dataset.title); |
|
this.querySelector('i').classList.toggle('far'); |
|
this.querySelector('i').classList.toggle('fas'); |
|
this.querySelector('i').classList.toggle('text-red-500'); |
|
}); |
|
}); |
|
} |
|
|
|
|
|
function openVideoModal(videoUrl, title) { |
|
|
|
let embedUrl = videoUrl; |
|
if (videoUrl.includes('youtube.com') || videoUrl.includes('youtu.be')) { |
|
embedUrl = videoUrl.replace(/(youtube\.com\/watch\?v=|youtu\.be\/)/, 'youtube.com/embed/'); |
|
embedUrl += '?autoplay=1&controls=0&modestbranding=1&rel=0&showinfo=0'; |
|
} |
|
|
|
videoPlayer.src = embedUrl; |
|
videoModalTitle.textContent = title; |
|
videoModal.classList.remove('hidden'); |
|
|
|
|
|
const isFavorite = state.favorites.videos.includes(videoUrl); |
|
toggleFavorite.innerHTML = ` |
|
<i class="${isFavorite ? 'fas' : 'far'} fa-heart ${isFavorite ? 'text-red-500' : ''}"></i> |
|
<span class="ml-1">${isFavorite ? 'Remover dos' : 'Adicionar aos'} favoritos</span> |
|
`; |
|
|
|
|
|
toggleFavorite.onclick = () => { |
|
toggleVideoFavorite(videoUrl, title); |
|
const newIsFavorite = state.favorites.videos.includes(videoUrl); |
|
toggleFavorite.innerHTML = ` |
|
<i class="${newIsFavorite ? 'fas' : 'far'} fa-heart ${newIsFavorite ? 'text-red-500' : ''}"></i> |
|
<span class="ml-1">${newIsFavorite ? 'Remover dos' : 'Adicionar aos'} favoritos</span> |
|
`; |
|
}; |
|
} |
|
|
|
|
|
function openPdfModal(pdfUrl, title) { |
|
pdfViewer.src = pdfUrl; |
|
pdfModalTitle.textContent = title; |
|
pdfModal.classList.remove('hidden'); |
|
|
|
|
|
const isFavorite = state.favorites.pdfs.includes(pdfUrl); |
|
togglePdfFavorite.innerHTML = ` |
|
<i class="${isFavorite ? 'fas' : 'far'} fa-heart ${isFavorite ? 'text-red-500' : ''}"></i> |
|
<span class="ml-1">${isFavorite ? 'Remover dos' : 'Adicionar aos'} favoritos</span> |
|
`; |
|
|
|
|
|
togglePdfFavorite.onclick = () => { |
|
togglePdfFavorite(pdfUrl, title); |
|
const newIsFavorite = state.favorites.pdfs.includes(pdfUrl); |
|
togglePdfFavorite.innerHTML = ` |
|
<i class="${newIsFavorite ? 'fas' : 'far'} fa-heart ${newIsFavorite ? 'text-red-500' : ''}"></i> |
|
<span class="ml-1">${newIsFavorite ? 'Remover dos' : 'Adicionar aos'} favoritos</span> |
|
`; |
|
}; |
|
} |
|
|
|
|
|
function toggleVideoFavorite(videoUrl, title) { |
|
const index = state.favorites.videos.indexOf(videoUrl); |
|
|
|
if (index === -1) { |
|
state.favorites.videos.push(videoUrl); |
|
} else { |
|
state.favorites.videos.splice(index, 1); |
|
} |
|
|
|
localStorage.setItem('favorites', JSON.stringify(state.favorites)); |
|
} |
|
|
|
|
|
function togglePdfFavorite(pdfUrl, title) { |
|
const index = state.favorites.pdfs.indexOf(pdfUrl); |
|
|
|
if (index === -1) { |
|
state.favorites.pdfs.push(pdfUrl); |
|
} else { |
|
state.favorites.pdfs.splice(index, 1); |
|
} |
|
|
|
localStorage.setItem('favorites', JSON.stringify(state.favorites)); |
|
} |
|
|
|
|
|
function showFavorites() { |
|
const favoriteVideos = state.videos.filter(video => state.favorites.videos.includes(video.video)); |
|
const favoritePDFs = state.pdfs.filter(pdf => state.favorites.pdfs.includes(pdf.pdf)); |
|
|
|
|
|
const modal = document.createElement('div'); |
|
modal.className = 'fixed inset-0 bg-black bg-opacity-90 z-50 flex items-center justify-center p-4'; |
|
modal.innerHTML = ` |
|
<div class="bg-gray-800 rounded-lg p-6 max-w-4xl w-full max-h-[90vh] overflow-y-auto"> |
|
<div class="flex justify-between items-center mb-6"> |
|
<h2 class="text-2xl font-bold">Meus Favoritos</h2> |
|
<button id="closeFavoritesModal" class="text-gray-400 hover:text-white"> |
|
<i class="fas fa-times"></i> |
|
</button> |
|
</div> |
|
|
|
<div class="space-y-8"> |
|
<div> |
|
<h3 class="text-xl font-bold mb-4">Vídeos Favoritos</h3> |
|
${favoriteVideos.length > 0 ? ` |
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
|
${favoriteVideos.map(video => ` |
|
<div class="bg-gray-700 rounded-lg overflow-hidden"> |
|
<div class="relative"> |
|
<img src="${video.imagem}" alt="${video.titulo}" class="w-full h-28 object-cover"> |
|
<button class="play-btn absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 opacity-0 hover:opacity-100 transition-opacity duration-200" data-video="${video.video}" data-title="${video.titulo}"> |
|
<i class="fas fa-play text-white text-3xl"></i> |
|
</button> |
|
</div> |
|
<div class="p-3"> |
|
<h3 class="font-medium truncate">${video.titulo}</h3> |
|
</div> |
|
</div> |
|
`).join('')} |
|
</div> |
|
` : ` |
|
<p class="text-gray-400">Nenhum vídeo favoritado</p> |
|
`} |
|
</div> |
|
|
|
<div> |
|
<h3 class="text-xl font-bold mb-4">PDFs Favoritos</h3> |
|
${favoritePDFs.length > 0 ? ` |
|
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
|
${favoritePDFs.map(pdf => ` |
|
<div class="bg-gray-700 rounded-lg overflow-hidden"> |
|
<div class="relative"> |
|
<img src="${pdf.imagem}" alt="${pdf.titulo}" class="w-full h-28 object-cover"> |
|
<button class="view-pdf-btn absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 opacity-0 hover:opacity-100 transition-opacity duration-200" data-pdf="${pdf.pdf}" data-title="${pdf.titulo}"> |
|
<i class="fas fa-eye text-white text-3xl"></i> |
|
</button> |
|
</div> |
|
<div class="p-3"> |
|
<h3 class="font-medium truncate">${pdf.titulo}</h3> |
|
</div> |
|
</div> |
|
`).join('')} |
|
</div> |
|
` : ` |
|
<p class="text-gray-400">Nenhum PDF favoritado</p> |
|
`} |
|
</div> |
|
</div> |
|
</div> |
|
`; |
|
|
|
document.body.appendChild(modal); |
|
|
|
|
|
modal.querySelector('#closeFavoritesModal').addEventListener('click', () => { |
|
modal.remove(); |
|
}); |
|
|
|
|
|
modal.querySelectorAll('.play-btn').forEach(btn => { |
|
btn.addEventListener('click', function() { |
|
modal.remove(); |
|
openVideoModal(this.dataset.video, this.dataset.title); |
|
}); |
|
}); |
|
|
|
|
|
modal.querySelectorAll('.view-pdf-btn').forEach(btn => { |
|
btn.addEventListener('click', function() { |
|
modal.remove(); |
|
openPdfModal(this.dataset.pdf, this.dataset.title); |
|
}); |
|
}); |
|
} |
|
|
|
|
|
document.addEventListener('DOMContentLoaded', init); |
|
</script> |
|
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=thigas88/vaquinha" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
|
</html> |