forked from datamade/my-reps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
365 lines (327 loc) · 15.7 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
---
layout: default
---
<!-- Add your call to action here! -->
<div class="row">
<div class='col-md-10 col-md-offset-1'>
<div class="input-group input-group-lg col-sm-8 col-sm-offset-2">
<input type="text" class="form-control" placeholder="Enter your address to find who represents you" id="address" name="address" >
<span class="input-group-btn">
<button class="btn btn-info" type="submit" id="address-search"><i class='fa fa-search'></i> <span class='hidden-xs hidden-sm'>Search</span></button>
<button class="btn btn-default" type="submit" id="find-me"><i class='fa fa-crosshairs'></i> <span class='hidden-xs hidden-sm'>Find me</span> </button>
</span>
</div>
<div class='col-sm-8 col-sm-offset-2 filter_level'>
<br /><p class='text-center'>
Show level of government:
<label>
<input type="checkbox" id="show_local_results" value="Local"> Local
</label>
<label>
<input type="checkbox" id="show_county_results" value="County"> County
</label>
<label>
<input type="checkbox" id="show_state_results" value="State"> State
</label>
<label>
<input type="checkbox" id="show_federal_results" value="Federal"> Federal
</label>
</p>
</div>
<br />
</div>
</div>
<div class="row">
<div class='col-md-10 col-md-offset-1'>
<div id='no-response-container' class='text-center' style="display:none;">
<h1><i class='fa fa-exclamation-triangle'></i> </h1>
<h3>No representatives found</h3>
<p>We couldn't find any representatives for that address. Please try again.</p>
</div>
<div id='response-container' style="display:none;">
<br />
<p class="lead text-center" id='results-nav'>
Levels of government<br />
<span id='local-nav' style='display: none;'>
<a id="local-name-nav" href="#local-name"></a>
</span>
<span id='county-nav' style='display: none;'>
<a id="county-name-nav" href="#county-name"></a>
</span>
<span id='state-nav' style='display: none;'>
<a id="state-name-nav" href="#state-name"></a>
</span>
<span id='fed-nav'>
<a id="federal-name-nav" href="#federal-name">Federal</a></li>
</span>
</ul>
</p>
<hr />
<p class='text-center'><small><em>Note: Data comes from the <a target='_blank' href='https://developers.google.com/civic-information/'>Google Civic Information API</a>, which does not have 100% coverage of all representatives.<br />If you notice an issue with the data, please <a target='_blank' href='https://docs.google.com/forms/d/e/1FAIpQLScFpFTOkTpm0YoerLLprY_ySS9PRXLsu27SM01hebHqkefW2Q/viewform'>report it to Google</a>.</em></small></p>
<div id='local-container'>
<br />
<h3 class='text-center' id="local-name"></h3>
<table id="local-results" class="table table-striped table-responsive">
<thead>
<tr>
<th></th>
<th>Representative</th>
<th class='hidden-xs hidden-sm'><i class='fa fa-institution'></i> Office</th>
<th class='hidden-xs'><i class='fa fa-map-marker'></i> Address</th>
<th><i class='fa fa-external-link'></i> Links</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id='local-container-not-found' style='display: none;' class='text-center'>
<h3 class='text-center' id="local-name-not-found"></h3>
<p>We couldn't find any representatives for this area</p>
</div>
<div id='county-container'>
<br />
<h3 class='text-center' id="county-name"></h3>
<table id="county-results" class="table table-striped table-responsive">
<thead>
<tr>
<th></th>
<th>Representative</th>
<th class='hidden-xs hidden-sm'><i class='fa fa-institution'></i> Office</th>
<th class='hidden-xs'><i class='fa fa-map-marker'></i> Address</th>
<th><i class='fa fa-external-link'></i> Links</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id='county-container-not-found' style='display: none;' class='text-center'>
<h3 class='text-center' id="county-name-not-found"></h3>
<p>We couldn't find any representatives for this area</p>
</div>
<div id='state-container'>
<br />
<h3 class='text-center' id="state-name"></h3>
<table id="state-results" class="table table-striped table-responsive">
<thead>
<tr>
<th></th>
<th>Representative</th>
<th class='hidden-xs hidden-sm'><i class='fa fa-institution'></i> Office</th>
<th class='hidden-xs'><i class='fa fa-map-marker'></i> Address</th>
<th><i class='fa fa-external-link'></i> Links</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id='federal-container'>
<h3 id='federal-name' class='text-center'>United States Federal Government</h3>
<table id="federal-results" class="table table-striped table-responsive">
<thead>
<tr>
<th></th>
<th>Representative</th>
<th class='hidden-xs hidden-sm'><i class='fa fa-institution'></i> Office</th>
<th class='hidden-xs'><i class='fa fa-map-marker'></i> Address</th>
<th><i class='fa fa-external-link'></i> Links</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div class='row'>
<div class='col-md-5 col-md-offset-2'>
<br />
<h2>About</h2>
<div class='about'>
<p>This is a tool for looking up who your <a href='https://en.wikipedia.org/wiki/Representative_democracy' target='_blank'>elected representatives</a> are across the United States. Based on your address, we can find all the federal, state, county and local officials who represent you in government.</p>
<p>Knowing who these representatives are and contacting their offices directly is the most effective way to change how our government works.</p>
<p>Have an issue you care about? <strong>Find your rep and tell them!</strong></p>
<p><a href='/about.html'>More about this project »</a></p>
<p><a href='/about.html#custom-installations'>Custom installations available ></a></p>
</div>
</div>
<div class='col-md-3 hidden-xs hidden-sm'>
<img class='img-responsive' src='images/usa.png' title='The United States of America' alt='The United States of America' />
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="contactModal" tabindex="-1" role="dialog" aria-labelledby="contactModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="contactModalLabel"></h4>
</div>
<div class="modal-body" id='modalContent'>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><i class='fa fa-times'></i> Close</button>
</div>
</div>
</div>
</div>
<script id="tableGuts" type="text/EJS">
<% $.each(people, function(i, info){ %>
<tr>
<td>
<% if (info.person.photoUrl) { %>
<img class="img-rounded headshot" src="<%= info.person.photoUrl %>" alt="<%= info.person.name %>" title="<%= info.person.name %>" />
<% } else { %>
<img class="img-rounded headshot" src="/images/blank-person.jpg" alt="<%= info.person.name %>" title="<%= info.person.name %>" />
<% } %>
</td>
<td>
<%= info.person.name %> <%= formatParty(info.person.party) %>
<span class='visible-xs-block visible-sm-block'><%= info.office.name %></span>
</td>
<td class='hidden-xs hidden-sm'><%= info.office.name %></td>
<td class='hidden-xs'>
<% if (info.address) { %>
<% $.each(info.address, function(i, addr){ %>
<p>
<%= toTitleCase(addr.line1) %><br />
<% if (addr.line2) { %>
<%= toTitleCase(addr.line2) %><br />
<% } %>
<% if (addr.line3) { %>
<%= toTitleCase(addr.line3) %><br />
<% } %>
<%= toTitleCase(addr.city) %>, <%= addr.state.toUpperCase() %> <%= addr.zip %>
</p>
<% }) %>
<% } %>
</td>
<td>
<% if (info.channels || info.urls){ %>
<span class='hidden-xs hidden-sm'>
<% if (info.channels){ %>
<% $.each(info.channels, function(i, channel){ %>
<a href="<%= channel.link %>" target="_blank"><i class="fa fa-fw fa-<%= channel.icon %>"> </i></a>
<% }) %>
<% } %>
<% if (info.urls){ %>
<% $.each(info.urls, function(i, url){ %>
<a href="<%= url %>" target="_blank"><i class="fa fa-fw fa-globe"> </i></a>
<% }) %>
<% } %>
</span>
<span class='visible-xs-inline visible-sm-inline'>
<% if (info.channels){ %>
<% $.each(info.channels, function(i, channel){ %>
<a href="<%= channel.link %>" target="_blank"><i class="fa fa-fw fa-<%= channel.icon %>"> </i></a>
<% }) %>
<% } %>
<% if (info.urls){ %>
<% $.each(info.urls, function(i, url){ %>
<a href="<%= url %>" target="_blank"><i class="fa fa-fw fa-globe"> </i></a>
<% }) %>
<% } %>
</span>
<% } %>
</td>
<% if (info.phones || info.emails){ %>
<td class='nowrap'>
<button type="button" class="btn btn-default btn-contact" data-toggle="modal" data-id="<%= info.pseudo_id %>">
Contact <i class='fa fa-chevron-right'></i>
</button>
</td>
<% } else { %>
<td></td>
<% } %>
</tr>
<% }) %>
</script>
<script id="modalGuts" type="text/EJS">
<div class='row'>
<div class='col-xs-4'>
<% if (info.person.photoUrl) { %>
<img class="img-rounded img-responsive" src="<%= info.person.photoUrl %>" alt="<%= info.person.name %>" title="<%= info.person.name %>" />
<% } else { %>
<img class="img-rounded img-responsive" src="/images/blank-person.jpg" alt="<%= info.person.name %>" title="<%= info.person.name %>" />
<% } %>
<br />
<strong><%= info.person.name %> <%= formatParty(info.person.party) %></strong><br />
<%= info.office.name %><br />
<%= info.jurisdiction %>
</div>
<div class='col-xs-8'>
<!-- Add your contact instructions here! -->
<p><strong>Contact <%= info.person.name %></strong></p>
<hr />
<% if (info.phones){ %>
<% $.each(info.phones, function(i, phone){ %>
<% if ((i + 1) < info.phones.length){ %>
<i class='fa fa-fw fa-phone'></i> <%= phone %><br />
<% } else { %>
<i class='fa fa-fw fa-phone'></i> <%= phone %>
<% } %>
<% }) %>
<br />
<% } %>
<% if (info.emails){ %>
<% $.each(info.emails, function(i, email){ %>
<% if ((i + 1) < info.emails.length){ %>
<i class='fa fa-fw fa-envelope'></i> <a href='mailto:<%= email %>'><%= email %></a><br />
<% } else { %>
<i class='fa fa-fw fa-envelope'></i> <a href='mailto:<%= email %>'><%= email %></a>
<% } %>
<% }) %>
<% } %>
</div>
</div>
</script>
<script src="js/lookup_tool.js"></script>
<script type='text/javascript'>
//<![CDATA[
var DEBUG = false;
$(function() {
var autocomplete = new google.maps.places.Autocomplete(document.getElementById('address'), {types: ['address']});
$("#address").val(convertToPlainString($.address.parameter('address')));
var results_level = $.address.parameter('results_level');
if (results_level == undefined)
results_level = ['local', 'county', 'state', 'federal'];
// set levels of government checkboxes
if (results_level.indexOf("local") >= 0)
$('#show_local_results').prop('checked', true);
if (results_level.indexOf("county") >= 0)
$('#show_county_results').prop('checked', true);
if (results_level.indexOf("state") >= 0)
$('#show_state_results').prop('checked', true);
if (results_level.indexOf("federal") >= 0)
$('#show_federal_results').prop('checked', true);
$("#results-nav a").click(function(e) {
e.preventDefault();
var scroll_to = $($("#" + e.target.id).attr('href'));
$('html, body').animate({
scrollTop: scroll_to.offset().top
}, 1000);
});
$('#find-me').click(function(){
findMe();
return false;
});
$(":text").keydown(function(e){
var key = e.keyCode ? e.keyCode : e.which;
if(key === 13) {
$('#address-search').click();
return false;
}
});
if ($("#address").val()) {
if (DEBUG) console.log("search on load")
addressSearch();
}
$('#address-search').click(function(){
addressSearch();
});
});
//]]>
</script>