-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_utils.js
35 lines (27 loc) · 1.02 KB
/
map_utils.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
function getPopupMedia(feature, list_id) {
var html = document.createElement('div');
if (feature.properties.image_id) {
var image_link = document.createElement('a');
// Check for path
if (feature.properties.image_id.includes('/')) {
image_link.href = `images/${feature.properties.image_id}.png`;
} else {
image_link.href = `images/${list_id}/${feature.properties.id}.png`;
}
var image = document.createElement('img');
image.src = image_link.href;
image.className = 'popup-media';
image_link.appendChild(image);
html.appendChild(image_link);
}
return html;
}
function containsKeyword(feature, keyword) {
if ("id" in feature.properties && feature.properties.id.toLowerCase().includes(keyword.toLowerCase())) {
return true;
}
if ("description" in feature.properties && feature.properties.description.toLowerCase().includes(keyword.toLowerCase())) {
return true;
}
return false;
}