-
Notifications
You must be signed in to change notification settings - Fork 1
/
gadgets.html
527 lines (498 loc) · 18.6 KB
/
gadgets.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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<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>Document</title>
<link rel="stylesheet" href="common.css" />
</head>
<body>
<div class="nav">
<div class="guest">
<a href="guest.html"> <h1>Guest Services</h1></a>
</div>
<div class="logo">
<img
onclick="window.location.href='index.html'"
src="https://shopdisney.in/media/logo/stores/1/shopDisney_1.png"
alt=""
/>
</div>
<div class="nav-right">
<div class="sign">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path
d="M224 256c70.7 0 128-57.31 128-128s-57.3-128-128-128C153.3 0 96 57.31 96 128S153.3 256 224 256zM274.7 304H173.3C77.61 304 0 381.6 0 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7C432.5 512 448 496.5 448 477.3C448 381.6 370.4 304 274.7 304z"
/>
</svg>
<span id="para">Hi Shrey!</span>
</div>
<div class="wishList">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M0 190.9V185.1C0 115.2 50.52 55.58 119.4 44.1C164.1 36.51 211.4 51.37 244 84.02L256 96L267.1 84.02C300.6 51.37 347 36.51 392.6 44.1C461.5 55.58 512 115.2 512 185.1V190.9C512 232.4 494.8 272.1 464.4 300.4L283.7 469.1C276.2 476.1 266.3 480 256 480C245.7 480 235.8 476.1 228.3 469.1L47.59 300.4C17.23 272.1 .0003 232.4 .0003 190.9L0 190.9z"
/>
</svg>
<a href="">My Wishlist</a>
</div>
<div class="cart">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M112 112C112 50.14 162.1 0 224 0C285.9 0 336 50.14 336 112V160H400C426.5 160 448 181.5 448 208V416C448 469 405 512 352 512H96C42.98 512 0 469 0 416V208C0 181.5 21.49 160 48 160H112V112zM160 160H288V112C288 76.65 259.3 48 224 48C188.7 48 160 76.65 160 112V160zM136 256C149.3 256 160 245.3 160 232C160 218.7 149.3 208 136 208C122.7 208 112 218.7 112 232C112 245.3 122.7 256 136 256zM312 208C298.7 208 288 218.7 288 232C288 245.3 298.7 256 312 256C325.3 256 336 245.3 336 232C336 218.7 325.3 208 312 208z"
/>
</svg>
<span id="cartno">0</span>
<a href="cartpage.html">My Bag</a>
</div>
</div>
</div>
<br />
<div class="nav-2">
<div class="sale">
<a href="deals.html"><h1>NEW</h1></a>
<h1>|</h1>
<a href="deals.html"><h1>SALE</h1></a>
</div>
<div class="opt">
<a href="gifts.html"><h1>GIFTS</h1></a>
<a href="fashion.html"><h1>FASHION AND ACCESSORIES</h1></a>
<a href="toys.html"><h1>TOYS</h1></a>
<a href="backtoschool.html"> <h1>BACK TO SCHOOL</h1></a>
<a href="afterSign.html"><h1>HOME</h1></a>
<a href="gadgets.html"><h1>GADGETS</h1></a>
</div>
<div class="search-container">
<input type="text" class="search-box" placeholder="Search..." />
<button class="search-button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"
/>
</svg>
</button>
</div>
</div>
<div id="pic">
<img
src="https://shopdisney.in/media/March/2022/banner/d_Gadgets.jpg"
alt=""
/>
</div>
<div id="text">
<p>ShopDisney / Fashion & Accessories</p>
</div>
<div id="flex">
<div id="filter">
<select id="sortNames" onchange="handleNameSort()">
<option value="">Sort By Names</option>
<option value="ascending">Ascending</option>
<option value="descending">Descending</option>
</select>
<br />
<select
name="Sort by price"
id="sortprice"
onchange="handlePriceSort()"
>
<option value="">Sort By Price</option>
<option value="htl">High To Low</option>
<option value="lth">Low To High</option>
</select>
<select id="filtercat" onchange="handleCatSort()">
<option value="">Filter by catagery</option>
<option value="Mouse Pad">Mouse Pad</option>
<option value="Watch">Watch</option>
<option value="Bluetooth">Bluetooth</option>
</select>
</div>
<div id="grid"></div>
</div>
</body>
</html>
<script>
cartdata = JSON.parse(localStorage.getItem("cart")) || [];
gadgetsdata = [
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882623_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Iron Man Storm Smartwatch Multicolor",
Strikeoffprice: 5990,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882630_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Black Panther Storm Smartwatch Multicolor",
Strikeoffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/8/9/8904130882616_1_.png",
Name: "Marvel Captain America Storm Smartwatch Multicolor",
Strikeoffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882630_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Black Panther Storm Smartwatch Multicolor",
Strikeoffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/8/9/8904130881640_1_.png",
Name: "Marvel Iron Man Airdopes 131 TWS Earbuds For Unisex",
Strikeoffprice: 2900,
Price: 1499,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/8/9/8904130881633_1_.png",
Name: "Marvel Black Panther Airdopes 131 TWS Earbuds For Unisex",
Strikeoffprice: 2990,
Price: 1499,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/8/9/8904130881626_1_.png",
Name: "Marvel Captain America Airdopes 131 TWS Earbuds For Unisex",
Strikeoffprice: 2999,
Price: 1299,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/8/9/8904130881596_1_.png",
Name: "Marvel Captain America Stone 190 bluetooth Speaker",
Strikeoffprice: 2990,
Price: 1499,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882616_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Captain America Storm Smartwatch",
Strikeoffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882623_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Iron Man Storm Smartwatch Multicolor",
Strikeo3799ffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882623_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Iron Man Storm Smartwatch Multicolor",
Strikeoffprice: 5990,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/8/9/8904130882630_1_.png?width=300&height=&canvas=300,&quality=80&bg-color=255,255,255&fit=bounds",
Name: "Marvel Black Panther Storm Smartwatch Multicolor",
Strikeoffprice: 5900,
Price: 3799,
Catagery: "Watch",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodciblintegratedspiderlogo1.jpg",
Name: "Marvel Spider-Man Integrated Logo - Decibel Wireless On Ear Headphones Multicolor ",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodciblmysticartsspidey1.jpg",
Name: "Marvel Spider-Man Mystic Arts - Decibel Wireless On Ear Headphones Multicolor For Unisex",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodciblstrangeparkeralliance1.jpg",
Name: "Marvel Spider-Man Black and Gold - Decibel Wireless On Ear Headphones Multicolor For Unisex",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodciblstrangetotherescue1.jpg",
Name: "Marvel Spider-Man Strange to the rescue - Decibel Wireless On Ear Headphones Multicolor ",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodcibltwofacespidey1.jpg",
Name: "Marvel Spider-Man Two Face - Decibel Wireless On Ear Headphones Multicolor For Unisex",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/s/o/sodciblwebshootingspidey1.jpg",
Name: "Marvel Spider-Man Web Shooting - Decibel Wireless On Ear Headphones Multicolor ",
Strikeoffprice: 1900,
Price: 1600,
Catagery: "Bluetooth",
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdstrangeparkeralliance1.jpg",
Name: "Marvel Spider-Man Strange Parker Alliance - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdspidermanengage1.jpg",
Name: "Marvel Spider-ManEngage - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdshattereddimensionspidey1.jpg",
Name: "Marvel Spider-Man Shattered Dimension - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdpublicenemyspidey1.jpg",
Name: "Marvel Spider-Man Public Enemy - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdpeterparkergrunge1.jpg",
Name: "Marvel Spider-Man Peter Parker Grunge - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdpeterblackandgold1.jpg",
Name: "Marvel Spider-Man Peter Black and Gold - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdnowayhomespidey1.jpg",
Name: "Marvel Spider-Man No Way Home - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdnewspidertech1.jpg",
Name: "Marvel Spider-Man New Tech - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdneighborhoodspidey1.jpg",
Name: "Marvel Spider-Man Neighborhood - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdmysticartsspidey1.jpg",
Name: "Marvel Spider-Man Mystic Arts - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdintegratedspiderlogo1.jpg",
Name: "Marvel Spider-Man Integrated Logo - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdextraordinaryspiderman1.jpg",
Name: "Marvel Spider-Man Extraordinary man - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
{
Image:
"https://shopdisney.in/media/catalog/product/cache/653b84d7c049b572e5becd44f2ff8080/m/c/mcdmopdall3spidey1.jpg",
Name: "Marvel Spider-Man All 3 - Mouse Pad Multicolor For Unisex",
Strikeoffprice: 499,
Price: 399,
Catagery: "Mouse Pad",
Incart: 1,
},
];
displayData(gadgetsdata);
function handlePriceSort() {
console.log("YES");
var sort = document.querySelector("#sortprice").value;
if (sort == "htl") {
gadgetsdata.sort(function (a, b) {
return b.Price - a.Price;
});
displayData(gadgetsdata);
}
if (sort == "lth") {
gadgetsdata.sort(function (a, b) {
return a.Price - b.Price;
});
displayData(gadgetsdata);
}
}
function handleNameSort() {
// console.log("Yes")
var sort = document.querySelector("#sortNames").value;
// console.log(sort)
if (sort == "ascending") {
gadgetsdata.sort(function (a, b) {
if (a.Name > b.Name) return 1;
if (a.Name < b.Name) return -1;
return 0;
});
console.log("Yes");
displayData(gadgetsdata);
}
if (sort == "descending") {
gadgetsdata.sort(function (a, b) {
if (a.Name > b.Name) return -1;
if (a.Name < b.Name) return 1;
return 0;
});
console.log("NOO");
displayData(gadgetsdata);
}
}
function handleCatSort() {
var sort = document.querySelector("#filtercat").value;
var sortlist = gadgetsdata.filter(function (elem) {
return elem.Catagery == sort;
});
console.log("Sorted");
displayData(sortlist);
}
function displayData(gadgetsdata) {
document.querySelector("#grid").innerHTML = "";
gadgetsdata.map(function (elem) {
var maindiv = document.createElement("div");
maindiv.setAttribute("id", "maindiv");
var div1 = document.createElement("div");
var image = document.createElement("img");
image.src = elem.Image;
image.setAttribute("id", "img");
var name = document.createElement("p");
name.innerText = elem.Name;
div1.append(image, name);
var pricediv = document.createElement("div");
pricediv.setAttribute("id", "pricediv");
var strprice = document.createElement("p");
strprice.innerText = "₹" + " " + elem.Strikeoffprice;
strprice.setAttribute("id", "strike");
var price = document.createElement("P");
price.innerText = "₹" + " " + elem.Price;
var cart = document.createElement("button");
cart.innerText = "Add to cart";
cart.setAttribute("id", "btn");
cart.addEventListener("click", function () {
cartfun(elem);
cartNumber();
});
pricediv.append(strprice, price);
maindiv.append(div1, pricediv, cart);
document.querySelector("#grid").append(maindiv);
});
}
function cartfun(elem) {
cartdata.push(elem);
localStorage.setItem("cart", JSON.stringify(cartdata));
alert("Item added to cart");
console.log(cartdata);
}
function onloadcartnumber() {
var productnumber = localStorage.getItem("cartNumber");
if (productnumber) {
document.querySelector(" #cartno").textContent = productnumber;
}
}
function cartNumber() {
var productnumber = localStorage.getItem("cartNumber") || [];
productnumber = parseInt(productnumber);
if (productnumber) {
localStorage.setItem("cartNumber", productnumber + 1);
document.querySelector("#cartno").textContent = productnumber + 1;
} else {
localStorage.setItem("cartNumber", 1);
document.querySelector("#cartno").innerText = 1;
}
}
onloadcartnumber();
</script>