-
Notifications
You must be signed in to change notification settings - Fork 1
/
nycnarratives.html
240 lines (231 loc) · 7.9 KB
/
nycnarratives.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
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
<!DOCTYPE html>
<html>
<head>
<meta https-equiv="Content-Type" content="text/html;charset=utf-8">
<meta charset="utf-8">
<meta name="description" content="Narratives of Displacement: Oral History Project documenting loss in New York City by the Anti-Eviction Mapping Project">
<meta name="author" content="Anti-Eviction Mapping Project">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="https://libs.cartodb.com/cartodb.js/v3/themes/css/cartodb.ie.css" />
<![endif]-->
<style type="text/css">
html, body, #map {
margin: 0;
width: 100%;
height: 100%;
}
</style>
<style>
/* Info Popup Container */
/*
div.cartodb-infowindow {
position: absolute;
top: 0;
left: auto !important;
right: 0 !important;
bottom: auto !important;
height: 100%;
width: 400px;
}
*/
#narrative_map{
marker-fill-opacity: 0.9;
marker-line-color: #000000;
marker-line-width: 2;
marker-line-opacity: 1;
marker-placement: point;
marker-type: ellipse;
marker-width: 15;
marker-fill: #00ddff;
marker-allow-overlap: true;
}
/* Narrative Marker */
div.aemp-narrativemarker.cartodb-popup.v2.custom_infowindow {
min-width: 200px;
width: 200px !important;
padding: 10px 5px 5px;
background: black;
opacity: 0.8;
border-radius: 20px;
box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}
div.aemp-narrativemarker.cartodb-popup.v2:before {
border-top: 14px solid black;
}
div.aemp-narrativemarker.cartodb-popup.custom_infowindow p {
width: 100%;
font-weight: bold;
text-align: center;
color: white;
cursor: default;
font-size: 15px;
letter-spacing: 0.3px;
}
/* Narrative Marker Popup (Tooltip) */
div.aemp-tooltip.cartodb-tooltip-content-wrapper.dark p span {
color: #999999;
}
/* Info Drawer */
div.aemp-infodrawer.cartodb-popup.custom_infowindow {
position: fixed;
top: 0;
right: 0;
height: 100%;
width: 400px;
margin-top: 60px;
background: transparent;
box-shadow: none;
-webkit-box-shadow: none;
}
div.aemp-infodrawer.cartodb-popup.custom_infowindow div.cartodb-popup-content-wrapper {
position: absolute;
right: 0;
height: 100%;
width: 350px;
background: white;
border-radius: 0;
box-shadow: 0 0 2px lightgray;
}
div.aemp-infodrawer.cartodb-popup .jspContainer:before,
div.aemp-infodrawer.cartodb-popup .jspContainer:after {
width: 100%;
}
div.aemp-infodrawer.cartodb-popup.v2 h4 {
margin-bottom: 5px;
}
div.cartodb-tooltip-content-wrapper.dark h4 {
margin: 0;
}
div.aemp-infodrawer.cartodb-popup p {
width: 100%;
max-width: 100%;
}
div.aemp-infodrawer.cartodb-popup p > iframe {
width: 100%;
height: 500px;
}
div.aemp-infodrawer-content.cartodb-popup-content {
max-height: 100% !important;
height: calc(100% - 60px - (12px * 2)) !important;
}
div.aemp-infodrawer.cartodb-popup.v2 a.cartodb-popup-close-button {
top: 0;
right: 0;
box-shadow: none;
}
div.aemp-infodrawer.cartodb-popup.v2 a.cartodb-popup-close-button:hover {
box-shadow: none;
}
div.aemp-infodrawer.cartodb-popup.v2 a.cartodb-popup-close-button:before, div.cartodb-popup.v2 a.cartodb-popup-close-button:after {
background: black;
}
</style>
<title>Anti-Eviction Mapping Project - Narratives of Displacement</title>
</head>
<body>
<div id="map"></div>
<!-- Narrative infowindow hover popup (tooltip) template -->
<!-- (Currently not in use; styled through CartoDB editor) -->
<script type="infowindow/html" id="aemp-tooltip">
<div class="aemp-tooltip cartodb-tooltip-content-wrapper dark">
<div class="aemp-tooltip cartodb-tooltip-content">
<h4>name</h4>
<p>{{name}}</p>
<h4>address</h4>
<p>{{address}}</p>
<h4>description</h4>
<p>{{description}}</p>
</div>
</div>
</script>
<!-- Narrative infowindow drawer template -->
<!-- (Currently not in use; styled through CartoDB editor) -->
<script type="infowindow/html" id="aemp-infowindow">
<div class="aemp-infodrawer cartodb-popup v2 custom_infowindow">
<a href="#close" class="aemp-infodrawer cartodb-popup-close-button close">x</a>
<div class="aemp-infodrawer cartodb-popup-content-wrapper">
<div class="aemp-infodrawer-content cartodb-popup-content row">
<div class="label"></div>
<div class="info">
<h4>Name</h4>
<p>{{name}}</p>
<h4>Description</h4>
<p>{{description}}</p>
<h4>Narrative</h4>
<p>{{{narrative}}}</p>
<h4>Credits</h4>
<p>{{{credit}}}</p>
</div>
</div>
</div>
</div>
</script>
<!-- Include CartoDB.js library --><script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script>
<!-- Use external cartodb.js: -->
<!-- <script src="http://libs.cartocdn.com/cartodb.js/v3/3.14/cartodb.js"></script> -->
<!-- Use external cartodb.uncompressed.js for debugging: -->
<script>
// Overwrites part of CartoDB library:
cdb.geo.ui.Infowindow.prototype._closeInfowindow = function(ev) {
if (ev) {
// Removes .custom_infowindow from DOM when closed
// (so media doesn't continue playing after closing popup)
if ($(".custom_infowindow")) { $(".custom_infowindow").remove(); }
ev.preventDefault();
ev.stopPropagation();
}
if (this.model.get("visibility")) {
this.model.set("visibility", false);
this.trigger('close');
}
}
</script>
<script>
function narrativesMap() {
// Sets custom options for our CartoDB map:
var options = {
https: true,
title: false,
description: false,
searchControl: false,
shareable: true,
cartodb_logo: false,
layer_selector: false,
legends: false,
scrollwheel: true,
fullscreen: true,
infowindow: true,
tooltip: true,
sw_lat: 40.516651,
sw_lon: -74.242788,
ne_lat: 40.898161,
ne_lon: -73.630296
};
// Loads CartoDB visualization with custom options:
cartodb.createVis("map", './nyc-cartoviz.js', options)
.done(function(vis, layers) {
var map = vis.getNativeMap();
var sublayer = layers[1].getSubLayer(3);
sublayer.infowindow.set({
// Sets infowindow drawer template to custom HTML:
template: $("#aemp-infowindow").html(),
// Prevents formatting of iframe code:
sanitizeTemplate: false
});
// TODO: Set infowindow hover template to $("#aemp-tooltip").html()
})
.error(function(err) { console.log(err); });
}
window.onload = function() {
// Prevents map from panning to static infowindow popup:
// cdb.geo.ui.Infowindow.prototype.adjustPan = function(callback) { return 0; }
// Loads CartoDB visualization with our custom options:
narrativesMap();
};
</script>
</body>
<!-- Include Google Analytics -->
<script src="./analytics.js"></script>
</html>