forked from Nadim0330/podcast-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browse.html
470 lines (414 loc) · 14.8 KB
/
browse.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browse - Podcasttttt</title>
<link rel="shortcut icon" href="./favicon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@400;500;700&display=swap" rel="stylesheet">
<style>
/* Internal CSS styles go here */
:root {
/**
* colors
*/
--flourescent-blue: hsl(178, 100%, 49%);
--heliotrope-gray: hsl(253, 15%, 70%);
--russian-violet: hsl(252, 80%, 16%);
--dark-violet: hsl(252, 100%, 12%);
--space-cadet: hsl(247, 43%, 20%);
--blue-ryb: hsl(221, 100%, 50%);
--white: hsl(0, 0%, 100%);
--gradient: linear-gradient(to right, var(--flourescent-blue), var(--blue-ryb));
/**
* typography
*/
--ff-josefin: 'Josefin sans', sans-serif;
--fs-1: 25px;
--fs-2: 18px;
--fs-3: 17px;
--fs-4: 15px;
--fw-500: 500;
--fw-700: 700;
/**
* transition
*/
--transition: 0.25s ease-in-out;
/**
* spacing
*/
--section-padding: 30px;
}
body {
background-color: var(--russian-violet);
margin: 0;
padding: 0;
font-family: 'Inter', sans-serif;
}
/* header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
} */
h1 {
font-size: 24px;
text-align: center;
margin-top: 20px;
color: whitesmoke;
}
main {
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.search-bar {
text-align: center;
margin: 20px 0;
}
#search-input {
padding: 10px;
width: 300px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
#search-button {
padding: 10px 20px;
background-color: #0074d9;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-left: 10px;
}
#search-button:hover {
background-color: #0056a0;
}
.playlist {
list-style: none;
padding: 0;
display: flex;
flex-wrap: wrap; /* Allows episodes to wrap to the next line */
justify-content: center; /* Center episodes horizontally */
}
.episode {
font-size: 18px;
margin: 0;
padding: 10px 10px;
border-bottom: 1px solid #ddd;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
width: 300px;
margin: 10px;
transition: 2s;
}
/* Hover effect on episodes */
.episode:hover {
background-color: lightsalmon;
cursor: pointer;
transform: translate3d(10px);
}
.episode:hover ~ .episode {
filter: blur(3px); /* Apply blur to non-hovered episodes */
}
/* Add this CSS to your existing styles */
.heart-icon {
color: #e74c3c; /* Red color for the heart icon (you can change the color) */
font-size: 18px;
margin-right: 5px;
}
.like-button:hover .heart-icon {
color: #c0392b; /* Change the color on hover (optional) */
}
/* Navigation Bar */
.navbar {
background-color: none;
color: #fff;
padding-right: 110px;
text-align: right;
}
.navbar a {
text-decoration: none;
color: #fff;
margin: 5px;
display: inline-block;
margin-right: 10px;
}
</style>
</head>
<body>
<div class="search-bar">
<input type="text" id="search-input" placeholder="Search for episodes...">
<button id="search-button">Search</button>
</div>
<div class="navbar">
<a href="index.html">Home</a>
<a href="browse.html">Browse</a>
<a href="genre.html">Genre</a>
<!-- Add more links as needed -->
</div>
<main>
<ul class="playlist">
<li class="episode">
<img src="episode1.jpg" alt="Episode 1">
<div class="episode-info">
<h2>Episode 1 Title</h2>
<p>Description of Episode 1.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episodes/episode1.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<div class="episode-actions">
<button class="like-button" id="episode10-like-button">
<span class="heart-icon">♥</span> Like
</button>
</div>
</li>
<li class="episode">
<img src="episode2.jpg" alt="Episode 02">
<div class="episode-info">
<h2>Episode 2 Title</h2>
<p>Description of Episode 2.</p>
<p>Release Date: February 15, 2023</p>
<p>Duration: 25:30</p>
</div>
<audio controls>
<source src="episode2.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<button class="like-button">Like</button>
</li>
<li class="episode">
<img src="episode3.jpg" alt="Episode 03">
<div class="episode-info">
<h2>Episode 3 Title</h2>
<p>Description of Episode 3.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode3.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode4.jpg" alt="Episode 04" id="episode4">
<div class="episode-info">
<h2>Episode 4 Title</h2>
<p>Description of Episode 4.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode4.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode5.jpg" alt="Episode 05">
<div class="episode-info">
<h2>Episode 5 Title</h2>
<p>Description of Episode 5.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode5.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode6.jpg" alt="Episode 06">
<div class="episode-info">
<h2>Episode 6 Title</h2>
<p>Description of Episode 6.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode6.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode7.jpg" alt="Episode 07">
<div class="episode-info">
<h2>Episode 7 Title</h2>
<p>Description of Episode 7.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode7.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode8.jpg" alt="Episode 08">
<div class="episode-info">
<h2>Episode 8 Title</h2>
<p>Description of Episode 8.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode8.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode9.jpg" alt="Episode 09">
<div class="episode-info">
<h2>Episode 9 Title</h2>
<p>Description of Episode 9.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode9.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode10.jpg" alt="Episode 10">
<div class="episode-info">
<h2>Episode 10 Title</h2>
<p>Description of Episode 10.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode10.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode11.jpg" alt="Episode 11">
<div class="episode-info">
<h2>Episode 3 Title</h2>
<p>Description of Episode 11.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode11.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<li class="episode">
<img src="episode12.jpg" alt="Episode 12">
<div class="episode-info">
<h2>Episode 12 Title</h2>
<p>Description of Episode 12.</p>
<p>Release Date: March 10, 2023</p>
<p>Duration: 35:15</p>
</div>
<audio controls>
<source src="episode12.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</li>
<!-- Add more episodes here -->
</ul>
<br>
<!-- <ul>
<li class="view-all">
<center><button style="color: blue;">View All</button></center>
</li>
</ul> -->
</main>
<script>
// Sample episode data
let currentAudio = null; // Keep track of the currently playing audio element
// Function to load episode data from a JSON file
async function loadEpisodeData() {
try {
const response = await fetch('episode-data.json');
const data = await response.json();
return data.episodes;
} catch (error) {
console.error('Error loading episode data:', error);
return [];
}
}
// Function to display episodes
function displayEpisodes(episodes) {
const playlist = document.querySelector('.playlist');
playlist.innerHTML = ''; // Clear the current playlist
if (episodes.length === 0) {
playlist.innerHTML = 'No matching episodes found.';
} else {
episodes.forEach(episode => {
const li = document.createElement('li');
li.className = 'episode';
li.innerHTML = `
<div class="episode-info">
<h2>${episode.title}</h2>
<p>${episode.description}</p>
</div>
<audio controls>
<source src="${episode.audio}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
`;
playlist.appendChild(li);
});
}
}
// Function to handle the search
function searchEpisodes(episodes, searchTerm) {
const results = episodes.filter(episode =>
episode.title.toLowerCase().includes(searchTerm) || episode.description.toLowerCase().includes(searchTerm)
);
displayEpisodes(results);
// Add event listeners to play audio on episode selection
results.forEach((episode, index) => {
const audio = document.querySelectorAll('audio')[index];
audio.addEventListener('play', () => {
if (currentAudio && currentAudio !== audio) {
// Pause the previously playing audio if different
currentAudio.pause();
}
currentAudio = audio;
});
});
}
// Add an event listener to the search button
document.getElementById('search-button').addEventListener('click', async () => {
const searchTerm = document.getElementById('search-input').value.toLowerCase();
const episodes = await loadEpisodeData();
searchEpisodes(episodes, searchTerm);
});
// Load initial episodes
loadEpisodeData()
.then(episodes => displayEpisodes(episodes))
.catch(error => console.error('Error loading episodes:', error));
// JavaScript code
document.addEventListener("DOMContentLoaded", function () {
const likeButton = document.getElementById("episode1-like-button");
const heartIcon = likeButton.querySelector(".heart-icon");
let isLiked = false;
likeButton.addEventListener("click", function () {
if (isLiked) {
// Remove the liked status
heartIcon.style.color = "black"; // Change the heart color back to black
} else {
// Set the liked status
heartIcon.style.color = "red"; // Change the heart color to red when liked
}
isLiked = !isLiked;
});
});
</script>
</body>
</html>