From 7006d4657d9c6f0f8a0f0dda82cb648a92ac3001 Mon Sep 17 00:00:00 2001 From: Blavignac Leonardo Date: Mon, 12 Dec 2022 08:43:56 +0100 Subject: [PATCH 1/2] clavier bangarang --- script.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index d72a463..261cd5e 100644 --- a/script.js +++ b/script.js @@ -8,6 +8,7 @@ let arrWords; readTextFile("words.txt"); aleatoire(); +setMyKeyDownListener(); function change_color_good_letter(coord){ coord = "case".concat(coord) @@ -125,4 +126,20 @@ function aleatoire() { let rand = Math.floor(Math.random() * arrWords.length); reponse = arrWords[rand]; console.log(reponse); -} \ No newline at end of file +} + +function setMyKeyDownListener() { + window.addEventListener("keydown", + function(event){ + console.log(event.key) + if (event.key == "Enter"){ + Enter(); + } + else if (event.key == "Backspace") { + Supprimer(); + } + else if (event.key != "Control" & event.key != "Fn" & event.key != "Alt" & event.key != "Tab" & event.key != "CapsLock"){ + update(event.key); + } + }); +} From 0b820b8e00ee269c873b8e9cdb86376f930c6d78 Mon Sep 17 00:00:00 2001 From: Blavignac Leonardo Date: Mon, 12 Dec 2022 08:57:22 +0100 Subject: [PATCH 2/2] modif lea --- index.html | 201 +++++++++++++++++++++++++++-------------------------- script.js | 29 +++++++- styles.css | 5 +- 3 files changed, 132 insertions(+), 103 deletions(-) diff --git a/index.html b/index.html index 7cd72ae..0571437 100644 --- a/index.html +++ b/index.html @@ -1,111 +1,112 @@ - - - - - Document - - - - - -
WORDLE INSA
+ + + + + WORDLE MAIS L'INSA + + + + + + +
WORDLE INSA
-
+
+

+
+
+

+

+

+

+

+
+
+

+

+

+

+

+
+
+

+

+

+

+

+
+
+

+

+

+

+

+
+
+

+

+

+

+

+
+
+

+

+

+

+

+
-
-
-

-

-

-

-

-
-
-

-

-

-

-

-
-
-

-

-

-

-

-
-
-

-

-

-

-

-
-
-

-

-

-

-

-
-
-

-

-

-

-

-
+
-
+ - - -
+
- + \ No newline at end of file diff --git a/script.js b/script.js index 261cd5e..02bf86a 100644 --- a/script.js +++ b/script.js @@ -31,6 +31,27 @@ function change_color_mid_letter(coord){ case_div.style.backgroundColor = mid_letter_color; } +function key_color_good_letter(coord){ + coord = "case".concat(coord) + console.log(coord) + var case_div = document.getElementById(coord); + case_div.style.backgroundColor = good_letter_color; +} + +function key_color_bad_letter(coord){ + coord = "case".concat(coord) + console.log(coord) + var case_div = document.getElementById(coord); + case_div.style.backgroundColor = bad_letter_color; +} + +function key_color_mid_letter(coord){ + coord = "case".concat(coord) + console.log(coord) + var case_div = document.getElementById(coord); + case_div.style.backgroundColor = mid_letter_color; +} + function update(x) { if (free_box[1]==6) { } @@ -43,6 +64,7 @@ function update(x) { } function Supprimer() { + document.getElementById("info").innerHTML=""; word = word.slice(0,-1); if (free_box[1]==1) { } @@ -114,13 +136,16 @@ function verifWord() { let exist = false; if (word.length == 5){ for(let i = 0; i< arrWords.length;i++){ - if(arrWords[i]==word){ + if(arrWords[i]==word){ exist = true; } + else { + document.getElementById("info").innerHTML="NOT A WORD"; + } } } return exist; -} +} function aleatoire() { let rand = Math.floor(Math.random() * arrWords.length); diff --git a/styles.css b/styles.css index aaa3d33..53eb4d2 100644 --- a/styles.css +++ b/styles.css @@ -17,7 +17,10 @@ section{ /* Alignement du tableau de jeu */ padding-top: 5%; align-items: center; } - +.info{ /* Alignement du tableau de jeu */ + text-align: center; + height: 15px; +} .grille_haut { /* Alignement du tableau de jeu */ display: flex; align-items: center;