-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters