Skip to content

Commit 1afcc69

Browse files
committed
I FIXED IT YES
I had to move the text inside onload()
1 parent 3a1f304 commit 1afcc69

File tree

1 file changed

+56
-54
lines changed

1 file changed

+56
-54
lines changed

results.html

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
4848
<p>Ideological matching is a work in progress, and is much less accurate than the values and axes.</p>
4949
<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 [email protected], or send us any comments, questions, or criticism. </p>
5050
<hr/>
51-
<canvas id="banner" width=800 height=600></canvas>
51+
<canvas id="banner" width=800 height=600 style="font-family:Montserrat"></canvas>
5252
<button class="button" onclick="location.href='index.html';" style="background-color: #2196f3;">Back</button> <br>
5353
<script>
5454
function getQueryVariable(variable)
@@ -134,11 +134,13 @@ <h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
134134
ctx.drawImage(img, x, y, w, h)
135135
}
136136
}
137-
var c = document.getElementById("banner")
138-
var ctx = c.getContext("2d")
139-
ctx.fillStyle = "#EEEEEE"
140-
ctx.fillRect(0,0,800,600)
137+
141138
window.onload = function() {
139+
var c = document.getElementById("banner")
140+
var ctx = c.getContext("2d")
141+
ctx.fillStyle = "#EEEEEE"
142+
ctx.fillRect(0,0,800,600)
143+
142144
img = document.getElementById("img-equality")
143145
ctx.drawImage(img, 20, 120, 100, 100);
144146
img = document.getElementById("img-wealth")
@@ -155,55 +157,55 @@ <h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
155157
ctx.drawImage(img, 20, 480, 100, 100)
156158
img = document.getElementById("img-progress")
157159
ctx.drawImage(img, 680, 480, 100, 100)
158-
}
159160

