-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
264 lines (233 loc) · 13.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>US Elections Remapped</title>
<!-- CSS -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" integrity="sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w==" crossorigin="anonymous" />
<!-- JS -->
<script src="https://schuelerzahlen-zuerich.opendata.iwi.unibe.ch/App2/d3geo-2/lib/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-legend/1.13.0/d3-legend.min.js" integrity="sha512-cyLUM5W3k6KyDoJRTNYY1Nu2wS0TeYwTjJ+agzmEGkqKBXX2Ks4wGhdFsNecOhPjVyDyfGnD+nOxsXIdUIvx8A==" crossorigin="anonymous"></script>
<script src="https://d3js.org/d3-polygon.v2.min.js"></script>
<script src="https://schuelerzahlen-zuerich.opendata.iwi.unibe.ch/App2/d3geo-2/lib/topojson.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.loadtemplate/1.5.10/jquery.loadTemplate.min.js" integrity="sha512-T1zx+UG2gXu9mr29wvzaKkNUmAOAie40T32ZPIvcRPJgO5br53+Ocqj8gzguUuix7FK+Z3ncRCJMaZcumnPZzg==" crossorigin="anonymous"></script>
<script src="js/cartogram.js"></script>
</head>
<body id="body">
<div class="container" id="nav-container">
<div class="row">
<div class="col-2">
<div class="input-group">
<div class="input-group-prepend">
<label class="input-group-text">Year</label>
</div>
<select class="form-control" id="year-selector">
<option value="default" disabled selected>Choose year</option>
<option value="2012">2012</option>
<option value="2016">2016</option>
<option value="2020">2020</option>
</select>
</div>
</div>
<div class="col-8">
<div id="factor-selector" class="btn-group btn-group-toggle" data-toggle="buttons">
<label id="normal-map-select-label" class="btn btn-info">
<input id="normal-map-select" value="normal-map" type="radio" name="options" autocomplete="off"> Normal Map
</label>
<label id="electoral-college-select-label" class="btn btn-info">
<input id="electoral-college-select" value="electoral-college" type="radio" name="options" autocomplete="off"> Electoral College
</label>
<label id="long-term-select-label" class="btn btn-info">
<input id="long-term-select" value="long-term" type="radio" name="options" autocomplete="off"> Long Term Factors
</label>
<label id="short-term-select-label" class="btn btn-info">
<input id="short-term-select" value="short-term" type="radio" name="options" autocomplete="off"> Short Term Factors
</label>
</div>
</div>
<div class="col-2">
<div id="story-stopped-group">
<button id="story-start" type="button" class="btn btn-danger">
<span class="fa fa-play"></span>
Story
</button>
</div>
<div id="story-playing-group" class="hidden">
<button id="story-toggle" type="button" class="btn btn-danger">
<span class="fa fa-pause"></span>
</button>
<button id="story-stop" type="button" class="btn btn-danger">
<span class="fa fa-stop"></span>
</button>
</div>
</div>
</div>
<div class="row hidden" id="election-results-row">
<div class="col-2">
<img id="democrat-profile" class="profile" src="" alt="Democrat Candidate Profile">
</div>
<div class="col-8">
<div class="election-results-indicator"><strong>270 to Win</strong></div>
<span class="fa fa-angle-down text-center" style="display: block"></span>
<div id="election-results-bar">
<span class="election-results-bar-vote-counter" style="left: 2%;">
<span id="election-results-vote-counter-democrats"></span> votes
</span>
<span id="election-results-win-indicator"></span>
<span class="election-results-bar-vote-counter" style="right: 2%;">
<span id="election-results-vote-counter-republicans"></span> votes
</span>
</div>
<div id="democrat-name" class="candidate-name" style="left: 0"></div>
<div id="republican-name" class="candidate-name" style="right: 0"></div>
</div>
<div class="col-2">
<img id="republican-profile" class="profile" src="" alt="Republican Candidate Profile">
</div>
</div>
<div id="subnav-container" style="height: 4em">
<div class="row hidden" id="long-term-row">
<div class="col-3"></div>
<div class="col-6">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label id="lt-social-class-label" class="btn btn-success">
<input id="lt-social-class" class="content-changer" value="social-class" type="radio" name="options" autocomplete="off"> Social Class
</label>
<label id="lt-race-label" class="btn btn-success">
<input id="lt-race" class="content-changer" value="race" type="radio" name="options" autocomplete="off"> Race
</label>
<label id="lt-sex-label" class="btn btn-success">
<input id="lt-sex" class="content-changer" value="sex" type="radio" name="options" autocomplete="off"> Sex
</label>
</div>
</div>
<div class="col-3"></div>
</div>
<div class="row hidden" id="short-term-row">
<div class="col-3"></div>
<div class="col-6">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label id="st-special-label" class="btn btn-success">
<input id="st-special" class="content-changer" value="special" type="radio" name="options" autocomplete="off"> Specific factor
</label>
<label id="st-voter-turnout-label" class="btn btn-success">
<input id="st-voter-turnout" class="content-changer" value="voter-turnout" type="radio" name="options" autocomplete="off"> Voter Turnout
</label>
</div>
</div>
<div class="col-3"></div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-8">
<div id="container">
<svg id="map"></svg>
<svg id="legend"></svg>
<svg id="gradients">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,182,193);stop-opacity:1" />
<stop offset="80%" style="stop-color:rgb(255,182,193);stop-opacity:1" />
<stop offset="80%" style="stop-color:rgb(135,206,250);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(135,206,250);stop-opacity:1" />
</linearGradient>
</defs>
</svg>
</div>
</div>
<div id="storyline" class="col-4" style="overflow: auto; max-height: 65vh;"></div>
</div>
</div>
<div id="tooltip" class="hidden"></div>
<div id="stateModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalStateName"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-4">
<img id="modalFlagImg" style="width: 100%; margin: auto; display: block;">
<svg id="stateMap" style="width: 100%; height: 15em; margin-top: 1em;"></svg>
</div>
<div class="col-4">
<h5 class="modal-body-heading">General</h5>
<p>
Population: <span id="modalPopulation"></span>
</p>
<p>
Electoral Votes: <span id="modalElectoralVotes"></span>
</p>
<h5 class="modal-body-heading">Social Class</h5>
<p>
Social Class Score: <span id="modalSocialClassScore"></span>
</p>
<p>
Social Class Impact: <span id="modalSocialClassImpact"></span>
</p>
<h5 class="modal-body-heading">Sex</h5>
<p>
<span style="color: rgb(255,182,193);">Women</span> Percentage: <span id="modalWomenPercentage"></span>
</p>
<p>
<span style="color: rgb(135,206,250);">Men</span> Percentage: <span id="modalMenPercentage"></span>
</p>
<h5 class="modal-body-heading">Race</h5>
<p>
<span style="color: rgb(253,231,214);">White</span> Percentage: <span id="modalWhitePercentage"></span>
</p>
<p>
<span style="color: rgb(59,45,52);">Black</span> Percentage: <span id="modalBlackPercentage"></span>
</p>
<p>
<span style="color: rgb(245,211,101);">Asian</span> Percentage: <span id="modalAsianPercentage"></span>
</p>
<p>
<span style="color: rgb(149,91,69);">Hispanic</span> Percentage: <span id="modalHispanicPercentage"></span>
</p>
<p>
<span style="color: rgb(134,49,45);">Native</span> Percentage: <span id="modalNativePercentage"></span>
</p>
</div>
<div class="col-4">
<h5 class="modal-body-heading">Internet Availability Percentage</h5>
<p>
2012: <span id="modalInternetUsage2012"></span>
</p>
<p>
2016: <span id="modalInternetUsage2016"></span>
</p>
<h5 class="modal-body-heading">COVID Impact</h5>
<p>
<span id="modalCovidImpact"></span>
</p>
<h5 class="modal-body-heading">Voter Turnout <span class="fa fa-info-circle" data-toggle="tooltip" data-placement="top" title="Arrows indicate whether the value is above or below the national average for a year"></span></h5>
<p>
2012: <span id="modalVoterTurnout2012"></span> <span id="modalVoterTurnout2012Indicator"></span>
</p>
<p>
2016: <span id="modalVoterTurnout2016"></span> <span id="modalVoterTurnout2016Indicator"></span>
</p>
<p>
2020: <span id="modalVoterTurnout2020"></span> <span id="modalVoterTurnout2020Indicator"></span>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/main.js"></script>
</body>
</html>