diff --git a/static/MAIN.js b/static/MAIN.js index 927fc52..3d8d3ea 100644 --- a/static/MAIN.js +++ b/static/MAIN.js @@ -344,6 +344,7 @@ function animate() { init_textes_contexte() premier_tour_page_contexte = false } + init_clavier_contexte() traitement_contexte() } //////////////////////////////////////////////////////////////////////////////// diff --git a/static/fonctions_avertissement.js b/static/fonctions_avertissement.js index 00ec7a1..025d3c1 100644 --- a/static/fonctions_avertissement.js +++ b/static/fonctions_avertissement.js @@ -120,6 +120,7 @@ function traitement_avertissements(){ if (clicked && click_inside(xyMouseDown, x_bouton_commencer, y_bouton_commencer , w_bouton_commencer, h_bouton_commencer)){ // on passe aux texte suivant action_bouton_commencer_avertissement() + clicked = false } } @@ -137,7 +138,6 @@ function traitement_avertissements(){ } - //////////////////////////////////////////////////////////////////// ///// Textes diff --git a/static/fonctions_clavier.js b/static/fonctions_clavier.js index 62e46b1..609057d 100644 --- a/static/fonctions_clavier.js +++ b/static/fonctions_clavier.js @@ -20,11 +20,6 @@ function action_clavier_avertissement(event){ function action_clavier_contexte(event){ switch (event.key){ - // selectionner pose - // case ' ' : - // action_bouton_commencer_contexte('clavier') - // break; - // valider case 'Enter': if (num_texte < ((textes_page_1.length + textes_page_2.length + textes_page_3.length +textes_page_4.length))-2){ action_bouton_suivant_contexte()} @@ -33,6 +28,9 @@ function action_clavier_contexte(event){ } break; case 'Backspace': + if (num_texte==0){ + action_revenir_page_avant_contexte() + } if (num_texte>0){ action_bouton_avant_contexte()} break; diff --git a/static/fonctions_contexte.js b/static/fonctions_contexte.js index 11842fb..718464a 100644 --- a/static/fonctions_contexte.js +++ b/static/fonctions_contexte.js @@ -54,7 +54,7 @@ function action_bouton_suivant_contexte(){ } function action_bouton_avant_contexte(){ - if (num_texte>0){ + if (num_texte>=0){ if (num_texte == textes_page_1.length){ texte_a_afficher = JSON.parse(JSON.stringify(textes_page_1))} else if (num_texte == (textes_page_1.length + textes_page_2.length)){ @@ -126,6 +126,7 @@ function traitement_contexte(){ if (clicked && click_inside(xyMouseDown, x_bouton_suivant, y_bouton_suivant , w_bouton_suivant, h_bouton_suivant)){ // on passe aux texte suivant action_bouton_suivant_contexte() + } } else { // affichage bouton next @@ -138,13 +139,17 @@ function traitement_contexte(){ } //affichage bouton previous dès le deuxièeme texte - if(num_texte > 0){ + if(num_texte >= 0){ // affichage bouton next afficher_bouton_avant_contexte() //si on clique sur previous if (clicked && click_inside(xyMouseDown, x_bouton_avant, y_bouton_avant , w_bouton_avant, h_bouton_avant)){ + if(num_texte == 0){ + action_revenir_page_avant_contexte() + + } // on passe aux texte suivant - action_bouton_avant_contexte() + else {action_bouton_avant_contexte()} } } // affichage image @@ -166,7 +171,15 @@ function traitement_contexte(){ } - +function action_revenir_page_avant_contexte(){ + page_contexte = false + page_avertissement = true + init_textes_avertissements() + avertissements_a_afficher = [avertissements["texte0"], avertissements["texte1"], avertissements["texte2"]] + num_avertissement = avertissements_a_afficher.length-1 + init_clavier_avertissement() + document.removeEventListener("keydown", action_clavier_contexte) +} //////////////////////////////////////////////////////////////////// ///// Textes