From 49c7fbe86d942c92a2024bc084c15e85d7085e0d Mon Sep 17 00:00:00 2001 From: Mattia Mascarello Date: Tue, 23 Apr 2024 11:29:03 +0200 Subject: [PATCH] Add progress tracker and further questions --- css/style.css | 9 +++++++- data.yaml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++- index.html | 3 ++- js/main.js | 6 ++++-- 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/css/style.css b/css/style.css index 61cadea..680b516 100644 --- a/css/style.css +++ b/css/style.css @@ -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%; diff --git a/data.yaml b/data.yaml index 17bfd76..3e35a9f 100644 --- a/data.yaml +++ b/data.yaml @@ -207,4 +207,60 @@ questions: - text: Yes! effect: -1000 - text: "Wait a minute..." - effect: -2000 \ No newline at end of file + 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 \ No newline at end of file diff --git a/index.html b/index.html index 897c69c..ce157bf 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,8 @@
-
+
+

Question

diff --git a/js/main.js b/js/main.js index 8cd0b16..7a4432f 100644 --- a/js/main.js +++ b/js/main.js @@ -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();