forked from CenterValues/centervalues.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardquiz.html
197 lines (191 loc) · 8.1 KB
/
hardquiz.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
<head>
<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>CenterValues Hardmode</title>
<link rel="icon" type="x-icon" href="hardicon.png">
<link rel="shortcut icon" type="x-icon" href="hardicon.png">
<meta charset="utf-8">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-6511426299019766",
enable_page_level_ads: true
});
</script>
</head>
<body>
<script type="application/javascript"
src="hardquestions.js">
</script>
<h1>CenterValues困难版</h1>
<hr>
<h2 style="text-align:center;" id="question-number">加载中……</h2>
<p class="question" id="question-text"></p>
<button class="button" onclick="next_question( 1.5)" style="background-color: #182600;">我会走得更远</button> <br>
<button class="button" onclick="next_question( 1.25)" style="background-color: #2b4005;">非常同意</button> <br>
<button class="button" onclick="next_question( 1.0)" style="background-color: #1b5e20;">同意</button> <br>
<button class="button" onclick="next_question( 0.5)" style="background-color: #4caf50;">略微同意</button> <br>
<button class="button" onclick="next_question( 0.25)" style="background-color: #9fb8a0;">中立</button> <br>
<button class="button" onclick="next_question(-0.25)" style="background-color: #c89d99;">不确定</button> <br>
<button class="button" onclick="next_question(-0.5)" style="background-color: #f44336;">略微反对</button> <br>
<button class="button" onclick="next_question(-1.0)" style="background-color: #b71c1c;">反对</button> <br>
<button class="button" onclick="next_question(-1.25)" style="background-color: #57180a;">非常反对</button> <br>
<button class="button" onclick="next_question(-1.5)" style="background-color: #330800;">这句话激怒了我</button> <br>
<button class="small_button" onclick="prev_question()" id="back_button">返回</button>
<button class="small_button_off" id="back_button_off">返回</button><br>
<!-- Website visit statistics - no personal information is collected! -->
<script type="text/javascript">
var sc_project=11325211;
var sc_invisible=1;
var sc_security="fd9f0659";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="web stats"
href="http://statcounter.com/" target="_blank"><img
class="statcounter"
src="//c.statcounter.com/11325211/0/fd9f0659/1/" alt="web
stats"></a></div></noscript>
<!-- JavaScript for the test itself -->
<script>
var max_ther, max_belf, max_polc, max_wing, max_govt, max_diag, max_vore, max_helf, max_smrt; // The vore is for carnivore or herbivore and not what you think
max_ther = max_polc = max_wing = max_govt = max_diag = max_vore = max_helf = max_smrt = 0;
max_belf = 10*questions.length;
var ther, belf, polc, wing, govt, vore, helf, smrt; // User's scores
ther = belf = polc = wing = govt = diag = vore = helf = smrt = 0;
var qn = 0; // Question number
var prev_answer = null;
var prev_polc = null;
init_question();
for (var i = 0; i < questions.length; i++) {
max_ther += Math.abs(questions[i].effect.ther)
max_polc += Math.abs(questions[i].effect.polc)
max_wing += Math.abs(questions[i].effect.wing)
max_govt += Math.abs(questions[i].effect.govt)
max_diag += Math.abs(questions[i].effect.diag)
max_vore += Math.abs(questions[i].effect.vore)
max_helf += Math.abs(questions[i].effect.helf)
max_smrt += Math.abs(questions[i].effect.smrt)
}
function init_question() {
document.getElementById("question-text").innerHTML = questions[qn].question;
document.getElementById("question-number").innerHTML = "第" + (qn + 1) + "题,共" + (questions.length) + "题";
if (prev_answer == null) {
document.getElementById("back_button").style.display = 'none';
document.getElementById("back_button_off").style.display = 'block';
} else {
document.getElementById("back_button").style.display = 'block';
document.getElementById("back_button_off").style.display = 'none';
}
}
function next_question(mult) {
ther += mult*questions[qn].effect.ther
polc += mult*questions[qn].effect.polc
wing += mult*questions[qn].effect.wing
govt += mult*questions[qn].effect.govt
diag += mult*questions[qn].effect.diag
vore += mult*questions[qn].effect.vore
helf += mult*questions[qn].effect.helf
smrt += mult*questions[qn].effect.smrt
if (mult == 1.5 || mult == -1.5) {
belf -= 15;
}
if (mult == 1.25 || mult == -1.25) {
belf -= 10;
}
if (mult == 1 || mult == -1) {
belf += 10;
}
if (mult == 0.5 || mult == -0.5) {
belf += 15;
}
prev_polc = questions[qn].effect.polc;
if ((mult == 0.25 || mult == -0.25) && prev_polc == 0) {
polc -= 10;
}
qn++;
prev_answer = mult;
if (qn < questions.length) {
init_question();
} else {
results();
}
}
function prev_question() {
if (prev_answer == null) {
return;
}
qn--;
ther -= prev_answer * questions[qn].effect.ther;
polc -= prev_answer * questions[qn].effect.polc;
wing -= prev_answer * questions[qn].effect.wing;
govt -= prev_answer * questions[qn].effect.govt;
diag -= prev_answer * questions[qn].effect.diag;
vore -= prev_answer * questions[qn].effect.vore;
helf -= prev_answer * questions[qn].effect.helf;
smrt -= prev_answer * questions[qn].effect.smrt;
if (prev_answer == 1.5 || prev_answer == -1.5) {
belf += 15;
}
if (prev_answer == 1.25 || prev_answer == -1.25) {
belf += 12.5;
}
if (prev_answer == 1 || prev_answer == -1) {
belf -= 12.5;
}
if (prev_answer == 0.5 || prev_answer == -0.5) {
belf -= 15;
}
if ((prev_answer == 0.25 || prev_answer == -0.25) && prev_polc == 0) {
polc += 10;
}
prev_answer = null;
prev_polc = null;
init_question();
}
function calc_cord(){
var cord = 100;
if (100*(max_wing+wing)/(2*max_wing) < 50) {
cord -= 50 - (100*(max_wing+wing)/(2*max_wing));
} else if (100*(max_wing+wing)/(2*max_wing) > 50) {
cord -= 100*(max_wing+wing)/(2*max_wing) - 50;
} else {
cord += 12.5;
}
if (100*(max_govt+govt)/(2*max_govt) < 50) {
cord -= 50 - (100*(max_govt+govt)/(2*max_govt));
} else if (100*(max_govt+govt)/(2*max_govt) > 50) {
cord -= 100*(max_govt+govt)/(2*max_govt) - 50;
} else {
cord += 12.5;
}
if (100*(max_diag+diag)/(2*max_diag) < 50) {
cord -= 50 - (100*(max_diag+diag)/(2*max_diag));
} else if (100*(max_diag+diag)/(2*max_diag) > 50) {
cord -= 100*(max_diag+diag)/(2*max_diag) - 50;
} else {
cord += 12.5;
}
return cord.toFixed(1)
}
function calc_score(score,max) {
return (100*(max+score)/(2*max)).toFixed(1)
}
function results() {
location.href = `hardresults.html`
+ `?a=${calc_score(ther,max_ther)}`
+ `&l=${calc_score(belf,max_belf)}`
+ `&b=${calc_score(polc,max_polc)}`
+ `&m=${calc_cord()}`
+ `&c=${calc_score(wing,max_wing)}`
+ `&d=${calc_score(govt,max_govt)}`
+ `&o=${calc_score(diag,max_diag)}`
+ `&e=${calc_score(vore,max_vore)}`
+ `&f=${calc_score(helf,max_helf)}`
+ `&g=${calc_score(smrt,max_smrt)}`
}
</script>
</body>