-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
316 lines (250 loc) · 8.53 KB
/
index.html
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<html>
<head>
<title>86 Risk Assessment Quiz</title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,maximum-scale=2.0,user-scalable=2">
<link
href="https://theme-machine.querie.cc/theme"
rel="stylesheet""
crossorigin="use-credentials"
>
<style>
body,
html {
background-color: rgb(var(--base00));
color: rgb(var(--base05));
}
input {
background: rgb(var(--base00));
color: rgb(var(--base05));
border-width: 2px;
}
a,
a:visited,
a:hover,
a:active {
color: rgb(var(--base09));
}
input,
textarea,
button {
background-color: rgb(var(--base00));
color: rgb(var(--base05));
border-color: rgba(var(--base02), 0.8);
}
input[type="submit"],
button {
border-color: rgb(var(--base02)) rgb(var(--base01)) rgb(var(--base01))
rgb(var(--base02));
}
hr {
border: none;
border-top: 3px solid rgba(var(--base01), 0.5);
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: rgb(var(--base0D));
}
select {
background-color: rgb(var(--base01));
color: rgb(var(--base05));
border-color: rgb(var(--base03));
}
.logo > a > img {
width: 6em;
height: auto;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
pre,
code {
background-color: rgb(var(--base00));
color: rgb(var(--base05));
outline: 1px solid rgba(var(--base01), 0.5);
}
pre {
padding: 0.5em;
white-space: pre-wrap;
}
ul {
list-style-type: none;
margin: 30px;
padding: 10px;
}
li {
margin:15px 3px;
}
.question {
font-size: 22px;
font-weight: bold;
background-color: lightgray;
border:1px dotted darkgray;
padding: 10px;
margin:20px;
}
.riskBar {
background-color: darkgray;
margin:10px;
width:100%;
position:relative;
height:10px;
}
#riskBarCount{
font-weight: 900;
}
.riskBarWidth {
display: block;
position: absolute;
top: 0;
left: 0;
height: 100%;
text-indent: -9999px;
overflow: hidden;
line-height: 2em;
z-index: 1;
background-color: blue;
}
</style>
</head>
<body>
<h1><em>Official</em> Noisebridge 86 Risk Assessment Quiz</h1>
<span id="riskBarCount"></span>
<div id="riskBar" class="riskBar">
<span id="riskBarWidth" class="riskBarWidth"></span>
</div>
<div id="quizContainer">
</div>
</body>
<script>
//Initialize variables
//This changes the length of the status bar
var riskBarCounter=0;
var questionCounter=0;
var questionObject = [
{
"question": "You see a box of pens at Noisebridge, but after two weeks no one is using them, is it ok to take one home without asking anyone?",
"answers": [
["Yes, but only if you are sure Noisebridge won't use it.",7,"Okay, but you better be sure!"],
["Yes, but only after asking 2 people.",2,"Good way to get confirmation, but how much do you need that pen?"],
["No, those are for Noisebridge Members Only",5,"You show risk of caring too much about the rules."],
],
},
{
"question": "You see a half built project at Noisebridge with a note saying 'Do Not Hack' and it is dated from 1 week ago, is it ok to hack it?",
"answers": [
["No, under no circumstances",2,"Everything is possible."],
["Yes, but only after asking the project owner",0,"It is excellent to improve projects at Noisebridge."],
["Yes, I can do whatever I want",25,"Your risk of getting banned just increased."],
]
},
{
"question": "You are an angel investor who wants to invest in all the Noisebridge Startups, you should...",
"answers": [
["Interupt everyone while they are working to talk about how lucky they would be to have you as an investor.",86,"That is an 86ing"],
["Spread the word quietly and let people come to you.",10,"Hmmmmm. Could find you the next billion dollar company."],
["Donate a large sum of money to Noisebridge anonymously.",-10,"You are excellent."],
]
},
{
"question": "Someone is working quietly and they are making an obvious mistake, you choose to...",
"answers": [
["Interupt them and show them the right way to do it, with lengthy explanations.",26,"Not excellent."],
["Ask them politely if they would like help.",1,"Nice Approach."],
["Wait for them to look up and sigh in frustration, before leading with 'cool project, want help with that?'",7,"Nice, but you might get sucked into a lengthy project that you will regret later."],
]
},
{
"question": "Do you think you are the King of Noisebridge?",
"answers": [
["Yes, and I plan to interupt the Tuesday meeting to let everyone know!",100,"Straight to 86, straight away."],
["No",1,"Nice, but your risk increases for even thinking about it."],
["Yes, but only when no one else is here",9,"Oh, you do huh?"],
]
},
{
"question": "It's 11:30 PM. A stranger rings the doorbell and mutters something about hacking stolen phones. Do you let them in?",
"answers": [
["Of course, Noisebridge is open to everyone.",30,"No. Stand your ground and defend Noisebridge."],
["No. I answer the door and tell them the space is closed.",15,"Nice of you, but could lead to a long conversation you would regret."],
["I ignore the situation.",3,"This is the way."]
]
},
{
"question": "You lose access to a shower and need a place to clean up. Do you:",
"answers": [
["Shower in the upstairs bathroom at Noisebridge.",30,"Dang, our water bill is already $1200"],
["Ask a friend if you can shower at their house.",0,"Please introduce your excellent friend to Noisebridge."],
["Shower at a drop-in center in the neighborhood.",0,"Thanks for your consideration of keeping Noisebridge excellent for all."]
]
},
{
"question": "Did you contribute to this quiz?",
"answers": [
["Yes",30,"Uh-oh"],
["No",1,"Okey Dokey, maybe contribute?"],
]
}
];
//This function creates the quiz
function createNextQuestion(questionCounter)
{
var questionHTML = `<div class="question">${questionObject[questionCounter].question}</div>`;
questionHTML+=`<ul>`;
//This loop creates the answers
for (var i = 0; i < questionObject[questionCounter].answers.length; i++) {
questionHTML+=`
<li><button onClick=
"showScore(${questionObject[questionCounter].answers[i][1]},'${questionObject[questionCounter].answers[i][2]}')">
${questionObject[questionCounter].answers[i][0]}</button>
</li>`;
}
questionHTML+=`</ul>`;
document.getElementById("quizContainer").innerHTML = questionHTML;
}
function showScore(score, message)
{
console.log("showScore",score,message);
riskBarCounter+=score;
document.getElementById("riskBarWidth").style.width = riskBarCounter+"%";
document.getElementById("riskBarCount").innerHTML = `Your Risk: ${riskBarCounter}%`;
questionCounter++;
var response=message;
if (questionCounter==questionObject.length-1)
{
response+=`<br><button onClick="riskAssessment()">View Your Final Risk Assessment</button>`
}
else
{
response+=`<br><button onClick="createNextQuestion(${questionCounter})">Next Question</button>`
}
document.getElementById("quizContainer").innerHTML = response;
}
function riskAssessment() {
if (riskBarCounter>100)
{
var riskMessage=`<h1>Your Final Risk Score is ${riskBarCounter}%</h1>
<h2>You are an 86 Risk</h2>
<h3>Time for some introspection on what it means to be excellent.</h3>
<br><button onClick="createNextQuestion(0)">Try Again</button>`;
}
else if (riskBarCounter<100 && riskBarCounter>50)
{
var riskMessage=`<h1>Your Final Risk Score is ${riskBarCounter}%</h1>
<h2>You have medium risk of getting 86d.</h2>
<h3>Try to contribute to the community a bit more, and re-evaluate some choices.</h3>
<br><button onClick="createNextQuestion(0)">Try The Quiz Again</button>`;
}
else
{
var riskMessage=`<h1>Your Final Risk Score is ${riskBarCounter}%</h1>
<h2>Congratulations! You are at low risk of getting banned from Noisebridge.</h2>
<h3>Spread your knowledge of excellence on to other hackers!</h3>
<br><button onClick="createNextQuestion(0)">Try The Quiz Again</button>`;
}
document.getElementById("quizContainer").innerHTML = riskMessage;
}
createNextQuestion(0);
</script>