-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheurope2.html
206 lines (160 loc) · 9.33 KB
/
europe2.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>UNHCR</title>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css"/>
<link rel="stylesheet" href="woc3.css"/>
<link href="http://www.unhcr.org/favicon.ico" rel="icon" type="image/x-icon">
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
</head>
<body>
<div id="count-window">
<input id="thecount" disabled/>
</div>
<div id="map"></div>
<!--start infowindow template-->
<div id="filters">
<div class="wrapper">
<div class="context subheader">
<h1>Sites in Europe</h1>
<br>
</div>
<p>This interactive map collates available information from different data sources about sites hostings
refugees. <a href=''>Lorem ipsum dolor sit ame</a> Lorem ipsum dolor sit amet, consectetur adipiscing elit,
</p>
<!--Copy and paste the div below for creating content blocks-->
<h6>Description</h6>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum</p>
<br>
<div id="logo-container"><img id="logo" height="30" src="unhcr.png" alt="Logo"></div>
<h4>Powered by the <a href="mailto:[email protected]">Winter Operations Cell</a></h4>
<a href="#" id="close-window">X</a>
<div id="custom-infowindow">
</div><!--end infowindow template-->
</div>
<script>
// changing the cursor when hover on features http://bl.ocks.org/javisantana/6102814
function addCursorInteraction(layer) {
var hovers = [];
layer.bind('featureOver', function (e, latlon, pxPos, data, layer) {
hovers[layer] = 5;
if (_.any(hovers)) {
$('img.leaflet-tile').css('cursor', 'pointer');
}
});
layer.bind('featureOut', function (m, layer) {
hovers[layer] = 0;
if (!_.any(hovers)) {
$('img.leaflet-tile').css('cursor', 'auto');
}
});
}
function main() {
cartodb.createVis('map', 'https://unhcrinnovation.cartodb.com/api/v2/viz/909727a2-e3c0-11e5-8d26-0ecfd53eb7d3/viz.json', {
shareable: false,
title: false,
description: true,
search: false,
infowindow: false,
tiles_loader: true,
center_lat: 42,
center_lon: 26,
zoom: 6
})
.done(function (vis, layers) {
// get the number of items
function getRecordsCount() {
$.getJSON('https://unhcrinnovation.cartodb.com/api/v2/sql/?q=SELECT count(*) FROM profile_europe_gdrive_cartodb', function (data) {
$.each(data.rows, function () {
var the_count = data.rows[0]["count"];
$("#thecount").val('Total number of sites: ' + the_count + ' -Click on a site for more info-');
});
});
}
getRecordsCount();
// layer 0 is the base layer, layer 1 is cartodb layer
layers[1].getSubLayer(4).setInteraction(true);
layers[1].getSubLayer(4).setInteractivity("cartodb_id,the_geom,police_security_guard_patrols_available_in_site_yes_no,information_reception_desk_operational,medical_services_available_yes_no,regular_cleaning_of_wash_facilities_ensured_yes_no,last_update,__of_outreach_and_community_workers,people_at_site,future_capacity,capacity,comments,infant_feeding_in_place_yes_no,three_meals_per_day_available_yes_no,hot_meals_in_place_yes_no,restauring_family_links_available_yes_no,access_managed_by_police_yes_no,__of_interpreters_available,cfs_operated_yes_no,ambulance_available_24_7_yes_no,garbage_disposel_waste_management_organized_yes_no,hygiene_promotion_done_yes_no,facilities_separated_men_women_yes_no,__of_showers,__of_latines,shelter_winterized_fully_partially_no,__of_rub_halls,__of_rhus_prefabs,__of_tents,unhcr_focal_point,gvt_focal_point,population_profile,site_name,location,m_i,country,pcode,longitude,latitude");
layers[1].getSubLayer(4).on('featureClick', function (e, latlng, pos, data) {
if (typeof data.site_name != 'undefined') {
$("#custom-infowindow").html(buildInfoWindow(data)).show();
$("#close-window").show();
}
});
addCursorInteraction(layers[1].getSubLayer(4));
})
.error(function (err) {
console.log(err);
});
$(document).on('click', '#close-window', function () {
$("#custom-infowindow").html('').css({'display': 'none'});
$("#close-window").css({'display': 'none'});
});
}
window.onload = main;
function buildInfoWindow(data) {
return '' +
'<div class="wrapper">' +
' <div class="item">' +
' <div class="header">' +
' <div class="infobar">' +
' <span class="idnumber"># PCODE ' + data.pcode + '</span>' +
' </div>' +
' </div>' +
' <div class="content">' +
' <h2 class="location">Site Name:<br><span class="main_location">' + data.site_name + '</span></>' +
getData('country', data.country) +
getData('People at site ', data. people_at_site ) +
getData(' Capacity ', data. capacity ) +
getData(' Future capacity ', data. future_capacity ) +
getData(' population profile ', data. population_profile ) +
getData(' unhcr focal point ', data. unhcr_focal_point ) +
getData(' Gov focal point ', data. gvt_focal_point ) +
getData(' police/security/guard/patrols available ', data. police_security_guard_patrols_available_in_site_yes_no ) +
getData(' information reception desk operational ', data. information_reception_desk_operational ) +
getData(' # of rub_halls ', data. __of_rub_halls ) +
getData(' # of rhus/prefabs ', data. __of_rhus_prefabs ) +
getData(' # of tents ', data. __of_tents ) +
getData(' shelter winterized ', data. shelter_winterized_fully_partially_no ) +
getData(' # of showers ', data. __of_showers ) +
getData(' # of latrines ', data. __of_latines ) +
getData(' facilities separated for men/women ', data. facilities_separated_men_women_yes_no ) +
getData(' Waste management', data. garbage_disposel_waste_management_organized_yes_no ) +
getData(' hygiene promotion', data. hygiene_promotion_done_yes_no ) +
getData(' Medical services available ', data. medical_services_available_yes_no ) +
getData(' ambulance available 24/7', data. ambulance_available_24_7_yes_no ) +
getData(' Regular cleaning of wash facilities ', data. regular_cleaning_of_wash_facilities_ensured_yes_no ) +
getData(' # of outreach and community workers ', data. __of_outreach_and_community_workers ) +
getData(' infant feeding in place ', data. infant_feeding_in_place_yes_no ) +
getData(' 3 meals/day available', data. three_meals_per_day_available_yes_no ) +
getData(' hot meals in place', data. hot_meals_in_place_yes_no ) +
getData(' restauring family links available ', data. restauring_family_links_available_yes_no ) +
getData(' access managed by police ', data. access_managed_by_police_yes_no ) +
getData(' # of interpreters available ', data. __of_interpreters_available ) +
getData(' cfs operated ', data. cfs_operated_yes_no ) +
getData(' comments ', data. comments ) +
getData(' longitude ', data. longitude ) +
getData(' latitude ', data. latitude ) +
getData(' last_update ', data. last_update ) +
' <p class="report" style="display: block;"><span class="viewreport download_button" tabindex="0"><a href="#" target="_blank">Download (soon)</a></span></p>' +
'<div class="viewassessment" tabindex="0"><a href="#" target="_blank">Cool blue button</div>' +
' </div>' +
' </div>' +
'</div>' +
'';
}
function getData(name, value) {
return typeof value == 'undefined' || value === null || value == '' ? '' :
'<p class="clusters">' + name + ':<br>' +
'<span class="clusters_content">' + value + '</span></p>';
}
</script>
</body>
</html>