-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbabyBoy.js
260 lines (220 loc) · 7.59 KB
/
babyBoy.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
let cartData=JSON.parse(localStorage.getItem("display"))||{}
let noise=[{img:"https://static.zara.net/photos///2022/I/0/3/p/6048/566/712/402/w/613/6048566712_1_1_1.jpg?ts=1654154307042",
name:"TEXTURED STRIPED TOP",
price:1490,
ProductID:"TOP"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/7545/531/712/402/w/613/7545531712_1_1_1.jpg?ts=1654154307653",
name:"TEXTURED STRIPED TOP",
price:1490,
ProductID:"TOP"},]
var b=11
for(let i=0 ;i<noise.length ; i++){
let x=noise[i]
if(x.quantity===undefined){
x.quantity=1
} if(x.category===undefined){
x.category=b
b++
}
if(x.cartePrice===undefined){
x.cartePrice=x.price
}
}
// console.log(noise);
// console.log(noise)
function display(data){
document.querySelector("#noise").innerHTML="" ;
data.forEach(function(el){
let div3 = document.createElement("div")
let div = document.createElement("div")
let div1 = document.createElement("div")
let img =document.createElement("img")
img.src=el.img ;
img.addEventListener("click",function(){
localSet(el)
})
let name= document.createElement("p")
name.innerText=el.name ;
name.addEventListener("click",function(){
localSet(el)
})
let price = document.createElement("p")
price.innerText="₹ "+el.price+".00" ;
div.append(img)
div1.append(name,price)
div3.append(div,div1)
document.querySelector("#noise").append(div3)
})
}
display(noise)
let baby=[{img:"https://static.zara.net/photos///2022/I/0/3/p/6048/563/712/2/w/297/6048563712_6_1_1.jpg?ts=1652370563860",
name:"SPECKLED TEXTURED SHIRT",
price:1490,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/7545/531/712/2/w/297/7545531712_6_1_1.jpg?ts=1653490628926",
name:"TEXTURED STRIPED TOP",
price:1490,
ProductID:"TOP"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/6048/566/712/405/w/613/6048566712_1_1_1.jpg?ts=1654154459243",
name:"SMOOTH TEXTURE SHIRT",
price:1490,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/1/3/p/6651/030/030/2/w/297/6651030030_6_1_1.jpg?ts=1652969488170",
name:"BABY/ LEATHER SANDALS",
price:2290,
ProductID:"SANDALS"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/5643/505/712/403/w/1247/5643505712_15_1_1.jpg?ts=1654689048766",
name:"PALM TREE T-SHIRT",
price:790,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/5643/505/712/2/w/297/5643505712_6_1_1.jpg?ts=1654180636640",
name:"PALM TREE T-SHIRT",
price:790,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/7878/559/250/402/w/1247/7878559250_15_1_1.jpg?ts=1654689051402",
name:"TECHNICAL PALM TREE T-SHIRT",
price:890,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/7878/559/250/2/w/297/7878559250_6_1_1.jpg?ts=1653402201520",
name:"TECHNICAL PALM TREE T-SHIRT",
price:890,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/7878/559/250/2/w/297/7878559250_6_2_1.jpg?ts=1653402203689",
name:"TECHNICAL PALM TREE T-SHIRT",
price:890,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/0377/558/500/402/w/613/0377558500_1_1_1.jpg?ts=1654689051981",
name:"PALM TREE BERMUDA SHORTS",
price:890,
ProductID:"SHORT"},
]
var a=1
for(let i=0 ;i<baby.length ; i++){
let x=baby[i]
if(x.quantity===undefined){
x.quantity=1
} if(x.category===undefined){
x.category=a
a++
}
if(x.cartePrice===undefined){
x.cartePrice=x.price
}
}
// console.log(baby)
// console.log(baby.length);
function baby1(data){
document.querySelector("#img").innerHTML="" ;
data.forEach(function(el){
let div3 = document.createElement("div")
let div = document.createElement("div")
let div1 = document.createElement("div")
let img =document.createElement("img")
img.src=el.img ;
img.addEventListener("click",function(){
localSet(el)
})
let name= document.createElement("p")
name.innerText=el.name ;
name.addEventListener("click",function(){
localSet(el)
})
let price = document.createElement("p")
price.innerText="₹ "+el.price+".00" ;
div.append(img)
div1.append(name,price)
div3.append(div,div1)
document.querySelector("#img").append(div3)
})
}
baby1(baby)
let baby2=[{img:"https://static.zara.net/photos///2022/I/0/3/p/0722/508/500/2/w/297/0722508500_6_1_1.jpg?ts=1653986212859",
name:"HENLEY T-SHIRT",
price:590,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/6264/553/300/2/w/297/6264553300_6_1_1.jpg?ts=1654597749606",
name:"TIE-DYE BERMUDA SHORTS",
price:890,
ProductID:"SHORT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/6264/552/306/2/w/297/6264552306_6_1_1.jpg?ts=1654243882694",
name:"PASSION FRUIT PRINT T-SHIRT",
price:790,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/6264/554/306/2/w/297/6264554306_6_1_1.jpg?ts=1654243894445",
name:"PASSION FRUIT PRINT BERMUDA SHORTS",
price:890,
ProductID:"SHORT"},
{img:"https://static.zara.net/photos///2022/V/0/3/p/5048/507/526/2/w/297/5048507526_6_1_1.jpg?ts=1652957762429",
name:"3-PACK OF STRIPED T-SHIRTS",
price:1290,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/V/0/3/p/3337/583/712/2/w/297/3337583712_6_1_1.jpg?ts=1651066419517",
name:"COLOURED DENIM DUNGAREES",
price:1590,
ProductID:"DENIM"},
{img:"https://static.zara.net/photos///2022/V/1/3/p/8613/930/030/2/w/297/8613930030_6_1_1.jpg?ts=1648549176373",
name:"BABY/ QUILTED SANDALS",
price:2490,
ProductID:"SANDAL"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/2209/551/402/2/w/297/2209551402_6_1_1.jpg?ts=1654605622926",
name:"LINK KNIT SWEATER",
price:1090,
ProductID:"SWEATER"},
{img:"https://static.zara.net/photos///2022/I/0/3/p/6048/550/712/2/w/297/6048550712_6_1_1.jpg?ts=1654851003850",
name:"FALSE PLAIN SHIRT",
price:1290,
ProductID:"SHIRT"},
{img:"https://static.zara.net/photos///2022/I/1/3/p/8639/930/107/2/w/297/8639930107_6_4_1.jpg?ts=1653410458623",
name:"BABY/ LEATHER SANDALS",
price:2290,
ProductID:"SANDALS"},
]
var b=13
for(let i=0 ;i<baby2.length ; i++){
let x=baby2[i]
if(x.quantity===undefined){
x.quantity=1
} if(x.category===undefined){
x.category=b
b++
}
if(x.cartePrice===undefined){
x.cartePrice=x.price
}
}
console.log(baby2)
function baby3(data){
document.querySelector("#img2").innerHTML="" ;
data.forEach(function(el){
let div3 = document.createElement("div")
let div = document.createElement("div")
let div1 = document.createElement("div")
let img =document.createElement("img")
img.src=el.img ;
img.addEventListener("click",function(){
localSet(el)
})
let name= document.createElement("p")
name.innerText=el.name ;
name.addEventListener("click",function(){
localSet(el)
})
let price = document.createElement("p")
price.innerText="₹ "+el.price+".00" ;
div.append(img)
div1.append(name,price)
div3.append(div,div1)
document.querySelector("#img2").append(div3)
})
}
baby3(baby2)
// console.log(bab);
function localSet(el){
// console.log("kunal");
localStorage.setItem("display",JSON.stringify(el))
window.location.href="linkimage.html"
}
let logdata=JSON.parse(localStorage.getItem("Userdata"))
logdata.forEach(function(elem){
document.querySelector("#lg").innerText=elem.name;
})