From 97359d172b39ab83b22e8f47e5efdca15d5a5cf4 Mon Sep 17 00:00:00 2001 From: arnaud Date: Sun, 15 Mar 2026 17:28:39 +0100 Subject: [PATCH] rename & handle several canvas --- datas.js | 51 ++++----- hanzi_1.html | 19 ++++ hanzi_1.js | 19 ---- hanzi_2.js => hanzi_2.html | 2 +- hanzi_3.js => hanzi_3.html | 6 +- module_hanzi.js | 223 +++++++++++++++++++++---------------- styles.html | 17 +++ 7 files changed, 192 insertions(+), 145 deletions(-) create mode 100644 hanzi_1.html delete mode 100644 hanzi_1.js rename hanzi_2.js => hanzi_2.html (79%) rename hanzi_3.js => hanzi_3.html (67%) create mode 100644 styles.html diff --git a/datas.js b/datas.js index ae13440..7091e56 100644 --- a/datas.js +++ b/datas.js @@ -1,28 +1,29 @@ \ No newline at end of file diff --git a/hanzi_1.html b/hanzi_1.html new file mode 100644 index 0000000..c386bea --- /dev/null +++ b/hanzi_1.html @@ -0,0 +1,19 @@ +
+
+ +

+ \ No newline at end of file diff --git a/hanzi_1.js b/hanzi_1.js deleted file mode 100644 index af6fef8..0000000 --- a/hanzi_1.js +++ /dev/null @@ -1,19 +0,0 @@ -
-
- -

- \ No newline at end of file diff --git a/hanzi_2.js b/hanzi_2.html similarity index 79% rename from hanzi_2.js rename to hanzi_2.html index 0a02ae6..00a8c5a 100644 --- a/hanzi_2.js +++ b/hanzi_2.html @@ -1,5 +1,5 @@
-
+

\ No newline at end of file + // --------------------------------------------------------- + // LANCER UN QUIZ PAR CANVAS + // --------------------------------------------------------- + function startMultiQuiz(writers, okArray) { + + writers.forEach((hw, idx) => { + + okArray[idx] = false; // reset + + hw.quiz({ + onMistake: () => { okArray[idx] = false; }, + onCorrectStroke: () => {}, + onComplete: () => { okArray[idx] = true; } + }); + }); + } + + // --------------------------------------------------------- + // CHECK GLOBAL + // --------------------------------------------------------- + function checkAll(okArray, feedbackId) { + + const allOK = okArray.every(v => v === true); + + if (allOK) { + document.getElementById(feedbackId).textContent = "✔️ Bravo !"; + document.getElementById(feedbackId).style.color = "green"; + return 1; + } else { + document.getElementById(feedbackId).textContent = "❌ Incorrect, continue !"; + document.getElementById(feedbackId).style.color = "red"; + return 0; + } + } + + // --------------------------------------------------------- + // EXPORT + // --------------------------------------------------------- + return { + init + }; +} + diff --git a/styles.html b/styles.html new file mode 100644 index 0000000..0a0c687 --- /dev/null +++ b/styles.html @@ -0,0 +1,17 @@ +