forked from Bernie-2016/EventMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abroad.html
430 lines (399 loc) · 20.1 KB
/
abroad.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
<!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="The next step for Bernie Sanders' movement is a new group called Our Revolution, which will fight to transform America and advance the progressive agenda that we believe in. Get started by hosting an event today and let's continue this political revolution.">
<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="Let's Organize and Continue this Political Revolution"/>
<meta property="og:description" content="The next step for Bernie Sanders' movement is a new group called Our Revolution, which will fight to transform America and advance the progressive agenda that we believe in. Get started by hosting an event today and let's continue this political revolution."/>
<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="Let's Organize and Continue this Political Revolution">
<meta name="twitter:description" content="The next step for Bernie Sanders' movement is a new group called Our Revolution, which will fight to transform America and advance the progressive agenda that we believe in. Get started by hosting an event today and let's continue this political revolution.">
<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="./css/abroad.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>Americans Abroad Map! We are fighting for a political revolution for USA across the globe.</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'>
<a id="header-logo" href="http://www.berniesanders.com"><img src="//dcxc7a0ls04u1.cloudfront.net/img/logo.png" style="float: left; margin-left: 10px;"></a>
<div class="main-title-area">
<div style="margin-bottom: 4px;">
<div id='spiel'>
<strong>Americans Abroad</strong><br>
Find Your Polling Place For the Global Presidential Primary.<br/>We are fighting for a political revolution for USA across the globe.
</div>
</div>
</div>
<nav>
<ul id="nav">
<li>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://events.berniesanders.com/abroad.html" 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://www.bernkit.com/" data-layout="button">
<a href="javascript:fbShare('http://events.berniesanders.com/abroad.html', 'Fb Share', 'Facebook share popup', 'http://www.bernkit.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'>Volunteer for Our Revolution</span>
</h4>
<form id='filter-form'>
<table>
<tr>
<td>
<h5 class='lato'>By Country</h5>
<select name='zipcode'>
<option>----- SELECT COUNTRY -----</option>
<option value='Australia' data-zoom="2000">Australia</option>
<option value='Austria' data-zoom="250">Austria</option>
<option value='Belgium' data-zoom="100">Belgium</option>
<option value='Canada' data-zoom="3000">Canada</option>
<option value='Chile' data-zoom="3000">Chile</option>
<option value='Costa Rica' data-zoom="100">Costa Rica</option>
<option value='Czech Republic' data-zoom="250">Czech Republic</option>
<option value='Denmark' data-zoom="250">Denmark</option>
<option value='Dominican Republic' data-zoom="250">Dominican Republic</option>
<option value='France' data-zoom="750">France</option>
<option value='Germany' data-zoom="500">Germany</option>
<option value='Greece' data-zoom="500">Greece</option>
<option value='Guatemala' data-zoom="250">Guatemala</option>
<option value='Hong Kong' data-zoom="20">Hong Kong</option>
<option value='Hungary' data-zoom="250">Hungary</option>
<option value='India' data-zoom="2000">India</option>
<option value='Ireland' data-zoom="250">Ireland</option>
<option value='Italy' data-zoom="750">Italy</option>
<option value='Japan' data-zoom="750">Japan</option>
<option value='Luxembourg' data-zoom="50">Luxembourg</option>
<option value='Mexico' data-zoom="750">Mexico</option>
<option value='New Zealand' data-zoom="750">New Zealand</option>
<option value='Norway' data-zoom="2000">Norway</option>
<option value='Panama' data-zoom="250">Panama</option>
<option value='Peru' data-zoom="750">Peru</option>
<option value='Portugal' data-zoom="250">Portugal</option>
<option value='Russia' data-zoom="3000">Russia</option>
<option value='Singapore' data-zoom="20">Singapore</option>
<option value='Spain' data-zoom="500">Spain</option>
<option value='Sweden' data-zoom="2000">Sweden</option>
<option value='Switzerland' data-zoom="250">Switzerland</option>
<option value='Taiwan' data-zoom="500">Taiwan</option>
<option value='Thailand' data-zoom="750">Thailand</option>
<option value='The Netherlands' data-zoom="250">The Netherlands</option>
<option value='The Philippines' data-zoom="750">The Philippines</option>
<option value='Ukraine' data-zoom="500">Ukraine</option>
<option value='United Arab Emirates' data-zoom="250">United Arab Emirates</option>
<option value='United Kingdom' data-zoom="750">United Kingdom</option>
<option value='Vietnam' data-zoom="750">Vietnam</option>
</select>
<input type='hidden' name='distance' value='100' />
<input type='hidden' name='sort' value='distance' />
<input type='hidden' name='f[]' value='rally' />
<!-- <input type='text' 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'>
<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>Our Revolution</h5>
<h5>PO BOx 905</h5>
<h5>Burlington, VT 05402</h5>
<div id='paid-for-bernie-box'>
Paid for By Our Revolution
</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>© Our Revolution | <a href='https://ourrevolution.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/d3.js' type='text/javascript'></script>
<script id='zipcodes-datadump' type='text/plain'></script>
<script src="//dcxc7a0ls04u1.cloudfront.net/js/jquery.js"></script>
<script src='//dcxc7a0ls04u1.cloudfront.net/js/deparam.min.js'></script>
<script src='//dcxc7a0ls04u1.cloudfront.net/js/mapbox.js'></script>
<!-- <script src='/js/leaflet-bouncer.js'></script> -->
<script src='./js/moment.min.js'></script>
<script src='./js/MapManager.js'></script>
<script type='text/javascript'>
window.eventTypeFilters = [];
</script>
<script type='text/javascript'>
window.customMapCoord = { center: [39,34], zoom: 2 };
(function($, d3) {
$("#loading-icon").show();
$.ajax({
url: 'https://sheetsu.com/apis/768ba17e',
dataType: 'json',
cache: true, // otherwise will get fresh copy every page load
success: function(americansAbroad) {
//dcxc7a0ls04u1.cloudfront.net
// d3.csv('./d/countries.csv',
// function(campaignOffices) {
//Load zipcodes
//dcxc7a0ls04u1.cloudfront.net
d3.csv('./d/countries.csv',
function(zipcodes) {
//Clean data
// console.log(zipcodes);
americansAbroad.result.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 "Rally":
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 an early 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;
default: d.filters.push('other'); break;
}
d.is_official = d.is_official == "1";
if (d.is_official) { d.filters.push("official-event"); }
});
window.EVENT_DATA = { results: [] };
window.EVENT_DATA.results = window.EVENT_DATA.results.concat(
americansAbroad.result.map(function(d){
var address = d.Address + " " + d.City + " " + d.Postal + " " + d.Country;
return {
filters: ["rally"],
url: "https://maps.google.com?saddr=Current+Location&daddr=" + encodeURIComponent(address),
longitude: d.Longitude,
latitude: d.Latitude,
name: (d.Chapter!=="" ? d.Chapter + ":" : "") + d.Venue,
location: address,
event_type_name: "Americans Abroad",
capacity: 0,
id_obfuscated: d.Address + moment(d.Date + " " + d.StartTime, "D/M/YYYY Hmm")._d,
phone: "",
is_official: false,
image: "",
is_campaign_office: true,
start_dt: moment(d.Date + " " + d.StartTime, "D/M/YYYY Hmm")._d,
end_dt: moment(d.Date + " " + d.EndTime, "D/M/YYYY Hmm")._d
};
})
);
window.mapManager = MapManager(window.EVENT_DATA.results, [], zipcodes);
$(window).trigger("hashchange");
});
// }
// );
}, error: function(a,b,c) {
console.log("ERROR", b,c);
}
});
/** initial loading before activating listeners...
*/
var params = $.deparam(window.location.hash.substring(1));
if (params.zipcode) { $("select[name='zipcode']").val(params.zipcode); }
if (params.distance) { $("input[name='distance']").val(params.distance);}
if (params.sort) { $("input[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
$("select[name='zipcode']").on('change', function(e) {
// console.log(e);
$("input[name=distance]").val($(this).find(":selected").attr('data-zoom'));
$(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));
$("#loading-icon").show();
setTimeout(function() {
window.mapManager.filterByType(params.f);
window.mapManager.filter(params.zipcode, params.distance, params.sort, params.f);
$("#loading-icon").hide();
}, 50);
// $("#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 (pre && pre.zipcode && pre.zipcode.length != 5 && $(window).width() >= 600) {
$("#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>