diff --git a/JavaScript Files/Disable one side of a side by side question.js b/JavaScript Files/Disable one side of a side by side question.js new file mode 100644 index 0000000..c6208d0 --- /dev/null +++ b/JavaScript Files/Disable one side of a side by side question.js @@ -0,0 +1,26 @@ +Qualtrics.SurveyEngine.addOnReady(function () { + choices = document.querySelectorAll(".Choice"); + + this.questionclick = function (event, el) { + c_el = el.id.split("#")[1].split("~"); + if (c_el[0] == 1) { + if (c_el[2] == 2) { + d_el = choices[c_el[1] - 1].querySelectorAll(".SBS2"); + for (i = 0; i < d_el.length; i++) { + d_el[i].children[0].disable(); + d_el[i].children[1].style.background = "lightgrey"; + d_el[i].children[1].style.borderColor = "lightgrey"; + d_el[i].children[1].style.opacity = "25%"; + } + } else if (c_el[2] == 1) { + d_el = choices[c_el[1] - 1].querySelectorAll(".SBS2"); + for (i = 0; i < d_el.length; i++) { + d_el[i].children[0].enable(); + d_el[i].children[1].style.background = ""; + d_el[i].children[1].style.borderColor = ""; + d_el[i].children[1].style.opacity = ""; + } + } + } + }; +}); diff --git a/JavaScript Files/Response Times for Images.js b/JavaScript Files/Response Times for Images.js new file mode 100644 index 0000000..588b61d --- /dev/null +++ b/JavaScript Files/Response Times for Images.js @@ -0,0 +1,68 @@ +if (document.getElementById("EndOfSurvey")) { // In case you show a response summary at the end. + throw 'Survey has ended!' +} +all_q = []; +st_time = 0; +ques_seq = []; // This will keep track of the question sequence in case of randomization. You will find this as the embedded data +res_time = []; // This will the final response time variable. You will find this as the embedded data +q_tracker = 1; // Keep a track of which question has been displayed + +// Getting the questions from page. +document.querySelector("#Questions").childElements().forEach((item) => { + if (!item.id.includes("Separator")) { + all_q.push(item); + ques_seq.push(item.id); + item.hide(); + item.style.textAlign = "center"; + } + }); + +// This is to hide all buttons. +for (i = 1; i < all_q.length; i++) { + all_q[i].querySelectorAll("label").forEach((item) => item.hide()); +} + +// Show the first question. Descriptive Text +all_q[0].show(); + +// Detect if the spacebar is being pressed +Event.observe(document, "keydown", init_questions); + +function init_questions(e) { + if (e.keyCode == 32) { // Spacebar was pressed + + // Change the Text to only show answer commands + all_q[0].innerHTML = + '