Spaces:
Running
Running
Download index.html from AliRashidiyan/wordpress: direct link, hf CLI and curl.
- Browser
- Download file 80.1 kB
-
https://huggingface.co/spaces/AliRashidiyan/wordpress/resolve/main/index.html
- Command line
-
hf download hf://spaces/AliRashidiyan/wordpress/index.html
-
curl -L -o index.html https://huggingface.co/spaces/AliRashidiyan/wordpress/resolve/main/index.html
80.1 kB
<!DOCTYPE html>
<html lang="Fa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Podcast Platform</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
50: '#fff7ed',
100: '#ffedd5',
200: '#fed7aa',
300: '#fdba74',
400: '#fb923c',
500: '#f97316',
600: '#ea580c',
700: '#c2410c',
800: '#9a3412',
900: '#7c2d12',
},
cream: {
50: '#fefaf6',
100: '#fdf4ec',
200: '#fbe9d9',
300: '#f9dfc5',
400: '#f7d4b2',
500: '#f5c99f',
600: '#f3bf8b',
700: '#f1b478',
800: '#efaa64',
900: '#ed9f51',
}
}
}
}
}
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom styles */
.podcast-player {
background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}
.episode-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.book-card:hover {
transform: rotate(2deg) scale(1.02);
}
.waveform {
background: repeating-linear-gradient(
90deg,
#f5c99f,
#f5c99f 2px,
transparent 2px,
transparent 4px
);
background-size: 200% 100%;
animation: wave 2s linear infinite;
}
@keyframes wave {
0% { background-position: 0 0; }
100% { background-position: -20px 0; }
}
.playing .waveform {
animation: wave 0.5s linear infinite;
}
body {
background-color: #fefaf6;
}
.bg-gradient-orange {
background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}
.bg-cream {
background-color: #fefaf6;
}
.bg-light-cream {
background-color: #fff7ed;
}
.text-orange {
color: #f97316;
}
.border-orange {
border-color: #f97316;
}
.bg-orange {
background-color: #f97316;
}
.hover\:bg-orange:hover {
background-color: #ea580c;
}
.accent-orange {
accent-color: #f97316;
}
</style>
</head>
<body class="bg-cream font-sans">
<!-- Backend Simulation -->
<script>
// Database simulation
const db = {
users: [
{ id: 1, name: "Admin", email: "admin@podcast.com", password: "admin123", role: "admin" },
{ id: 2, name: "John Doe", email: "john@example.com", password: "password123", role: "user" }
],
episodes: [
{
id: 1,
title: "The Future of AI in Business",
description: "Exploring how artificial intelligence is transforming modern businesses and what it means for entrepreneurs.",
duration: 1860,
episodeNumber: 42,
audioFile: "episode1.mp3",
coverImage: "https://images.unsplash.com/photo-1620712943543-bcc4688e7485?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
book: 1,
publishDate: "2023-05-15",
listens: 1245,
tags: ["technology", "business", "AI"]
},
{
id: 2,
title: "Mastering Productivity",
description: "Learn the secrets of highly productive people and how to implement these strategies in your daily life.",
duration: 2340,
episodeNumber: 41,
audioFile: "episode2.mp3",
coverImage: "https://images.unsplash.com/photo-1541462608143-67571c6738dd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
book: 2,
publishDate: "2023-05-01",
listens: 987,
tags: ["productivity", "self-improvement"]
},
{
id: 3,
title: "Financial Freedom Blueprint",
description: "A step-by-step guide to achieving financial independence through smart investing and budgeting.",
duration: 1980,
episodeNumber: 40,
audioFile: "episode3.mp3",
coverImage: "https://images.unsplash.com/photo-1554224155-6726b3ff858f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
book: 3,
publishDate: "2023-04-20",
listens: 1562,
tags: ["finance", "investing"]
}
],
books: [
{
id: 1,
title: "AI Superpowers",
author: "Kai-Fu Lee",
description: "China, Silicon Valley, and the New World Order",
coverImage: "https://images.unsplash.com/photo-1589998059171-988d887df646?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
category: "technology",
publishDate: "2023-01-10"
},
{
id: 2,
title: "Atomic Habits",
author: "James Clear",
description: "An Easy & Proven Way to Build Good Habits & Break Bad Ones",
coverImage: "https://images.unsplash.com/photo-1544947950-fa07a98d237f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
category: "productivity",
publishDate: "2023-02-15"
},
{
id: 3,
title: "The Psychology of Money",
author: "Morgan Housel",
description: "Timeless lessons on wealth, greed, and happiness",
coverImage: "https://images.unsplash.com/photo-1601597111158-2fceff292cdb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80",
category: "finance",
publishDate: "2023-03-05"
}
],
subscriptions: [
{ id: 1, email: "subscriber@example.com", createdAt: "2023-01-01", isActive: true }
],
contacts: [
{
id: 1,
name: "Jane Smith",
email: "jane@example.com",
subject: "Question about episode",
message: "I loved your recent episode about productivity. Do you have any additional resources?",
createdAt: "2023-05-10",
status: "responded"
}
]
};
// JWT simulation
let currentToken = null;
// API simulation
const api = {
// Auth endpoints
login: (email, password) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const user = db.users.find(u => u.email === email && u.password === password);
if (user) {
currentToken = `mock-jwt-token-${user.id}`;
resolve({
success: true,
token: currentToken,
user: { id: user.id, name: user.name, email: user.email, role: user.role }
});
} else {
reject({ success: false, message: "Invalid credentials" });
}
}, 500);
});
},
logout: () => {
return new Promise((resolve) => {
setTimeout(() => {
currentToken = null;
resolve({ success: true });
}, 300);
});
},
getCurrentUser: () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (!currentToken) {
reject({ success: false, message: "Not authenticated" });
return;
}
const userId = parseInt(currentToken.split('-').pop());
const user = db.users.find(u => u.id === userId);
if user) {
resolve({
success: true,
user: { id: user.id, name: user.name, email: user.email, role: user.role }
});
} else {
reject({ success: false, message: "User not found" });
}
}, 300);
});
},
// Episode endpoints
getEpisodes: () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
success: true,
data: db.episodes.map(episode => ({
...episode,
book: db.books.find(b => b.id === episode.book)
}))
});
}, 600);
});
},
getEpisode: (id) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const episode = db.episodes.find(e => e.id === id);
if (episode) {
resolve({
success: true,
data: {
...episode,
book: db.books.find(b => b.id === episode.book)
}
});
} else {
reject({ success: false, message: "Episode not found" });
}
}, 400);
});
},
incrementListens: (id) => {
return new Promise((resolve) => {
setTimeout(() => {
const episode = db.episodes.find(e => e.id === id);
if (episode) {
episode.listens++;
}
resolve({ success: true });
}, 300);
});
},
// Book endpoints
getBooks: () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({ success: true, data: db.books });
}, 500);
});
},
getBook: (id) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const book = db.books.find(b => b.id === id);
if (book) {
resolve({ success: true, data: book });
} else {
reject({ success: false, message: "Book not found" });
}
}, 400);
});
},
// Subscription endpoints
subscribe: (email) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const existing = db.subscriptions.find(s => s.email === email);
if (existing) {
if (existing.isActive) {
reject({ success: false, message: "Email is already subscribed" });
} else {
existing.isActive = true;
resolve({ success: true, data: existing });
}
} else {
const newSub = {
id: db.subscriptions.length + 1,
email,
createdAt: new Date().toISOString(),
isActive: true
};
db.subscriptions.push(newSub);
resolve({ success: true, data: newSub });
}
}, 500);
});
},
unsubscribe: (email) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const subscription = db.subscriptions.find(s => s.email === email);
if (!subscription) {
reject({ success: false, message: "Email is not subscribed" });
} else {
subscription.isActive = false;
resolve({ success: true, data: subscription });
}
}, 500);
});
},
// Contact endpoints
submitContact: (formData) => {
return new Promise((resolve) => {
setTimeout(() => {
const newContact = {
id: db.contacts.length + 1,
...formData,
createdAt: new Date().toISOString(),
status: "pending"
};
db.contacts.push(newContact);
// Simulate email sending
console.log(`Email sent to admin about new contact from ${formData.name}`);
resolve({ success: true, data: newContact });
}, 700);
});
}
};
// Frontend state management
const state = {
currentUser: null,
currentEpisode: null,
isPlaying: false,
currentTime: 0,
volume: 0.7
};
// Audio simulation
const audio = {
play: () => {
state.isPlaying = true;
console.log("Playing audio:", state.currentEpisode?.title);
updateUI();
},
pause: () => {
state.isPlaying = false;
console.log("Paused audio");
updateUI();
},
setCurrentTime: (time) => {
state.currentTime = time;
updateUI();
},
setVolume: (vol) => {
state.volume = vol;
updateUI();
}
};
</script>
<!-- Frontend UI -->
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-podcast text-orange text-2xl"></i>
<h1 class="text-xl font-bold text-gray-800">Multi-Topic</h1>
</div>
<nav class="hidden md:flex space-x-8">
<a href="#home" class="text-gray-700 hover:text-orange font-medium">Home</a>
<a href="#episodes" class="text-gray-700 hover:text-orange font-medium">Episodes</a>
<a href="#books" class="text-gray-700 hover:text-orange font-medium">Books</a>
<a href="#about" class="text-gray-700 hover:text-orange font-medium">About</a>
<a href="#contact" class="text-gray-700 hover:text-orange font-medium">Contact</a>
</nav>
<div class="flex items-center space-x-4">
<button id="loginBtn" class="px-4 py-2 text-orange font-medium hover:bg-orange-50 rounded-lg">
Login
</button>
<button id="signupBtn" class="px-4 py-2 bg-orange text-white font-medium hover:bg-orange-700 rounded-lg">
Sign Up
</button>
<div id="userMenu" class="hidden items-center space-x-2">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="User" class="w-8 h-8 rounded-full">
<span id="usernameDisplay" class="font-medium"></span>
</div>
</div>
<button id="mobileMenuBtn" class="md:hidden text-gray-700">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
<!-- Mobile menu -->
<div id="mobileMenu" class="hidden md:hidden bg-white border-t">
<div class="container mx-auto px-4 py-3 flex flex-col space-y-3">
<a href="#home" class="text-gray-700 hover:text-orange font-medium">Home</a>
<a href="#episodes" class="text-gray-700 hover:text-orange font-medium">Episodes</a>
<a href="#books" class="text-gray-700 hover:text-orange font-medium">Books</a>
<a href="#about" class="text-gray-700 hover:text-orange font-medium">About</a>
<a href="#contact" class="text-gray-700 hover:text-orange font-medium">Contact</a>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-grow">
<!-- Hero Section -->
<section id="home" class="py-16 md:py-24 bg-gradient-orange">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row items-center">
<div class="md:w-1/2 mb-10 md:mb-0">
<h2 class="text-4xl md:text-5xl font-bold text-gray-800 mb-4">
Multi-Topic Podcast
</h2>
<p class="text-lg text-gray-700 mb-8">
با مولتی تاپیک میتونی خلاصه کتابهای حوزه کسب و کار رو گوش بدی تا از دانش روز، عقب نمونی
</p>
<div class="flex space-x-4">
<button id="exploreEpisodesBtn" class="px-6 py-3 bg-orange text-white font-medium rounded-lg hover:bg-orange-700">
Browse Episodes
</button>
<button id="subscribeBtn" class="px-6 py-3 border border-orange text-orange font-medium rounded-lg hover:bg-orange-50">
Subscribe
</button>
</div>
</div>
<div class="md:w-1/2 flex justify-center">
<div class="relative w-full max-w-md">
<div class="absolute -top-6 -left-6 w-64 h-64 bg-orange-200 rounded-2xl opacity-30"></div>
<div class="absolute -bottom-6 -right-6 w-64 h-64 bg-orange-300 rounded-2xl opacity-30"></div>
<img src="https://images.unsplash.com/photo-1593697909683-bccb1b9e68a4?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80"
alt="Podcast" class="relative rounded-2xl shadow-xl w-full">
</div>
</div>
</div>
</div>
</section>
<!-- Featured Episodes -->
<section id="episodes" class="py-16 bg-light-cream">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center mb-10">
<h2 class="text-3xl font-bold text-gray-800">Latest Episodes</h2>
<a href="#all-episodes" class="text-orange font-medium hover:underline">View All</a>
</div>
<div id="episodesContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Episodes will be loaded here -->
</div>
</div>
</section>
<!-- Featured Books -->
<section id="books" class="py-16 bg-cream">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center mb-10">
<h2 class="text-3xl font-bold text-gray-800">Featured Books</h2>
<a href="#all-books" class="text-orange font-medium hover:underline">View All</a>
</div>
<div id="booksContainer" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8">
<!-- Books will be loaded here -->
</div>
</div>
</section>
<!-- About Section -->
<section id="about" class="py-16 bg-light-cream">
<div class="container mx-auto px-4">
<div class="max-w-3xl mx-auto text-center">
<h2 class="text-3xl font-bold text-gray-800 mb-6">About Multi Topic</h2>
<p class="text-lg text-gray-600 mb-8">
توی مولتی تاپیک ما هر دو هفته یه کتاب در حوزه کسب و کار رو خلاصه میکنیم و از طریق پلتفرم های مختلف، در اختیارتون قرار میدیم. برای همین زمان خوبیه که اگه وقت خوندن کتاب رو نداری یا به کتابی دسترسی نداری، ما رو دنبال کنی تا هر روز خودت رو در شغلت ارتقا ببخشی و یه محیط سالم و امن برای خودت و همکارات بسازی
</p>
<div class="flex justify-center space-x-6">
<div class="text-center">
<div class="text-4xl font-bold text-orange mb-2">19</div>
<div class="text-gray-600">Episodes</div>
</div>
<div class="text-center">
<div class="text-4xl font-bold text-orange mb-2">16</div>
<div class="text-gray-600">Books</div>
</div>
<div class="text-center">
<div class="text-4xl font-bold text-orange mb-2">2K+</div>
<div class="text-gray-600">Listeners</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="py-16 bg-cream">
<div class="container mx-auto px-4">
<div class="max-w-4xl mx-auto">
<h2 class="text-3xl font-bold text-gray-800 mb-10 text-center">Get In Touch</h2>
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="md:flex">
<div class="md:w-1/2 bg-orange text-white p-10">
<h3 class="text-2xl font-bold mb-4">Contact Information</h3>
<p class="mb-8">Fill out the form and our team will get back to you within 24 hours.</p>
<div class="space-y-6">
<div class="flex items-start space-x-4">
<i class="fas fa-envelope mt-1"></i>
<div>
<h4 class="font-medium">Email Us</h4>
<p class="text-orange-100">Ali.Rashidiyan.id@gmail.com</p>
</div>
</div>
<div class="flex items-start space-x-4">
<i class="fas fa-phone-alt mt-1"></i>
<div>
<h4 class="font-medium">Call Us</h4>
<p class="text-orange-100">+98 9396533568</p>
</div>
</div>
<div class="flex items-start space-x-4">
<i class="fas fa-map-marker-alt mt-1"></i>
<div>
<h4 class="font-medium">Visit Us</h4>
<p class="text-orange-100">Iran, Tehran</p>
</div>
</div>
</div>
</div>
<div class="md:w-1/2 p-10">
<form id="contactForm">
<div class="mb-6">
<label for="name" class="block text-gray-700 font-medium mb-2">Name</label>
<input type="text" id="name" name="name" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="email" class="block text-gray-700 font-medium mb-2">Email</label>
<input type="email" id="email" name="email" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="subject" class="block text-gray-700 font-medium mb-2">Subject</label>
<input type="text" id="subject" name="subject" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="message" class="block text-gray-700 font-medium mb-2">Message</label>
<textarea id="message" name="message" rows="4" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange"></textarea>
</div>
<button type="submit" class="w-full py-3 bg-orange text-white font-medium rounded-lg hover:bg-orange-700">
Send Message
</button>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="bg-gray-900 text-white py-12">
<div class="grid grid-cols-1 md:grid-cols-4 gap-10 container mx-auto px-4">
<div>
<div class="flex items-center space-x-2 mb-4">
<i class="fas fa-podcast text-orange-400 text-2xl"></i>
<h3 class="text-xl font-bold">Multi-Topic</h3>
</div>
<p class="text-gray-400 mb-4">
</p>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-white">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white">
<i class="fab fa-twitter"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white">
<i class="fab fa-instagram"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white">
<i class="fab fa-spotify"></i>
</a>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Quick Links</h4>
<ul class="space-y-2">
<li><a href="#home" class="text-gray-400 hover:text-white">Home</a></li>
<li><a href="#episodes" class="text-gray-400 hover:text-white">Episodes</a></li>
<li><a href="#books" class="text-gray-400 hover:text-white">Books</a></li>
<li><a href="#about" class="text-gray-400 hover:text-white">About</a></li>
<li><a href="#contact" class="text-gray-400 hover:text-white">Contact</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Categories</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">Business</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Technology</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Productivity</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Marketing</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Finance</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Newsletter</h4>
<p class="text-gray-400 mb-4">
Subscribe to our newsletter to get the latest episodes and book recommendations.
</p>
<form id="newsletterForm" class="flex">
<input type="email" placeholder="Your email" required
class="px-4 py-2 bg-gray-800 text-white rounded-l-lg focus:outline-none focus:ring-1 focus:ring-orange w-full">
<button type="submit" class="px-4 py-2 bg-orange text-white rounded-r-lg hover:bg-orange-700">
<i class="fas fa-paper-plane"></i>
</button>
</form>
</div>
</div>
<div class="border-t border-gray-800 mt-10 pt-6 flex flex-col md:flex-row justify-between items-center container mx-auto px-4">
<p class="text-gray-400 text-sm">
© 2023 Multi-Topic. All rights reserved.
</p>
<div class="flex space-x-6 mt-4 md:mt-0">
<a href="#" class="text-gray-400 hover:text-white text-sm">Privacy Policy</a>
<a href="#" class="text-gray-400 hover:text-white text-sm">Terms of Service</a>
<a href="#" class="text-gray-400 hover:text-white text-sm">Cookies</a>
</div>
</div>
</footer>
<!-- Player Bar -->
<div id="playerBar" class="fixed bottom-0 left-0 right-0 bg-white shadow-lg border-t border-gray-200 transform translate-y-full transition-transform duration-300">
<div class="container mx-auto px-4 py-3">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4 w-1/4">
<img id="playerThumbnail" src="" alt="Episode" class="w-12 h-12 rounded-lg object-cover">
<div>
<div id="playerTitle" class="font-medium text-gray-800 truncate">No episode selected</div>
<div id="playerAuthor" class="text-sm text-gray-500">Multi-Topic</div>
</div>
</div>
<div class="flex items-center space-x-6 w-2/4">
<button id="prevBtn" class="text-gray-600 hover:text-orange">
<i class="fas fa-step-backward"></i>
</button>
<button id="playPauseBtn" class="w-10 h-10 bg-orange text-white rounded-full flex items-center justify-center hover:bg-orange-700">
<i id="playPauseIcon" class="fas fa-play"></i>
</button>
<button id="nextBtn" class="text-gray-600 hover:text-orange">
<i class="fas fa-step-forward"></i>
</button>
</div>
<div class="flex items-center space-x-4 w-1/4 justify-end">
<div class="flex items-center space-x-2">
<button id="volumeDownBtn" class="text-gray-600 hover:text-orange">
<i class="fas fa-volume-down"></i>
</button>
<input id="volumeSlider" type="range" min="0" max="1" step="0.1" value="0.7"
class="w-20 accent-orange">
<button id="volumeUpBtn" class="text-gray-600 hover:text-orange">
<i class="fas fa-volume-up"></i>
</button>
</div>
<div class="hidden md:flex items-center space-x-2">
<span id="currentTime" class="text-sm text-gray-600">0:00</span>
<div class="w-32 h-1 bg-gray-200 rounded-full overflow-hidden">
<div id="progressBar" class="h-full bg-orange" style="width: 0%"></div>
</div>
<span id="duration" class="text-sm text-gray-600">0:00</span>
</div>
</div>
</div>
</div>
</div>
<!-- Login Modal -->
<div id="loginModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md overflow-hidden">
<div class="flex justify-between items-center bg-gray-100 px-6 py-4">
<h3 class="text-xl font-bold text-gray-800">Login</h3>
<button id="closeLoginModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<form id="loginForm">
<div class="mb-6">
<label for="loginEmail" class="block text-gray-700 font-medium mb-2">Email</label>
<input type="email" id="loginEmail" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="loginPassword" class="block text-gray-700 font-medium mb-2">Password</label>
<input type="password" id="loginPassword" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="flex items-center justify-between mb-6">
<div class="flex items-center">
<input type="checkbox" id="rememberMe" class="w-4 h-4 text-orange rounded border-gray-300 focus:ring-orange">
<label for="rememberMe" class="ml-2 text-gray-700">Remember me</label>
</div>
<a href="#" class="text-orange hover:underline">Forgot password?</a>
</div>
<button type="submit" class="w-full py-3 bg-orange text-white font-medium rounded-lg hover:bg-orange-700 mb-4">
Login
</button>
<div class="text-center text-gray-600">
Don't have an account? <button id="switchToSignup" class="text-orange hover:underline">Sign up</button>
</div>
</form>
</div>
</div>
</div>
<!-- Signup Modal -->
<div id="signupModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md overflow-hidden">
<div class="flex justify-between items-center bg-gray-100 px-6 py-4">
<h3 class="text-xl font-bold text-gray-800">Create Account</h3>
<button id="closeSignupModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<form id="signupForm">
<div class="mb-6">
<label for="signupName" class="block text-gray-700 font-medium mb-2">Full Name</label>
<input type="text" id="signupName" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="signupEmail" class="block text-gray-700 font-medium mb-2">Email</label>
<input type="email" id="signupEmail" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="signupPassword" class="block text-gray-700 font-medium mb-2">Password</label>
<input type="password" id="signupPassword" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="mb-6">
<label for="signupConfirmPassword" class="block text-gray-700 font-medium mb-2">Confirm Password</label>
<input type="password" id="signupConfirmPassword" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<div class="flex items-center mb-6">
<input type="checkbox" id="agreeTerms" required
class="w-4 h-4 text-orange rounded border-gray-300 focus:ring-orange">
<label for="agreeTerms" class="ml-2 text-gray-700">
I agree to the <a href="#" class="text-orange hover:underline">Terms of Service</a> and
<a href="#" class="text-orange hover:underline">Privacy Policy</a>
</label>
</div>
<button type="submit" class="w-full py-3 bg-orange text-white font-medium rounded-lg hover:bg-orange-700 mb-4">
Create Account
</button>
<div class="text-center text-gray-600">
Already have an account? <button id="switchToLogin" class="text-orange hover:underline">Login</button>
</div>
</form>
</div>
</div>
</div>
<!-- Episode Modal -->
<div id="episodeModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden overflow-y-auto">
<div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="flex justify-between items-center bg-gray-100 px-6 py-4 sticky top-0">
<h3 class="text-xl font-bold text-gray-800">Episode Details</h3>
<button id="closeEpisodeModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<div id="episodeModalContent">
<!-- Content will be loaded here -->
</div>
</div>
</div>
</div>
<!-- Book Modal -->
<div id="bookModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden overflow-y-auto">
<div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="flex justify-between items-center bg-gray-100 px-6 py-4 sticky top-0">
<h3 class="text-xl font-bold text-gray-800">Book Details</h3>
<button id="closeBookModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<div id="bookModalContent">
<!-- Content will be loaded here -->
</div>
</div>
</div>
</div>
<!-- Subscribe Modal -->
<div id="subscribeModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl w-full max-w-md overflow-hidden">
<div class="flex justify-between items-center bg-gray-100 px-6 py-4">
<h3 class="text-xl font-bold text-gray-800">Subscribe to Newsletter</h3>
<button id="closeSubscribeModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<form id="subscribeForm">
<div class="mb-6">
<label for="subscribeEmail" class="block text-gray-700 font-medium mb-2">Email</label>
<input type="email" id="subscribeEmail" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange focus:border-orange">
</div>
<button type="submit" class="w-full py-3 bg-orange text-white font-medium rounded-lg hover:bg-orange-700">
Subscribe
</button>
</form>
</div>
</div>
</div>
<!-- Success Notification -->
<div id="successNotification" class="fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg flex items-center space-x-3 transform translate-x-full transition-transform duration-300 z-50">
<i class="fas fa-check-circle"></i>
<span id="successMessage">Operation completed successfully!</span>
</div>
<!-- Error Notification -->
<div id="errorNotification" class="fixed top-4 right-4 bg-red-500 text-white px-6 py-3 rounded-lg shadow-lg flex items-center space-x-3 transform translate-x-full transition-transform duration-300 z-50">
<i class="fas fa-exclamation-circle"></i>
<span id="errorMessage">An error occurred. Please try again.</span>
</div>
</div>
<!-- Frontend JavaScript -->
<script>
// DOM Elements
const loginBtn = document.getElementById('loginBtn');
const signupBtn = document.getElementById('signupBtn');
const userMenu = document.getElementById('userMenu');
const usernameDisplay = document.getElementById('usernameDisplay');
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
const mobileMenu = document.getElementById('mobileMenu');
const exploreEpisodesBtn = document.getElementById('exploreEpisodesBtn');
const subscribeBtn = document.getElementById('subscribeBtn');
const episodesContainer = document.getElementById('episodesContainer');
const booksContainer = document.getElementById('booksContainer');
const contactForm = document.getElementById('contactForm');
const newsletterForm = document.getElementById('newsletterForm');
const playerBar = document.getElementById('playerBar');
const playerThumbnail = document.getElementById('playerThumbnail');
const playerTitle = document.getElementById('playerTitle');
const playerAuthor = document.getElementById('playerAuthor');
const playPauseBtn = document.getElementById('playPauseBtn');
const playPauseIcon = document.getElementById('playPauseIcon');
const prevBtn = document.getElementById('prevBtn');
const nextBtn = document.getElementById('nextBtn');
const volumeSlider = document.getElementById('volumeSlider');
const volumeDownBtn = document.getElementById('volumeDownBtn');
const volumeUpBtn = document.getElementById('volumeUpBtn');
const currentTime = document.getElementById('currentTime');
const duration = document.getElementById('duration');
const progressBar = document.getElementById('progressBar');
const loginModal = document.getElementById('loginModal');
const closeLoginModal = document.getElementById('closeLoginModal');
const loginForm = document.getElementById('loginForm');
const loginEmail = document.getElementById('loginEmail');
const loginPassword = document.getElementById('loginPassword');
const signupModal = document.getElementById('signupModal');
const closeSignupModal = document.getElementById('closeSignupModal');
const signupForm = document.getElementById('signupForm');
const switchToSignup = document.getElementById('switchToSignup');
const switchToLogin = document.getElementById('switchToLogin');
const episodeModal = document.getElementById('episodeModal');
const closeEpisodeModal = document.getElementById('closeEpisodeModal');
const episodeModalContent = document.getElementById('episodeModalContent');
const bookModal = document.getElementById('bookModal');
const closeBookModal = document.getElementById('closeBookModal');
const bookModalContent = document.getElementById('bookModalContent');
const subscribeModal = document.getElementById('subscribeModal');
const closeSubscribeModal = document.getElementById('closeSubscribeModal');
const subscribeForm = document.getElementById('subscribeForm');
const successNotification = document.getElementById('successNotification');
const successMessage = document.getElementById('successMessage');
const errorNotification = document.getElementById('errorNotification');
const errorMessage = document.getElementById('errorMessage');
// Event Listeners
document.addEventListener('DOMContentLoaded', initApp);
loginBtn.addEventListener('click', openLoginModal);
signupBtn.addEventListener('click', openSignupModal);
mobileMenuBtn.addEventListener('click', toggleMobileMenu);
exploreEpisodesBtn.addEventListener('click', scrollToEpisodes);
subscribeBtn.addEventListener('click', openSubscribeModal);
closeLoginModal.addEventListener('click', closeLoginModalHandler);
closeSignupModal.addEventListener('click', closeSignupModalHandler);
closeEpisodeModal.addEventListener('click', closeEpisodeModalHandler);
closeBookModal.addEventListener('click', closeBookModalHandler);
closeSubscribeModal.addEventListener('click', closeSubscribeModalHandler);
switchToSignup.addEventListener('click', switchToSignupHandler);
switchToLogin.addEventListener('click', switchToLoginHandler);
loginForm.addEventListener('submit', handleLogin);
signupForm.addEventListener('submit', handleSignup);
contactForm.addEventListener('submit', handleContactSubmit);
newsletterForm.addEventListener('submit', handleNewsletterSubmit);
subscribeForm.addEventListener('submit', handleSubscribeSubmit);
playPauseBtn.addEventListener('click', togglePlayPause);
prevBtn.addEventListener('click', playPreviousEpisode);
nextBtn.addEventListener('click', playNextEpisode);
volumeSlider.addEventListener('input', updateVolume);
volumeDownBtn.addEventListener('click', decreaseVolume);
volumeUpBtn.addEventListener('click', increaseVolume);
// Initialize application
function initApp() {
// Check if user is logged in
api.getCurrentUser()
.then(response => {
state.currentUser = response.user;
updateUserUI();
})
.catch(() => {
// Not logged in
});
// Load episodes and books
loadEpisodes();
loadBooks();
}
// Load episodes from API
function loadEpisodes() {
api.getEpisodes()
.then(response => {
renderEpisodes(response.data);
})
.catch(error => {
showError(error.message || 'Failed to load episodes');
});
}
// Render episodes to the DOM
function renderEpisodes(episodes) {
episodesContainer.innerHTML = '';
episodes.forEach(episode => {
const durationMinutes = Math.floor(episode.duration / 60);
const durationSeconds = episode.duration % 60;
const formattedDuration = `${durationMinutes}:${durationSeconds.toString().padStart(2, '0')}`;
const episodeElement = document.createElement('div');
episodeElement.className = 'episode-card bg-white rounded-xl shadow-md overflow-hidden transition-transform duration-300';
episodeElement.innerHTML = `
<div class="relative">
<img src="${episode.coverImage}" alt="${episode.title}" class="w-full h-48 object-cover">
<div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black to-transparent p-4">
<span class="text-white text-sm font-medium">Episode ${episode.episodeNumber}</span>
</div>
</div>
<div class="p-6">
<div class="flex justify-between items-start mb-2">
<h3 class="text-xl font-bold text-gray-800">${episode.title}</h3>
<span class="text-gray-500 text-sm">${formattedDuration}</span>
</div>
<p class="text-gray-600 mb-4 line-clamp-2">${episode.description}</p>
<div class="flex justify-between items-center">
<div class="flex items-center space-x-1 text-gray-500">
<i class="fas fa-headphones"></i>
<span class="text-sm">${episode.listens}</span>
</div>
<button class="play-episode-btn px-4 py-2 bg-orange text-white rounded-lg hover:bg-orange-700"
data-id="${episode.id}">
<i class="fas fa-play mr-1"></i> Play
</button>
</div>
</div>
`;
episodesContainer.appendChild(episodeElement);
});
// Add event listeners to play buttons
document.querySelectorAll('.play-episode-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const episodeId = parseInt(e.currentTarget.getAttribute('data-id'));
playEpisode(episodeId);
});
});
}
// Load books from API
function loadBooks() {
api.getBooks()
.then(response => {
renderBooks(response.data);
})
.catch(error => {
showError(error.message || 'Failed to load books');
});
}
// Render books to the DOM
function renderBooks(books) {
booksContainer.innerHTML = '';
books.forEach(book => {
const bookElement = document.createElement('div');
bookElement.className = 'book-card bg-white rounded-xl shadow-md overflow-hidden transition-transform duration-300';
bookElement.innerHTML = `
<div class="relative">
<img src="${book.coverImage}" alt="${book.title}" class="w-full h-64 object-cover">
<div class="absolute inset-0 bg-gradient-to-t from-black via-transparent to-transparent opacity-0 hover:opacity-100 transition-opacity duration-300 flex items-end p-4">
<button class="view-book-btn px-4 py-2 bg-orange text-white rounded-lg hover:bg-orange-700"
data-id="${book.id}">
View Details
</button>
</div>
</div>
<div class="p-4">
<h3 class="text-lg font-bold text-gray-800 mb-1">${book.title}</h3>
<p class="text-gray-600 text-sm">by ${book.author}</p>
</div>
`;
booksContainer.appendChild(bookElement);
});
// Add event listeners to view buttons
document.querySelectorAll('.view-book-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const bookId = parseInt(e.currentTarget.getAttribute('data-id'));
viewBookDetails(bookId);
});
});
}
// Play episode
function playEpisode(episodeId) {
api.getEpisode(episodeId)
.then(response => {
const episode = response.data;
state.currentEpisode = episode;
// Update player UI
playerThumbnail.src = episode.coverImage;
playerTitle.textContent = episode.title;
playerAuthor.textContent = episode.book ? episode.book.title : 'Multi-Topic';
// Format duration
const durationMinutes = Math.floor(episode.duration / 60);
const durationSeconds = episode.duration % 60;
duration.textContent = `${durationMinutes}:${durationSeconds.toString().padStart(2, '0')}`;
// Show player
playerBar.classList.remove('translate-y-full');
playerBar.classList.add('translate-y-0');
// Play episode
audio.play();
// Increment listens
api.incrementListens(episodeId)
.then(() => {
// Update listens count in UI if needed
})
.catch(error => {
console.error 'Failed to increment listens:', error);
});
})
.catch(error => {
showError(error.message || 'Failed to play episode');
});
}
// Toggle play/pause
function togglePlayPause() {
if (!state.currentEpisode) return;
if (state.isPlaying) {
audio.pause();
} else {
audio.play();
}
}
// Play previous episode
function playPreviousEpisode() {
if (!state.currentEpisode) return;
const currentIndex = db.episodes.findIndex(e => e.id === state.currentEpisode.id);
if (currentIndex > 0) {
playEpisode(db.episodes[currentIndex - 1].id);
}
}
// Play next episode
function playNextEpisode() {
if (!state.currentEpisode) return;
const currentIndex = db.episodes.findIndex(e => e.id === state.currentEpisode.id);
if (currentIndex < db.episodes.length - 1) {
playEpisode(db.episodes[currentIndex + 1].id);
}
}
// Update volume
function updateVolume(e) {
const volume = parseFloat(e.target.value);
audio.setVolume(volume);
}
// Decrease volume
function decreaseVolume() {
const newVolume = Math.max(0, state.volume - 0.1);
volumeSlider.value = newVolume;
audio.setVolume(newVolume);
}
// Increase volume
function increaseVolume() {
const newVolume = Math.min(1, state.volume + 0.1);
volumeSlider.value = newVolume;
audio.setVolume(newVolume);
}
// View episode details
function viewEpisodeDetails(episodeId) {
api.getEpisode(episodeId)
.then(response => {
const episode = response.data;
// Format duration
const durationMinutes = Math.floor(episode.duration / 60);
const durationSeconds = episode.duration % 60;
const formattedDuration = `${durationMinutes}:${durationSeconds.toString().padStart(2, '0')}`;
// Format publish date
const publishDate = new Date(episode.publishDate);
const formattedDate = publishDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
// Create modal content
episodeModalContent.innerHTML = `
<div class="flex flex-col md:flex-row gap-6 mb-8">
<div class="md:w-1/3">
<img src="${episode.coverImage}" alt="${episode.title}" class="w-full rounded-lg shadow-md">
</div>
<div class="md:w-2/3">
<h3 class="text-2xl font-bold text-gray-800 mb-2">${episode.title}</h3>
<div class="flex items-center space-x-4 mb-4">
<span class="text-gray-600"><i class="fas fa-calendar-alt mr-1"></i> ${formattedDate}</span>
<span class="text-gray-600"><i class="fas fa-clock mr-1"></i> ${formattedDuration}</span>
<span class="text-gray-600"><i class="fas fa-headphones mr-1"></i> ${episode.listens} listens</span>
</div>
${episode.book ? `
<div class="mb-4">
<h4 class="text-sm font-semibold text-gray-500 uppercase mb-1">Featured Book</h4>
<div class="flex items-center space-x-3">
<img src="${episode.book.coverImage}" alt="${episode.book.title}" class="w-12 h-16 object-cover rounded">
<div>
<h5 class="font-medium text-gray-800">${episode.book.title}</h5>
<p class="text-sm text-gray-600">by ${episode.book.author}</p>
</div>
</div>
</div>
` : ''}
<div class="flex space-x-2 mb-6">
${episode.tags.map(tag => `
<span class="px-3 py-1 bg-orange-100 text-orange-800 text-xs font-medium rounded-full">${tag}</span>
`).join('')}
</div>
<button class="play-episode-modal-btn px-6 py-3 bg-orange text-white rounded-lg hover:bg-orange-700 w-full md:w-auto"
data-id="${episode.id}">
<i class="fas fa-play mr-2"></i> Play Episode
</button>
</div>
</div>
<div class="mb-8">
<h4 class="text-lg font-semibold text-gray-800 mb-3">Episode Description</h4>
<p class="text-gray-600 whitespace-pre-line">${episode.description}</p>
</div>
`;
// Add event listener to play button in modal
document.querySelector('.play-episode-modal-btn').addEventListener('click', (e) => {
const episodeId = parseInt(e.currentTarget.getAttribute('data-id'));
closeEpisodeModalHandler();
playEpisode(episodeId);
});
// Show modal
episodeModal.classList.remove('hidden');
})
.catch(error => {
showError(error.message || 'Failed to load episode details');
});
}
// View book details
function viewBookDetails(bookId) {
api.getBook(bookId)
.then(response => {
const book = response.data;
// Format publish date
const publishDate = new Date(book.publishDate);
const formattedDate = publishDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
// Create modal content
bookModalContent.innerHTML = `
<div class="flex flex-col md:flex-row gap-6 mb-8">
<div class="md:w-1/3">
<img src="${book.coverImage}" alt="${book.title}" class="w-full rounded-lg shadow-md">
</div>
<div class="md:w-2/3">
<h3 class="text-2xl font-bold text-gray-800 mb-2">${book.title}</h3>
<p class="text-gray-600 mb-4">by ${book.author}</p>
<div class="flex items-center space-x-4 mb-6">
<span class="px-3 py-1 bg-orange-100 text-orange-800 text-sm font-medium rounded-full">${book.category}</span>
<span class="text-gray-600"><i class="fas fa-calendar-alt mr-1"></i> Published ${formattedDate}</span>
</div>
<div class="mb-6">
<h4 class="text-lg font-semibold text-gray-800 mb-2">Description</h4>
<p class="text-gray-600">${book.description}</p>
</div>
<div class="flex space-x-3">
<button class="px-6 py-3 bg-orange text-white rounded-lg hover:bg-orange-700">
<i class="fas fa-shopping-cart mr-2"></i> Buy Now
</button>
<button class="px-6 py-3 border border-orange text-orange rounded-lg hover:bg-orange-50">
<i class="fas fa-book-open mr-2"></i> Preview
</button>
</div>
</div>
</div>
<div>
<h4 class="text-lg font-semibold text-gray-800 mb-4">Related Episodes</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
${db.episodes.filter(e => e.book === book.id).map(episode => `
<div class="flex items-center space-x-3 p-3 bg-gray-50 rounded-lg">
<img src="${episode.coverImage}" alt="${episode.title}" class="w-16 h-16 object-cover rounded">
<div>
<h5 class="font-medium text-gray-800">${episode.title}</h5>
<button class="play-related-episode-btn text-sm text-orange hover:underline mt-1"
data-id="${episode.id}">
<i class="fas fa-play mr-1"></i> Play Episode
</button>
</div>
</div>
`).join('')}
</div>
</div>
`;
// Add event listeners to play buttons for related episodes
document.querySelectorAll('.play-related-episode-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const episodeId = parseInt(e.currentTarget.getAttribute('data-id'));
closeBookModalHandler();
playEpisode(episodeId);
});
});
// Show modal
bookModal.classList.remove('hidden');
})
.catch(error => {
showError(error.message || 'Failed to load book details');
});
}
// Handle login
function handleLogin(e) {
e.preventDefault();
const email = loginEmail.value;
const password = loginPassword.value;
api.login(email, password)
.then(response => {
state.currentUser = response.user;
updateUserUI();
closeLoginModalHandler();
showSuccess('Logged in successfully');
})
.catch(error => {
showError(error.message || 'Login failed');
});
}
// Handle signup
function handleSignup(e) {
e.preventDefault();
// In a real app, you would validate passwords match, etc.
const name = document.getElementById('signupName').value;
const email = document.getElementById('signupEmail').value;
const password = document.getElementById('signupPassword').value;
// Simulate signup by adding to "database"
const newUser = {
id: db.users.length + 1,
name,
email,
password,
role: 'user'
};
db.users.push(newUser);
// Simulate login after signup
state.currentUser = { id: newUser.id, name: newUser.name, email: newUser.email, role: newUser.role };
currentToken = `mock-jwt-token-${newUser.id}`;
updateUserUI();
closeSignupModalHandler();
showSuccess('Account created successfully');
}
// Handle contact form submission
function handleContactSubmit(e) {
e.preventDefault();
const formData = {
name: document.getElementById('name').value,
email: document.getElementById('email').value,
subject: document.getElementById('subject').value,
message: document.getElementById('message').value
};
api.submitContact(formData)
.then(response => {
contactForm.reset();
showSuccess('Message sent successfully! We will get back to you soon.');
})
.catch(error => {
showError(error.message || 'Failed to send message');
});
}
// Handle newsletter subscription
function handleNewsletterSubmit(e) {
e.preventDefault();
const email = e.target.querySelector('input[type="email"]').value;
api.subscribe(email)
.then(response => {
newsletterForm.reset();
showSuccess('Thanks for subscribing to our newsletter!');
})
.catch(error => {
showError(error.message || 'Subscription failed');
});
}
// Handle subscribe modal submission
function handleSubscribeSubmit(e) {
e.preventDefault();
const email = document.getElementById('subscribeEmail').value;
api.subscribe(email)
.then(response => {
subscribeForm.reset();
closeSubscribeModalHandler();
showSuccess('Thanks for subscribing to our newsletter!');
})
.catch(error => {
showError(error.message || 'Subscription failed');
});
}
// Update user UI based on login state
function updateUserUI() {
if (state.currentUser) {
loginBtn.classList.add('hidden');
signupBtn.classList.add('hidden');
userMenu.classList.remove('hidden');
usernameDisplay.textContent = state.currentUser.name;
} else {
loginBtn.classList.remove('hidden');
signupBtn.classList.remove('hidden');
userMenu.classList.add('hidden');
}
}
// Update UI based on player state
function updateUI() {
// Update play/pause button
if (state.isPlaying) {
playPauseIcon.classList.remove('fa-play');
playPauseIcon.classList.add('fa-pause');
playerBar.classList.add('playing');
} else {
playPauseIcon.classList.remove('fa-pause');
playPauseIcon.classList.add('fa-play');
playerBar.classList.remove('playing');
}
// Update volume slider
volumeSlider.value = state.volume;
// Update progress bar (simulated)
if (state.currentEpisode && state.isPlaying) {
const progressPercent = (state.currentTime / state.currentEpisode.duration) * 100;
progressBar.style.width = `${progressPercent}%`;
// Format current time
const currentMinutes = Math.floor(state.currentTime / 60);
const currentSeconds = Math.floor(state.currentTime % 60);
currentTime.textContent = `${currentMinutes}:${currentSeconds.toString().padStart(2, '0')}`;
// Simulate progress
if (state.currentTime < state.currentEpisode.duration) {
state.currentTime += 1;
setTimeout(() => {
updateUI();
}, 1000);
} else {
state.isPlaying = false;
state.currentTime = 0;
}
}
}
// Modal handlers
function openLoginModal() {
loginModal.classList.remove('hidden');
}
function closeLoginModalHandler() {
loginModal.classList.add('hidden');
}
function openSignupModal() {
signupModal.classList.remove('hidden');
}
function closeSignupModalHandler() {
signupModal.classList.add('hidden');
}
function closeEpisodeModalHandler() {
episodeModal.classList.add('hidden');
}
function closeBookModalHandler() {
bookModal.classList.add('hidden');
}
function openSubscribeModal() {
subscribeModal.classList.remove('hidden');
}
function closeSubscribeModalHandler() {
subscribeModal.classList.add('hidden');
}
function switchToSignupHandler(e) {
e.preventDefault();
closeLoginModalHandler();
openSignupModal();
}
function switchToLoginHandler(e) {
e.preventDefault();
closeSignupModalHandler();
openLoginModal();
}
// Mobile menu toggle
function toggleMobileMenu() {
mobileMenu.classList.toggle('hidden');
}
// Scroll to episodes
function scrollToEpisodes() {
document.getElementById('episodes').scrollIntoView({ behavior: 'smooth' });
}
// Show success notification
function showSuccess(message) {
successMessage.textContent = message;
successNotification.classList.remove('translate-x-full');
successNotification.classList.add('translate-x-0');
setTimeout(() => {
successNotification.classList.remove('translate-x-0');
successNotification.classList.add('translate-x-full');
}, 3000);
}
// Show error notification
function showError(message) {
errorMessage.textContent = message;
errorNotification.classList.remove('translate-x-full');
errorNotification.classList.add('translate-x-0');
setTimeout(() => {
errorNotification.classList.remove('translate-x-0');
errorNotification.classList.add('translate-x-full');
}, 3000);
}
// Simulate audio progress
setInterval(() => {
if (state.isPlaying && state.currentEpisode) {
if (state.currentTime < state.currentEpisode.duration) {
state.currentTime += 1;
} else {
state.isPlaying = false;
state.currentTime = 0;
}
updateUI();
}
}, 1000);
</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=AliRashidiyan/wordpress" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>
<html lang="Fa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Podcast Platform</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
50: '#fff7ed',
100: '#ffedd5',
200: '#fed7aa',
300: '#fdba74',
400: '#fb923c',
500: '#f97316',
600: '#ea580c',
700: '#c2410c',
800: '#9a3412',
900: '#7c2d12',
},
cream: {
50: '#fefaf6',
100: '#fdf4ec',
200: '#fbe9d9',
300: '#f9dfc5',
400: '#f7d4b2',
500: '#f5c99f',
600: '#f3bf8b',
700: '#f1b478',
800: '#efaa64',
900: '#ed9f51',
}
}
}
}
}
</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom styles */
.podcast-player {
background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}
.episode-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.book-card:hover {
transform: rotate(2deg) scale(1.02);
}
.waveform {
background: repeating-linear-gradient(
90deg,
#f5c99f,
#f5c99f 2px,
transparent 2px,
transparent 4px
);
background-size: 200% 100%;
animation: wave 2s linear infinite;
}
@keyframes wave {
0% { background-position: 0 0; }
100% { background-position: -20px 0; }
}
.playing .waveform {
animation: wave 0.5s linear infinite;
}
body {
background-color: #fefaf6;
}
.bg-gradient-orange {
background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}
.bg-cream {
background-color: #fefaf6;
}
.bg-light-cream {
background-color: #fff7ed;
}
.text-orange {
color: #f97316;
}
.border-orange {
border-color: #f97316;
}
.bg-orange {
background-color: #f97316;
}
.hover\:bg-orange:hover {
background-color: #ea580c;
}
.accent-orange {
accent-color: #f97316;
}
</style>