From 5e41bea598ff38b3c520b69fd92ee3412e716df2 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 9 Sep 2025 15:37:50 +0200 Subject: =?UTF-8?q?fin=20de=20l'utilisation=20du=20champ=20article=5Ftimes?= =?UTF-8?q?tamp=20de=20la=20table=20node,=20r=C3=A9solue=20erreur=20lorsqu?= =?UTF-8?q?e=20deux=20news=20sont=20cr=C3=A9=C3=A9es=20dans=20la=20m=C3=AA?= =?UTF-8?q?me=20minute=20(pas=20dans=20la=20m=C3=AAme=20seconde=20par=20co?= =?UTF-8?q?ntre)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'public/js/main.js') diff --git a/public/js/main.js b/public/js/main.js index 8f2b214..2936ea0 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -80,8 +80,9 @@ document.addEventListener('DOMContentLoaded', () => { // pour pouvoir attraper l // complète les fonctions dans tinymce.js function switchPositions(article_id, direction) { - const current_article = findParentByTagName(document.getElementById(article_id), 'article'); // l'id n'est pas sur la bonne balise - var other_article; + const current_article = findParentByTagName(document.getElementById(article_id), 'article'); // l'id n'est pas toujours sur la même balise + let other_article; + let other_article_id; if(direction == 'down'){ other_article = current_article.nextElementSibling; @@ -90,10 +91,8 @@ function switchPositions(article_id, direction) other_article = current_article.previousElementSibling; } - var other_article_id; try{ other_article_id = other_article.querySelector('div[id]').id; - other_article_id = 'i' + other_article_id.slice(1); // peut mieux faire } catch(error){ console.log('Inversion impossible'); -- cgit v1.2.3