update prolific que prolific id

This commit is contained in:
mpelissi 2023-04-26 15:03:10 +02:00
parent 4d430df15b
commit f02925f808
2 changed files with 93 additions and 79 deletions

View File

@ -22,13 +22,18 @@ function affichage_inscription(){
ctx.strokeStyle = "rgb(255, 255, 255)" ctx.strokeStyle = "rgb(255, 255, 255)"
ctx.fillStyle = "rgb(255, 255, 255)" ctx.fillStyle = "rgb(255, 255, 255)"
ctx.font = taille_texte_inscription+"pt Courier" ctx.font = taille_texte_inscription+"pt Courier"
//ctx.fillText("Firstname:", x_texte_zone, parseInt(document.getElementById("Firstname").style.top) -12) //ctx.fillText("Firstname:", x_texte_zone, parseInt(document.getElementById("Firstname").style.top) -12)
ctx.fillText("Please enter your Prolific ID:", x_texte_zone, parseInt(document.getElementById("Pseudo").style.top) - 12) //Prolificctx.fillText("Pseudo:", x_texte_zone, parseInt(document.getElementById("Pseudo").style.top) - 12)
ctx.fillText("Age:", x_texte_zone, parseInt(document.getElementById("Age").style.top) - 12) //Prolific ctx.fillText("Age:", x_texte_zone, parseInt(document.getElementById("Age").style.top) - 12)
ctx.fillText("Gender:", parseInt(document.getElementById("SexeM").style.left), parseInt(document.getElementById("SexeM").style.top) - 22) //Prolific ctx.fillText("Gender:", parseInt(document.getElementById("SexeM").style.left), parseInt(document.getElementById("SexeM").style.top) - 22)
ctx.fillText("Male", parseInt(document.getElementById("SexeM").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+24) //Prolific ctx.fillText("Male", parseInt(document.getElementById("SexeM").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+24)
ctx.fillText("Female", parseInt(document.getElementById("SexeF").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+24) //Prolific ctx.fillText("Female", parseInt(document.getElementById("SexeF").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+24)
ctx.fillText("None of these above", parseInt(document.getElementById("SexeA").style.left)+40, parseInt(document.getElementById("SexeA").style.top)+24) //Prolific ctx.fillText("None of these above", parseInt(document.getElementById("SexeA").style.left)+40, parseInt(document.getElementById("SexeA").style.top)+24)
//Prolific
ctx.fillText("Please enter your Prolific ID:", x_texte_zone, parseInt(document.getElementById("Pseudo").style.top) - 20)
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
@ -128,11 +133,15 @@ function champs_remplis_correctment(){
age_ok = false age_ok = false
sexe_ok = false sexe_ok = false
//if ((document.getElementById("Firstname").value.length >0) && (value_non_vide(document.getElementById("Firstname").value))){firstname_ok = true} //if ((document.getElementById("Firstname").value.length >0) && (value_non_vide(document.getElementById("Firstname").value))){firstname_ok = true}
if (document.getElementById("Pseudo").value.length >0 && (value_non_vide(document.getElementById("Pseudo").value))){name_ok = true} //Prolific if (document.getElementById("Pseudo").value.length > 10 && (value_non_vide(document.getElementById("Pseudo").value))){name_ok = true} //Prolific on a mis 24 au lieu de 0
if ((document.getElementById("Age").value >0) && (document.getElementById("Age").value.length >0) && (value_non_vide(document.getElementById("Age").value))){age_ok = true} //Prolific if ((document.getElementById("Age").value >0) && (document.getElementById("Age").value.length >0) && (value_non_vide(document.getElementById("Age").value))){age_ok = true}
if (document.getElementById("SexeM").checked || document.getElementById("SexeF").checked || document.getElementById("SexeA").checked){ sexe_ok= true} //Prolific if (document.getElementById("SexeM").checked || document.getElementById("SexeF").checked || document.getElementById("SexeA").checked){ sexe_ok= true}
//return firstname_ok && name_ok && age_ok && sexe_ok //return firstname_ok && name_ok && age_ok && sexe_ok
return name_ok && age_ok && sexe_ok //Prolific return name_ok && age_ok && sexe_ok
//Prolific
if (document.getElementById("Pseudo").value.length == 24 && (value_non_vide(document.getElementById("Pseudo").value))){name_ok = true} //Prolific on a mis 24 au lieu de 0
return name_ok
} }
function value_non_vide(V){ function value_non_vide(V){
@ -145,12 +154,12 @@ function value_non_vide(V){
function afficher_champs_inscription() { function afficher_champs_inscription() {
inscription_finie = false inscription_finie = false
w_text_zone = 0.015*window.innerWidth w_text_zone = 0.02*window.innerWidth
h_text_zone = 0.05*window.innerHeight h_text_zone = 0.05*window.innerHeight
nb_caract_min = 1 nb_caract_min = 1
nb_caract_max = 30 nb_caract_max = 30
x_texte_zone = (window.innerWidth/4) x_texte_zone = (window.innerWidth/4)
y_texte_zone = 0.20*window.innerHeight y_texte_zone = 0.40*window.innerHeight
ecart_texte_zone = 0.2*window.innerHeight ecart_texte_zone = 0.2*window.innerHeight
@ -187,85 +196,90 @@ function afficher_champs_inscription() {
document.body.appendChild(input2); document.body.appendChild(input2);
input2.focus(); input2.focus();
// Zone de texte : Age //Prolific
var input3 = document.createElement('input'); // // Zone de texte : Age
input3.type = 'number'; // var input3 = document.createElement('input');
input3.id = 'Age'; // input3.type = 'number';
input3.min = 1 // input3.id = 'Age';
input3.max = 99 // input3.min = 1
input3.size = 10 // input3.max = 99
// style // input3.size = 10
input3.style.position = 'fixed'; // // style
input3.style.left = x_texte_zone+'px'; // input3.style.position = 'fixed';
input3.style.top = ecart_texte_zone+y_texte_zone+'px';//2*ecart_texte_zone + y_texte_zone+'px'; // input3.style.left = x_texte_zone+'px';
input3.style.textAlign = 'left' // input3.style.top = ecart_texte_zone+y_texte_zone+'px';//2*ecart_texte_zone + y_texte_zone+'px';
input3.style.height = h_text_zone // input3.style.textAlign = 'left'
input3.style.font = taille_texte_inscription+"pt Courier" // input3.style.height = h_text_zone
document.body.appendChild(input3); // input3.style.font = taille_texte_inscription+"pt Courier"
input3.focus(); // document.body.appendChild(input3);
// input3.focus();
// Zone de texte : Sexe //Prolific
var input4 = document.createElement('input'); // // Zone de texte : Sexe
input4.type = 'radio'; // var input4 = document.createElement('input');
input4.id = 'SexeM'; // input4.type = 'radio';
input4.name = "sexe" // input4.id = 'SexeM';
//input4.size = w_text_zone // input4.name = "sexe"
// style // //input4.size = w_text_zone
input4.style.position = 'fixed'; // // style
input4.style.left = x_texte_zone+'px'; // input4.style.position = 'fixed';
input4.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px'; // input4.style.left = x_texte_zone+'px';
input4.style.height = 20 // input4.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px';
input4.style.width = 20 // input4.style.height = 20
document.body.appendChild(input4); // input4.style.width = 20
input4.focus(); // document.body.appendChild(input4);
// input4.focus();
var input5 = document.createElement('input'); //Prolific
input5.type = 'radio'; // var input5 = document.createElement('input');
input5.id = 'SexeF'; // input5.type = 'radio';
input5.name = "sexe" // input5.id = 'SexeF';
//input4.size = w_text_zone // input5.name = "sexe"
// style // //input4.size = w_text_zone
input5.style.position = 'fixed'; // // style
input5.style.left = window.innerWidth*0.1 + x_texte_zone+'px'; // input5.style.position = 'fixed';
input5.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px'; // input5.style.left = window.innerWidth*0.1 + x_texte_zone+'px';
input5.style.height = 20 // input5.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px';
input5.style.width = 20 // input5.style.height = 20
document.body.appendChild(input5); // input5.style.width = 20
input5.focus(); // document.body.appendChild(input5);
// input5.focus();
var input6 = document.createElement('input'); //Prolific
input6.type = 'radio'; // var input6 = document.createElement('input');
input6.id = 'SexeA'; // input6.type = 'radio';
input6.name = "sexe" // input6.id = 'SexeA';
//input4.size = w_text_zone // input6.name = "sexe"
// style // //input4.size = w_text_zone
input6.style.position = 'fixed'; // // style
input6.style.left = window.innerWidth*0.22 + x_texte_zone+'px'; // input6.style.position = 'fixed';
input6.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px'; // input6.style.left = window.innerWidth*0.22 + x_texte_zone+'px';
input6.style.height = 20 // input6.style.top = 2*ecart_texte_zone + y_texte_zone+'px';//3*ecart_texte_zone + y_texte_zone+'px';
input6.style.width = 20 // input6.style.height = 20
document.body.appendChild(input6); // input6.style.width = 20
input6.focus(); // document.body.appendChild(input6);
// input6.focus();
} }
function gestion_donnees_personnelles(){ function gestion_donnees_personnelles(){
// Sauvegarde des infos // Sauvegarde des infos
if (document.getElementById("SexeM").checked){sexe = "M"} //Prolific if (document.getElementById("SexeM").checked){sexe = "M"}
else if (document.getElementById("SexeF").checked){sexe = "F"} //Prolific else if (document.getElementById("SexeF").checked){sexe = "F"}
else if (document.getElementById("SexeM").checked){sexe = "M"} //Prolific else if (document.getElementById("SexeM").checked){sexe = "M"}
else {sexe='None'} //Prolific else {sexe='None'}
choix['identite'] = {//"Firstname":document.getElementById("Firstname").value, choix['identite'] = {//"Firstname":document.getElementById("Firstname").value,
"Pseudo": document.getElementById("Pseudo").value, "Pseudo": document.getElementById("Pseudo").value,
"Age": document.getElementById("Age").value, //Prolific "Age": document.getElementById("Age").value,
"Sexe": sexe} //Prolific "Sexe": sexe
}
//document.getElementById("Firstname").style.display = 'none' //document.getElementById("Firstname").style.display = 'none'
document.getElementById("Pseudo").style.display = 'none' document.getElementById("Pseudo").style.display = 'none'
document.getElementById("Age").style.display = 'none' //Prolific document.getElementById("Age").style.display = 'none'
document.getElementById("SexeM").style.display = 'none' //Prolific document.getElementById("SexeM").style.display = 'none'
document.getElementById("SexeF").style.display = 'none' //Prolific document.getElementById("SexeF").style.display = 'none'
document.getElementById("SexeA").style.display = 'none' //Prolific document.getElementById("SexeA").style.display = 'none'
} }