-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.html
798 lines (717 loc) · 27 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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>115th United States Senate</title>
<meta name="description" content="115th United States Senate data">
<meta name="keywords" content="Civil, Services, Local, State, Federal, Government, Legislation, Accountability, Action, Information, Elected, Officials, API, Developers" />
<meta name="author" content="Civil Services">
<meta name="robots" content="noodp,noydir">
<meta name="robots" content="index,follow">
<meta name="coverage" content="worldwide">
<meta name="cache-control" content="public">
<meta name="googlebot" content="index,follow">
<!-- Mobile Metadata -->
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="US Senate">
<meta name="application-name" content="US Senate">
<!-- Twitter Metadata -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="115th United States Senate">
<meta name="twitter:site" content="@CivilServiceUSA">
<meta name="twitter:creator" content="@CivilServiceUSA">
<meta name="twitter:description" content="View Contact Information for United States Senators, including: Phone Number, Mailing Address, Official Website, Twitter & Facebook Accounts.">
<meta name="twitter:image" content="https://civil.services/app-image.jpg">
<meta name="twitter:image:alt" content="115th United States Senate">
<meta name="twitter:domain" content="civil.services">
<!-- Open Graph Metadata -->
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website">
<meta property="og:title" content="115th United States Senate">
<meta property="og:url" content="https://civil.services">
<meta property="og:image" content="https://civil.services/app-image.jpg">
<meta property="og:site_name" content="Civil Services">
<meta property="og:description" content="View Contact Information for United States Senators, including: Phone Number, Mailing Address, Official Website, Twitter & Facebook Accounts.">
<!-- Dublin Core Metadata -->
<meta name="dc:language" content="en_US">
<meta name="dc:title" content="115th United States Senate">
<meta name="dc:source" content="https://civil.services">
<meta name="dc:description" content="View Contact Information for United States Senators, including: Phone Number, Mailing Address, Official Website, Twitter & Facebook Accounts.">
<!-- Structured Metadata -->
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Service",
"serviceType": "Public Service",
"provider": {
"@type": "LocalBusiness",
"name": "Civil Services",
"image": "https://civil.services/app-image.jpg",
"address": {
"@type": "PostalAddress",
"addressCountry": "US",
"addressLocality": "St. Petersburg",
"addressRegion": "FL",
"postOfficeBoxNumber": "Suite 420",
"postalCode": "33701",
"streetAddress": "200 2nd Avenue South"
},
"description": "View Contact Information for United States Senators, including: Phone Number, Mailing Address, Official Website, Twitter & Facebook Accounts.",
"name": "115th United States Senate",
"telephone": "N/A",
"priceRange": "0",
"geo": {
"@type": "GeoCoordinates",
"latitude": "27.7691736",
"longitude": "-82.6379893"
},
"sameAs": [
"https://github.com/CivilServiceUSA",
"https://twitter.com/CivilServiceUSA",
"https://www.facebook.com/CivilServiceUSA/"
]
},
"areaServed": {
"@type": "Country",
"name": "US"
},
"hasOfferCatalog": {
"@type": "OfferCatalog",
"name": "Civil Services",
"itemListElement": [
{
"@type": "Offer",
"itemOffered": {
"@type": "Service",
"name": "115th United States Senate Data"
}
}
]
}
}
</script>
<!-- App Icons -->
<link rel="shortcut icon" href="https://civil.services/favicon.ico">
<link rel="apple-touch-icon" sizes="144x144" href="https://civil.services/img/favicon-retina-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://civil.services/img/favicon-retina-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://civil.services/img/favicon-standard-ipad.png">
<link rel="apple-touch-icon" sizes="57x57" href="https://civil.services/img/favicon-standard-iphone.png">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
<style>
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
html, body, ul, li, h1, a, p {
padding: 0;
margin: 0;
}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
}
::-moz-placeholder { /* Firefox 19+ */
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
}
:-ms-input-placeholder { /* IE 10+ */
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
}
:-moz-placeholder { /* Firefox 18- */
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
}
body {
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
color: #222;
}
h2.slogan {
padding: 40px;
background-color: #e3edf5;
font-weight: 300;
}
h2.slogan a {
text-decoration: none;
font-weight: 400;
color: #000;
}
h2.slogan a:hover {
text-decoration: underline;
}
.wrapper {
margin: 0 auto;
max-width: 1250px;
}
.logo {
width: 125px;
height: 125px;
background: url(https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Seal_of_the_United_States_Senate.svg/240px-Seal_of_the_United_States_Senate.svg.png) center center no-repeat;
background-size: cover;
display: inline-block;
float: left;
margin-right: 20px;
}
.wrapper > h1 {
font-weight: 300;
margin-bottom: 20px;
font-size: 40px;
width: 100%;
height: 125px;
line-height: 125px;
margin-top: 40px;
}
h1.name {
padding: 4px 8px;
position: absolute;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
width: 100%;
margin: 0;
font-size: 16px !important;
opacity: 1;
transition: opacity 0.25s ease;
}
.buttons {
margin-top: 16px;
text-align: center;
}
.buttons a {
color: rgba(255, 255, 255, 0.5);
font-size: 24px;
margin-right: 10px;
}
.buttons a:hover {
color: #FFF;
}
.senators {
color: #FFF;
margin: 0 auto;
margin-top: 20px;
}
.senators li {
display: inline-block;
float: left;
width: 250px;
height: 250px;
background: center center no-repeat;
background-size: 100% 100%;
position: relative;
transition: background-size 0.5s ease;
}
.senators .data {
background: rgba(0, 0, 0, 0.8);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 0.25s ease;
padding: 20px;
}
.senators li.hover,
.senators li:hover {
background-size: 120% 120%;
}
.senators li.hover h1.name,
.senators li:hover h1.name {
opacity: 0;
}
.senators li.hover .data,
.senators li:hover .data {
opacity: 1;
}
.senators h1 {
font-size: 20px;
font-weight: 300;
text-align: center;
}
.stats {
color: #bbb;
}
.stats h2 {
color: #000 !important;
}
.stats span {
color: #666;
font-weight: 400;
}
.stats .percent {
color: #bbb;
}
.stats .control {
padding-left: 0 !important;
}
.control-group {
display: block;
vertical-align: top;
background: #fff;
text-align: left;
}
.control-group h2 {
font-weight: 300;
display: inline-block;
margin: 0;
padding: 0;
min-width: 100px;
text-align: right;
margin-right: 10px;
}
.control {
display: inline-block;
position: relative;
padding-left: 30px;
margin-bottom: 5px;
cursor: pointer;
font-size: 18px;
margin-right: 10px;
font-weight: 300;
}
.control input {
position: absolute;
z-index: -1;
opacity: 0;
}
.control__indicator {
position: absolute;
top: 2px;
left: 0;
height: 20px;
width: 20px;
background: #e6e6e6;
}
.control--radio .control__indicator {
border-radius: 50%;
}
.control:hover input ~ .control__indicator,
.control input:focus ~ .control__indicator {
background: #ccc;
}
.control input:checked ~ .control__indicator {
background: #2aa1c0;
}
.control:hover input:not([disabled]):checked ~ .control__indicator,
.control input:checked:focus ~ .control__indicator {
background: #0e647d;
}
.control input:disabled ~ .control__indicator {
background: #e6e6e6;
opacity: 0.6;
pointer-events: none;
}
.control__indicator:after {
content: '';
position: absolute;
display: none;
}
.control input:checked ~ .control__indicator:after {
display: block;
}
.control--checkbox .control__indicator:after {
left: 8px;
top: 4px;
width: 5px;
height: 10px;
border: solid #fff;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.control--checkbox input:disabled ~ .control__indicator:after {
border-color: #7b7b7b;
}
input[type="text"] {
font-size: 16px;
line-height: 30px;
height: 30px;
padding: 0 8px;
border: 1px solid #dddddd;
}
input[type="text"]:focus {
outline: none;
border: 1px solid #bbbbbb;
}
.search-note {
color: #BBB;
margin-left: 10px;
}
.push {
height: 40px;
display: block;
clear: both;
}
.toggle-filters {
margin-bottom: 20px;
}
.toggle-filters a {
text-decoration: none;
color: #FFFFFF;
width: 100%;
padding: 10px 0;
display: block;
background: #22427b;
font-weight: 400;
letter-spacing: 2px;
text-align: center;
text-transform: uppercase;
}
.toggle-filters a.hide {
display: none;
}
.filters {
display: none;
}
sup {
font-size: 14px;
}
@media (min-width: 1251px) {
.wrapper {
width: 1250px;
}
}
@media (max-width: 1250px) {
.wrapper {
width: 1000px;
}
}
@media (max-width: 1000px) {
.wrapper {
width: 750px;
}
}
@media (max-width: 750px) {
.wrapper {
width: 500px;
}
.wrapper > h1 {
margin-bottom: 20px;
font-size: 30px;
font-weight: 300;
height: 64px;
line-height: 50px;
margin-top: 30px;
}
.logo {
width: 64px;
height: 64px;
margin-right: 10px;
}
h2.slogan {
padding: 20px;
font-size: 18px;
}
.control-group h2 {
display: block;
text-align: left;
margin: 14px 0 4px 0;
}
}
@media (max-width: 500px) {
.wrapper {
width: 250px;
}
.wrapper > h1 {
margin-bottom: 20px;
font-size: 18px;
font-weight: 400;
height: 32px;
line-height: 22px;
margin-top: 40px;
}
.logo {
width: 32px;
height: 32px;
margin-right: 5px;
}
h2.slogan {
padding: 20px;
font-size: 16px;
}
.control-group label {
font-size: 14px;
line-height: 24px;
}
.control-group h2 {
display: block;
text-align: left;
margin: 14px 0 4px 0;
}
.search-note {
display: none;
}
}
</style>
</head>
<body>
<a href="https://github.com/CivilServiceUSA/us-senate" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>
<div class="wrapper">
<h1>
<div class="logo"></div>
115<sup>th</sup> United States Senate
</h1>
<h2 class="slogan">View Contact Information for United States Senators, including: Phone Number, Mailing Address, Official Website, Twitter & Facebook Accounts. This data is 100% <a href="https://github.com/CivilServiceUSA/us-senate">Open Source.</a></h2>
<div class="toggle-filters">
<a href="#" title="Search Senators" onclick="toggleFilters(); return false;" class="open-search"><i class="fa fa-fw fa-search"></i> Search Senators</a>
<a href="#" title="Close Search" onclick="toggleFilters(); return false;" class="close-search hide"><i class="fa fa-fw fa-times"></i> Close Search</a>
</div>
<div class="filters">
<div class="control-group stats">
<h2>Showing:</h2>
<label class="control control--checkbox">
<span class="count"></span> of <span class="total"></span> ( <span class="percent"></span> )
</label>
</div>
<div class="control-group">
<h2>Search:</h2>
<input type="text" name="q" id="search" onkeyup="doSearch()" placeholder="Find a Senator ...">
<span class="search-note">( Overwrites Filters Below )</span>
</div>
<div class="control-group">
<h2>Party:</h2>
<label class="control control--checkbox">
<input type="checkbox" value="democrat" id="party-democrat"> Democrat
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="republican" id="party-republican"> Republican
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="independent" id="party-independent"> Independent
<div class="control__indicator"></div>
</label>
</div>
<div class="control-group">
<h2>Gender:</h2>
<label class="control control--checkbox">
<input type="checkbox" value="female" id="gender-female"> Female
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="male" id="gender-male"> Male
<div class="control__indicator"></div>
</label>
</div>
<div class="control-group">
<h2>Ethnicity:</h2>
<label class="control control--checkbox">
<input type="checkbox" value="african-american" id="ethnicity-african-american"> African American
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="asian-american" id="ethnicity-asian-american"> Asian American
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="hispanic-american" id="ethnicity-hispanic-american"> Hispanic American
<div class="control__indicator"></div>
</label>
<label class="control control--checkbox">
<input type="checkbox" value="white" id="ethnicity-white"> White
<div class="control__indicator"></div>
</label>
</div>
</div>
<div class="senators"></div>
<div class="push"></div>
</div>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
var items = [];
var filtersShowing = false;
function trackEvent(category, action, label) {
if(typeof window.ga !== 'undefined') {
ga('US_Senate.send', 'event', category, action, label);
}
}
function toggleFilters() {
if (filtersShowing) {
$('.filters').hide();
$('.open-search').removeClass('hide');
$('.close-search').addClass('hide');
trackEvent('Nav', 'Filter', 'Close');
filtersShowing = false;
} else {
$('.filters').show();
$('.open-search').addClass('hide');
$('.close-search').removeClass('hide');
trackEvent('Nav', 'Filter', 'Open');
filtersShowing = true;
}
}
function doSearch(){
var search = $('#search').val();
if (search && search !== '') {
$('li').hide();
$('li[data-name*="' + search + '" i]').show();
} else {
$('li').show();
}
var count = $('li:visible').length;
var total = items.length;
var percent = Math.round((count / total) * 100);
$('span.count').text(count);
$('span.total').text(total);
$('span.percent').text(percent + '%');
trackEvent('Search', 'Term', search);
trackEvent('Search', 'Match Number', count);
trackEvent('Search', 'Match Percent', percent);
}
function updateSenators (init) {
var $dem = $('li[data-party="democrat"]');
var $rep = $('li[data-party="republican"]');
var $ind = $('li[data-party="independent"]');
var $male = $('li[data-gender="male"]');
var $female = $('li[data-gender="female"]');
var $white = $('li[data-ethnicity="white"]');
var $african = $('li[data-ethnicity="african-american"]');
var $asian = $('li[data-ethnicity="asian-american"]');
var $hispanic = $('li[data-ethnicity="hispanic-american"]');
$dem.show();
$rep.show();
$ind.show();
$male.show();
$female.show();
$white.show();
$african.show();
$asian.show();
$hispanic.show();
var democrat = $('#party-democrat').is(':checked');
var republican = $('#party-republican').is(':checked');
var independent = $('#party-independent').is(':checked');
var male = $('#gender-male').is(':checked');
var female = $('#gender-female').is(':checked');
var white = $('#ethnicity-white').is(':checked');
var african = $('#ethnicity-african-american').is(':checked');
var asian = $('#ethnicity-asian-american').is(':checked');
var hispanic = $('#ethnicity-hispanic-american').is(':checked');
if (democrat || republican || independent) {
if (!democrat) {
$dem.hide();
} else {
trackEvent('Search', 'Party', 'Democrat');
}
if (!republican) {
$rep.hide();
} else {
trackEvent('Search', 'Party', 'Republican');
}
if (!independent) {
$ind.hide();
} else {
trackEvent('Search', 'Party', 'Independent');
}
}
if (male || female) {
if (!male) {
$male.hide();
} else {
trackEvent('Search', 'Gender', 'Male');
}
if (!female) {
$female.hide();
}
else {
trackEvent('Search', 'Gender', 'Female');
}
}
// Hide if any are selected, if all are not selected, ignore
if (white || african || asian || hispanic) {
if (!white) {
$white.hide();
} else {
trackEvent('Search', 'Ethnicity', 'White');
}
if (!african) {
$african.hide();
} else {
trackEvent('Search', 'Ethnicity', 'African American');
}
if (!asian) {
$asian.hide();
} else {
trackEvent('Search', 'Ethnicity', 'Asian American');
}
if (!hispanic) {
$hispanic.hide();
} else {
trackEvent('Search', 'Ethnicity', 'Hispanic American');
}
}
var count = $('li:visible').length;
var total = items.length;
var percent = Math.round((count / total) * 100);
$('span.count').text(count);
$('span.total').text(total);
$('span.percent').text(percent + '%');
if (!init) {
trackEvent('Search', 'Match Number', count);
trackEvent('Search', 'Match Percent', percent);
}
}
$.getJSON("data/senate.json", function (data) {
$.each(data, function (key, senator) {
var title = senator.name + ' ( ' + senator.party.substr(0,1).toUpperCase() + ' - ' + senator.state + ' )';
items.push('<li style="background-image: url(' + senator.photo_url + ')" data-name="' + senator.name + '" data-state="' + senator.state + '" data-party="' + senator.party + '" data-gender="' + senator.gender + '" data-ethnicity="' + senator.ethnicity + '"><h1 class="name">' + title + '</h1><div class="data">' +
'<h1>' + senator.name + '</h1>' +
'<div>State: ' + senator.state + '</div>' +
'<div>Party: ' + senator.party + '</div>' +
'<div>Class: ' + senator.class + '</div>' +
'<div>Entered Office: ' + senator.entered_office + '</div>' +
'<div>Term Ends: ' + senator.term_end + '</div>' +
'<div>DOB: ' + senator.date_of_birth + '</div>' +
'<div class="buttons">' +
'<a href="tel:' + senator.phone + '" title="Call Senator" target="_blank"><i class="fa fa-fw fa-phone-square"></i></a>' +
'<a href="' + senator.website + '" title="Visit Website" target="_blank"><i class="fa fa-fw fa-external-link-square"></i></a>' +
'<a href="https://maps.google.com/?daddr=' + senator.address.replace(/ /g, '+') + '" title="View Senator Address" target="_blank"><i class="fa fa-fw fa-map-marker"></i></a>' +
'<a href="' + senator.twitter_url + '" title="View Senator Twitter" target="_blank"><i class="fa fa-fw fa-twitter-square"></i></a>' +
'<a href="' + senator.facebook_url + '" title="View Senator Facebook" target="_blank"><i class="fa fa-fw fa-facebook-square"></i></a>' +
'</div>' +
'</div></li>');
});
$("<ul/>", { html: items }).appendTo('.senators');
$('li').on('click', function(){
if ($(this).hasClass('hover')) {
$(this).removeClass('hover');
} else {
$('li.hover').removeClass('hover');
$(this).addClass('hover');
var data = $(this).data();
trackEvent('Senator', 'Ethnicity', data.ethnicity);
trackEvent('Senator', 'Gender', data.gender);
trackEvent('Senator', 'Name', data.name);
trackEvent('Senator', 'State', data.state);
trackEvent('Senator', 'Party', data.party);
}
});
$('li a').on('click', function(){
var title = $(this).attr('title');
var data = $(this).closest('li').data();
trackEvent('Button', 'Click', title);
trackEvent('Button', 'Ethnicity', data.ethnicity);
trackEvent('Button', 'Gender', data.gender);
trackEvent('Button', 'Name', data.name);
trackEvent('Button', 'State', data.state);
trackEvent('Button', 'Party', data.party);
});
$('input[type="checkbox"]').change(updateSenators);
updateSenators(true);
});
</script>
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-89110231-2', 'auto', 'US_Senate');
ga('US_Senate.send', 'pageview');
</script>
</body>
</html>