Skip to content

Commit 5922cef

Browse files
committed
I don't know what happened to the commits. Help me.
1 parent 3177db6 commit 5922cef

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

results.html

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<head>
2+
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:400,700" rel="stylesheet">
3+
<link href='style.css' rel='stylesheet' type='text/css'>
4+
<title>8values Results</title>
5+
<link rel="icon" type="x-icon" href="icon.png">
6+
<link rel="shortcut icon" type="x-icon" href="icon.png">
7+
<meta charset="utf-8">
8+
</head>
9+
<script type="application/javascript"
10+
src="ideologies.js">
11+
</script>
12+
13+
<body>
14+
<h1>8values</h1>
15+
<hr>
16+
17+
<h1>Results</h1>
18+
19+
<h2>Economic Axis: <span class="weight-300" id="economic-label"></span></h2>
20+
<div class="axis">
21+
<img src="value_images/equality.svg" height="128pt"/>
22+
<div class="bar equality" id="bar-equality"><div class="text-wrapper" id="equality"></div></div>
23+
<div class="bar wealth" id="bar-wealth"><div class="text-wrapper" id="wealth"></div></div>
24+
<img src="value_images/wealth.svg" height="128pt"/>
25+
</div>
26+
<h2>Diplomatic Axis: <span class="weight-300" id="diplomatic-label"></span></h2>
27+
<div class="axis">
28+
<img src="value_images/might.svg" height="128pt"/>
29+
<div class="bar might" id="bar-might"><div class="text-wrapper" id="might"></div></div>
30+
<div class="bar peace" id="bar-peace"><div class="text-wrapper" id="peace"></div></div>
31+
<img src="value_images/peace.svg" height="128pt"/>
32+
</div>
33+
<h2>State Axis: <span class="weight-300" id="state-label"></span></h2>
34+
<div class="axis">
35+
<img src="value_images/liberty.svg" height="128pt"/>
36+
<div class="bar liberty" id="bar-liberty"><div class="text-wrapper" id="liberty"></div></div>
37+
<div class="bar authority" id="bar-authority"><div class="text-wrapper" id="authority"></div></div>
38+
<img src="value_images/authority.svg" height="128pt"/>
39+
</div>
40+
<h2>Society Axis: <span class="weight-300" id="society-label"></span></h2>
41+
<div class="axis">
42+
<img src="value_images/tradition.svg" height="128pt"/>
43+
<div class="bar tradition" id="bar-tradition"><div class="text-wrapper" id="tradition"></div></div>
44+
<div class="bar progress" id="bar-progress"><div class="text-wrapper" id="progress"></div></div>
45+
<img src="value_images/progress.svg" height="128pt"/>
46+
</div>
47+
<h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
48+
<p>Ideological matching is a work in progress, and is much less accurate than the values and axes.</p>
49+
<p>You can send these results by copying and pasting the URL at the top of the page. Think your matched ideology was wrong? Want to help us calibrate the test? Send the results along with your political ideology to us at [email protected], or send us any comments, questions, or criticism. </p>
50+
<hr/>
51+
<button class="button" onclick="location.href='index.html';" style="background-color: #2196f3;">Back</button> <br>
52+
<script>
53+
function getQueryVariable(variable)
54+
{
55+
var query = window.location.search.substring(1)
56+
var vars = query.split("&")
57+
for (var i=0;i<vars.length;i++) {
58+
var pair = vars[i].split("=")
59+
if(pair[0] == variable) {return pair[1]}
60+
}
61+
return(NaN);
62+
}
63+
64+
function setBarValue(name, value) {
65+
innerel = document.getElementById(name)
66+
outerel = document.getElementById("bar-" + name)
67+
outerel.style.width = (value + "%")
68+
innerel.innerHTML = (value + "%")
69+
if (innerel.offsetWidth + 20 > outerel.offsetWidth) {
70+
innerel.style.visibility = "hidden"
71+
}
72+
}
73+
74+
econArray = ["Communist","Socialist","Egalitarian","Centrist","Market","Capitalist","Laissez-Faire"]
75+
diplArray = ["Ultra-Pacifist","Pacifist","Dovish","Balanced","Hawkish","Militarist","Ultra-Militarist"]
76+
govtArray = ["Anarchist","Libertarian","Liberal","Moderate","Statist","Authoritarian","Totalitarian"]
77+
sctyArray = ["Revolutionary","Very Progressive","Progressive","Neutral","Traditional","Very Traditional","Reactionary"]
78+
79+
function setLabel(val,ary) {
80+
if (val > 100) { return "" } else
81+
if (val > 90) { return ary[0] } else
82+
if (val > 75) { return ary[1] } else
83+
if (val > 60) { return ary[2] } else
84+
if (val >= 40) { return ary[3] } else
85+
if (val >= 25) { return ary[4] } else
86+
if (val >= 10) { return ary[5] } else
87+
if (val >= 0) { return ary[6] } else
88+
{return ""}
89+
}
90+
91+
equality = getQueryVariable("e")
92+
peace = getQueryVariable("d")
93+
liberty = getQueryVariable("g")
94+
progress = getQueryVariable("s")
95+
wealth = (100 - equality).toFixed(1)
96+
might = (100 - peace ).toFixed(1)
97+
authority = (100 - liberty ).toFixed(1)
98+
tradition = (100 - progress).toFixed(1)
99+
100+
setBarValue("equality", equality)
101+
setBarValue("wealth", wealth)
102+
setBarValue("peace", peace)
103+
setBarValue("might", might)
104+
setBarValue("liberty", liberty)
105+
setBarValue("authority", authority)
106+
setBarValue("progress", progress)
107+
setBarValue("tradition", tradition)
108+
109+
document.getElementById("economic-label").innerHTML = setLabel(equality, econArray)
110+
document.getElementById("diplomatic-label").innerHTML = setLabel(peace, diplArray)
111+
document.getElementById("state-label").innerHTML = setLabel(liberty, govtArray)
112+
document.getElementById("society-label").innerHTML = setLabel(progress, sctyArray)
113+
114+
ideology = ""
115+
ideodist = 30000
116+
for (var i = 0; i < ideologies.length; i++) {
117+
dist = 0
118+
dist += Math.pow(ideologies[i].stats.econ - equality, 2)
119+
dist += Math.pow(ideologies[i].stats.govt - liberty, 2)
120+
dist += Math.pow(ideologies[i].stats.dipl - peace, 2)/3
121+
dist += Math.pow(ideologies[i].stats.scty - progress, 2)/2
122+
if (dist < ideodist) {
123+
ideology = ideologies[i].name
124+
ideodist = dist
125+
}
126+
}
127+
document.getElementById("ideology-label").innerHTML = ideology
128+
</script>
129+
</body>

0 commit comments

Comments
 (0)