From 46b455a0d3e96099e78975f53a25365a2ca9dcb4 Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 5 Sep 2025 11:27:37 +0200 Subject: =?UTF-8?q?classe=20Editor=20et=20encapsulation,=20placement=20art?= =?UTF-8?q?icle=20premier=20ou=20dernier,=20variable=20window.Config.page,?= =?UTF-8?q?=20s=C3=A9paration=20openEditor=20et=20initEditor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'public/js/main.js') diff --git a/public/js/main.js b/public/js/main.js index 4be7843..8f2b214 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -1,10 +1,10 @@ -function newPassword(page, id = ''){ +function newPassword(id = ''){ if(id != ''){ id = '&id=' + id; } alert('Le mot de passe a été modifié.'); window.setTimeout(function(){ - location.href = "index.php?page=" + page + "&message=nouveau_mdp" + id; + location.href = "index.php?page=" + window.Config.page + "&message=nouveau_mdp" + id; }, 0); } @@ -71,14 +71,16 @@ document.addEventListener('DOMContentLoaded', () => { // pour pouvoir attraper l nav_zone.style.height = entry.contentRect.height + 'px'; } }); - resize_observer.observe(nav); + if(nav){ + resize_observer.observe(nav); + } }); // complète les fonctions dans tinymce.js function switchPositions(article_id, direction) { - const current_article = findParent(document.getElementById(article_id), 'article'); // l'id n'est pas sur la bonne balise + const current_article = findParentByTagName(document.getElementById(article_id), 'article'); // l'id n'est pas sur la bonne balise var other_article; if(direction == 'down'){ @@ -232,10 +234,9 @@ function updateDate(id_date, date_input){ return date_input; } -function findParent(element, tag_name){ - while (element !== null) { - if (element.tagName === tag_name.toUpperCase()) // tagName est en majuscules - { +function findParentByTagName(element, tag_name){ + while(element !== null){ + if(element.tagName === tag_name.toUpperCase()){ // tagName est en majuscules return element; } element = element.parentElement; -- cgit v1.2.3