Skip to content

Commit 5983c45

Browse files
committed
Added canvas element to allow you to copy images
1 parent 81d07b6 commit 5983c45

File tree

4 files changed

+756
-694
lines changed

4 files changed

+756
-694
lines changed

ideologies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ ideologies = [
234234
}
235235
},
236236
{
237-
"name": "Centrist/Moderate",
237+
"name": "Centrist",
238238
"stats": {
239239
"econ": 50,
240240
"dipl": 50,

results.html

Lines changed: 91 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,37 @@ <h1>Results</h1>
1818

1919
<h2>Economic Axis: <span class="weight-300" id="economic-label"></span></h2>
2020
<div class="axis">
21-
<img src="value_images/equality.svg" height="128pt"/>
21+
<img id="img-equality" src="value_images/equality.svg" height="128pt"/>
2222
<div class="bar equality" id="bar-equality"><div class="text-wrapper" id="equality"></div></div>
2323
<div class="bar wealth" id="bar-wealth"><div class="text-wrapper" id="wealth"></div></div>
24-
<img src="value_images/wealth.svg" height="128pt"/>
24+
<img id="img-wealth" src="value_images/wealth.svg" height="128pt"/>
2525
</div>
2626
<h2>Diplomatic Axis: <span class="weight-300" id="diplomatic-label"></span></h2>
2727
<div class="axis">
28-
<img src="value_images/might.svg" height="128pt"/>
28+
<img id="img-might" src="value_images/might.svg" height="128pt"/>
2929
<div class="bar might" id="bar-might"><div class="text-wrapper" id="might"></div></div>
3030
<div class="bar peace" id="bar-peace"><div class="text-wrapper" id="peace"></div></div>
31-
<img src="value_images/peace.svg" height="128pt"/>
31+
<img id="img-peace" src="value_images/peace.svg" height="128pt"/>
3232
</div>
33-
<h2>State Axis: <span class="weight-300" id="state-label"></span></h2>
33+
<h2>Civil Axis: <span class="weight-300" id="state-label"></span></h2>
3434
<div class="axis">
35-
<img src="value_images/liberty.svg" height="128pt"/>
35+
<img id="img-liberty" src="value_images/liberty.svg" height="128pt"/>
3636
<div class="bar liberty" id="bar-liberty"><div class="text-wrapper" id="liberty"></div></div>
3737
<div class="bar authority" id="bar-authority"><div class="text-wrapper" id="authority"></div></div>
38-
<img src="value_images/authority.svg" height="128pt"/>
38+
<img id="img-authority" src="value_images/authority.svg" height="128pt"/>
3939
</div>
40-
<h2>Society Axis: <span class="weight-300" id="society-label"></span></h2>
40+
<h2>Societal Axis: <span class="weight-300" id="society-label"></span></h2>
4141
<div class="axis">
42-
<img src="value_images/tradition.svg" height="128pt"/>
42+
<img id="img-tradition" src="value_images/tradition.svg" height="128pt"/>
4343
<div class="bar tradition" id="bar-tradition"><div class="text-wrapper" id="tradition"></div></div>
4444
<div class="bar progress" id="bar-progress"><div class="text-wrapper" id="progress"></div></div>
45-
<img src="value_images/progress.svg" height="128pt"/>
45+
<img id="img-progress" src="value_images/progress.svg" height="128pt"/>
4646
</div>
4747
<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>
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>
49+
<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>
5152
<button class="button" onclick="location.href='index.html';" style="background-color: #2196f3;">Back</button> <br>
5253
<script>
5354
function getQueryVariable(variable)
@@ -125,5 +126,84 @@ <h2>Closest Match: <span class="weight-300" id="ideology-label"></span></h2>
125126
}
126127
}
127128
document.getElementById("ideology-label").innerHTML = ideology
129+
130+
function createImage(src, x, y, w, h) {
131+
img = new Image ()
132+
img.src = src
133+
img.onLoad = function() {
134+
ctx.drawImage(img, x, y, w, h)
135+
}
136+
}
137+
var c = document.getElementById("banner")
138+
var ctx = c.getContext("2d")
139+
ctx.fillStyle = "#EEEEEE"
140+
ctx.fillRect(0,0,800,600)
141+
window.onload = function() {
142+
img = document.getElementById("img-equality")
143+
ctx.drawImage(img, 20, 120, 100, 100);
144+
img = document.getElementById("img-wealth")
145+
ctx.drawImage(img, 680, 120, 100, 100)
146+
img = document.getElementById("img-might")
147+
ctx.drawImage(img, 20, 240, 100, 100)
148+
img = document.getElementById("img-peace")
149+
ctx.drawImage(img, 680, 240, 100, 100)
150+
img = document.getElementById("img-liberty")
151+
ctx.drawImage(img, 20, 360, 100, 100)
152+
img = document.getElementById("img-authority")
153+
ctx.drawImage(img, 680, 360, 100, 100)
154+
img = document.getElementById("img-tradition")
155+
ctx.drawImage(img, 20, 480, 100, 100)
156+
img = document.getElementById("img-progress")
157+
ctx.drawImage(img, 680, 480, 100, 100)
158+
}
159+
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="bold 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, 90)
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="200 30px Montserrat";
202+
ctx.fillText("8values.github.io", 780, 50)
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)
128208
</script>
129209
</body>

style.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ div.bar {
100100
padding: 8pt;
101101
margin-top: 4pt;
102102
margin-bottom: 4pt;
103-
border-width: 2px;
103+
border-width: 4px;
104+
border-right-width: 1px;
105+
border-top-style: solid;
106+
border-bottom-style: solid;
104107
border-color: #222222;
105108
background-color: #eeeeee;
106109
display: block;
@@ -156,3 +159,13 @@ div.tradition {
156159
span.weight-300 {
157160
font-weight: 300;
158161
}
162+
canvas {
163+
border-color: #444444;
164+
border-style: solid;
165+
border-width: 2px;
166+
border-radius: 8pt;
167+
display: block;
168+
margin: 8pt;
169+
margin-left: auto;
170+
margin-right: auto;
171+
}

0 commit comments

Comments
 (0)