diff options
Diffstat (limited to 'public/js/main.js')
-rw-r--r-- | public/js/main.js | 7 |
1 files changed, 3 insertions, 4 deletions
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 | |||
80 | // complète les fonctions dans tinymce.js | 80 | // complète les fonctions dans tinymce.js |
81 | function switchPositions(article_id, direction) | 81 | function switchPositions(article_id, direction) |
82 | { | 82 | { |
83 | const current_article = findParentByTagName(document.getElementById(article_id), 'article'); // l'id n'est pas sur la bonne balise | 83 | const current_article = findParentByTagName(document.getElementById(article_id), 'article'); // l'id n'est pas toujours sur la même balise |
84 | var other_article; | 84 | let other_article; |
85 | let other_article_id; | ||
85 | 86 | ||
86 | if(direction == 'down'){ | 87 | if(direction == 'down'){ |
87 | other_article = current_article.nextElementSibling; | 88 | other_article = current_article.nextElementSibling; |
@@ -90,10 +91,8 @@ function switchPositions(article_id, direction) | |||
90 | other_article = current_article.previousElementSibling; | 91 | other_article = current_article.previousElementSibling; |
91 | } | 92 | } |
92 | 93 | ||
93 | var other_article_id; | ||
94 | try{ | 94 | try{ |
95 | other_article_id = other_article.querySelector('div[id]').id; | 95 | other_article_id = other_article.querySelector('div[id]').id; |
96 | other_article_id = 'i' + other_article_id.slice(1); // peut mieux faire | ||
97 | } | 96 | } |
98 | catch(error){ | 97 | catch(error){ |
99 | console.log('Inversion impossible'); | 98 | console.log('Inversion impossible'); |