-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresults.html
More file actions
209 lines (192 loc) · 8.87 KB
/
Copy pathresults.html
File metadata and controls
209 lines (192 loc) · 8.87 KB
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
<head>
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:400,700" rel="stylesheet">
<link href='style.css' rel='stylesheet' type='text/css'>
<title>8values Results</title>
<link rel="icon" type="x-icon" href="icon.png">
<link rel="shortcut icon" type="x-icon" href="icon.png">
<meta charset="utf-8">
<script>
version = "Test Edition #1" //Remember to update this before making changes to the test itself!
</script>
</head>
<script type="application/javascript"
src="ideologies.js">
</script>
<body>
<h1>8values</h1>
<hr>
<h1>Results</h1>
<h2>Radicality Axis: <span class="weight-300" id="economic-label"></span></h2>
<div class="axis">
<img id="img-equality" src="value_images/equality.svg" height="128pt"/>
<div class="bar moderation" id="bar-moderation"><div class="text-wrapper" id="moderation"></div></div>
<div class="bar extremity" id="bar-extremity"><div class="text-wrapper" id="extremity"></div></div>
<img id="img-wealth" src="value_images/wealth.svg" height="128pt"/>
</div>
<h2>Unity Axis: <span class="weight-300" id="state-label"></span></h2>
<div class="axis">
<img id="img-liberty" src="value_images/liberty.svg" height="128pt"/>
<div class="bar libunity" id="bar-libunity"><div class="text-wrapper" id="libunity"></div></div>
<div class="bar rightunity" id="bar-rightunity"><div class="text-wrapper" id="rightunity"></div></div>
<img id="img-authority" src="value_images/authority.svg" height="128pt"/>
</div>
<h2>Cultural Axis: <span class="weight-300" id="society-label"></span></h2>
<div class="axis">
<img id="img-tradition" src="value_images/tradition.svg" height="128pt"/>
<div class="bar tradition" id="bar-tradition"><div class="text-wrapper" id="tradition"></div></div>
<div class="bar progress" id="bar-progress"><div class="text-wrapper" id="progress"></div></div>
<img id="img-progress" src="value_images/progress.svg" height="128pt"/>
</div>
<h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
<p>Ideological matching is a work in progress, and is much less accurate than the values and axes.</p>
<p>You can send these results by copying and pasting the URL at the top of the page or using the image below. Think your matched ideology was wrong? Want to help us calibrate the test? Send the results along with your political ideology to us at eightvalues@gmail.com, or send us any comments, questions, or criticism. </p>
<hr/>
<img src="" id="banner">
<button class="button" onclick="location.href='index.html';" style="background-color: #2196f3;">Back</button> <br>
<!-- Website visit statistics - no personal information is collected! -->
<script type="text/javascript">
var sc_project=11325211;
var sc_invisible=1;
var sc_security="fd9f0659";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="web stats"
href="http://statcounter.com/" target="_blank"><img
class="statcounter"
src="//c.statcounter.com/11325211/0/fd9f0659/1/" alt="web
stats"></a></div></noscript>
<script>
function getQueryVariable(variable)
{
var query = window.location.search.substring(1)
var vars = query.split("&")
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=")
if(pair[0] == variable) {return pair[1]}
}
return(NaN);
}
function setBarValue(name, value) {
innerel = document.getElementById(name)
outerel = document.getElementById("bar-" + name)
outerel.style.width = (value + "%")
innerel.innerHTML = (value + "%")
if (innerel.offsetWidth + 20 > outerel.offsetWidth) {
innerel.style.visibility = "hidden"
}
}
radArray = ["Centrist","Liberal","Libertarian","Minarchist","Voluntarist"]
aliArray = ["Libertarian Unity","Libertarian Co-Operation","Distinctionist","Right Co-Operation","Right Unity"]
culArray = ["Progressive","Cultural Liberal","Neutral","Cultural Conservative","Traditionalist"]
function setLabel(val,ary) {
if (val > 100) { return "" } else
if (val > 90) { return ary[0] } else
if (val > 75) { return ary[1] } else
if (val > 60) { return ary[2] } else
if (val >= 40) { return ary[3] } else
if (val >= 25) { return ary[4] } else
if (val >= 10) { return ary[5] } else
if (val >= 0) { return ary[6] } else
{return ""}
}
moderation = getQueryVariable("e")
libunity = getQueryVariable("g")
progress = getQueryVariable("s")
extremity = (100 - moderation).toFixed(1)
rightunity = (100 - libunity ).toFixed(1)
tradition = (100 - progress).toFixed(1)
setBarValue("moderation", moderation)
setBarValue("extremity", extremity)
setBarValue("libunity", libunity)
setBarValue("rightunity", rightunity)
setBarValue("progress", progress)
setBarValue("tradition", tradition)
document.getElementById("economic-label").innerHTML = setLabel(moderation, radArray)
document.getElementById("state-label").innerHTML = setLabel(libunity, aliArray)
document.getElementById("society-label").innerHTML = setLabel(progress, culArray)
ideology = ""
ideodist = Infinity
for (var i = 0; i < ideologies.length; i++) {
dist = 0
dist += Math.pow(Math.abs(ideologies[i].stats.econ - moderation), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.govt - libunity), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.scty - progress), 1.73856063)
if (dist < ideodist) {
ideology = ideologies[i].name
ideodist = dist
}
}
document.getElementById("ideology-label").innerHTML = ideology
function createImage(src, x, y, w, h) {
img = new Image ()
img.src = src
img.onLoad = function() {
ctx.drawImage(img, x, y, w, h)
}
}
window.onload = function() {
var c = document.createElement("canvas")
var ctx = c.getContext("2d")
c.width = 800;
c.height = 650;
ctx.fillStyle = "#EEEEEE"
ctx.fillRect(0,0,800,650);
img = document.getElementById("img-equality")
ctx.drawImage(img, 20, 170, 100, 100);
img = document.getElementById("img-wealth")
ctx.drawImage(img, 680, 170, 100, 100)
img = document.getElementById("img-liberty")
ctx.drawImage(img, 20, 410, 100, 100)
img = document.getElementById("img-authority")
ctx.drawImage(img, 680, 410, 100, 100)
img = document.getElementById("img-tradition")
ctx.drawImage(img, 20, 530, 100, 100)
img = document.getElementById("img-progress")
ctx.drawImage(img, 680, 530, 100, 100)
ctx.fillStyle="#222222"
ctx.fillRect(120, 180, 560, 80)
ctx.fillRect(120, 300, 560, 80)
ctx.fillRect(120, 420, 560, 80)
ctx.fillRect(120, 540, 560, 80)
ctx.fillStyle="#f44336"
ctx.fillRect(120, 184, 5.6*moderation-2, 72)
ctx.fillStyle="#00897b"
ctx.fillRect(682-5.6*extremity, 184, 5.6*extremity-2, 72)
ctx.fillStyle="#ff9800"
ctx.fillRect(120, 424, 5.6*libunity-2, 72)
ctx.fillStyle="#3f51b5"
ctx.fillRect(682-5.6*right, 424, 5.6*rightunity-2, 72)
ctx.fillStyle="#8bc34a"
ctx.fillRect(120, 544, 5.6*tradition-2, 72)
ctx.fillStyle="#9c27b0"
ctx.fillRect(682-5.6*progress, 544, 5.6*progress-2, 72)
ctx.fillStyle="#222222"
ctx.font="700 80px Montserrat"
ctx.textAlign="left"
ctx.fillText("8values", 20, 90)
ctx.font="50px Montserrat"
ctx.fillText(ideology, 20, 140)
ctx.textAlign="left"
if (moderation > 30) {ctx.fillText(moderation + "%", 130, 237.5)}
if (libunity > 30) {ctx.fillText(libunity + "%", 130, 477.5)}
if (tradition > 30) {ctx.fillText(tradition + "%", 130, 597.5)}
ctx.textAlign="right"
if (extremity > 30) {ctx.fillText(extremity + "%", 670, 237.5)}
if (rightunity > 30) {ctx.fillText(rightunity + "%", 670, 477.5)}
if (progress > 30) {ctx.fillText(progress + "%", 670, 597.5)}
ctx.font="300 30px Montserrat"
ctx.fillText("8values.github.io", 780, 60)
ctx.fillText(version, 780, 90)
ctx.textAlign="center"
ctx.fillText("Economic Axis: " + document.getElementById("economic-label").innerHTML, 400, 175)
ctx.fillText("Diplomatic Axis: " + document.getElementById("diplomatic-label").innerHTML, 400, 295)
ctx.fillText("Civil Axis: " + document.getElementById("state-label").innerHTML, 400, 415)
ctx.fillText("Societal Axis: " + document.getElementById("society-label").innerHTML, 400, 535)
document.getElementById("banner").src = c.toDataURL();
}
</script>
</body>