160-
ctx.fillStyle="#222222"
161-
ctx.fillRect(120, 130, 560, 80)
162-
ctx.fillRect(120, 250, 560, 80)
163-
ctx.fillRect(120, 370, 560, 80)
164-
ctx.fillRect(120, 490, 560, 80)
165-
ctx.fillStyle="#f44336"
166-
ctx.fillRect(120, 134, 5.6*equality-2, 72)
167-
ctx.fillStyle="#00897b"
168-
ctx.fillRect(682-5.6*wealth, 134, 5.6*wealth-2, 72)
169-
ctx.fillStyle="#ff9800"
170-
ctx.fillRect(120, 254, 5.6*might-2, 72)
171-
ctx.fillStyle="#03a9f4"
172-
ctx.fillRect(682-5.6*peace, 254, 5.6*peace-2, 72)
173-
ctx.fillStyle="#ffeb3b"
174-
ctx.fillRect(120, 374, 5.6*liberty-2, 72)
175-
ctx.fillStyle="#3f51b5"
176-
ctx.fillRect(682-5.6*authority, 374, 5.6*authority-2, 72)
177-
ctx.fillStyle="#8bc34a"
178-
ctx.fillRect(120, 494, 5.6*tradition-2, 72)
179-
ctx.fillStyle="#9c27b0"
180-
ctx.fillRect(682-5.6*progress, 494, 5.6*progress-2, 72)
181-
ctx.fillStyle="#222222"
182-
ctx.font="700 80px Montserrat"
183-
ctx.textAlign="left"
184-
ctx.fillText("8values", 20, 90)
185-
ctx.font="normal 40px Montserrat"
186-
ctx.textAlign="right"
187-
ctx.fillText(ideology, 780, 87.5)
188-
189-
ctx.font="normal 50px Montserrat"
190-
ctx.textAlign="left"
191-
if (equality > 30) {ctx.fillText(equality + "%", 130, 187.5)}
192-
if (might > 30) {ctx.fillText(might + "%", 130, 307.5)}
193-
if (liberty > 30) {ctx.fillText(liberty + "%", 130, 427.5)}
194-
if (tradition > 30) {ctx.fillText(tradition + "%", 130, 547.5)}
195-
ctx.textAlign="right"
196-
if (wealth > 30) {ctx.fillText(wealth + "%", 670, 187.5)}
197-
if (peace > 30) {ctx.fillText(peace + "%", 670, 307.5)}
198-
if (authority > 30) {ctx.fillText(authority + "%", 670, 427.5)}
199-
if (progress > 30) {ctx.fillText(progress + "%", 670, 547.5)}
200-
201-
ctx.font="300 30px Montserrat"
202-
ctx.fillText("8values.github.io", 780, 55)
203-
ctx.textAlign="center"
204-
ctx.fillText("Economic Axis: " + document.getElementById("economic-label").innerHTML, 400, 125)
205-
ctx.fillText("Diplomatic Axis: " + document.getElementById("diplomatic-label").innerHTML, 400, 245)
206-
ctx.fillText("Civil Axis: " + document.getElementById("state-label").innerHTML, 400, 365)
207-
ctx.fillText("Societal Axis: " + document.getElementById("society-label").innerHTML, 400, 485)
161+
ctx.fillStyle="#222222"
162+
ctx.fillRect(120, 130, 560, 80)
163+
ctx.fillRect(120, 250, 560, 80)
164+
ctx.fillRect(120, 370, 560, 80)
165+
ctx.fillRect(120, 490, 560, 80)
166+
ctx.fillStyle="#f44336"
167+
ctx.fillRect(120, 134, 5.6*equality-2, 72)
168+
ctx.fillStyle="#00897b"
169+
ctx.fillRect(682-5.6*wealth, 134, 5.6*wealth-2, 72)
170+
ctx.fillStyle="#ff9800"
171+
ctx.fillRect(120, 254, 5.6*might-2, 72)
172+
ctx.fillStyle="#03a9f4"
173+
ctx.fillRect(682-5.6*peace, 254, 5.6*peace-2, 72)
174+
ctx.fillStyle="#ffeb3b"
175+
ctx.fillRect(120, 374, 5.6*liberty-2, 72)
176+
ctx.fillStyle="#3f51b5"
177+
ctx.fillRect(682-5.6*authority, 374, 5.6*authority-2, 72)
178+
ctx.fillStyle="#8bc34a"
179+
ctx.fillRect(120, 494, 5.6*tradition-2, 72)
180+
ctx.fillStyle="#9c27b0"
181+
ctx.fillRect(682-5.6*progress, 494, 5.6*progress-2, 72)
182+
ctx.fillStyle="#222222"
183+
ctx.font="700 80px Montserrat"
184+
ctx.textAlign="left"
185+
ctx.fillText("8values", 20, 90)
186+
ctx.font="40px Montserrat"
187+
ctx.textAlign="right"
188+
ctx.fillText(ideology, 780, 87.5)
189+
190+
ctx.font="50px Montserrat"
191+
ctx.textAlign="left"
192+
if (equality > 30) {ctx.fillText(equality + "%", 130, 187.5)}
193+
if (might > 30) {ctx.fillText(might + "%", 130, 307.5)}
194+
if (liberty > 30) {ctx.fillText(liberty + "%", 130, 427.5)}
195+
if (tradition > 30) {ctx.fillText(tradition + "%", 130, 547.5)}
196+
ctx.textAlign="right"
197+
if (wealth > 30) {ctx.fillText(wealth + "%", 670, 187.5)}
198+
if (peace > 30) {ctx.fillText(peace + "%", 670, 307.5)}
199+
if (authority > 30) {ctx.fillText(authority + "%", 670, 427.5)}
200+
if (progress > 30) {ctx.fillText(progress + "%", 670, 547.5)}
201+
202+
ctx.font="300 30px Montserrat"
203+
ctx.fillText("8values.github.io", 780, 55)
204+
ctx.textAlign="center"
205+
ctx.fillText("Economic Axis: " + document.getElementById("economic-label").innerHTML, 400, 125)
206+
ctx.fillText("Diplomatic Axis: " + document.getElementById("diplomatic-label").innerHTML, 400, 245)
207+
ctx.fillText("Civil Axis: " + document.getElementById("state-label").innerHTML, 400, 365)
208+
ctx.fillText("Societal Axis: " + document.getElementById("society-label").innerHTML, 400, 485)
209+
}
208210
</script>
209211
</body>

0 commit comments

Comments
 (0)