-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html
490 lines (450 loc) · 19.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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
<!doctype html>
<meta charset="utf-8" />
<meta name='google-site-verification' content='-jE-f4Gbpim9_feo74iK5zP_-tegU7xvV89-yqFy7ZI' />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="Take a Stand. Find the nearest rally near you">
<meta name="keywords" content="Bernie Sanders, FeelTheBern, Events, Bernie, Volunteer for Bernie, Phonebank for Bernie, Canvassing for Bernie, Bernie Rallies, Bernie Townhall #bernie2016, #feelthebern, #westandtogether">
<meta property="og:image" content="http://events.berniesanders.com/img/map-v-2.png" />
<meta property="og:url" content="http://events.berniesanders.com/" />
<meta property="og:title" content="Take a Stand. Find the nearest rally near you"/>
<meta property="og:description" content=""/>
<link href='//api.tiles.mapbox.com/mapbox.js/v2.1.9/mapbox.css' rel='stylesheet' />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@BernieSanders">
<meta name="twitter:creator" content="@BernieSanders">
<meta name="twitter:title" content="Take a Stand. Find the nearest rally near you">
<meta name="twitter:description" content="">
<meta name="twitter:image" content="http://events.berniesanders.com/img/map-v-2.png">
<link rel="stylesheet" type="text/css" href="./css/events-map.css">
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Merriweather:400,900,700' />
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Lato:100,900,700,400,300' />
<title>Let's Get to Work! Find Volunteer Work, Grassroots events, and official Rallies for Bernie Sanders.</title>
<!--[if lte IE 9]>
<meta http-equiv="refresh" content="0; url=https://go.berniesanders.com/page/event/search_simple" />
<![endif]-->
<body class='list-view initial-view'>
<section id='header'>
<div id="header" class='lato'>
<div class="main-title-area">
<div style="margin-bottom: 4px;">
<div id='spiel'>
<strong>Take a Stand</strong><br>
Find the nearest rally near you
</div>
</div>
</div>
<nav>
<ul id="nav">
<li>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://events.berniesanders.com/" data-text="I'm going to a volunteer event for Our Revolution! Find events near you!" data-related="BernieSanders" data-count="none">Tweet</a> <div class="fb-share-button" data-href="http://events.berniesanders.com/" data-layout="button">
<a href="javascript:fbShare('http://events.berniesanders.com/', 'Fb Share', 'Facebook share popup', 'http://events.berniesanders.com/img/fb.png', 520, 350)"><img src='./img/icon/fb.png' /><span>Share</span></a></div>
<!-- div class="fb-share-button" data-href="http://events.berniesanders.com/phonebank/" data-layout="button"></div -->
</li>
<li><a href="https://go.berniesanders.com/page/event/create" class="contribute contribute-big" target="_blank">Host an Event</a></li>
</ul>
</nav>
<div style="clear: both"></div>
</div>
</section>
<section id='activity-area' class='clearfix'>
<article id='events'>
<div id='filters'>
<div id='loading-icon' class='lato'>Loading...</div>
<h3 id='switch-link'>
<a href='javascript: void(null)' onclick='window.mapManager.toMapView()' id='to-map-view'>Show Map</a>
<a href='javascript: void(null)' onclick='window.mapManager.toListView()' id='to-list-view'>Show List</a>
</h3>
<h4 class='lato title'>
<span id='screen-title'>Filters</span>
<span id='mobile-title'>Take a Stand</span>
</h4>
<form id='filter-form'>
<table>
<tr>
<td>
<h5 class='lato'>By Zipcode</h5>
<input type='number' name='zipcode' maxlength='5' placeholder='ZIPCODE' onclick="this.select();" >
</td>
<td>
<h5 class='lato'>Distance</h5>
<select name='distance'>
<option value='5'>5mi</option>
<option value='20'>20mi</option>
<option value='50' selected='selected'>50mi</option>
<option value='100'>100mi</option>
</select>
</td>
<td>
<h5 class='lato'>Sort By</h5>
<select name='sort'>
<option value='time' selected='selected'>Time</option>
<option value='distance'>Distance</option>
</select>
<input type='button' style='position: absolute; z-index: -1; opacity: 0;' id='hidden-button'/>
</td>
</tr>
</table>
<div id='filter-popup-area' class='lato'>
<a href='javascript: void(null)' class='filter-button show-filter' onclick='$("#events").addClass("show-type-filter");'>
Search by Event
</a>
<div id='filter-list-area'>
<h5>Search by Event</h5>
<div id='f-container'>
<div id='filter-list-container'>
<ul id='filter-list'></ul>
</div>
<div style='text-align: center; font-size: 11px; margin-top: 10px; color: lightgray;'>
<a href='javascript: void(null)' id='show-all'
onclick='$("#filter-list").find("input[type=checkbox]").prop("checked", true).trigger("change");'>Show All</a> •
<a href='javascript: void(null)'
onclick='$("#filter-list").find("input[type=checkbox]").prop("checked", false).trigger("change")'>Hide All</a>
</div>
</div>
<p align='right'>
<a href='javascript: void(null)' class='filter-button'
onclick='$("#events").removeClass("show-type-filter");'>
Hide Legend
</a>
</p>
</div>
</div>
</form>
</div>
<div id='event-list-container'>
<div id='hide-show-office' data-count="0">
<a href='javascript: void(null)' class='contribute-big show-office' onclick='$("body").addClass("show-office")'>
<span class='show-offices'>⊲ Show Nearby Offices (<span id='campaign-off-count'></span>)</span>
</a>
<a href='javascript: void(null);' class='contribute-big hide-office' onclick='$("body").removeClass("show-office")'>
<span class='hide-offices'>⊳ Hide Offices</span>
</a>
</div>
<ul id='event-list'><li class='mobile-only lato'>Please type in your <strong>zipcode</strong> to view nearby events.
</li></ul>
<footer>
<div id='footer-area' >
<h5>Friends of Bernie Sanders</h5>
<h5>PO Box 391</h5>
<h5>Burlington, VT 05402</h5>
<div id='paid-for-bernie-box'>
Paid for By Friends of Bernie Sanders
</div>
<div id='footer-billionaire' style="margin-bottom: 30px;">
<svg width="200" height="40">
<image xlink:href="//dcxc7a0ls04u1.cloudfront.net/img/billionaires.svg" width="200" height="40"
x="0"
/>
</svg>
</div>
<sub>© Friends of Bernie Sanders | <a href='https://berniesanders.com/privacy-policy/'>Privacy Policy</a></sub>
</div>
</footer>
</div>
</article>
<article id='map'>
<div id='map-container'></div>
</article>
</section>
<section id='campaign-offices'>
<div class='viewport'>
<h3 class='title'>Nearby Campaign Offices</h3>
<a class='close-button lato' href='javascript: void(null);' onclick='$("body").removeClass("show-office")'>x</a>
<div class='container'>
<ul id='campaign-office-list'></ul>
</div>
</div>
</section>
<script src="//dcxc7a0ls04u1.cloudfront.net/js/jquery.gz"></script>
<script src='//dcxc7a0ls04u1.cloudfront.net/js/d3.gz' type='text/javascript'></script>
<script id='zipcodes-datadump' type='text/plain'></script>
<script src='//dcxc7a0ls04u1.cloudfront.net/js/deparam.min.gz'></script>
<script src='//dcxc7a0ls04u1.cloudfront.net/js/mapbox.gz'></script>
<!-- <script src='/js/leaflet-bouncer.js'></script> -->
<script src='//dcxc7a0ls04u1.cloudfront.net/js/moment.min.js'></script>
<script src='./js/js-cookie.js'></script>
<script src='./js/MapManager.js'></script>
<script type='text/javascript'>
window.eventTypeFilters = [
// {
// name: 'Campaign Office',
// id: 'campaign-office',
// onItem: "<img style='width: 14px; height: 14px;' src='//dcxc7a0ls04u1.cloudfront.net/img/icon/star.png' />",
// offItem: "<img style='width: 14px; height: 14px;' src='//dcxc7a0ls04u1.cloudfront.net/img/icon/star-gray.png' />"
// },
// { name: 'GOTV Center',
// id: 'gotv-center',
// onItem: "<img style='width: 14px; height: 14px;' src='//dcxc7a0ls04u1.cloudfront.net/img/icon/gotv-star.png' />",
// offItem: "<img style='width: 14px; height: 14px;' src='//dcxc7a0ls04u1.cloudfront.net/img/icon/star-gray.png' />"
// },
// {
// name: 'Bernie Event',
// id: 'bernie-event',
// onItem: "<span class='map-red-circle'></span>",
// },
// {
// name: 'Official Event',
// id: 'official-event',
// },
// {
// name: 'Phonebank',
// id: 'phonebank'
// },
// {
// name: 'Get Out The Vote',
// id: 'gotv'
// },
// {
// name: 'Canvassing',
// id: 'canvassing'
// },
// {
// name: 'Ballot Access',
// id: 'ballot-access'
// },
// {
// name: 'Carpool',
// id: 'carpool'
// },
// {
// name: 'Register Voters',
// id: 'register-voters'
// },
// {
// name: 'Barnstorm',
// id: 'barnstorm'
// },
{
name: 'Rally',
id: 'rally'
},
{
name: 'Other',
id: 'other'
}
];
</script>
<script type='text/javascript'>
(function($, d3) {
var date = new Date();
$("#loading-icon").show();
$.ajax({
url: '//dcxc7a0ls04u1.cloudfront.net/js/event-data.gz',
dataType: 'script',
cache: true, // otherwise will get fresh copy every page load
success: function(data) {
d3.csv('//dcxc7a0ls04u1.cloudfront.net/d/campaign-offices.csv',
function(campaignOffices) {
//Load zipcodes
//dcxc7a0ls04u1.cloudfront.net
d3.csv('//dcxc7a0ls04u1.cloudfront.net/d/us_postal_codes.gz',
function(zipcodes) {
$("#loading-icon").hide();
//Clean data
window.EVENT_DATA.results.forEach(function(d) {
d.filters = [];
//Set filter info
switch(d.event_type_name) {
case "Iowa Event":
case "New Hampshire Event":
case "South Carolina Event":
case "Nevada Event":
// case "Organizing Meeting": d.filters.push("official-event"); break;
case "Town Meeting": d.filters.push("bernie-event"); break;
case "Barnstorm": d.filters.push("barnstorm"); break;
case "Get Out the Vote" : d.filters.push("gotv"); break;
// case "Gather ballot access signatures": d.filters.push("ballot-access"); break;
case "Carpool to a primary state": d.filters.push("carpool"); break;
case "Canvass": d.filters.push("canvassing"); break;
case "Phonebank event" : d.filters.push("phonebank"); break;
case "Registering Voters": d.filters.push('register-voters'); break;
case "Rally": d.filters.push("rally"); break;
default: d.filters.push('other'); break;
}
d.is_official = d.is_official == "1";
if (d.is_official) { d.filters.push("official-event"); }
});
var oldDate = new Date()
window.EVENT_DATA.results = window.EVENT_DATA.results.concat(
campaignOffices.map(function(d){
return {
filters: d.type == 'office' ? ["campaign-office"] : ["gotv-center"],
url: "https://maps.google.com?saddr=Current+Location&daddr=" + encodeURIComponent(d.address),
longitude: d.lon,
latitude: d.lat,
name: d.name,
location: d.address,
event_type_name: d.type == 'office' ? "Campaign Office" : "GOTV Center",
capacity: 0,
id_obfuscated: d.address,
phone: d.phone,
is_official: false,
image: d.type == 'office' ? d.photo : null,
is_campaign_office: d.type == 'office',
is_gotv_center: d.type == 'gotv',
opening_event: d.opening_event == "" ? null : d.opening_event
};
})
);
/* Extract default lat lon */
var m = /.*\?c=(.+?),(.+?),(\d+)z#?.*/g.exec(window.location.href)
if (m && m[1] && m[2] && m[3]) {
var defaultCoord = {
center: [parseFloat(m[1]), parseFloat(m[2])],
zoom: parseInt(m[3])
};
window.mapManager = MapManager(window.EVENT_DATA.results, campaignOffices, zipcodes, { defaultCoord: defaultCoord });
var params = $.deparam
window.mapManager.filterByCoords(defaultCoord.center, 50, params.sort, params.f);
} else {
window.mapManager = MapManager(window.EVENT_DATA.results, campaignOffices, zipcodes);
}
if($("input[name='zipcode']").val() == '' && Cookies.get('map.bernie.zipcode') && window.location.hash == '') {
$("input[name='zipcode']").val(Cookies.get('map.bernie.zipcode'));
window.location.hash = $("#filter-form").serialize();
} else {
$(window).trigger("hashchange");
}
});
}
);
}, error: function(a,b,c) {
console.log("ERROR", b,c);
}
});
// Registration Data items
d3.csv('./d/registration-data.csv', function(votinginfo) {
window.votingInfoManager = VotingInfoManager(votinginfo);
})
/** initial loading before activating listeners...
*/
var params = $.deparam(window.location.hash.substring(1));
if (params.zipcode) {
$("input[name='zipcode']").val(params.zipcode);
}
if (params.distance) { $("select[name='distance']").val(params.distance);}
if (params.sort) { $("select[name='sort']").val(params.sort);}
/* Prepare filters */
$("#filter-list").append(
window.eventTypeFilters.map(function(d) {
return $("<li />")
.append(
$("<input type='checkbox' class='filter-type' />")
.attr('name', 'f[]')
.attr("value", d.id)
.attr("id", d.id)
.prop("checked", !params.f ? true : $.inArray(d.id, params.f) >= 0)
)
.append($("<label />").attr('for', d.id).append($("<span />").addClass('filter-on')
.append(d.onItem ? d.onItem : $("<span>").addClass('circle-button default-on')))
.append($("<span />").addClass('filter-off')
.append(d.offItem ? d.offItem : $("<span>").addClass('circle-button default-off')))
.append($("<span>").text(d.name)));
})
);
/***
* define events
*/
//only numbers
$("input[name='zipcode']").on('keyup keydown', function(e) {
if (e.type == 'keydown' && (e.keyCode < 48 || e.keyCode > 57)
&& e.keyCode != 8 && !(e.keyCode >= 37 || e.keyCode <= 40)) {
return false;
}
if (e.type == 'keyup' && $(this).val().length == 5) {
if (! (e.keyCode >= 37 && e.keyCode <= 40) ) {
$(this).closest("form#filter-form").submit();
$("#hidden-button").focus();
}
}
});
/***
* onchange of select
*/
$("select[name='distance'],select[name='sort']").on('change', function(e) {
$(this).closest("form#filter-form").submit();
});
/**
* On filter type change
*/
$(".filter-type").on('change', function(e) {
$(this).closest("form#filter-form").submit();
})
//On submit
$("form#filter-form").on('submit', function(e) {
var serial = $(this).serialize();
window.location.hash = serial;
e.preventDefault();
return false;
});
$(window).on('hashchange', function(e) {
var hash = window.location.hash;
if (hash.length == 0 || hash.substring(1) == 0) { $("#loading-icon").hide(); return false; }
var params = $.deparam(hash.substring(1));
//Custom feature for specific default lat/lon
//lat=40.7415479&lon=-73.8239609&zoom=17
setTimeout(function() {
$("#loading-icon").show();
if ( window.mapManager._options && window.mapManager._options.defaultCoord && params.zipcode.length != 5) {
window.mapManager.filterByType(params.f);
window.mapManager.filterByCoords(window.mapManager._options.defaultCoord.center, params.distance, params.sort, params.f);
} else {
window.mapManager.filterByType(params.f);
window.mapManager.filter(params.zipcode, params.distance, params.sort, params.f);
}
$("#loading-icon").hide();
var $info = window.votingInfoManager.getInfo(window.mapManager._zipcodes[params.zipcode].state);
$(".registration-msg").remove();
if ($info) {
$info.prependTo("#event-list-container");
}
}, 10);
// $("#loading-icon").hide();
if (params.zipcode.length == 5 && $("body").hasClass("initial-view")) {
$("#events").removeClass("show-type-filter");
$("body").removeClass("initial-view");
}
});
var pre = $.deparam(window.location.hash.substring(1));
if ($("body").hasClass("initial-view")) {
if ($(window).width() >= 600 && (!pre.zipcode || pre && pre.zipcode.length != 5)) {
$("#events").addClass("show-type-filter");
}
}
})(jQuery, d3);
</script>
<!-- SOCIAL -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-58354050-1', 'auto');
ga('send', 'pageview');
</script>
<script>
// window.fbAsyncInit = function() {
// FB.init({
// appId : '1747464662152148',
// xfbml : true,
// version : 'v2.5'
// });
// };
// (function(d, s, id){
// var js, fjs = d.getElementsByTagName(s)[0];
// if (d.getElementById(id)) {return;}
// js = d.createElement(s); js.id = id;
// js.src = "//connect.facebook.net/en_US/sdk.js";
// fjs.parentNode.insertBefore(js, fjs);
// }(document, 'script', 'facebook-jssdk'));
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</body>
<script>
function fbShare(url, title, descr, image, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
</script>