// nuemro init de l'analyse num_analyse = 1 idx_tache = 0 // ATTENTION ça commence à 1 h_bouton_analyse = 0.1*window.innerHeight // Variable function init_variable_analyse(){ // liste des checkbox clické pour chaque recap //checkbox_clicked_courant = {} // for (let p=0; p texte non vide if (checkbox_clicked_courant.idx_checkbox.indexOf(keywords.length-1)!=-1){ if(document.getElementById('texte_area').value.length == 0){ return false } } return true } function action_bouton_valider_analyse(){ interactions.push({"time": new Date().getTime(), "type": get_message("bouton_valider_analyse", [num_analyse]) }) // si au moins un mot est coché et qu'il reste des analyse à faire if (condition_valider()){ // sauvegarde des checkbox clikée et les mesh if (checkbox_clicked_courant.idx_checkbox.indexOf(keywords.length-1)!=-1){ texte_toto = lecture_zone_texte() checkbox_clicked['Analyse_N'+(num_analyse)] = {"mesh" : choix["tache_N"+list_idx_tache[idx_tache]].mesh ,"Checkbox" : checkbox_clicked_courant, "Texte_other":texte_toto} } else { checkbox_clicked['Analyse_N'+(num_analyse)] = {"mesh" : choix["tache_N"+list_idx_tache[idx_tache]].mesh ,"Checkbox" : checkbox_clicked_courant} } //RAZ pour la prochaine analyse checkbox_clicked_courant = {idx_checkbox:[], mots:[]} keywords = shuffle(keywords_init).concat(["Other:"]) toto = document.getElementById('texte_area') if (toto!= null){toto.parentElement.removeChild(toto)} // analyse suivant num_analyse = num_analyse + 1 // indice mesh da l'analyse suivante idx_tache = idx_tache + 1 if (num_analyse<=nb_analyse_demande){ interactions.push({"time": new Date().getTime(), "type": get_message("fin_analyse_i", [num_analyse-1]) }) interactions.push({"time": new Date().getTime(), "type": get_message("debut_analyse_i", [num_analyse, choix["tache_N"+list_idx_tache[idx_tache]].mesh,]) })} } } /////////////////////////////////////////////////////////////// ///////////////////// Checkbox function measure_largeur(debut, pos){ if (pos>=0){ l = 0 for (let p = debut; p<=debut+pos; p++){ l = l + ctx.measureText(keywords[p]).width + 0.05*window.innerWidth } return l } else{return 15} } function traitement_empty_checkbox(){ //for(let p=0; p 5){p = (pos%5)-1; x_checkbox = window.innerWidth*1/10 + measure_largeur(6, p-1); y_checkbox = y_checkbox_init + 2*h_checkbox} else{ x_checkbox = window.innerWidth*1/10 + measure_largeur(0, pos-1) y_checkbox = y_checkbox_init } //ctx.drawImage(imgs["check"], x_checkbox-5 , y_checkbox-5, w_checkbox+10, h_checkbox+10) print_text(handle_text(""+(i+1), x_checkbox + 0.2*w_checkbox, y_checkbox + h_checkbox*0.75, taille_texte_explication+"pt Courier", longueur_max_error, '#EF476F')) } } function zone_texte(){ inscription_finie = false h_text_zone = 0.15*window.innerHeight nb_caract_min = 1 nb_caract_max = 250 x_texte_zone = (window.innerWidth/3) y_texte_zone = y_checkbox_init + 2*h_checkbox ecart_texte_zone = 0.2*window.innerHeight // Zone de texte : Name input2 = document.createElement('textarea'); input2.type = 'text'; input2.id = 'texte_area'; input2.maxLength = nb_caract_max input2.cols = 0.02*window.innerWidth // style input2.style.position = 'fixed'; input2.style.left = x_texte_zone+'px'; input2.style.top = y_texte_zone+'px';//ecart_texte_zone+y_texte_zone+'px'; input2.style.textAlign = 'left' input2.style.height = h_text_zone input2.style.display = true input2.style.font = taille_texte_inscription+"pt Courier" document.body.appendChild(input2); //input2.focus(); } function lecture_zone_texte(){ toto = document.getElementById('texte_area') if(toto.value != null){ return toto.value } } /////////////////////////////////////////////////////////////// ///////////////////// MAIN function traitement_analyse(){ if ((num_analyse <= nb_analyse_demande)){ // affiche les textes de la page sauf les ceheckbox affichage_texte() // afficher les checkbox et gerer les click ou declick traitement_empty_checkbox() // affiche les check vert en fonction de ce qu'il y a dans checkbox_clicked_courant for (let p =0; p