-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathresults.html
More file actions
222 lines (184 loc) · 9.32 KB
/
results.html
File metadata and controls
222 lines (184 loc) · 9.32 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
210
211
212
213
214
215
216
217
218
219
220
221
222
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-99715444-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-99715444-5');
</script>
<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>AltValues 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 type="application/javascript" src="ideologies.js"></script>
<script type="application/javascript" src="results_dat.js"></script>
</head>
<body>
<h1>AltValues</h1>
<hr>
<h1>Results</h1>
<!-- HACK TO GET IMAGES PROPERLY WORK ON CANVAS -->
<img id="img-individual" src="value_images/individual.svg" height="200%" style="display: none;"/>
<img id="img-market" src="value_images/market.svg" height="128pt" style="display: none;"/>
<img id="img-essentialist" src="value_images/essentialist.svg" height="128pt" style="display: none;"/>
<img id="img-pragmatic" src="value_images/pragmatic.svg" height="128pt" style="display: none;"/>
<img id="img-universal" src="value_images/universal.svg" height="128pt" style="display: none;"/>
<img id="img-ecological" src="value_images/ecological.svg" height="128pt" style="display: none;"/>
<img id="img-politicized" src="value_images/politicized.svg" height="128pt" style="display: none;"/>
<img id="img-religious" src="value_images/religious.svg" height="128pt" style="display: none;"/>
<img id="img-futurist" src="value_images/futurist.svg" height="128pt" style="display: none;"/>
<img id="img-collective" src="value_images/collective.svg" height="128pt" style="display: none;"/>
<img id="img-planned" src="value_images/planned.svg" height="128pt" style="display: none;"/>
<img id="img-constructivist" src="value_images/constructivist.svg" height="128pt" style="display: none;"/>
<img id="img-idealist" src="value_images/idealist.svg" height="128pt" style="display: none;"/>
<img id="img-particular" src="value_images/particular.svg" height="128pt" style="display: none;"/>
<img id="img-industrial" src="value_images/industrial.svg" height="128pt" style="display: none;"/>
<img id="img-apolitical" src="value_images/apolitical.svg" height="128pt" style="display: none;"/>
<img id="img-secular" src="value_images/secular.svg" height="128pt" style="display: none;"/>
<img id="img-historic" src="value_images/historic.svg" height="128pt" style="display: none;"/>
<p>Disclaimer: Proper data collection features were added with v1.0.0 and ideological assumptions can't be made before there's enough data.</p>
<h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
<h3>Description: <span class="weight-300" id="ideodesc-label"></span></h3>
<!--<h3>Theory: <span class="weight-300" id="theory-label"></span></h3>-->
<canvas id="banner" width=800 height=1250 style="font-family:Montserrat"></canvas>
<button class="button" onclick="location.href='index.html';" style="background-color: #2196f3;">Back</button> <br>
<hr/>
<p style="text-align: center">You can contact me via <a href="mailto:censusbot3@gmail.com">censusbot3@gmail.com</a>, <a href="https://discord.gg/vwqk2UZ">Discord</a> or <a href="https://twitter.com/sunkdatadiver">Twitter</a>.</p>
<!-- JavaScript for the test itself -->
<script>
version = "ver 1.0.0"
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 + 15 > outerel.offsetWidth) {
innerel.style.visibility = "hidden"
}
}
function setLabel(val,ary) {
return ary[Math.min(parseInt(val/100*ary.length), ary.length-1)]
}
// GET VALUES
individual = getQueryVariable("social")
market = getQueryVariable("econ")
essentialist = getQueryVariable("essence")
pragmatic = getQueryVariable("moral")
universal = getQueryVariable("apply")
ecological = getQueryVariable("ecol")
politicized = getQueryVariable("socpol")
religious = getQueryVariable("relig")
futurist = getQueryVariable("aesth")
collective = (100 - individual ).toFixed(1)
planned = (100 - market ).toFixed(1)
constructivist = (100 - essentialist ).toFixed(1)
idealist = (100 - pragmatic ).toFixed(1)
particular = (100 - universal ).toFixed(1)
industrial = (100 - ecological ).toFixed(1)
apolitical = (100 - politicized ).toFixed(1)
secular = (100 - religious ).toFixed(1)
historic = (100 - futurist ).toFixed(1)
ideology = ""
ideodesc = ""
theory = ""
ideodist = Infinity
for (var i = 0; i < ideologies.length; i++) {
dist = 0
dist += Math.pow(Math.abs(ideologies[i].stats.social - individual), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.econ - market), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.essence - essentialist), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.moral - pragmatic), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.apply - universal), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.ecol - ecological), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.socpol - politicized), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.relig - religious), 2)
dist += Math.pow(Math.abs(ideologies[i].stats.aesth - futurist), 2)
if (dist < ideodist) {
ideology = ideologies[i].name
ideodesc = ideologies[i].desc
theory = ideologies[i].theory
ideodist = dist
}
}
document.getElementById("ideology-label").innerHTML = ideology
document.getElementById("ideodesc-label").innerHTML = ideodesc
//document.getElementById("theory-label").innerHTML = theory
window.onload = function() {
var c = document.getElementById("banner")
var ctx = c.getContext("2d")
ctx.fillStyle = "#EEEEEE"
ctx.fillRect(0,0,800,1250)
//LOGOS ON THE IMAGE
var starting_height = 170;
for(let i = 0; i < values.left.length; i++){
img = document.getElementById("img-"+values.left[i]);
ctx.drawImage(img, 20, starting_height, 100, 100);
starting_height += 120
};
var starting_height = 170;
for(let i = 0; i < values.right.length; i++){
img = document.getElementById("img-"+values.right[i]);
ctx.drawImage(img, 680, starting_height, 100, 100);
starting_height += 120
};
ctx.fillStyle="#222222"
var starting_height = 180;
for(let i = 0; i < values.left.length; i++){
ctx.fillRect(120, starting_height, 560, 80)
starting_height += 120
}
//color fill
var starting_height = 184;
for(let i = 0; i < values.left.length; i++){
ctx.fillStyle=valueColors[values.left[i]]
ctx.fillRect(120, starting_height, 5.6*eval(values.left[i])-2, 72)
starting_height += 120
}
var starting_height = 184;
for(let i = 0; i < values.right.length; i++){
ctx.fillStyle=valueColors[values.right[i]]
ctx.fillRect(682-5.6*eval(values.right[i]), starting_height, 5.6*eval(values.right[i])-2, 72)
starting_height += 120
}
ctx.fillStyle="#222222"
ctx.font="700 80px Montserrat"
ctx.textAlign="left"
ctx.fillText("AltValues", 20, 90)
ctx.font="50px Montserrat"
ctx.fillText(ideology, 20, 140)
var starting_height = 237.5;
ctx.textAlign="left"
for(let i = 0; i < values.left.length; i++){
if (eval(values.left[i]) > 27) {ctx.fillText(eval(values.left[i]) + "%", 130, starting_height)}
starting_height += 120
}
var starting_height = 237.5;
ctx.textAlign="right"
for(let i = 0; i < values.right.length; i++){
if (eval(values.right[i]) > 27) {ctx.fillText(eval(values.right[i]) + "%", 670, starting_height)}
starting_height += 120
}
ctx.font="300 30px Montserrat"
ctx.fillText("altvalues.github.io", 780, 60)
ctx.fillText(version, 780, 90)
ctx.textAlign="center"
var starting_height = 175;
for(let i = 0; i < values.left.length; i++){
ctx.fillText(axisNames[labels[i]]+": " + setLabel(eval(values.left[i]), axisArrays[labels[i]]), 400, starting_height)
starting_height += 120
}
}
</script>
</body>