Skip to content

Commit

Permalink
added a few functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tafakkur committed Jan 7, 2021
1 parent c4e5f96 commit f5a6dc7
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
2 changes: 1 addition & 1 deletion JavaScript Files/Visibility Change.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Qualtrics.SurveyEngine.addOnload(function () {
});

document.addEventListener("fullscreenchange", function () {
if (document.fullscreenElement !== null) {
if (document.fullscreenElement != null) {
full_screen = setInterval(() => {
time_fs++;
}, 100);
Expand Down
36 changes: 36 additions & 0 deletions JavaScript Files/all three.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Qualtrics.SurveyEngine.addOnload(function(){
this.hideNextButton();
Qualtrics.SurveyEngine.setEmbeddedData("First", "Empathy");

var vidlen = 120;
var maxlen = vidlen*4;
time_off = 0;
var that = this;

document.addEventListener("fullscreenchange", function () {
if (document.fullscreenElement != null) {
Qualtrics.SurveyEngine.setEmbeddedData("full_screen", "TRUE");
}
});

document.addEventListener("visibilitychange", function () {
if (document.visibilityState != "visible") {
Qualtrics.SurveyEngine.setEmbeddedData("tab_changed", "TRUE");
off_screen = setInterval(() => {
time_off++;
Qualtrics.SurveyEngine.setEmbeddedData("time_off", time_off);
}, 100);
}else{
clearInterval(off_screen);
}
});

(function(){that.showNextButton();}).delay(vidlen);
(function(){
Qualtrics.SurveyEngine.setEmbeddedData("too_much_time", "TRUE");
that.clickNextButton();
}).delay(maxlen);



});
43 changes: 43 additions & 0 deletions functions/Randomize by blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Qualtrics.SurveyEngine.addOnReady(function () {
x = document.querySelectorAll(".QuestionOuter");
vids = [];
for (i = 0; i < x.length; i++) {
vids.push(x[i].classList[3]);
}

// Sort them and split them into blocks
vids = vids.sort();
block_a = vids.slice(0, 5);
block_b = vids.slice(5);

// Generate three unequal random numbers for Block A
ra1 = Math.floor(Math.random() * 5);
do {
ra2 = Math.floor(Math.random() * 5);
} while (ra2 == ra1);
do {
ra3 = Math.floor(Math.random() * 5);
} while (ra3 == ra1 || ra3 == ra2);

hide_a = [ra1, ra2, ra3];

// Generate three unequal random numbers for Block B
rb1 = Math.floor(Math.random() * 5);
do {
rb2 = Math.floor(Math.random() * 5);
} while (rb2 == rb1);
do {
rb3 = Math.floor(Math.random() * 5);
} while (rb3 == rb1 || rb3 == rb2);

hide_b = [rb1, rb2, rb3];

// Hide the selected questions
hide_a.forEach((item) => {
document.querySelector("#"+block_a[item]).hide();
});

hide_b.forEach((item) => {
document.querySelector("#"+block_b[item]).hide();
});
});
4 changes: 2 additions & 2 deletions personal_qualtrics_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/*Change next and previous button colors ("static" and on mouseover/focus*/
.Skin #Buttons #NextButton,
.Skin #Buttons #PreviousButton {
background-color: #002554;
background-color: #271c88;
}
.Skin #Buttons #NextButton:hover,
.Skin #Buttons #NextButton:focus,
Expand Down Expand Up @@ -140,7 +140,7 @@ body,

@media (min-width: 770px){
.Skin .SkinInner {
background-color: #0c3452;
background-color: #71b6eb;
width: 900px;
max-width: 95%;
}
Expand Down

0 comments on commit f5a6dc7

Please sign in to comment.