-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnewArrival.js
407 lines (308 loc) · 13.4 KB
/
newArrival.js
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
let newArrival = [
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6882689955441864704/16548/goods_thumb_220-v1/d585179323c5.jpg",
newProductName: "Laptop Car Charger Adapter With USB Port for Magsafe2",
newPrice: "31.00",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 1",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6878025592978206720/16553/goods_thumb_220-v1/a5e183b72eb6.jpg",
newProductName: "XT9 Mini WiFi FPV with 4K ESC HD Dual Camera Optical Flow",
newPrice: "35.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 2",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/store/6878025592978206720/16553/goods_thumb_220-v1/bad7de278e59.jpg",
newProductName: "Inflatable Floating Bed Water Backrest Lounger PVC Deck",
newPrice: "39.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 3",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/store/6933482338412326912/16551/goods_thumb_220-v1/6f33bf36f8e7.jpg",
newProductName: "Electric Gooseneck Kettle Hot Water Kettle 100% Stainless",
newPrice: "119.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 4",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6883820374342168576/16551/goods_thumb_220-v1/c13cdeecbe0d.jpg",
newProductName: "Xiaomi Redmi 9A Global ROM 4GB of RAM 64GB / 128GB",
newPrice: "148.00",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 5",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6883820374342168576/16551/goods_thumb_220-v1/ca62cec7e518.jpg",
newProductName: "Sink Colander Baskets Pack of 2 Wash Vegetables and Fruits",
newPrice: " 28.00 ",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 6",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6878391336429613056/16553/goods_thumb_220-v1/a32163ea9522.jpg",
newProductName: "Xiaomi Mijia Mini Fascia Gun Muscle Electric Massager",
newPrice: "79.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 7",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6898654298117435392/16549/goods_img_big-v1/d87e35c0597d.jpg",
newProductName: "Lenovo Tab P11 Global Firmware Xiaoxin Pad 11 inch",
newPrice: "309.80",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 8",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/store/6878025592978206720/16553/goods_thumb_220-v1/d3f86c375a7c.jpg",
newProductName: "CflyAi Faith 2S GPS Drone 5G 5KM WiFi FPV with 4K HD",
newPrice: "329.99 ",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 9",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6878025592978206720/16553/goods_thumb_220-v1/bfa7a57705ba.jpg",
newProductName: "Double Floating Boat Inflatable Floating Bed Floating Boat",
newPrice: "117.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 10",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6900386065325158400/16469/goods_thumb_220-v1/86ea8b332343.jpg",
newProductName: "GOGOBEST GF700 E-bike E-bike Dual motor 1000W Hydraulic",
newPrice: "1499.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 11",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/store/6933482338412326912/16551/goods_thumb_220-v1/0f63949c218e.jpg",
newProductName: "Portable Electric Kettle Temperature Control Keep",
newPrice: " 109.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 12",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6870745450383863808/16554/goods_thumb_220-v1/474893e6aae3.jpg",
newProductName: "OnePlus 9RT 5G Global Rom Snapdragon 888 6.62 inch",
newPrice: "479.00 ",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 13",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6878391336429613056/16549/goods_thumb_220-v1/ab2f2258ad2e.jpg",
newProductName: "Original Xiaomi Mi TDS Water Quality Tester Total Dissolved",
newPrice: "12.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 14",
},
{
newImage: "https://gloimg.gbtcdn.com/soa/gb/item/6878391336429613056/16552/goods_thumb_220-v2/86364c7a257c.jpg",
newProductName: "Xiaomi Mijia Massage Gun Electric Neck Massager Smart",
newPrice: " 109.99",
cartBtn: "https://cdn-icons-png.flaticon.com/128/891/891462.png",
newProductID: "new arrival 15",
},
];
let productCont= document.getElementById("newContainer")
let cartNewArrivalLs= JSON.parse(localStorage.getItem("newCart")) || [];
newArrival.map(function (elem, index, arr) {
let boxNewarrival = document.createElement("div");
let productImage = document.createElement("img");
productImage.setAttribute("src", elem.newImage);
let productName = document.createElement("p");
productName.innerText = elem.newProductName;
let productPrice = document.createElement("h3");
productPrice.innerText = elem.newPrice;
let cartIcon = document.createElement("img");
cartIcon.setAttribute("src", elem.cartBtn);
cartIcon.style.width = "25px";
cartIcon.style.height = "25px";
cartIcon.addEventListener("click", function(){
if(newArrivalCart(elem.newProductID)===true){
alert("Product Added Successfully");
cartNewArrivalLs.push(elem);
localStorage.setItem("newCart", JSON.stringify(cartNewArrivalLs));
}
else{
alert("Product is alredy in the cart");
}
})
boxNewarrival.append(productImage, productName, productPrice, cartIcon);
document.querySelector("#newContainer").append(boxNewarrival);
})
function newArrivalCart(id){
for(let i=0;i<cartNewArrivalLs.length;i++){
if(cartNewArrivalLs[i].newProductID==id){
return false;
}
}
return true;
}
let main_footer = document.querySelector("#footer_main_aj")
let f4_data = [
{
mh: "Company Information",
sh1: "About Us",
sh2: "Privacy Policy",
sh3: " Terms and Conditions",
sh4: "Intellectual Property Policy",
sh5: "Testimonials",
sh6: "Contact Us",
sh7: "Report Security Issue",
sh8: "Sell on Gearbest",
sh9: "Cookies Policy",
sh10: "Top Brands",
sh11: "Gearbest Official Blog",
sh12: "Top Searches"
},
{
mh: "Customer Service",
sh1: "Shipping Information",
sh2: "My Favorites",
sh3: "FAQ For Newsletter Subscription",
sh4: "My Points",
sh5: "Warranty and Return",
sh6: "Payment Methods",
sh7: "Deposit Expansion",
sh8: "FAQ & Support",
sh9: "Sitemap",
sh10: "Gearbest Wallet Instruction",
sh11: "FAQs about COVID-19",
sh12: "",
},
{
mh: "Other Business",
sh1: "Partnership Programs",
sh2: "Associate Program",
sh3: "",
sh4: "",
sh5: "",
sh6: "",
sh7: "",
sh8: "",
sh9: "",
sh10: "",
sh11: "",
sh12: "",
},
]
display_footer_4()
function display_footer_4() {
f4_data.forEach(function (elem) {
let footer_4 = document.querySelector("#footer-4")
let f4_boxes = document.querySelector("#cont_boxes")
let tbody = document.createElement("div")
// console.log(elem)
let th = document.createElement("h3")
th.innerText = elem.mh
let td1 = document.createElement("a")
td1.href = "https://www.gearbest.com/"
td1.innerText = elem.sh1
let td2 = document.createElement("a")
td2.innerText = elem.sh2
td2.href = "https://www.gearbest.com/"
let td3 = document.createElement("a")
td3.innerText = elem.sh3
td3.href = "https://www.gearbest.com/"
let td4 = document.createElement("a")
td4.innerText = elem.sh4
td4.href = "https://www.gearbest.com/"
let td5 = document.createElement("a")
td5.innerText = elem.sh5
td5.href = "https://www.gearbest.com/"
let td6 = document.createElement("a")
td6.innerText = elem.sh6
td6.href = "https://www.gearbest.com/"
let td7 = document.createElement("a")
td7.innerText = elem.sh7
td7.href = "https://www.gearbest.com/"
let td8 = document.createElement("a")
td8.innerText = elem.sh8
td8.href = "https://www.gearbest.com/"
let td9 = document.createElement("a")
td9.innerText = elem.sh9
td9.href = "https://www.gearbest.com/"
let td10 = document.createElement("a")
td10.innerText = elem.sh10
td10.href = "https://www.gearbest.com/"
let td11 = document.createElement("a")
td11.innerText = elem.sh11
td11.href = "https://www.gearbest.com/"
let td12 = document.createElement("a")
td12.innerText = elem.sh12
td12.href = "https://www.gearbest.com/"
let pd1 = document.createElement("p")
pd1.append(td1)
let pd2 = document.createElement("p")
pd2.append(td2)
let pd3 = document.createElement("p")
pd3.append(td3)
let pd4 = document.createElement("p")
pd4.append(td4)
let pd5 = document.createElement("p")
pd5.append(td5)
let pd6 = document.createElement("p")
pd6.append(td6)
let pd7 = document.createElement("p")
pd7.append(td7)
let pd8 = document.createElement("p")
pd8.append(td8)
let pd9 = document.createElement("p")
pd8.append(td9)
let pd10 = document.createElement("p")
pd10.append(td10)
let pd11 = document.createElement("p")
pd11.append(td11)
let pd12 = document.createElement("p")
pd12.append(td12)
tbody.append(th, pd1, pd2, pd3, pd4, pd5, pd6, pd7, pd8, td9, pd10, pd11, pd12)
f4_boxes.append(tbody)
footer_4.append(f4_boxes)
main_footer.append(footer_4)
})
}
display_footer_5()
function display_footer_5() {
let f5_data = [
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/money.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/m.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/rese.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/paypal.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/visa.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/a.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/ww.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/jcb.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/dic.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/ya.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/d.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/qiwi.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/oxxo.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/webmoney.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/bo.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/postepay.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/giropay.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/sofort.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/p.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/pago.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/banner/20180407_2974/eps.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/others/20190222_7819/Visa-Logo.png" },
{ image: "https://uidesign.gbtcdn.com/GB/image/others/20190222_7819/m-Logo.png" },
]
f5_data.forEach(function (elem) {
let img = document.createElement("img")
img.src = elem.image
let box_f5 = document.querySelector("#footer-5")
box_f5.append(img)
main_footer.append(box_f5)
})
}
display_lastfooter()
function display_lastfooter() {
td = document.createElement("p")
td.innerText = "Copyright © 2014-2022 Gearbest.com. All Rights Reserved."
let box = document.querySelector("#last_footer")
box.append(td)
main_footer.append(box)
}