karanpateldev / index.html
KaranPatelDev's picture
Add 2 files
4fed026 verified
Raw History Blame Contribute Delete
44.1 kB
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VideoHub - Watch and Share Videos</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">
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
primary: '#FF0000',
dark: {
900: '#0f0f0f',
800: '#181818',
700: '#202020',
600: '#282828',
}
}
}
}
}
</script>
<style>
.video-thumbnail {
transition: transform 0.2s;
}
.video-thumbnail:hover {
transform: scale(1.03);
}
.sidebar {
scrollbar-width: none;
}
.sidebar::-webkit-scrollbar {
display: none;
}
.comment-input:focus {
outline: none;
border-bottom: 2px solid #FF0000;
}
#videoPlayer {
aspect-ratio: 16/9;
width: 100%;
}
@media (max-width: 768px) {
#sidebar {
position: fixed;
top: 56px;
left: -100%;
width: 80%;
height: calc(100vh - 56px);
transition: all 0.3s;
z-index: 40;
}
#sidebar.active {
left: 0;
}
.overlay {
position: fixed;
top: 56px;
left: 0;
width: 100%;
height: calc(100vh - 56px);
background-color: rgba(0,0,0,0.5);
z-index: 30;
display: none;
}
.overlay.active {
display: block;
}
}
</style>
</head>
<body class="bg-gray-100 dark:bg-dark-900 text-gray-900 dark:text-gray-100 min-h-screen">
<!-- Header -->
<header class="sticky top-0 z-20 bg-white dark:bg-dark-800 shadow-sm">
<div class="flex items-center justify-between px-4 py-2">
<!-- Left section -->
<div class="flex items-center space-x-4">
<button id="menuBtn" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-bars text-xl"></i>
</button>
<a href="#" class="flex items-center">
<i class="fas fa-play-circle text-primary text-3xl mr-1"></i>
<span class="text-xl font-bold">VideoHub</span>
</a>
</div>
<!-- Center section - Search bar -->
<div class="hidden md:flex flex-1 max-w-2xl mx-4">
<div class="relative w-full">
<input type="text" placeholder="Search"
class="w-full px-4 py-2 border border-gray-300 dark:border-dark-600 rounded-l-full focus:outline-none focus:border-primary bg-white dark:bg-dark-700">
<button class="absolute right-0 top-0 h-full px-5 bg-gray-100 dark:bg-dark-600 border border-l-0 border-gray-300 dark:border-dark-600 rounded-r-full hover:bg-gray-200 dark:hover:bg-dark-500">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<!-- Right section -->
<div class="flex items-center space-x-2">
<button class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-dark-700 md:hidden">
<i class="fas fa-search text-xl"></i>
</button>
<button id="themeToggle" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-moon dark:hidden"></i>
<i class="fas fa-sun hidden dark:block"></i>
</button>
<button class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-bell text-xl"></i>
</button>
<div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center text-white cursor-pointer">
<span class="font-medium">U</span>
</div>
</div>
</div>
<!-- Mobile search bar -->
<div class="px-4 py-2 md:hidden">
<div class="relative w-full">
<input type="text" placeholder="Search"
class="w-full px-4 py-2 border border-gray-300 dark:border-dark-600 rounded-full focus:outline-none focus:border-primary bg-white dark:bg-dark-700">
<button class="absolute right-0 top-0 h-full px-5">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</header>
<!-- Overlay for mobile sidebar -->
<div id="overlay" class="overlay"></div>
<!-- Main content -->
<div class="flex">
<!-- Sidebar -->
<aside id="sidebar" class="w-64 bg-white dark:bg-dark-800 h-screen overflow-y-auto sidebar fixed md:static">
<div class="py-2">
<!-- Main menu -->
<div class="px-4 py-2">
<div class="space-y-1">
<a href="#" class="flex items-center px-3 py-2 rounded-lg bg-gray-200 dark:bg-dark-700 font-medium">
<i class="fas fa-home mr-4 text-xl"></i>
<span>Home</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-compass mr-4 text-xl"></i>
<span>Explore</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-subscript mr-4 text-xl"></i>
<span>Subscriptions</span>
</a>
</div>
</div>
<!-- Library section -->
<div class="border-t border-gray-200 dark:border-dark-700 px-4 py-2">
<h3 class="px-3 py-2 font-medium">Library</h3>
<div class="space-y-1">
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-history mr-4 text-xl"></i>
<span>History</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-clock mr-4 text-xl"></i>
<span>Watch later</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-thumbs-up mr-4 text-xl"></i>
<span>Liked videos</span>
</a>
</div>
</div>
<!-- Subscriptions section -->
<div class="border-t border-gray-200 dark:border-dark-700 px-4 py-2">
<h3 class="px-3 py-2 font-medium">Subscriptions</h3>
<div class="space-y-1">
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<div class="w-6 h-6 rounded-full bg-blue-500 mr-4"></div>
<span>Tech Channel</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<div class="w-6 h-6 rounded-full bg-green-500 mr-4"></div>
<span>Nature Videos</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<div class="w-6 h-6 rounded-full bg-purple-500 mr-4"></div>
<span>Music Hub</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<div class="w-6 h-6 rounded-full bg-red-500 mr-4"></div>
<span>Gaming World</span>
</a>
</div>
</div>
<!-- Settings section -->
<div class="border-t border-gray-200 dark:border-dark-700 px-4 py-2">
<h3 class="px-3 py-2 font-medium">Settings</h3>
<div class="space-y-1">
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-cog mr-4 text-xl"></i>
<span>Settings</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-flag mr-4 text-xl"></i>
<span>Report history</span>
</a>
<a href="#" class="flex items-center px-3 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-700">
<i class="fas fa-question-circle mr-4 text-xl"></i>
<span>Help</span>
</a>
</div>
</div>
</div>
</aside>
<!-- Main content area -->
<main class="flex-1 p-4 md:ml-64">
<!-- Video player section -->
<div class="max-w-5xl mx-auto">
<!-- Video player -->
<div class="bg-black rounded-xl overflow-hidden">
<iframe id="videoPlayer" src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<!-- Video title and actions -->
<div class="mt-4">
<h1 class="text-xl font-bold">Never Gonna Give You Up - Rick Astley (Official Music Video)</h1>
<div class="flex flex-wrap items-center justify-between mt-2">
<div class="flex items-center space-x-4">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-gray-300 mr-2"></div>
<div>
<p class="font-medium">Rick Astley</p>
<p class="text-sm text-gray-600 dark:text-gray-400">1.2M subscribers</p>
</div>
</div>
<button id="subscribeBtn" class="px-4 py-2 bg-primary text-white rounded-full font-medium hover:bg-red-700">
Subscribe
</button>
</div>
<div class="flex items-center space-x-2 mt-2 sm:mt-0">
<div class="flex items-center bg-gray-200 dark:bg-dark-700 rounded-full">
<button id="likeBtn" class="px-4 py-2 rounded-l-full hover:bg-gray-300 dark:hover:bg-dark-600 flex items-center">
<i class="fas fa-thumbs-up mr-2"></i>
<span>125K</span>
</button>
<div class="w-px h-6 bg-gray-400 dark:bg-dark-600"></div>
<button id="dislikeBtn" class="px-4 py-2 rounded-r-full hover:bg-gray-300 dark:hover:bg-dark-600">
<i class="fas fa-thumbs-down"></i>
</button>
</div>
<button class="px-4 py-2 bg-gray-200 dark:bg-dark-700 rounded-full hover:bg-gray-300 dark:hover:bg-dark-600 flex items-center">
<i class="fas fa-share mr-2"></i>
<span>Share</span>
</button>
<button class="p-2 bg-gray-200 dark:bg-dark-700 rounded-full hover:bg-gray-300 dark:hover:bg-dark-600">
<i class="fas fa-ellipsis-h"></i>
</button>
</div>
</div>
</div>
<!-- Video description -->
<div class="mt-4 p-4 bg-gray-100 dark:bg-dark-800 rounded-lg">
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400 mb-2">
<span>1,234,567 views</span>
<span class="mx-2">•</span>
<span>Oct 25, 2009</span>
</div>
<p class="mb-2">The official video for "Never Gonna Give You Up" by Rick Astley.</p>
<p class="mb-2">"Never Gonna Give You Up" was a global smash on its release in July 1987, topping the charts in 25 countries including Rick's native UK and the US Billboard Hot 100. It also won the Brit Award for Best single in 1988.</p>
<button id="showMoreBtn" class="text-sm font-medium">Show more</button>
<div id="fullDescription" class="hidden mt-2">
<p>Credits:</p>
<p>Director: Simon West</p>
<p>Producer: Simon Fields</p>
<p>Choreographer: Arlene Phillips</p>
<p>Follow Rick Astley:</p>
<p>Facebook: https://www.facebook.com/rickastley</p>
<p>Twitter: https://twitter.com/rickastley</p>
<p>Instagram: https://www.instagram.com/officialrickastley/</p>
<p>Website: https://rickastley.lnk.to/website</p>
</div>
</div>
<!-- Comments section -->
<div class="mt-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold">1,234 Comments</h2>
<div class="flex items-center">
<i class="fas fa-sort mr-2"></i>
<span class="font-medium">Sort by</span>
</div>
</div>
<!-- Add comment -->
<div class="flex mb-6">
<div class="w-10 h-10 rounded-full bg-gray-300 mr-4"></div>
<div class="flex-1 border-b border-gray-300 dark:border-dark-600 pb-1">
<input type="text" placeholder="Add a comment..." class="w-full bg-transparent comment-input border-none focus:ring-0">
</div>
</div>
<!-- Comments list -->
<div id="commentsContainer">
<!-- Comment 1 -->
<div class="flex mb-6">
<div class="w-10 h-10 rounded-full bg-blue-500 mr-4"></div>
<div class="flex-1">
<div class="flex items-center mb-1">
<span class="font-medium mr-2">TechEnthusiast</span>
<span class="text-sm text-gray-600 dark:text-gray-400">2 days ago</span>
</div>
<p class="mb-2">This song never gets old! The 80s had such great music.</p>
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-up mr-1"></i>
<span>1.2K</span>
</button>
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="hover:text-gray-900 dark:hover:text-gray-200">Reply</button>
</div>
</div>
</div>
<!-- Comment 2 -->
<div class="flex mb-6">
<div class="w-10 h-10 rounded-full bg-green-500 mr-4"></div>
<div class="flex-1">
<div class="flex items-center mb-1">
<span class="font-medium mr-2">MusicLover42</span>
<span class="text-sm text-gray-600 dark:text-gray-400">1 week ago</span>
</div>
<p class="mb-2">I remember when this first came out. Still sounds amazing today!</p>
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-up mr-1"></i>
<span>856</span>
</button>
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="hover:text-gray-900 dark:hover:text-gray-200">Reply</button>
</div>
<!-- Replies -->
<div class="mt-4 pl-4 border-l-2 border-gray-200 dark:border-dark-700">
<div class="flex mb-4">
<div class="w-8 h-8 rounded-full bg-purple-500 mr-3"></div>
<div class="flex-1">
<div class="flex items-center mb-1">
<span class="font-medium mr-2">ReplyGuy</span>
<span class="text-sm text-gray-600 dark:text-gray-400">5 days ago</span>
</div>
<p class="mb-2">Same here! Classic never dies.</p>
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-up mr-1"></i>
<span>124</span>
</button>
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="hover:text-gray-900 dark:hover:text-gray-200">Reply</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Comment 3 -->
<div class="flex mb-6">
<div class="w-10 h-10 rounded-full bg-red-500 mr-4"></div>
<div class="flex-1">
<div class="flex items-center mb-1">
<span class="font-medium mr-2">GamerDude</span>
<span class="text-sm text-gray-600 dark:text-gray-400">3 weeks ago</span>
</div>
<p class="mb-2">Got Rickrolled again! Can't believe I fell for it.</p>
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-up mr-1"></i>
<span>2.3K</span>
</button>
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="hover:text-gray-900 dark:hover:text-gray-200">Reply</button>
</div>
</div>
</div>
</div>
<button class="px-4 py-2 bg-gray-200 dark:bg-dark-700 rounded-full hover:bg-gray-300 dark:hover:bg-dark-600 font-medium">
<i class="fas fa-arrow-down mr-2"></i>
Show more comments
</button>
</div>
</div>
<!-- Recommended videos -->
<div class="mt-8 max-w-5xl mx-auto">
<div class="flex items-center mb-4">
<div class="w-1 h-6 bg-primary mr-2"></div>
<h2 class="text-xl font-bold">Recommended videos</h2>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
<!-- Video 1 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">3:32</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">Never Gonna Give You Up - Rick Astley (Official Music Video)</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Rick Astley • 1.2B views • 3 years ago</p>
</div>
</div>
</div>
<!-- Video 2 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/9bZkp7q19f0/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">4:20</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">PSY - GANGNAM STYLE(강남스타일) M/V</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">officialpsy • 4.6B views • 11 years ago</p>
</div>
</div>
</div>
<!-- Video 3 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/JGwWNGJdvx8/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">3:22</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">Ed Sheeran - Shape of You (Official Music Video)</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Ed Sheeran • 5.9B views • 6 years ago</p>
</div>
</div>
</div>
<!-- Video 4 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/kJQP7kiw5Fk/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">4:16</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">Luis Fonsi - Despacito ft. Daddy Yankee</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Luis Fonsi • 7.8B views • 6 years ago</p>
</div>
</div>
</div>
<!-- Video 5 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/RgKAFK5djSk/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">3:47</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">Wiz Khalifa - See You Again ft. Charlie Puth [Official Video]</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Wiz Khalifa • 6.1B views • 8 years ago</p>
</div>
</div>
</div>
<!-- Video 6 -->
<div class="cursor-pointer">
<div class="relative overflow-hidden rounded-xl video-thumbnail">
<img src="https://i.ytimg.com/vi/OPf0YbVqDNE/hqdefault.jpg" alt="Video thumbnail" class="w-full h-auto">
<span class="absolute bottom-2 right-2 bg-black bg-opacity-80 text-white text-sm px-1 rounded">2:54</span>
</div>
<div class="mt-2 flex">
<div class="w-9 h-9 rounded-full bg-gray-300 mr-3 flex-shrink-0"></div>
<div>
<h3 class="font-medium line-clamp-2">Mark Ronson - Uptown Funk (Official Video) ft. Bruno Mars</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1">Mark Ronson • 4.8B views • 8 years ago</p>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<script>
// Mock backend data
const mockBackend = {
currentUser: {
id: 1,
name: "User",
avatar: "U",
subscribed: false,
likedVideos: [],
dislikedVideos: [],
},
video: {
id: 1,
title: "Never Gonna Give You Up - Rick Astley (Official Music Video)",
views: 1234567890,
uploadDate: "2009-10-25",
likes: 125000,
dislikes: 5000,
channel: {
id: 1,
name: "Rick Astley",
subscribers: 1200000,
avatar: "",
},
description: `The official video for "Never Gonna Give You Up" by Rick Astley.
"Never Gonna Give You Up" was a global smash on its release in July 1987, topping the charts in 25 countries including Rick's native UK and the US Billboard Hot 100. It also won the Brit Award for Best single in 1988.
Credits:
Director: Simon West
Producer: Simon Fields
Choreographer: Arlene Phillips
Follow Rick Astley:
Facebook: https://www.facebook.com/rickastley
Twitter: https://twitter.com/rickastley
Instagram: https://www.instagram.com/officialrickastley/
Website: https://rickastley.lnk.to/website`,
comments: [
{
id: 1,
user: {
id: 2,
name: "TechEnthusiast",
avatar: "",
},
text: "This song never gets old! The 80s had such great music.",
date: "2023-06-10",
likes: 1200,
replies: [],
},
{
id: 2,
user: {
id: 3,
name: "MusicLover42",
avatar: "",
},
text: "I remember when this first came out. Still sounds amazing today!",
date: "2023-06-05",
likes: 856,
replies: [
{
id: 3,
user: {
id: 4,
name: "ReplyGuy",
avatar: "",
},
text: "Same here! Classic never dies.",
date: "2023-06-07",
likes: 124,
}
],
},
{
id: 4,
user: {
id: 5,
name: "GamerDude",
avatar: "",
},
text: "Got Rickrolled again! Can't believe I fell for it.",
date: "2023-05-20",
likes: 2300,
replies: [],
}
],
},
recommendedVideos: [
{
id: 1,
title: "Never Gonna Give You Up - Rick Astley (Official Music Video)",
thumbnail: "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
duration: "3:32",
channel: "Rick Astley",
views: "1.2B views",
uploadDate: "3 years ago",
},
{
id: 2,
title: "PSY - GANGNAM STYLE(강남스타일) M/V",
thumbnail: "https://i.ytimg.com/vi/9bZkp7q19f0/hqdefault.jpg",
duration: "4:20",
channel: "officialpsy",
views: "4.6B views",
uploadDate: "11 years ago",
},
{
id: 3,
title: "Ed Sheeran - Shape of You (Official Music Video)",
thumbnail: "https://i.ytimg.com/vi/JGwWNGJdvx8/hqdefault.jpg",
duration: "3:22",
channel: "Ed Sheeran",
views: "5.9B views",
uploadDate: "6 years ago",
},
{
id: 4,
title: "Luis Fonsi - Despacito ft. Daddy Yankee",
thumbnail: "https://i.ytimg.com/vi/kJQP7kiw5Fk/hqdefault.jpg",
duration: "4:16",
channel: "Luis Fonsi",
views: "7.8B views",
uploadDate: "6 years ago",
},
{
id: 5,
title: "Wiz Khalifa - See You Again ft. Charlie Puth [Official Video]",
thumbnail: "https://i.ytimg.com/vi/RgKAFK5djSk/hqdefault.jpg",
duration: "3:47",
channel: "Wiz Khalifa",
views: "6.1B views",
uploadDate: "8 years ago",
},
{
id: 6,
title: "Mark Ronson - Uptown Funk (Official Video) ft. Bruno Mars",
thumbnail: "https://i.ytimg.com/vi/OPf0YbVqDNE/hqdefault.jpg",
duration: "2:54",
channel: "Mark Ronson",
views: "4.8B views",
uploadDate: "8 years ago",
},
],
};
// DOM elements
const menuBtn = document.getElementById('menuBtn');
const sidebar = document.getElementById('sidebar');
const overlay = document.getElementById('overlay');
const themeToggle = document.getElementById('themeToggle');
const subscribeBtn = document.getElementById('subscribeBtn');
const likeBtn = document.getElementById('likeBtn');
const dislikeBtn = document.getElementById('dislikeBtn');
const showMoreBtn = document.getElementById('showMoreBtn');
const fullDescription = document.getElementById('fullDescription');
const commentsContainer = document.getElementById('commentsContainer');
const commentInput = document.querySelector('.comment-input');
// Event listeners
menuBtn.addEventListener('click', toggleSidebar);
overlay.addEventListener('click', toggleSidebar);
themeToggle.addEventListener('click', toggleTheme);
subscribeBtn.addEventListener('click', toggleSubscription);
likeBtn.addEventListener('click', () => toggleLikeDislike('like'));
dislikeBtn.addEventListener('click', () => toggleLikeDislike('dislike'));
showMoreBtn.addEventListener('click', toggleDescription);
commentInput.addEventListener('keypress', addComment);
// Functions
function toggleSidebar() {
sidebar.classList.toggle('active');
overlay.classList.toggle('active');
}
function toggleTheme() {
document.documentElement.classList.toggle('dark');
localStorage.setItem('darkMode', document.documentElement.classList.contains('dark'));
}
function toggleSubscription() {
mockBackend.currentUser.subscribed = !mockBackend.currentUser.subscribed;
if (mockBackend.currentUser.subscribed) {
subscribeBtn.textContent = 'Subscribed';
subscribeBtn.classList.remove('bg-primary', 'hover:bg-red-700');
subscribeBtn.classList.add('bg-gray-200', 'dark:bg-dark-700', 'hover:bg-gray-300', 'dark:hover:bg-dark-600');
mockBackend.video.channel.subscribers += 1;
} else {
subscribeBtn.textContent = 'Subscribe';
subscribeBtn.classList.add('bg-primary', 'hover:bg-red-700');
subscribeBtn.classList.remove('bg-gray-200', 'dark:bg-dark-700', 'hover:bg-gray-300', 'dark:hover:bg-dark-600');
mockBackend.video.channel.subscribers -= 1;
}
}
function toggleLikeDislike(type) {
const videoId = mockBackend.video.id;
const likedIndex = mockBackend.currentUser.likedVideos.indexOf(videoId);
const dislikedIndex = mockBackend.currentUser.dislikedVideos.indexOf(videoId);
if (type === 'like') {
if (likedIndex === -1) {
// Like the video
mockBackend.currentUser.likedVideos.push(videoId);
mockBackend.video.likes += 1;
likeBtn.querySelector('span').textContent = formatNumber(mockBackend.video.likes);
likeBtn.classList.add('text-primary');
// Remove dislike if exists
if (dislikedIndex !== -1) {
mockBackend.currentUser.dislikedVideos.splice(dislikedIndex, 1);
mockBackend.video.dislikes -= 1;
dislikeBtn.classList.remove('text-primary');
}
} else {
// Remove like
mockBackend.currentUser.likedVideos.splice(likedIndex, 1);
mockBackend.video.likes -= 1;
likeBtn.querySelector('span').textContent = formatNumber(mockBackend.video.likes);
likeBtn.classList.remove('text-primary');
}
} else {
if (dislikedIndex === -1) {
// Dislike the video
mockBackend.currentUser.dislikedVideos.push(videoId);
mockBackend.video.dislikes += 1;
dislikeBtn.classList.add('text-primary');
// Remove like if exists
if (likedIndex !== -1) {
mockBackend.currentUser.likedVideos.splice(likedIndex, 1);
mockBackend.video.likes -= 1;
likeBtn.querySelector('span').textContent = formatNumber(mockBackend.video.likes);
likeBtn.classList.remove('text-primary');
}
} else {
// Remove dislike
mockBackend.currentUser.dislikedVideos.splice(dislikedIndex, 1);
mockBackend.video.dislikes -= 1;
dislikeBtn.classList.remove('text-primary');
}
}
}
function toggleDescription() {
fullDescription.classList.toggle('hidden');
showMoreBtn.textContent = fullDescription.classList.contains('hidden') ? 'Show more' : 'Show less';
}
function addComment(e) {
if (e.key === 'Enter' && commentInput.value.trim() !== '') {
const newComment = {
id: Date.now(),
user: {
id: mockBackend.currentUser.id,
name: mockBackend.currentUser.name,
avatar: mockBackend.currentUser.avatar,
},
text: commentInput.value,
date: 'Just now',
likes: 0,
replies: [],
};
mockBackend.video.comments.unshift(newComment);
renderComment(newComment);
commentInput.value = '';
}
}
function renderComment(comment) {
const commentElement = document.createElement('div');
commentElement.className = 'flex mb-6';
commentElement.innerHTML = `
<div class="w-10 h-10 rounded-full bg-gray-300 mr-4 flex items-center justify-center font-medium">${comment.user.avatar}</div>
<div class="flex-1">
<div class="flex items-center mb-1">
<span class="font-medium mr-2">${comment.user.name}</span>
<span class="text-sm text-gray-600 dark:text-gray-400">${comment.date}</span>
</div>
<p class="mb-2">${comment.text}</p>
<div class="flex items-center text-sm text-gray-600 dark:text-gray-400">
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-up mr-1"></i>
<span>${comment.likes}</span>
</button>
<button class="flex items-center mr-4 hover:text-gray-900 dark:hover:text-gray-200">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="hover:text-gray-900 dark:hover:text-gray-200">Reply</button>
</div>
</div>
`;
commentsContainer.insertBefore(commentElement, commentsContainer.firstChild);
}
function formatNumber(num) {
if (num >= 1000000) {
return (num / 1000000).toFixed(1) + 'M';
}
if (num >= 1000) {
return (num / 1000).toFixed(1) + 'K';
}
return num.toString();
}
// Initialize
if (localStorage.getItem('darkMode') === 'true') {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
</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=KaranPatelDev/karanpateldev" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>