-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
368 lines (339 loc) · 12.7 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
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
<!--
Bug 0 - 30/11/2021 - Added a close button at the ends of Reportoire.
Bug 1 - 30/11/2021 - Changed data array to Object and Iterating over it. Removing need for ID's to be consecutive
Bug 2 - 31/11/2021 - Added id's to the footer
Bug 9 - Added Carousel
Bug 11 -04/12/2021 - Make site responsive
Bug 12 - 04/12/2021 - Added Bootstrap and jquery dist files to the project.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
/>
<!-- Bug 12 starts -->
<link rel="stylesheet" href="assets/bootstrap.min.css" />
<link rel="stylesheet" href="assets/bootstrap-3-4-1.min.css" />
<link rel="stylesheet" href="assets/bootstrap.bundle.min.js" />
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> -->
<script src="./assets/jquery-3.5.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<!-- Bug 12 ends -->
<link
href="https://fonts.googleapis.com/css2?family=Raleway:wght@700&family=Oleo+Script:wght@700&family=Quicksand:wght@300;500&display=swap"
rel="stylesheet"
/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<!--Above line Bug 11 - Make it responsive-->
<title>Libra</title>
<link rel="stylesheet" href="shared.css" />
<link rel="stylesheet" href="styles.css" />
</head>
<body class="lang">
<header>
<div id="page-logo">
<a href="/index.html">Library</a>
</div>
<nav>
<ul>
<li><a href="/add-book.html">Add Book</a></li>
<li>
<a href="https://contact-ekansh.herokuapp.com/">Contact Us</a>
</li>
<li><a href="https://github.com/CAPTAINCOBRA">About</a></li>
</ul>
</nav>
</header>
<main>
<!-- create a carousel here with the images of the books in the database and
the links to the books in the database -->
<div
id="carousel-example-generic"
class="carousel slide"
data-ride="carousel"
>
<!-- Indicators -->
<ol class="carousel-indicators">
<li
data-target="#carousel-example-generic"
data-slide-to="0"
class="active"
></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
<li data-target="#carousel-example-generic" data-slide-to="4"></li>
<li data-target="#carousel-example-generic" data-slide-to="5"></li>
<li data-target="#carousel-example-generic" data-slide-to="6"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="images/carousel/library1.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/carousel/library2.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/library.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/carousel/library3.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/carousel/library4.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/carousel/library5.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
<div class="item">
<img src="images/carousel/library6.jpg" alt="..." />
<div class="carousel-caption"></div>
</div>
</div>
<!-- </div> -->
<!-- Controls -->
<a
class="left carousel-control"
href="#carousel-example-generic"
role="button"
data-slide="prev"
>
<span
class="glyphicon glyphicon-chevron-left"
aria-hidden="true"
></span>
<span class="sr-only">Previous</span>
</a>
<a
class="right carousel-control"
href="#carousel-example-generic"
role="button"
data-slide="next"
>
<span
class="glyphicon glyphicon-chevron-right"
aria-hidden="true"
></span>
<span class="sr-only">Next</span>
</a>
</div>
<section id="hero">
<div id="hero-content">
<h1>Ekansh's Library</h1>
<p>Let's explore the world of books together!</p>
<a href="/repertoire.html">Discover books</a>
<a id="show" href="#root">Repertoire</a>
</div>
</section>
<section id="highlights">
<h2>Highlights</h2>
<ul id="destinations">
<li class="destination">
<img
src="images/fav-books/famous-five.jpg"
alt="Famous Five By Enid Blyton"
title="Famous Five By Enid Blyton"
/>
<p>Famous <strong>Five</strong></p>
</li>
<li class="destination">
<img
src="images/fav-books/angDem.jpg"
alt="Angels & Demons by Dan Brown"
title="Angels & Demons by Dan Brown"
/>
<p>Angels & <strong>Demons</strong></p>
</li>
<li class="destination">
<img
src="images/fav-books/camelClub.jpg"
alt="Camel Club By David Baldacci"
title="Camel Club By David Baldacci"
/>
<p>Camel <strong>Club</strong></p>
</li>
</ul>
</section>
</main>
<div id="root"></div>
<footer>
<ul>
<li>
<a href="https://www.instagram.com">
<img src="images/icons/insta.png" alt="Instagram logo"
/></a>
</li>
<li>
<a href="https://www.facebook.com">
<img src="images/icons/facebook.png" alt="Facebook logo"
/></a>
</li>
</ul>
</footer>
<!-- Imports and Configuration Section -->
<!-- Bug 12 starts -->
<!-- <script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"
></script> -->
<!-- Bug 12 ends -->
<script type="module" id="MainScript">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyAwumkhm8FXf9gqxJamWDfKB2810--fOxk",
authDomain: "library-83403.firebaseapp.com",
databaseURL:
"https://library-83403-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "library-83403",
storageBucket: "library-83403.appspot.com",
messagingSenderId: "801479317930",
appId: "1:801479317930:web:4dcf61be9e2f45d44133d3",
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
import {
getDatabase,
ref,
set,
child,
update,
remove,
get,
} from "https://www.gstatic.com/firebasejs/9.5.0/firebase-database.js";
const db = getDatabase();
const appl = document.getElementById("root");
const container = document.createElement("div");
container.setAttribute("class", "container");
appl.appendChild(container);
// Get data function
const getData = () => {
const dbref = ref(db);
get(child(dbref, "/books")).then(function (snapshot) {
if (snapshot.exists()) {
var data = snapshot.val(); // Bug 1
//Bug 1
const books = [];
Object.entries(data).forEach(([key, value]) => books.push(value));
data = books;
//Bug 1 ends
data.forEach((book) => {
const card = document.createElement("div");
card.setAttribute("class", "card");
const h1 = document.createElement("h1");
h1.textContent = book.name;
const p = document.createElement("p");
// book.description = book.description.substring(0, 300);
p.textContent = `${book.description}...`;
const div = document.createElement("div");
div.setAttribute("class", "imgDiv");
const img = document.createElement("img");
img.src = book.image;
div.appendChild(img);
container.appendChild(card);
card.appendChild(h1);
// card.appendChild(img);
card.appendChild(div);
card.appendChild(p);
});
//Bug 0
// const closeDiv = document.createElement("div");
// closeDiv.setAttribute("class", "closeDiv");
// const hr = document.createElement("hr");
// container.appendChild(hr);
const closeBtn = document.createElement("button");
closeBtn.setAttribute("class", "closeBtn");
closeBtn.setAttribute("id", "closeBtn");
closeBtn.textContent = "Close";
// closeDiv.appendChild(closeBtn);
// container.appendChild(closeBtn);
// container.appendChild(closeDiv);
// appl.appendChild(closeDiv);
appl.appendChild(closeBtn);
//
console.log(data);
document
.getElementById("closeBtn")
.addEventListener("click", () => {
container.style.transition = "all 0.5s ease-in-out";
container.innerHTML = "";
// appl.removeChild(closeDiv);
appl.removeChild(closeBtn);
});
//Bug 0 ends
} else {
console.log("No data found");
}
// console.log(snapshot.val());
});
};
document.getElementById("show").addEventListener("click", getData);
// $(document).ready(function () {
// $("#closeBtn").click(function () {
// $("#root").toggle();
// // $("#root").empty();
// // $("#container").empty();
// // appl.removeChild(container);
// console.log("Hello");
// });
// });
// $(document).ready(function () {
// // $(body).setAttribute("id", "google_translate_element");
// const bady = document.getElementsByClassName("lang");
// const boody = Array.from(bady);
// boody[0].setAttribute("id", "google_translate_element");
// });
</script>
<script src="script.js"></script>
</body>
</html>
<!-- document.getElementById("add-book").addEventListener("click", function() {
const bookName = document.getElementById("book-name").value;
const bookAuthor = document.getElementById("book-author").value;
const bookGenre = document.getElementById("book-genre").value;
const bookYear = document.getElementById("book-year").value;
const bookImage = document.getElementById("book-image").value;
const bookDescription = document.getElementById("book-description").value;
// const book = {
// name: bookName,
} -->
<!--
// Get a reference to the database service
const database = app.database(); -->
<!-- // document.getElementById("show").onClick = function () {
// firebase
// .database()
// .ref("/")
// .once("value", function (snapshot) {
// console.log(snapshot.val());
// });
// // database.ref("/books").once("value").then(function (snapshot) {
// // console.log(snapshot.val());
// // });
// }; -->
<!-- //Smooth Scroll Starts. Found a btter way to do this. In CSS - html{scroll-behavior:smooth}
// document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
// anchor.addEventListener("click", function (e) {
// e.preventDefault();
// document.querySelector(this.getAttribute("href")).scrollIntoView({
// behavior: "smooth",
// });
// });
// });
//Smooth Scroll Ends -->