-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.js
More file actions
714 lines (628 loc) · 23 KB
/
Copy pathfilter.js
File metadata and controls
714 lines (628 loc) · 23 KB
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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
let places = [
{
"name": "Spice Route",
"address": "1957 Westchester Ave, Bronx, NY 10462",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": false,
"pescatarian": false,
"vegetarian": true,
"reviews": "3.7",
"price-range": "$8-$45",
"restaurantType": "Fast Food",
"ethnicity": "Middle Eastern",
"borough": "Bronx"
},
{
"name": "King Grill",
"address": "855 E 169th St, Bronx, NY 10452",
"glutenFree": false,
"vegan": true,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": true,
"vegetarian": false,
"reviews": "4.2",
"price-range": "$10-$30",
"restaurantType": "Casual Dining"
,
"ethnicity": "Latin",
"borough": "Bronx"
},
{
"name": "Golden Krust Caribbean Restaurant",
"address": "358 E 149th St, Bronx, NY 10455",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": false,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "3.5",
"price-range": "$12-$40",
"restaurantType": "Cafe"
,
"ethnicity": "Caribbean",
"borough": "Bronx"
},
{
"name": "Parrilla Latina",
"address": "2501 Webster Ave, Bronx, NY 10458",
"glutenFree": false,
"vegan": true,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": true,
"reviews": "4.0",
"price-range": "$5-$25",
"restaurantType": "Buffet"
,
"ethnicity": "Caribbean",
"borough": "Bronx"
},
{
"name": "The Healthy Kitchen",
"address": "1135C Morris Park Ave, Bronx, NY 10461",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": false,
"reviews": "2.8",
"price-range": "$15-$50",
"restaurantType": "Bakery"
,
"ethnicity": "American",
"borough": "Bronx"
},
{
"name": "Urban Vegan Roots",
"address": "34-47 31st St, Astoria, NY 11106",
"glutenFree": true,
"vegan": true,
"petFriendly": true,
"halal": false,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": false,
"reviews": "4.6",
"price-range": "$20-$35",
"restaurantType": "Fine Dining"
,
"ethnicity": "American",
"borough": "Queens"
},
{
"name": "King Wah",
"address": "69-11 Northern Blvd, Woodside, NY 11377",
"glutenFree": false,
"vegan": true,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": true,
"reviews": "3.9",
"price-range": "$8-$20",
"restaurantType": "Fast Food"
,
"ethnicity": "Asian",
"borough": "Queens"
},
{
"name": "Peace & Plants Restaurant",
"address": "5317 Broadway, Woodside, NY 11377",
"glutenFree": true,
"vegan": false,
"petFriendly": false,
"halal": false,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": false,
"reviews": "4.3",
"price-range": "$12-$45",
"restaurantType": "Cafe"
,
"ethnicity": "American",
"borough": "Queens"
},
{
"name": "The COOP",
"address": "133-42 39th Ave #103, Queens, NY 11354",
"glutenFree": false,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": true,
"reviews": "3.6",
"price-range": "$10-$25",
"restaurantType": "Buffet"
,
"ethnicity": "Asian",
"borough": "Queens"
},
{
"name": "Lime and Salt Restaurant Bar",
"address": "98-102 Queens Blvd, Rego Park, NY 11374",
"glutenFree": true,
"vegan": true,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": false,
"reviews": "4.1",
"price-range": "$8-$35",
"restaurantType": "Bakery"
,
"ethnicity": "Latin",
"borough": "Queens"
}
,
{
"name": "Dynasty Chinese Restaurant",
"address": "1669 Flatbush Ave, Brooklyn, NY 11210",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "3.2",
"price-range": "$15-$30",
"restaurantType": "Fast Food"
,
"ethnicity": "Asian",
"borough": "Brooklyn"
},
{
"name": "New Ruan's Restaurant",
"address": "1955 86th St, Brooklyn, NY 11214",
"glutenFree": false,
"vegan": true,
"petFriendly": true,
"halal": false,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": true,
"vegetarian": true,
"reviews": "4.0",
"price-range": "$10-$20",
"restaurantType": "Casual Dining"
,
"ethnicity": "Asian",
"borough": "Brooklyn"
},
{
"name": "Little Istanbul Restaurant",
"address": "2007 Avenue U, Brooklyn, NY 11229",
"glutenFree": false,
"vegan": true,
"petFriendly": true,
"halal": false,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": true,
"vegetarian": true,
"reviews": "4.0",
"price-range": "$10-$20",
"restaurantType": "Casual Dining"
,
"ethnicity": "European",
"borough": "Brooklyn"
},
{
"name": "Terrace Restaurant & Bakery",
"address": "280 5th Ave, Brooklyn, NY 11215",
"glutenFree": true,
"vegan": false,
"petFriendly": false,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": false,
"reviews": "4.4",
"price-range": "$20-$50",
"restaurantType": "Buffet"
,
"ethnicity": "Latin",
"borough": "Brooklyn"
},
{
"name": "Gino's Pizza",
"address": "548 Flatbush Ave, Brooklyn, NY 11225",
"glutenFree": false,
"vegan": false,
"petFriendly": true,
"halal": false,
"nutAllergy": true,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "2.9",
"price-range": "$5-$25",
"restaurantType": "Cafe"
,
"ethnicity": "European",
"borough": "Brooklyn"
}
,
{
"name": "Tio Pepe",
"address": "168 West 4th Street, New York, NY 10014",
"glutenFree": true,
"vegan": true,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": false,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": false,
"reviews": "4.7",
"price-range": "$8-$40",
"restaurantType": "Fine Dining"
,
"ethnicity": "Latin",
"borough": "Manhattan"
},
{
"name": "Trinity Place",
"address": "115 Broadway, New York, NY 10006",
"glutenFree": false,
"vegan": false,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": true,
"vegetarian": true,
"reviews": "3.1",
"price-range": "$15-$25",
"restaurantType": "Bakery"
,
"ethnicity": "American",
"borough": "Manhattan"
},
{
"name": "Wild",
"address": "535 Hudson St, New York, NY 10014",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": false,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "3.8",
"price-range": "$12-$30",
"restaurantType": "Casual Dining"
,
"ethnicity": "American",
"borough": "Manhattan"
},
{
"name": "Carmine's",
"address": "200 W 44th St, New York, NY 10036",
"glutenFree": true,
"vegan": false,
"petFriendly": false,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": true,
"vegetarian": false,
"reviews": "4.2",
"price-range": "$5-$45",
"restaurantType": "Buffet"
,
"ethnicity": "European",
"borough": "Manhattan"
},
{
"name": "Brine Chicken",
"address": "1063 1st Ave, New York, NY 10022",
"glutenFree": false,
"vegan": true,
"petFriendly": true,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": false,
"reviews": "3.9",
"price-range": "$10-$35",
"restaurantType": "Bakery"
,
"ethnicity": "Middle Eastern",
"borough": "Manhattan"
}
,
{
"name": "Wat Buddhathai Thavorn Vanaram",
"address": "1100 Victory Blvd, Staten Island, NY 10301",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": false,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": false,
"pescatarian": true,
"vegetarian": true,
"reviews": "4.1",
"price-range": "$8-$25",
"restaurantType": "Cafe"
,
"ethnicity": "Asian",
"borough": "Staten Island"
},
{
"name": "Moe's Southwest Grill",
"address": "2397 Hylan Blvd, Staten Island, NY 10306",
"glutenFree": false,
"vegan": true,
"petFriendly": false,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "3.4",
"price-range": "$15-$50",
"restaurantType": "Fine Dining"
,
"ethnicity": "Latin",
"borough": "Staten Island"
},
{
"name": "Pronto Pizza & Pasta",
"address": "7339 Amboy Rd, Staten Island, NY 10307",
"glutenFree": true,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": false,
"shellfishAllergy": true,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": false,
"reviews": "3.6",
"price-range": "$10-$40",
"restaurantType": "Fast Food"
,
"ethnicity": "European",
"borough": "Staten Island"
},
{
"name": "Ho' Brah Taco Joint",
"address": "412 Forest Ave, Staten Island, NY 10301",
"glutenFree": true,
"vegan": true,
"petFriendly": false,
"halal": false,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": true,
"reviews": "4.0",
"price-range": "$12-$28",
"restaurantType": "Bakery"
,
"ethnicity": "Latin",
"borough": "Staten Island"
},
{
"name": "Angelo's Pizzeria",
"address": "715 Forest Ave, Staten Island, NY 10310",
"glutenFree": false,
"vegan": false,
"petFriendly": true,
"halal": true,
"nutAllergy": true,
"shellfishAllergy": false,
"lactoseIntolerant": true,
"pescatarian": false,
"vegetarian": false,
"reviews": "3.3",
"price-range": "$8-$25",
"restaurantType": "Cafe",
"ethnicity": "European",
"borough": "Staten Island"
}
]
document.addEventListener('DOMContentLoaded', function() {
scrollPosition();
});
// Get references for back to the top button
let backtotopButton = document.getElementById('back-to-top');
// This function determines whether the back-to-top button should be shown or hidden based on the user's scroll position.
function scrollPosition(){
// This gets the total height of the document (webpage), including any content that extends beyond the viewport.
let websiteHeight = document.documentElement.scrollHeight;
// This calculates the current scroll position plus the height of the viewport. Essentially, this gives the distance from the top of the page to the bottom of the viewport.
let currentwheelPos = window.innerHeight + window.pageYOffset;
// If the user has scrolled to the bottom of the page (currentwheelPos is greater than or equal to websiteHeight - 1), the button is shown. Otherwise, it is hidden.
if( currentwheelPos >= websiteHeight - 1) {
backtotopButton.style.display = "block";
}
else {
backtotopButton.style.display = "none";
}
}
// This function scrolls the page back to the top when the back-to-top button is clicked.
function scrollToTop() {
// Sets the scroll position of the document body to 0.
document.body.scrollTop = 0;
// This line of code sets the scroll position of the entire webpage to the top.
document.documentElement.scrollTop = 0;
}
// Attach scrollPosition to the window scroll event
window.addEventListener("scroll", scrollPosition);
// Attach scrollToTop to the button click event
backtotopButton.addEventListener("click", scrollToTop);
// Gallery Animation Section
function populateDropdowns() {
const boroughDropdown = document.getElementById('borough');
const ethnicityDropdown = document.getElementById('ethnicity');
const restaurantTypeDropdown = document.getElementById('restaurantType');
const boroughs = [...new Set(places.map(place => place.borough))];
const ethnicities = [...new Set(places.map(place => place.ethnicity))];
const restaurantTypes = [...new Set(places.map(place => place.restaurantType))];
boroughs.forEach(borough => {
const option = document.createElement('option');
option.value = borough;
option.textContent = borough;
boroughDropdown.appendChild(option);
});
ethnicities.forEach(ethnicity => {
const option = document.createElement('option');
option.value = ethnicity;
option.textContent = ethnicity;
ethnicityDropdown.appendChild(option);
});
restaurantTypes.forEach(restaurantType => {
const option = document.createElement('option');
option.value = restaurantType;
option.textContent = restaurantType;
restaurantTypeDropdown.appendChild(option);
});
}
function filterPlaces() {
const borough = document.getElementById('borough').value;
const ethnicity = document.getElementById('ethnicity').value;
const restaurantType = document.getElementById('restaurantType').value;
const glutenFree = document.getElementById('glutenFree').value;
const vegan = document.getElementById('vegan').value;
//
const halal = document.getElementById('halal').value;
const petFriendly = document.getElementById('petFriendly').value;
const nutAllergy = document.getElementById('nutAllergy').value;
const shellfishAllergy = document.getElementById('shellfishAllergy').value;
const lactoseIntolerant = document.getElementById('lactoseIntolerant').value;
const pescatarian = document.getElementById('pescatarian').value;
const vegetarian = document.getElementById('vegetarian').value;
const filteredPlaces = places.filter(place => {
return (
(borough === "" || place.borough === borough) &&
(ethnicity === "" || place.ethnicity === ethnicity) &&
(restaurantType === "" || place.restaurantType === restaurantType) &&
(glutenFree === "" || place.glutenFree.toString() === glutenFree) &&
(vegan === "" || place.vegan.toString() === vegan) &&
(halal === "" || place.halal.toString() === halal)&&
(petFriendly === "" || place.petFriendly.toString() === petFriendly) &&
(nutAllergy === "" || place.nutAllergy.toString() === nutAllergy) &&
(shellfishAllergy === "" || place.shellfishAllergy.toString() === shellfishAllergy)&&
(lactoseIntolerant === "" || place.lactoseIntolerant.toString() === lactoseIntolerant) &&
(pescatarian === "" || place.pescatarian.toString() === pescatarian)&&
(vegetarian === "" || place.vegetarian.toString() === vegetarian)
);
});
const resultsContainer = document.getElementById('results');
resultsContainer.innerHTML = ''; // Clear previous results
filteredPlaces.forEach(place => {
const placeElement = document.createElement('div');
placeElement.className = 'place-item';
placeElement.innerHTML = `
<h3>${place.name}</h3>
<p><strong>Address:</strong> ${place.address}</p>
<p><strong>Star Review:</strong> ${place.reviews}</p>
<p><strong>Price Range:</strong> ${place['price-range']}</p>
<p><strong>Borough:</strong> ${place.borough}</p>
<p><strong>Ethnicity:</strong> ${place.ethnicity}</p>
<p><strong>Gluten Free:</strong> ${place.glutenFree ? 'Yes' : 'No'}</p>
<p><strong>Vegan:</strong> ${place.vegan ? 'Yes' : 'No'}</p>
<p><strong>Halal:</strong> ${place.halal ? 'Yes' : 'No'}</p>
<p><strong>Pet Friendly:</strong> ${place.petFriendly ? 'Yes' : 'No'}</p>
<p><strong>Nut Allergy:</strong> ${place.nutAllergy ? 'Yes' : 'No'}</p>
<p><strong>Shellfish Allergy:</strong> ${place.shellfishAllergy ? 'Yes' : 'No'}</p>
<p><strong>Lactose Intolerant:</strong> ${place.lactoseIntolerant ? 'Yes' : 'No'}</p>
<p><strong>Pescatarian:</strong> ${place.pescatarian ? 'Yes' : 'No'}</p>
<p><strong>Vegetarian:</strong> ${place.vegetarian ? 'Yes' : 'No'}</p>
<p><strong>Restaurant Type:</strong> ${place.restaurantType}</p>
`;
resultsContainer.appendChild(placeElement);
});
}
document.getElementById('borough').addEventListener('change', filterPlaces);
document.getElementById('ethnicity').addEventListener('change', filterPlaces);
document.getElementById('restaurantType').addEventListener('change', filterPlaces);
document.getElementById('glutenFree').addEventListener('change', filterPlaces);
document.getElementById('vegan').addEventListener('change', filterPlaces);
document.getElementById('halal').addEventListener('change', filterPlaces);
document.getElementById('petFriendly').addEventListener('change', filterPlaces);
document.getElementById('nutAllergy').addEventListener('change', filterPlaces);
document.getElementById('shellfishAllergy').addEventListener('change', filterPlaces);
document.getElementById('lactoseIntolerant').addEventListener('change', filterPlaces);
document.getElementById('pescatarian').addEventListener('change', filterPlaces);
document.getElementById('vegetarian').addEventListener('change', filterPlaces);
populateDropdowns();
filterPlaces(); // Display all places initially
//////
//////
//////
//////
// Function to clear all selected filters and update the displayed results
function clearFilters() {
// Get all filter inputs and select elements
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
const radioButtons = document.querySelectorAll('input[type="radio"]');
const selectElements = document.querySelectorAll('select');
// Uncheck all checkboxes
checkboxes.forEach(checkbox => checkbox.checked = false);
// Deselect all radio buttons (assuming one group at a time)
radioButtons.forEach(radio => radio.checked = false);
// Reset all select elements to their default values
selectElements.forEach(select => select.selectedIndex = 0);
// Optionally, you can also clear the search input if you have one
const searchInput = document.querySelector('input[type="text"]');
if (searchInput) searchInput.value = '';
// Trigger the filtering function to apply the changes
filterPlaces();
}
document.getElementById('clear-filters-btn').addEventListener('click', clearFilters);