forked from Nadim0330/podcast-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Social-Media.html
383 lines (341 loc) · 11.8 KB
/
Social-Media.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Socail-Media Podcasts</title>
<style>
: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: 10;
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: 20px 20px;
border-bottom: 1px solid #ddd;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
width: 500px;
margin: 10px;
transition: 2s;
}
/* Hover effect on episodes */
.episode:hover {
background-color: lightsalmon;
cursor: pointer;
transform: translate3d(10px);
}
.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;
font-size: 20px;
}
.episode-image {
width: 100%; /* 100% of the container width */
height: auto; /* Maintain aspect ratio */
border-radius: 10px;}
</style>
</head>
<body>
<h1>Explore Socail-Media Podcasts</h1>
<div class="navbar">
<a href="genre.html"><b>Back To Genre</b></a>
</div>
<main>
<ul class="playlist">
<li class="episode">
<img src="episode1.jpg" alt="Episode 1" class="episode-image">
<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>
</button>
</div>
</li> -->
<li class="episode">
<img src="episode2.jpg" alt="Episode 02" class="episode-image">
<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" class="episode-image">
<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" class="episode-image">
<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" class="episode-image">
<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" class="episode-image">
<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" class="episode-image">
<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" class="episode-image">
<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>
</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>