47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
// ******
|
|
// Please define your load animation in the configuration variable.
|
|
// Note that each page needs to have a (hidden) button called #end-trial that will
|
|
// be used to close the trial and move on to the user rating task
|
|
// ******
|
|
|
|
//$('#b1').on('click', function() {
|
|
// $('#launch').addClass('display_toggle');
|
|
//
|
|
// if (jsPsych.data.getURLVariable('debug') === 'true') {
|
|
// $('.debug').css({'display': 'block'});
|
|
// }
|
|
//});
|
|
|
|
var reloads = 0;
|
|
|
|
function replayVideo(){
|
|
document.getElementById("vid").load();
|
|
reloads = reloads + 1;
|
|
}
|
|
|
|
document.getElementById("end-trial").style.display = "none"
|
|
document.getElementById("replay").style.display = "none"
|
|
|
|
document.getElementById("timer").innerHTML = picDuration;
|
|
|
|
var distance = picDuration - 1;
|
|
|
|
var x = setInterval(function() {
|
|
|
|
// Time calculations for days, hours, minutes and seconds
|
|
var seconds = distance;
|
|
distance--;
|
|
|
|
// If the count down is finished, write some text
|
|
if (seconds <= 0) {
|
|
document.getElementById("timer").innerHTML = "";
|
|
document.getElementById("end-trial").style.display = ""
|
|
document.getElementById("replay").style.display = ""
|
|
clearInterval(x);
|
|
} else {
|
|
// Display the result in the element with id="demo"
|
|
document.getElementById("timer").innerHTML = seconds;
|
|
}
|
|
}, 1000);
|
|
|