Switched from json to yaml

This commit is contained in:
2024-04-23 10:09:39 +02:00
parent 5ee2c88341
commit 404ccd8cc5
4 changed files with 199 additions and 8 deletions

2
js/js-yaml.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -32,15 +32,19 @@ $("#playBegin").click(function () {
$(this).fadeOut();
});
var data = {}, cQuestion = {}, indexeslist = [], indexesProgress = 0, total = 100;
$.getJSON("data.json", function (d) {
data = d;
total = d["initialScore"];
$("#counter").html("Social credit score: " + total);
for (var i = 0; i < d["questions"].length; i++) {
indexeslist.push(i);
$.ajax({
type: 'GET',
url: 'data.yaml',
complete: function (r) {
data = jsyaml.load(r.responseText);
total = data["initialScore"];
$("#counter").html("Social credit score: " + total);
for (var i = 0; i < data["questions"].length; i++) {
indexeslist.push(i);
}
shuffle(indexeslist);
displayQuestion();
}
shuffle(indexeslist);
displayQuestion();
});
function displayQuestion() {
$("html, body").scrollTop(0);