-
Notifications
You must be signed in to change notification settings - Fork 1
/
Food Menu.js
432 lines (346 loc) · 11.2 KB
/
Food Menu.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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
let Data=[
{
image:'https://www.kindmeal.my/photos/item/0/335-4318-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Jakarta-Style Gadogado"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4322-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Nasi Lemak"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4298-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Rich Chocolate Cake"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3884-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Vegan Macaron"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3898-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Cakes"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4315-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Coconut Orange Slice"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4328-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Valentine's Day Buttercake"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3883-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Vegan Macaron"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4317-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Eggless Doughnut"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4326-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"White Chocolate Daisy"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3882-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Sunflower Buttercake"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4327-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Taco Set"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4320-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Maggi Goreng"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4294-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Pie"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4316-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Eggfree Chocolate Cake"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-4324-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Tango Lemon Rice"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3868-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Raw Burrito With A Side Of Salsa & Cauliflower Rice"
},
{
image:'https://www.kindmeal.my/photos/item/0/335-3879-m.jpg',
Name:"The Black Cat Cafe",
Address:"Kuala Lumpur, Wilayah Persekutuan",
Details:"Festive Butttercake Slice"
}
]
let results=110;
let per_page=10;
let showButns=(results,per_page)=>{
let buttons_div=document.getElementById("buttonss")
let buttons=Math.ceil(results/per_page)
for(let i=1;i<buttons;i++){
let button=document.createElement("button")
button.innerText=i;
button.style.backgroundColor="transparent"
button.style.border="0px"
button.style.color="#057ff1"
button.onclick=function(){
pagination(i);
}
buttons_div.append(button)
}
}
showButns(results,per_page)
let showButns1=(results,per_page)=>{
let buttons_div=document.getElementById("buttonss1")
let buttons=Math.ceil(results/per_page)
for(let i=1;i<buttons;i++){
let button=document.createElement("button")
button.innerText=i;
button.style.backgroundColor="transparent"
button.style.border="0px"
button.style.color="#057ff1"
button.onclick=function(){
pagination(i);
}
buttons_div.append(button)
}
}
showButns1(results,per_page)
let cont=document.getElementById("cont2")
display(Data)
function display(Data){
document.getElementById("cont2").innerHTML=null
Data.map(function(ele){
let div = document.createElement("div");
div.style.boxShadow = "rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px";
let image = document.createElement("img");
image.src=ele.image
image.style.width="100%"
image.style.borderRadius="10px 10px 0 0"
image.addEventListener("click",function(){
togglePopup()
dis(ele)
di()
})
let details=document.createElement('h4')
details.style.fontWeight="500"
details.style.paddingLeft="10px"
details.style.paddingRight="10px"
details.innerText=ele.Details
if(ele.Details==undefined){
details.innerText=null
details.style.display="none"
}
let address=document.createElement('h5')
address.innerText=ele.Address
address.style.fontWeight="400"
address.style.color="grey"
address.style.paddingLeft="10px"
address.style.marginTop='-20px';
let name=document.createElement('h4')
name.innerText=ele.Name
name.style.marginLeft='10px';
name.style.fontWeight="400";
div.append(image,details,name,address)
document.getElementById("cont2").append(div);
})
}
let imageState = 0;
function togglePopup(){
document.getElementById("popup-1").classList.toggle("active");
imageState = 0;
}
function dis(ele){
document.getElementById("cont3").innerHTML=null;
let div1 = document.createElement("div");
let image1 = document.createElement('img')
image1.src=ele.image;
image1.style.width="400px"
image1.style.height="350px"
image1.style.marginLeft="80px"
image1.style.paddingTop="20px"
image1.id="image1"
let det=document.createElement("h4")
det.innerText=ele.Details
det.style.textAlign="center"
det.style.marginLeft="80px"
det.id="det"
let divs=document.createElement("div")
divs.style.marginTop="180px"
divs.style.display="flex"
divs.style.justifyContent="space-between"
divs.style.marginLeft="60px"
let buttns=document.createElement("button")
buttns.innerText="◀ Prev Item"
buttns.style.backgroundColor="#04be5a"
buttns.style.color="white"
buttns.style.padding="10px 20px"
buttns.style.border="0"
buttns.style.borderRadius="5px"
buttns.style.fontWeight="500"
buttns.addEventListener("click",function(){
di3()
})
let buttns1=document.createElement("button")
buttns1.innerText="Next Item ▶"
buttns1.style.backgroundColor="#04be5a"
buttns1.style.color="white"
buttns1.style.padding="10px 20px"
buttns1.style.border="0"
buttns1.style.borderRadius="5px"
buttns1.style.fontWeight="500"
buttns1.addEventListener("click",function(){
di2()
})
divs.append(buttns,buttns1)
div1.append(image1,det)
document.getElementById("cont3").append(div1,divs)
}
function di2(){
imageState++;
if(imageState===Data.length){
imageState=0;
}
image1.src=Data[imageState].image;
det.innerText=Data[imageState].Details
}
function di3(){
imageState--;
if(imageState<0){
imageState=Data.length-1;
}
image1.src=Data[imageState].image;
det.innerText=Data[imageState].Details
}
function di(){
document.getElementById("cont6").innerHTML=null;
let div2 = document.createElement("div");
div2.id="div2"
let image2 = document.createElement('img')
image2.src='https://www.kindmeal.my/photos/shop/3/335-2150-m.jpg'
let name=document.createElement("h4")
name.innerText="The Black Cat Cafe"
name.style.color="#666666"
let add=document.createElement("h5")
add.innerText="Address:"
add.style.color='grey'
add.style.textAlign="left"
add.style.fontWeight="500"
let ph=document.createElement("h5")
ph.innerText="Phone:"
ph.style.color='grey'
ph.style.textAlign="left"
ph.style.fontWeight="500"
let oh=document.createElement("h5")
oh.innerText="Opening Hours:"
oh.style.color='grey'
oh.style.textAlign="left"
oh.style.fontWeight="500"
let address=document.createElement('h5')
address.innerText="B-00-11 Viva Residency, Jalan Suppiah Pillay, 2nd mile Jalan Ipoh, 51200 Kuala Lumpur, Wilayah Persekutuan"
address.style.color='grey'
address.id="address"
address.style.textAlign="left"
let phone=document.createElement('h5')
phone.innerText="03-4050 2822 / 016-419 1309"
phone.style.color='grey'
phone.id="phone"
phone.style.textAlign="left"
let hours=document.createElement('h5')
hours.innerText="Mon - Sat: 11am - 9.30pm; Sun: Closed"
hours.style.color='grey'
hours.id="hours"
hours.style.textAlign="left"
let div3=document.createElement("div")
div3.style.display="grid"
div3.style.gap="10px"
let buttn1=document.createElement("button")
buttn1.innerText="Meal Deals"
buttn1.style.border="0"
buttn1.style.padding="5px 0"
buttn1.style.borderRadius="5px"
buttn1.style.cursor="pointer"
buttn1.addEventListener("click",function(){
linkd()
})
let buttn2=document.createElement("button")
buttn2.innerText="Food Menu"
buttn2.style.border="0"
buttn2.style.padding="5px 0"
buttn2.style.borderRadius="5px"
buttn2.style.cursor="pointer"
buttn2.addEventListener("click",function(){
linkd()
})
let buttn3=document.createElement("button")
buttn3.innerText="Outlets"
buttn3.style.border="0"
buttn3.style.padding="5px 0"
buttn3.style.borderRadius="5px"
buttn3.style.cursor="pointer"
buttn3.addEventListener("click",function(){
linkd()
})
div3.append(buttn1,buttn2,buttn3)
div2.append(image2,name,ph,phone,add,address,oh,hours,div3)
document.getElementById("cont6").append(div2)
}
function linkd(){
window.location.href="black.html"
}
let tab1=document.getElementById("tab1");
tab1.addEventListener("click",show);
function show(){
window.location.href="directory.html"
}
let tab2=document.getElementById("tab2");
tab2.addEventListener("click",show1);
function show1(){
window.location.href="Featured Restaurants.html"
}
let tab3=document.getElementById("tab3");
tab3.addEventListener("click",show2);
function show2(){
window.location.href="Food Menu.html"
}
let tab4=document.getElementById("tab4");
tab4.addEventListener("click",show3);
function show3(){
window.location.href="Food Map.html"
}