forked from n00rsy/halal-map
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
250 lines (238 loc) · 11.7 KB
/
index.html
File metadata and controls
250 lines (238 loc) · 11.7 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
<!DOCTYPE html>
<html>
<head>
<title>Halal Map</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script async
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBeQvkyGVlDbl91fEjxMBfgSwK7hIP4Slk&loading=async&callback=initMap&libraries=marker">
</script>
<script>
let map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: { lat: 40.6683491, lng: -97.6131147 },
gestureHandling: "greedy",
streetViewControl: false,
mapTypeControl: false,
mapId: "HALAL_MAP"
});
let currentInfoWindow = null;
fetch('locations.json')
.then(response => response.json())
.then(data => {
data['places'].forEach(function (place) {
const glyphImg = document.createElement("img");
glyphImg.style.width = "10px"
glyphImg.src = "resturaunt.svg"
const glyphSvgPinElement = new google.maps.marker.PinElement({
glyph: glyphImg,
});
let marker = new google.maps.marker.AdvancedMarkerElement({
position: { lat: place.lat, lng: place.lng },
map: map,
title: place.name,
content: glyphSvgPinElement.element,
});
let identifier = place.nav_url.substring(48).replace(/[^a-zA-Z0-9]/g, '')
let content = `
<div class="card border-0" style="max-width: 23rem;">
<button type="button" title="Close" id="close-btn-${identifier}" class="close" aria-label="Close" style="border: none; background: none; outline: none; position: absolute; top: 10px; right: 10px;">
<span aria-hidden="true">×</span>
</button>
<div class="card-body">
<h4 class="card-title">${place.name}</h3>
<h6 class="card-subtitle mb-2 text-muted">Certification: ${place.certification}
`
if (place.expires && isDatePast(place.expires)) {
content += `<span class="badge badge-danger">Expired</span>
`
}
content += `</h6>
<br>
<p><b>Address:</b> ${place.address}</p>`
if (place.phone) {
content += `<p><b>Phone:</b> <a href="tel:${place.phone}"> ${place.phone}</a></p>`
}
if (place.products) {
content += `<p><b>Products:</b>`
place.products.forEach(product => {
content += `<span class="badge badge-success">${product}</span>
`
})
content += `</p>`
}
if (place.expires) {
content += `<p><b>Expires:</b> ${formatDate(place.expires)}</p>`
}
if (place.website) {
content += `<a href="${place.website}" target="_blank" class="btn btn-outline-secondary btn-block">Website</a>
`
}
content += `<a href="${place.nav_url}" target="_blank" class="btn btn-primary btn-block">Navigate</a>
`
content += `</div></div>`
let infoWindow = new google.maps.InfoWindow({
content: content,
headerDisabled: true
});
google.maps.event.addListenerOnce(infoWindow, 'domready', function () {
document.getElementById(`close-btn-${identifier}`).addEventListener('click', function () {
infoWindow.close();
currentInfoWindow = null;
});
})
marker.addListener('click', function () {
if (currentInfoWindow) {
currentInfoWindow.close();
}
if (currentInfoWindow == infoWindow) {
currentInfoWindow = null
}
else {
infoWindow.open(map, marker);
currentInfoWindow = infoWindow;
}
});
});
document.getElementById('last-updated').innerText = `Last updated: ${data['updated']}`
})
.catch(error => {
console.error('Error fetching JSON data:', error);
});
getCurrentLocation()
}
function formatDate(dateString) {
const date = new Date(dateString);
const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const day = date.getDate();
const month = monthNames[date.getMonth()];
const year = date.getFullYear();
// Format the date as "Mon DD, YYYY"
return `${month} ${day}, ${year}`;
}
function isDatePast(dateString) {
const currentDate = new Date().toISOString().split(".")[0];
return dateString < currentDate;
}
function getCurrentLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
let currentPos = {
lat: position.coords.latitude,
lng: position.coords.longitude,
};
const pinGlyph = new google.maps.marker.PinElement({
glyphColor: "white",
background: "blue",
borderColor: "#00008B"
});
const markerViewGlyph = new google.maps.marker.AdvancedMarkerElement({
map,
position: currentPos,
content: pinGlyph.element,
title: "Your Location",
});
map.setCenter(currentPos);
map.setZoom(10)
},
(error) => {
console.log(error.message)
});
}
}
</script>
<style>
#map {
height: 75vh;
margin-top: 15px;
width: 100%;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">
Halal Map
</a>
<button id="getCurrentLocationButton" class="btn btn-outline-success my-2 my-sm-0"
onclick="getCurrentLocation()">Locate Me!</button>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col">
<div id="map"></div>
</div>
</div>
<div class="row">
<div class="col-md">
<p id="last-updated">Last updated:</p>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-8">
<h3>Find Halal-Certified Restaurants Near You 🍔</h3>
<p>
This map pulls the latest data from HMS (Halal Monitoring Services) and HFSAA (Halal Food Standards
Alliance of America) daily, ensuring that you have up-to-date information on certified Halal
restaurants across the U.S. Simply click on the pins to explore!
</p>
</div>
</div>
<div class="row justify-content-center mt-4">
<div class="col-12 col-md-10 col-lg-8">
<h4>What is Halal? 🤔</h4>
<p>
In regards to food, Halal refers to the set of standards that deem a product permissible under
Islamic law. This includes specific guidelines
for how animals are slaughtered, how food is prepared, and ensuring the absence of prohibited
ingredients like pork or alcohol.
</p>
</div>
<div class="col-12 col-md-10 col-lg-8">
<h4>About HMS and HFSAA ℹ️</h4>
<p><strong>HMS (Halal Monitoring Services):</strong> a non-profit branch of the Shariah Board of
America, is run by an independent team of experienced Ulama, certifying and monitoring
hand-slaughtered Halal meat across the supply chain in over 13 U.S. states, ensuring adherence to
Zabiha Halal principles and offering its services free of charge since 2005.</p>
<p><strong>HFSAA (Halal Food Standards Alliance of America):</strong> a non-profit Halal certification
organization that ensures a high standard of Halal compliance across the entire supply chain,
including meat, foods, cosmetics, and chemicals, accommodating various Islamic views on Halal. With
extensive research across 15 U.S. states and multiple countries, HFSAA certifies practices such as
hand slaughter by Muslim slaughterers, Tasmiya on each animal, and ensures non-meat products are
free of most alcohol and animal byproducts.</p>
</div>
<div class="col-12 col-md-10 col-lg-8">
<h4>Verifying Certification</h4>
<p>
<strong>Check for Certification Labels:</strong> Look for visible HMS or HFSAA certification
labels at the establishment.
</p>
<p>
<strong>Visit Official Websites:</strong> For the most current information, visit the <a
href="https://www.hmsusa.org/certified-listing.html">HMS website</a> or the <a
href="https://www.hfsaa.org/restaurants/">HFSAA website</a>.
</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
</body>
</html>