Corrected long last page with dynamic reloading

This commit is contained in:
Thomas FORGIONE
2015-10-05 09:50:04 +02:00
parent 837baa6673
commit 5006d1d71d
8 changed files with 140 additions and 20 deletions

View File

@@ -6,8 +6,3 @@ block content
source(src="/static/data/music/thankyou.ogg")
source(src="/static/data/music/thankyou.mp3")
if (vcode !== undefined)
p Your vcode is #{vcode}.
else if (workerId !== undefined)
p You have no vcode because you're bad

View File

@@ -0,0 +1,36 @@
extends ../../../views/base.jade
block content
h1 Thank you for everything !
audio(autoplay)
source(src="/static/data/music/thankyou.ogg")
source(src="/static/data/music/thankyou.mp3")
p We are verifying that the experiment was correctly done...
#vcode
script.
function tryVcode() {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/vcode', true);
xhr.onreadystatechange = function (aEvt) {
if (xhr.readyState == 4) {
if(xhr.status == 200) {
changeHtml(xhr.responseText);
}
}
};
xhr.send(null);
}
function changeHtml(vcode) {
if (vcode === 'not ready') {
setTimeout(tryVcode, 1000);
} else if (vcode === 'no vcode') {
$('#vcode').html('Sorry, the experiment has not been correctly done ! You have no vcode.');
} else {
$('#vcode').html('Your vcode is ' + vcode);
}
}
tryVcode();