From 743663b1a26edec6a2da30772f464889b53f8e74 Mon Sep 17 00:00:00 2001 From: adrien Date: Mon, 8 Dec 2025 10:09:37 +0100 Subject: [PATCH] =?UTF-8?q?s=C3=A9lection=20de=20l'algo=20de=20s=C3=A9lect?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/script.js b/script.js index 4959f2c..9acd66e 100644 --- a/script.js +++ b/script.js @@ -17,37 +17,36 @@ for (let input of inputs) { input.onfocus = function (event) { for (li of document.querySelectorAll( - `.definitions.horizontales > ol > li:nth-child(${input.y + 1}), .definitions.verticales > ol > li:nth-child(${input.x + 1})` + `.definitions.horizontales > ol > li:nth-child(${input.y + 1})` )) { li.classList.add("selectionee"); + for (liEnfant of li.querySelectorAll("li")) { + if (liEnfant.id == input.dataset.iddh) { + liEnfant.classList.add("selectionee"); + } else { + liEnfant.classList.add("non-selectionee"); + } + } + } + for (li of document.querySelectorAll( + `.definitions.verticales > ol > li:nth-child(${input.x + 1})` + )) { + li.classList.add("selectionee"); + for (liEnfant of li.querySelectorAll("li")) { + if (liEnfant.id == input.dataset.iddv) { + liEnfant.classList.add("selectionee"); + } else { + liEnfant.classList.add("non-selectionee"); + } + } } for (li of document.querySelectorAll( `.definitions.horizontales > ol > li:not(:nth-child(${input.y + 1})), .definitions.verticales > ol > li:not(:nth-child(${input.x + 1}))` )) { li.classList.add("non-selectionee"); } - if (input.dataset.iddh) { - for (li of document.querySelectorAll(`.definitions.horizontales ol li ol #${input.dataset.iddh}`)) { - for (liVoisin of li.parentElement.querySelectorAll("li")) { - if (liVoisin == li) { - liVoisin.classList.add("selectionee"); - } else { - liVoisin.classList.add("non-selectionee"); - } - } - } - } - if (input.dataset.iddv) { - for (li of document.querySelectorAll(`.definitions.verticales ol li ol #${input.dataset.iddv}`)) { - for (liVoisin of li.parentElement.querySelectorAll("li")) { - if (liVoisin == li) { - liVoisin.classList.add("selectionee"); - } else { - liVoisin.classList.add("non-selectionee"); - } - } - } - } + + input.select(); }; input.onkeydown = function (event) {