Add progress tracker and further questions

This commit is contained in:
Mattia Mascarello 2024-04-23 11:29:03 +02:00
parent 92e333611d
commit 49c7fbe86d
4 changed files with 71 additions and 5 deletions

View File

@ -56,10 +56,17 @@ body {
margin-top: 10vh;
}
#counter {
#scoreDisplay {
font-size: 25px;
}
#progress {
font-size: 25px;
position: absolute;
top: 6px;
right: 10px;
}
.floatleft {
position: absolute;
left: 2%;

View File

@ -207,4 +207,60 @@ questions:
- text: Yes!
effect: -1000
- text: "Wait a minute..."
effect: -2000
effect: -2000
- title: What is your opinion on China's Belt and Road Initiative?
answers:
- text: It's a great opportunity for global development
effect: 3000
- text: It's a form of debt-trap diplomacy
effect: -2000
- text: I'm not sure
effect: 1000
- title: How do you feel about China's military expansion in the South China Sea?
answers:
- text: It's necessary for national security
effect: 2000
- text: It's aggressive and destabilizing
effect: -3000
- text: I have no opinion
effect: 500
- title: Thoughts on China's social credit system?
answers:
- text: It's a great way to maintain social order
effect: 2000
- text: It's a violation of personal freedoms
effect: -3000
- text: I'm indifferent
effect: 500
- title: Do you believe in the concept of "One Country, Two Systems" for Hong Kong?
answers:
- text: Yes, it's a fair arrangement
effect: -1500
- text: No, Hong Kong should be fully integrated into China
effect: 2000
- text: I'm not familiar with it
effect: 1000
- title: What is your opinion on China's stance on human rights?
answers:
- text: China is improving its human rights record
effect: 2000
- text: China's human rights abuses are concerning
effect: -3000
- text: I don't know enough to comment
effect: 1000
- title: How do you feel about China's relationship with North Korea?
answers:
- text: It's a necessary strategic alliance
effect: 2000
- text: China should distance itself from North Korea
effect: -2500
- text: I'm not familiar with their relationship
effect: 1000
- title: What's your opinion on China's approach to technology and innovation?
answers:
- text: China is leading in technological advancement
effect: 2000
- text: China engages in intellectual property theft
effect: -3000
- text: I have no strong feelings about it
effect: 500

View File

@ -24,7 +24,8 @@
<body>
<div id="main">
<div id="counter"></div>
<div id="scoreDisplay"></div>
<div id="progress"></div>
<div id="question">
<h1 id="questionTitle">Question</h1>
<div class="grid">

View File

@ -38,10 +38,11 @@ $.ajax({
complete: function (r) {
data = jsyaml.load(r.responseText);
total = data["initialScore"];
$("#counter").html("Social credit score: " + total);
$("#scoreDisplay").html("Social credit score: " + total);
for (var i = 0; i < data["questions"].length; i++) {
indexeslist.push(i);
}
$("#progress").html("1 of " + indexeslist.length);
shuffle(indexeslist);
displayQuestion();
}
@ -132,9 +133,10 @@ $(".ans").mouseleave(function () {
// ***8888888************************************8
$(".ans").click(function () {
$("#progress").html(indexesProgress + 1 + " of " + indexeslist.length);
var res = cQuestion["answers"][$(this).attr("data-ans") - 1]["effect"];
total += res;
$("#counter").html("Social credit score: " + total);
$("#scoreDisplay").html("Social credit score: " + total);
var d = Math.random();
if (d < 0.10) {
d = Math.random();