-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
297 lines (232 loc) · 11.1 KB
/
index.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
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
<html>
<!-- mapping violence -->
<head>
<!-- css -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="https://npmcdn.com/[email protected]/dist/leaflet.css" />
<link rel="stylesheet" href="css/tooltip.css" />
<link rel="stylesheet" href="css/mappingviolence.css" />
<!-- fonts -->
<link href="https://fonts.googleapis.com/css?family=Crimson+Text|Fjalla+One" rel="stylesheet">
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="js/jquery.animate-colors.js"></script>
<script src="js/tether.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E=" crossorigin="anonymous"></script>
<!-- js -->
<script src="https://npmcdn.com/[email protected]/dist/leaflet.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div id="coverPage" class="container-fluid">
<!-- black transparency -->
<div id="blackOverlay" class="col-md-12 col-xs-12"> </div>
<!-- right side navbar -->
<div id="navbar" class="navbar light hidden">
<ul class="nav navbar-nav">
<li >
<button id="infoButton" type="button" class="btn btn-link" title="about this project">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</button>
</li>
<li>
<button type="button" class="btn btn-link" title="tours">
<span class="glyphicon glyphicon-globe" aria-hidden="true"></span>
</button>
</li>
<li>
<button type="button" class="btn btn-link" title="filters">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</button>
</li>
<form id="search" class="navbar-form navbar-left hidden">
<div class="form-group">
<input name="searchInput" type="text" class="form-control" placeholder="Search">
</div>
<button id="submitSearch" type="submit" class="btn btn-default">Submit</button>
</form>
<li>
<button id="searchIcon" type="button" class="btn btn-link" title="search">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</button>
</li>
</ul>
</div>
<!-- left-side info panel -->
<div id="infoPanel" class="col-md-8 col-sm-10">
<h1 class="title"> MAPPING<br/>VIOLENCE </h1>
<div id="introduction" class="infoScroll">
<p>Some of the worst racial violence in United States history took place along the Mexico-Texas border from 1900 to 1930.</p>
<p>This project seeks to enrich current understandings of histories of racial violence. Historical institutions (state archives, university libraries, etc.) neglected to keep accurate records of racially motivated killings. This project takes on the task of researching episodes of racial violence and compiling a digital archive that preserves hundreds of events in Texas between 1900 and 1930. The events in this database are visualized as an interactive map that plots the locations of hundreds of episodes of violence. By clicking dots on the map, users can read brief narratives of each event, access a list of primary and secondary sources available for further research, and see other connected events. Users will also be able to read about individual events, search content in the database, and watch short-guided tours.</p>
<!--
<p> Some of the worst racial violence in United States history took place along the Mexico-Texas border from 1910 to 1920. </p>
<p>The dead included women and men, the aged and the young, long-time residents and recent arrivals. They were killed by strangers, sometimes by neighbors, some by vigilantes and other times at the hands of local law enforcement officers or Texas Rangers. Some were summarily executed after being taken captive, or shot under the flimsy pretext of trying to escape. Some were left in the open to rot, others desecrated by being burnt, being decapitated, or revealing evidence of other forms of torture and violation such as having beer bottles rammed into their mouths.</p>
-->
</div>
<div id="howToUseCover" class="infoScroll hidden">
<p> write up a "how to use" section </p>
</div>
<div id="aboutUs" class="infoScroll fullHeight hidden">
<h1> MAPPING VIOLENCE </h1> <br /> <p>This project was created in 2016 by an interdisciplinary team of undergraduate researchers at Brown University led by Professor Monica Martinez.</p>
<br />
<p> Descriptions of incidents were written by Danielle Gomez, Ricardo Jaramillo, and Nnamdi Jogwe, and Liliana Sampedro.</p>
<br />
<p> This database and mapping visualization were built by Cole Hansen, Edward Jiao, and Ben Vars.</p>
<br />
<p>It is a project under the organization <i>Refusing to Forget</i>, which works to bring public attention to this period of violence.</p>
</div>
<div id="howToUseSmall" class="smallPanel hidden">
<h1> HOW TO USE THIS MAP </hi>
<p> Each dot represents an incidence of violence </p>
<p> Click a dot to learn more about an incident </p>
</div>
<div id="poiInfo" class="hidden">
<h1> HOW TO USE THIS MAP </h1>
<h3> Each dot represents an incidence of violence </h3>
<h3> Click a dot to learn more about an incident </h3>
</div>
<button type="button" id="slideLeft" class="btn btn-link">
<span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span>
</button>
</div>
<!-- map -->
<div id="mapid"> </div>
</div>
</body>
<!-- TODO: put in separate doc -->
<script>
function simple_tooltip(target_items, name){
$(target_items).each(function(i){
$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
var my_tooltip = $("#"+name+i);
$(this).removeAttr("title").mouseover(function(){
my_tooltip.css({opacity:0.9, display:"none"}).fadeIn(100);
}).mousemove(function(kmouse){
my_tooltip.css({left:kmouse.pageX - ($("#"+name+i).width())/2 - 15, top:kmouse.pageY+25});
}).mouseout(function(){
my_tooltip.fadeOut(0);
});
});
}
$(document).ready(function() {
// init tooltips
simple_tooltip("#navbar button","tooltip");
// init map
var mymap = L.map('mapid').setView([28.667, -103.5], 7);
L.tileLayer('https://api.mapbox.com/styles/v1/ejiao/cirpbdjyr0024g8nflf48lzs6/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZWppYW8iLCJhIjoiY2lycGJjdWc1MGV6ZGZhbThkOXNwNWNqbSJ9.JmvgWwuCzvSBa5ieYUXWtw', {
attribution: "Map data © © <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>'",
maxZoom: 18,
id: 'ejiao.139c2pig',
accessToken: 'pk.eyJ1IjoiZWppYW8iLCJhIjoiY2lycGJjdWc1MGV6ZGZhbThkOXNwNWNqbSJ9.JmvgWwuCzvSBa5ieYUXWtw',
}).addTo(mymap);
mymap.zoomControl.setPosition('bottomright');
/* defining our red dot map marker */
var redDot = L.icon({
iconUrl: 'red_circle.png',
shadowUrl: '',
iconSize: [10, 10], // size of the icon
shadowSize: [0, 0], // size of the shadow
iconAnchor: [5, 5], // point of the icon which will correspond to marker's location
shadowAnchor: [0, 0], // the same for the shadow
popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor
});
function loadMarkers(data) {
$(data).each(function(poi) {
var marker = L.marker([data[poi].location.coordinates[1], data[poi].location.coordinates[0]], {icon: redDot}).addTo(mymap);
marker.bindPopup("<b>" + data[poi].title + "</b>");
$(marker).on("mouseover", function() {
marker.openPopup();
});
$(marker).on("mouseout", function() {
marker.closePopup();
});
$(marker).on("click", function() {
$("#poiInfo").hide();
$("#poiInfo").html(
"<h1>" + data[poi].title + "</h1>" +
"<br /><p>" + data[poi].description +"</p>"
);
$("#poiInfo").fadeIn();
});
});
}
$.get( "http://private-817eec-mappingracialviolencedatabaseapiv090.apiary-mock.com/pois", function( data ) {
console.log(data);
loadMarkers(data);
});
$("#submitSearch").on("click", function(e) {
e.preventDefault();
console.log()
var input = $("input[name='searchInput']").val();
var inputArray = input.split(' ');
console.log("searched: " + inputArray);
var data =
[
{
"field" : "all",
"values" : inputArray
}
]
$.ajax({
type: "POST",
url: "http://utra.mappingviolence.org:4567/searches/",
data: JSON.stringify(data)
}).done(function(data) {
$.get( "http://utra.mappingviolence.org:4567/searches/" + data.id,
function( data ) {
console.log(data);
console.log("logged data");
$("#poiInfo").hide();
var html = ""
$(data).each(function(i){
var result = data[i];
html += "<div> <h1>" +
"<a href='#' id=result" + i + ">" +
result.title + "</a> </h1> </div> <hr> ";
});
$("#poiInfo").html(html);
$("#poiInfo").fadeIn();
$(data).each(function(i) {
$("#result" + i).on("click", function() {
console.log("clicked poi " + i);
$("#poiInfo").hide();
$("#poiInfo").html(
"<h1>" + data[i].title + "</h1>" +
"<br /><p>" + data[i].description +"</p>"
);
$("#poiInfo").fadeIn();
});
});
});
});
});
$("#slideLeft").on("click", function(e) {
$("#infoPanel").switchClass("col-md-8 col-sm-10", "smallInfoPanel");
$(".title").hide();
$(".buttons").hide();
$(".infoScroll").hide();
$("#slideLeft").hide();
$("#blackOverlay").fadeOut("slow");
$("#poiInfo").removeClass("hidden");
$("#poiInfo").hide();
$("#poiInfo").fadeIn("slow");
$("#navbar").hide();
$("#navbar").removeClass("hidden");
$("#navbar").fadeIn("slow");
// showMarkers();
});
$("#searchIcon").on("click", function() {
$("#search").toggleClass("hidden");
});
$("#infoButton").on("click", function(e) {
$("#infoPanel").switchClass("smallInfoPanel", "col-md-8 col-sm-10");
$("#poiInfo").hide();
$("#blackOverlay").fadeIn("slow");
$("#aboutUs").removeClass("hidden");
$("#aboutUs").fadeIn();
$("#slideLeft").show();
$("#navbar").addClass("hidden");
});
});
</script>
</html>