forked from Ctoic/Lisbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
312 lines (264 loc) · 11.5 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>My Favorite Books Music App</title>
<style>
body {
transition: background-color 0.3s, color 0.3s;
}
body.light-theme {
background-color: #f0f0f0;
color: #333;
}
body.dark-theme {
background-color: #121212;
color: #b3b3b3;
}
h1, h2, h3 {
color: inherit;
}
#playlist li:hover {
background-color: #282828;
color: #1DB954;
cursor: pointer;
}
#audio-player {
background-color: #282828;
color: #1DB954;
}
button {
transition: background-color 0.3s;
}
button:hover {
background-color: #1ed760;
}
footer {
background-color: #191414;
color: #b3b3b3;
}
footer a:hover {
color: #1DB954;
}
.book-card {
background-color: #181818;
transition: transform 0.3s, box-shadow 0.3s;
cursor: pointer;
}
.book-card:hover {
transform: translateY(-10px);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.favorite-button {
transition: color 0.3s;
}
.favorite-button.active {
color: #1DB954;
}
.favorite-button:hover {
color: #1DB954;
}
.light-theme .book-card,
.light-theme #playlist,
.light-theme .bg-gray-800 {
background-color: #f8f8f8;
}
.light-theme .text-gray-300 {
color: #333;
}
.light-theme .bg-gray-700 {
background-color: #e0e0e0;
}
/* Play/Pause button animation */
.play-pause-button {
display: inline-block;
width: 50px;
height: 50px;
background-color: #1DB954;
border-radius: 50%;
cursor: pointer;
position: relative;
transition: background-color 0.3s;
}
.play-pause-button.play::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-style: solid;
border-width: 10px 0 10px 18px;
border-color: transparent transparent transparent #fff;
}
.play-pause-button.pause::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 10px;
height: 24px;
background-color: #fff;
box-shadow: 16px 0 0 #fff;
}
.play-pause-button:hover {
background-color: #1ed760;
}
</style>
</head>
<body class="bg-gray-900 text-gray-300 dark-theme">
<!-- Navbar -->
<nav class="bg-gray-800 p-4">
<div class="container mx-auto flex justify-between items-center">
<!-- Logo -->
<a class="text-green-500 text-2xl font-bold" href="./index.html">Lisbook</a>
<!-- Menu Links and Theme Toggle -->
<div id="menu" class="fixed inset-0 bg-gray-900 w-full h-full flex flex-col items-center justify-center space-y-8 transform scale-0 transition-transform duration-300 ease-in-out lg:relative lg:flex lg:items-end lg:justify-end lg:space-y-0 lg:bg-transparent lg:scale-100 lg:flex-row lg:space-x-4">
<div id="menu-close" class="text-gray-300 lg:hidden absolute top-5 right-5 cursor-pointer">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</div>
<a href="./index.html" class="text-gray-300 hover:text-green-500">Home</a>
<a href="./pbd.html" class="text-gray-300 hover:text-green-500">Next</a>
<a href="./index.html" class="text-gray-300 hover:text-green-500">Previous</a>
<button id="theme-toggle" class="text-gray-300 hover:text-green-500">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
</svg>
</button>
</div>
<!-- Mobile Menu Toggle Button -->
<div id="menu-toggle" title="Menu" class="text-gray-300 lg:hidden cursor-pointer">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" />
</svg>
</div>
</div>
</nav>
<!-- Book Card Display -->
<div class="container mx-auto mt-10 text-center">
<div class="book-card p-6 rounded-lg shadow-lg max-w-xs mx-auto">
<!-- Cover Image -->
<img id="img" src="./Images/GD.jpeg" alt="God Delusion Cover" class="w-full h-64 object-cover rounded-lg">
<!-- Book Details -->
<div class="mt-4">
<h1 class="text-2xl font-bold">God Delusion</h1>
<h3 class="text-lg mt-2">By Richard Dawkins</h3>
<p class="text-sm mt-2">The God Delusion is a book by English biologist Richard Dawkins that argues against the existence of a supernatural creator.</p>
</div>
<!-- Favorite Button -->
<div class="mt-4 flex justify-center">
<button id="favorite-button" class="favorite-button text-gray-300 text-xl focus:outline-none">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="h-6 w-6">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.121 20.121L12 15.243l6.879 4.878A7.502 7.502 0 0019 10.75C19 6.917 15.777 3 12 3S5 6.917 5 10.75c0 3.62 3.323 6.852 7.121 9.37z" />
</svg>
</button>
</div>
</div>
</div>
<!-- Playlist Section -->
<div class="container mx-auto mt-10 text-center">
<ul id="playlist" class="list-none mt-5 bg-gray-800 rounded-lg shadow-lg p-4">
<li class="p-2 hover:bg-gray-700" data-src="audio/part1.mp3">Introduction: God Delusion</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part2.mp3">Part 2</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part3.mp3">Part 3</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part4.mp3">Part 4</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part5.mp3">Part 5</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part6.mp3">Part 6</li>
<li class="p-2 hover:bg-gray-700" data-src="audio/part7.mp3">Part 7</li>
</ul>
<audio id="audio-player" controls class="mt-4 mx-auto"></audio>
<!-- Play/Pause Button with Animation -->
<div class="mt-4 flex justify-center">
<button id="playPauseBtn" class="play"></button> <!-- Added Play/Pause button here -->
</div>
</div>
<!-- Comments Section -->
<div class="container mx-auto mt-10 text-center">
<h2 class="text-xl font-bold">Leave a Comment</h2>
<form id="comment-form" class="mt-4">
<input type="text" id="name" placeholder="Your Name" class="w-full p-2 bg-gray-700 rounded mb-2">
<textarea id="comment" placeholder="Your Comment" class="w-full p-2 bg-gray-700 rounded mb-2"></textarea>
<button type="submit" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">Submit</button>
</form>
<!-- Display comments -->
<div id="comment-section" class="mt-4 space-y-2">
<!-- New comments will appear here -->
</div>
</div>
<!-- Footer -->
<footer class="bg-gray-900 p-4 text-center mt-10">
<div class="text-gray-500">
© 2024 Your Website Name | All Rights Reserved
</div>
</footer>
<!-- JS Scripts -->
<script>
const themeToggle = document.getElementById('theme-toggle');
const body = document.body;
const favoriteButton = document.getElementById('favorite-button');
const audioPlayer = document.getElementById('audio-player');
const playlist = document.getElementById('playlist');
const playPauseButton = document.getElementById('playPauseBtn'); // Updated ID for Play/Pause button
// Toggle theme
themeToggle.addEventListener('click', () => {
body.classList.toggle('dark-theme');
body.classList.toggle('light-theme');
});
// Toggle favorite button
favoriteButton.addEventListener('click', () => {
favoriteButton.classList.toggle('active');
});
// Playlist functionality
playlist.addEventListener('click', (event) => {
if (event.target.tagName === 'LI') {
const src = event.target.getAttribute('data-src');
audioPlayer.src = src;
audioPlayer.play();
}
});
// Play/Pause button functionality
playPauseButton.addEventListener('click', () => {
if (audioPlayer.paused) {
audioPlayer.play();
playPauseButton.classList.remove('play');
playPauseButton.classList.add('pause');
} else {
audioPlayer.pause();
playPauseButton.classList.remove('pause');
playPauseButton.classList.add('play');
}
});
// Handle comment submission
const commentForm = document.getElementById('comment-form');
const commentSection = document.getElementById('comment-section');
commentForm.addEventListener('submit', (event) => {
event.preventDefault();
const name = document.getElementById('name').value;
const comment = document.getElementById('comment').value;
if (name && comment) {
const newComment = document.createElement('div');
newComment.classList.add('bg-gray-700', 'p-2', 'rounded');
newComment.innerHTML = `<strong>${name}:</strong> ${comment}`;
commentSection.appendChild(newComment);
// Clear the form
document.getElementById('name').value = '';
document.getElementById('comment').value = '';
}
});
// Mobile menu toggle
const menuToggle = document.getElementById('menu-toggle');
const menu = document.getElementById('menu');
const menuClose = document.getElementById('menu-close');
menuToggle.addEventListener('click', () => {
menu.classList.toggle('scale-0');
});
menuClose.addEventListener('click', () => {
menu.classList.toggle('scale-0');
});
</script>
</body>
</html>