diff options
Diffstat (limited to 'public/js/main.js')
-rw-r--r-- | public/js/main.js | 17 |
1 files changed, 9 insertions, 8 deletions
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 @@ | |||
1 | function newPassword(page, id = ''){ | 1 | function newPassword(id = ''){ |
2 | if(id != ''){ | 2 | if(id != ''){ |
3 | id = '&id=' + id; | 3 | id = '&id=' + id; |
4 | } | 4 | } |
5 | alert('Le mot de passe a été modifié.'); | 5 | alert('Le mot de passe a été modifié.'); |
6 | window.setTimeout(function(){ | 6 | window.setTimeout(function(){ |
7 | location.href = "index.php?page=" + page + "&message=nouveau_mdp" + id; | 7 | location.href = "index.php?page=" + window.Config.page + "&message=nouveau_mdp" + id; |
8 | }, 0); | 8 | }, 0); |
9 | } | 9 | } |
10 | 10 | ||
@@ -71,14 +71,16 @@ document.addEventListener('DOMContentLoaded', () => { // pour pouvoir attraper l | |||
71 | nav_zone.style.height = entry.contentRect.height + 'px'; | 71 | nav_zone.style.height = entry.contentRect.height + 'px'; |
72 | } | 72 | } |
73 | }); | 73 | }); |
74 | resize_observer.observe(nav); | 74 | if(nav){ |
75 | resize_observer.observe(nav); | ||
76 | } | ||
75 | }); | 77 | }); |
76 | 78 | ||
77 | 79 | ||
78 | // complète les fonctions dans tinymce.js | 80 | // complète les fonctions dans tinymce.js |
79 | function switchPositions(article_id, direction) | 81 | function switchPositions(article_id, direction) |
80 | { | 82 | { |
81 | const current_article = findParent(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 sur la bonne balise |
82 | var other_article; | 84 | var other_article; |
83 | 85 | ||
84 | if(direction == 'down'){ | 86 | if(direction == 'down'){ |
@@ -232,10 +234,9 @@ function updateDate(id_date, date_input){ | |||
232 | return date_input; | 234 | return date_input; |
233 | } | 235 | } |
234 | 236 | ||
235 | function findParent(element, tag_name){ | 237 | function findParentByTagName(element, tag_name){ |
236 | while (element !== null) { | 238 | while(element !== null){ |
237 | if (element.tagName === tag_name.toUpperCase()) // tagName est en majuscules | 239 | if(element.tagName === tag_name.toUpperCase()){ // tagName est en majuscules |
238 | { | ||
239 | return element; | 240 | return element; |
240 | } | 241 | } |
241 | element = element.parentElement; | 242 | element = element.parentElement; |