Spaces:
Running

eae / index.html
NV2024's picture
Add 2 files
7d75770 verified
Raw History Blame Contribute Delete
31.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VibeRank - Music Video Ranking</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>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #0f172a;
color: #f8fafc;
min-height: 100vh;
}
.video-card {
transition: all 0.3s ease;
background: linear-gradient(145deg, #1e293b, #0f172a);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.video-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
}
.rank-badge {
width: 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
border-radius: 50%;
}
.rank-1 {
background: linear-gradient(135deg, #fcd34d, #f59e0b);
color: #1e293b;
}
.rank-2 {
background: linear-gradient(135deg, #e2e8f0, #94a3b8);
color: #1e293b;
}
.rank-3 {
background: linear-gradient(135deg, #fca5a5, #f87171);
color: #1e293b;
}
.other-ranks {
background: #1e293b;
color: #f8fafc;
}
.vote-btn {
transition: all 0.2s ease;
}
.vote-btn:hover {
transform: scale(1.1);
}
.like-btn:hover {
color: #4ade80;
}
.dislike-btn:hover {
color: #f87171;
}
.active-filter {
background-color: #3b82f6;
color: white;
}
.comment-bubble {
position: relative;
background-color: #1e293b;
border-radius: 1rem;
padding: 0.75rem;
margin-bottom: 1rem;
}
.comment-bubble::after {
content: '';
position: absolute;
bottom: -10px;
left: 20px;
border-width: 10px 10px 0;
border-style: solid;
border-color: #1e293b transparent;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeIn 0.3s ease forwards;
}
.pulse {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body class="min-h-screen">
<header class="bg-gradient-to-r from-blue-900 to-indigo-900 py-6 shadow-lg">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="flex items-center mb-4 md:mb-0">
<i class="fas fa-music text-3xl mr-3 text-blue-300"></i>
<h1 class="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-300 to-purple-300">
VibeRank
</h1>
</div>
<div class="flex items-center space-x-4">
<button id="submit-video-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-full flex items-center transition">
<i class="fas fa-plus mr-2"></i> Submit Video
</button>
<div class="relative group">
<button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-full flex items-center transition">
<i class="fas fa-share-alt mr-2"></i> Share
</button>
<div class="absolute right-0 mt-2 w-48 bg-gray-800 rounded-md shadow-lg z-10 hidden group-hover:block">
<div class="p-2">
<a href="#" class="flex items-center px-3 py-2 text-sm hover:bg-gray-700 rounded">
<i class="fab fa-twitter mr-2"></i> Twitter
</a>
<a href="#" class="flex items-center px-3 py-2 text-sm hover:bg-gray-700 rounded">
<i class="fab fa-facebook mr-2"></i> Facebook
</a>
<a href="#" class="flex items-center px-3 py-2 text-sm hover:bg-gray-700 rounded">
<i class="fab fa-instagram mr-2"></i> Instagram
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-8">
<!-- Video Submission Modal -->
<div id="video-modal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 hidden">
<div class="bg-gray-800 rounded-lg p-6 w-full max-w-md">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Submit a Music Video</h3>
<button id="close-modal" class="text-gray-400 hover:text-white">
<i class="fas fa-times"></i>
</button>
</div>
<form id="video-form" class="space-y-4">
<div>
<label for="video-url" class="block text-sm font-medium mb-1">YouTube URL</label>
<input type="url" id="video-url" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2"
placeholder="https://www.youtube.com/watch?v=..." required>
</div>
<div>
<label for="video-title" class="block text-sm font-medium mb-1">Video Title</label>
<input type="text" id="video-title" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2"
placeholder="Enter video title" required>
</div>
<div>
<label for="video-artist" class="block text-sm font-medium mb-1">Artist</label>
<input type="text" id="video-artist" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2"
placeholder="Enter artist name" required>
</div>
<div>
<label for="video-genre" class="block text-sm font-medium mb-1">Genre</label>
<select id="video-genre" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option value="pop">Pop</option>
<option value="rock">Rock</option>
<option value="hiphop">Hip Hop</option>
<option value="electronic">Electronic</option>
<option value="r&b">R&B</option>
<option value="country">Country</option>
<option value="jazz">Jazz</option>
<option value="classical">Classical</option>
<option value="other">Other</option>
</select>
</div>
<div class="flex justify-end space-x-3 pt-2">
<button type="button" id="cancel-submit" class="px-4 py-2 rounded-md bg-gray-600 hover:bg-gray-500">
Cancel
</button>
<button type="submit" class="px-4 py-2 rounded-md bg-blue-600 hover:bg-blue-500">
Submit Video
</button>
</div>
</form>
</div>
</div>
<!-- Filters -->
<div class="mb-8">
<div class="flex flex-wrap items-center gap-3 mb-4">
<h3 class="text-lg font-semibold mr-2">Filter by:</h3>
<button class="filter-btn active-filter px-4 py-1 rounded-full" data-genre="all">All</button>
<button class="filter-btn px-4 py-1 rounded-full bg-gray-700 hover:bg-gray-600" data-genre="pop">Pop</button>
<button class="filter-btn px-4 py-1 rounded-full bg-gray-700 hover:bg-gray-600" data-genre="rock">Rock</button>
<button class="filter-btn px-4 py-1 rounded-full bg-gray-700 hover:bg-gray-600" data-genre="hiphop">Hip Hop</button>
<button class="filter-btn px-4 py-1 rounded-full bg-gray-700 hover:bg-gray-600" data-genre="electronic">Electronic</button>
<button class="filter-btn px-4 py-1 rounded-full bg-gray-700 hover:bg-gray-600" data-genre="r&b">R&B</button>
</div>
<div class="flex items-center">
<div class="relative flex-grow max-w-md">
<input type="text" id="search-input" placeholder="Search videos or artists..."
class="w-full bg-gray-700 border border-gray-600 rounded-full px-4 py-2 pl-10 focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<button id="sort-btn" class="ml-3 px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-full flex items-center">
<i class="fas fa-sort-amount-down mr-2"></i> Sort
</button>
</div>
</div>
<!-- Video Ranking -->
<div id="video-ranking" class="space-y-6">
<!-- Videos will be dynamically inserted here -->
<div class="text-center py-10">
<i class="fas fa-music text-5xl text-gray-600 mb-4"></i>
<h3 class="text-xl text-gray-400">No videos submitted yet. Be the first!</h3>
</div>
</div>
</main>
<footer class="bg-gray-900 py-6 mt-12">
<div class="container mx-auto px-4 text-center text-gray-400">
<div class="flex justify-center space-x-6 mb-4">
<a href="#" class="hover:text-white"><i class="fab fa-twitter"></i></a>
<a href="#" class="hover:text-white"><i class="fab fa-facebook"></i></a>
<a href="#" class="hover:text-white"><i class="fab fa-instagram"></i></a>
<a href="#" class="hover:text-white"><i class="fab fa-youtube"></i></a>
</div>
<p class="text-sm">© 2023 VibeRank. All rights reserved.</p>
<p class="text-xs mt-2">Music videos are property of their respective owners.</p>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Sample data for demonstration
let videos = [
{
id: 1,
title: "Blinding Lights",
artist: "The Weeknd",
youtubeId: "4NRXx6U8ABQ",
likes: 42,
dislikes: 3,
score: 39,
genre: "pop",
comments: [
{user: "MusicLover22", text: "This song never gets old!"},
{user: "DJ_Spin", text: "Perfect beat for my sets"}
],
timestamp: new Date('2023-05-15').getTime()
},
{
id: 2,
title: "Bohemian Rhapsody",
artist: "Queen",
youtubeId: "fJ9rUzIMcZQ",
likes: 38,
dislikes: 1,
score: 37,
genre: "rock",
comments: [
{user: "ClassicRockFan", text: "Timeless masterpiece!"}
],
timestamp: new Date('2023-06-20').getTime()
},
{
id: 3,
title: "SICKO MODE",
artist: "Travis Scott",
youtubeId: "6ONRf7h3Mdk",
likes: 35,
dislikes: 5,
score: 30,
genre: "hiphop",
comments: [],
timestamp: new Date('2023-04-10').getTime()
}
];
// DOM elements
const videoModal = document.getElementById('video-modal');
const submitVideoBtn = document.getElementById('submit-video-btn');
const closeModalBtn = document.getElementById('close-modal');
const cancelSubmitBtn = document.getElementById('cancel-submit');
const videoForm = document.getElementById('video-form');
const videoRanking = document.getElementById('video-ranking');
const filterButtons = document.querySelectorAll('.filter-btn');
const searchInput = document.getElementById('search-input');
const sortBtn = document.getElementById('sort-btn');
// Current filter and sort state
let currentFilter = 'all';
let currentSort = 'score';
// Modal handling
submitVideoBtn.addEventListener('click', () => videoModal.classList.remove('hidden'));
closeModalBtn.addEventListener('click', () => videoModal.classList.add('hidden'));
cancelSubmitBtn.addEventListener('click', () => videoModal.classList.add('hidden'));
// Filter buttons
filterButtons.forEach(button => {
button.addEventListener('click', () => {
filterButtons.forEach(btn => btn.classList.remove('active-filter', 'bg-blue-600'));
button.classList.add('active-filter', 'bg-blue-600');
currentFilter = button.dataset.genre;
renderVideos();
});
});
// Search functionality
searchInput.addEventListener('input', () => {
renderVideos();
});
// Sort functionality
sortBtn.addEventListener('click', () => {
if (currentSort === 'score') {
currentSort = 'timestamp';
sortBtn.innerHTML = '<i class="fas fa-clock mr-2"></i> Newest';
} else {
currentSort = 'score';
sortBtn.innerHTML = '<i class="fas fa-sort-amount-down mr-2"></i> Score';
}
renderVideos();
});
// Form submission
videoForm.addEventListener('submit', function(e) {
e.preventDefault();
const url = document.getElementById('video-url').value;
const title = document.getElementById('video-title').value;
const artist = document.getElementById('video-artist').value;
const genre = document.getElementById('video-genre').value;
// Extract YouTube ID from URL
let videoId = '';
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
const match = url.match(regExp);
if (match && match[2].length === 11) {
videoId = match[2];
} else {
alert('Please enter a valid YouTube URL');
return;
}
// Create new video object
const newVideo = {
id: videos.length > 0 ? Math.max(...videos.map(v => v.id)) + 1 : 1,
title: title,
artist: artist,
youtubeId: videoId,
likes: 0,
dislikes: 0,
score: 0,
genre: genre,
comments: [],
timestamp: new Date().getTime()
};
videos.push(newVideo);
// Reset form and close modal
videoForm.reset();
videoModal.classList.add('hidden');
// Re-render videos
renderVideos();
// Auto-scroll to the new video
setTimeout(() => {
const newVideoElement = document.getElementById(`video-${newVideo.id}`);
if (newVideoElement) {
newVideoElement.scrollIntoView({ behavior: 'smooth' });
newVideoElement.classList.add('pulse');
// Remove pulse animation after it completes
setTimeout(() => {
newVideoElement.classList.remove('pulse');
}, 1500);
}
}, 500);
});
// Function to extract video ID from URL
function extractVideoId(url) {
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
const match = url.match(regExp);
return (match && match[2].length === 11) ? match[2] : null;
}
// Function to render videos based on current filter and search
function renderVideos() {
// Filter videos
let filteredVideos = [...videos];
// Apply genre filter
if (currentFilter !== 'all') {
filteredVideos = filteredVideos.filter(video => video.genre === currentFilter);
}
// Apply search filter
const searchTerm = searchInput.value.toLowerCase();
if (searchTerm) {
filteredVideos = filteredVideos.filter(video =>
video.title.toLowerCase().includes(searchTerm) ||
video.artist.toLowerCase().includes(searchTerm)
);
}
// Sort videos
if (currentSort === 'score') {
filteredVideos.sort((a, b) => b.score - a.score);
} else {
filteredVideos.sort((a, b) => b.timestamp - a.timestamp);
}
// Limit to top 20 videos by score if we're sorting by score
if (currentSort === 'score' && filteredVideos.length > 20) {
filteredVideos = filteredVideos.slice(0, 20);
}
// Clear current ranking
videoRanking.innerHTML = '';
// If no videos match filters
if (filteredVideos.length === 0) {
videoRanking.innerHTML = `
<div class="text-center py-10">
<i class="fas fa-search text-5xl text-gray-600 mb-4"></i>
<h3 class="text-xl text-gray-400">No videos match your search criteria.</h3>
</div>
`;
return;
}
// Render each video
filteredVideos.forEach((video, index) => {
const rank = index + 1;
const rankClass = rank === 1 ? 'rank-1' :
rank === 2 ? 'rank-2' :
rank === 3 ? 'rank-3' : 'other-ranks';
const videoCard = document.createElement('div');
videoCard.className = `video-card rounded-xl p-4 md:p-6 fade-in`;
videoCard.id = `video-${video.id}`;
videoCard.innerHTML = `
<div class="flex flex-col md:flex-row">
<!-- Rank and voting -->
<div class="flex md:flex-col items-center md:items-start md:w-24 mb-4 md:mb-0">
<div class="rank-badge ${rankClass} mr-4 md:mr-0 md:mb-4">
${rank}
</div>
<div class="flex flex-col items-center md:items-start">
<button class="vote-btn like-btn text-xl mb-1" data-video-id="${video.id}">
<i class="fas fa-thumbs-up"></i>
</button>
<span class="text-lg font-semibold mx-2">${video.score}</span>
<button class="vote-btn dislike-btn text-xl mt-1" data-video-id="${video.id}">
<i class="fas fa-thumbs-down"></i>
</button>
</div>
</div>
<!-- Video and info -->
<div class="flex-1 md:ml-6">
<div class="flex flex-col lg:flex-row">
<!-- Video embed -->
<div class="w-full lg:w-2/3 mb-4 lg:mb-0 lg:mr-6">
<div class="aspect-w-16 aspect-h-9">
<iframe class="w-full h-64 md:h-80 rounded-lg"
src="https://www.youtube.com/embed/${video.youtubeId}"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
</div>
<!-- Video details -->
<div class="w-full lg:w-1/3">
<div class="mb-4">
<h2 class="text-xl md:text-2xl font-bold mb-1">${video.title}</h2>
<p class="text-lg text-gray-300 mb-2">${video.artist}</p>
<span class="inline-block px-3 py-1 rounded-full text-sm bg-gray-700 text-gray-300">
${video.genre.toUpperCase()}
</span>
</div>
<!-- Stats -->
<div class="flex justify-between mb-4">
<div class="text-center">
<div class="text-2xl font-bold">${video.likes}</div>
<div class="text-sm text-gray-400">LIKES</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold">${video.dislikes}</div>
<div class="text-sm text-gray-400">DISLIKES</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold">${video.comments.length}</div>
<div class="text-sm text-gray-400">COMMENTS</div>
</div>
</div>
<!-- Share button -->
<button class="share-btn w-full bg-gray-700 hover:bg-gray-600 py-2 rounded-lg mb-4 flex items-center justify-center"
data-video-id="${video.id}">
<i class="fas fa-share-alt mr-2"></i> Share
</button>
</div>
</div>
<!-- Comments section -->
<div class="mt-6">
<h4 class="text-lg font-semibold mb-3">Comments</h4>
${video.comments.length > 0 ?
video.comments.map(comment => `
<div class="comment-bubble">
<div class="font-semibold">${comment.user}</div>
<p>${comment.text}</p>
</div>
`).join('') :
'<p class="text-gray-400">No comments yet. Be the first to comment!</p>'
}
<div class="mt-4 flex">
<input type="text" class="comment-input flex-grow bg-gray-700 border border-gray-600 rounded-l-lg px-4 py-2 focus:outline-none"
placeholder="Add a comment..." data-video-id="${video.id}">
<button class="comment-submit bg-blue-600 hover:bg-blue-500 px-4 py-2 rounded-r-lg"
data-video-id="${video.id}">
Post
</button>
</div>
</div>
</div>
</div>
`;
videoRanking.appendChild(videoCard);
});
// Add event listeners to the newly created elements
addEventListeners();
}
// Function to add event listeners to dynamic elements
function addEventListeners() {
// Like buttons
document.querySelectorAll('.like-btn').forEach(button => {
button.addEventListener('click', function() {
const videoId = parseInt(this.dataset.videoId);
const video = videos.find(v => v.id === videoId);
if (video) {
video.likes++;
video.score = video.likes - video.dislikes;
renderVideos();
}
});
});
// Dislike buttons
document.querySelectorAll('.dislike-btn').forEach(button => {
button.addEventListener('click', function() {
const videoId = parseInt(this.dataset.videoId);
const video = videos.find(v => v.id === videoId);
if (video) {
video.dislikes++;
video.score = video.likes - video.dislikes;
renderVideos();
}
});
});
// Comment submission
document.querySelectorAll('.comment-submit').forEach(button => {
button.addEventListener('click', function() {
const videoId = parseInt(this.dataset.videoId);
const video = videos.find(v => v.id === videoId);
const input = document.querySelector(`.comment-input[data-video-id="${videoId}"]`);
if (video && input.value.trim()) {
video.comments.push({
user: "You", // In a real app, this would be the logged in user
text: input.value.trim()
});
input.value = '';
renderVideos();
}
});
});
// Share buttons
document.querySelectorAll('.share-btn').forEach(button => {
button.addEventListener('click', function() {
const videoId = parseInt(this.dataset.videoId);
const video = videos.find(v => v.id === videoId);
if (video) {
// In a real app, this would open share dialogs or copy to clipboard
alert(`Share "${video.title}" by ${video.artist}\nhttps://youtu.be/${video.youtubeId}`);
}
});
});
// Allow pressing Enter to submit comments
document.querySelectorAll('.comment-input').forEach(input => {
input.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
const videoId = parseInt(this.dataset.videoId);
const button = document.querySelector(`.comment-submit[data-video-id="${videoId}"]`);
button.click();
}
});
});
}
// Initial render
renderVideos();
});
</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=NV2024/eae" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>