diff options
| author | polo <ordipolo@gmx.fr> | 2025-09-05 11:27:37 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-09-05 11:27:37 +0200 |
| commit | 46b455a0d3e96099e78975f53a25365a2ca9dcb4 (patch) | |
| tree | 54f4616a103410d2bc77827b738f592806dbff67 /public/js/main.js | |
| parent | f477314613beb26b0ce4c61ec0b1900df1de1cb1 (diff) | |
| download | cms-46b455a0d3e96099e78975f53a25365a2ca9dcb4.tar.gz cms-46b455a0d3e96099e78975f53a25365a2ca9dcb4.tar.bz2 cms-46b455a0d3e96099e78975f53a25365a2ca9dcb4.zip | |
classe Editor et encapsulation, placement article premier ou dernier, variable window.Config.page, séparation openEditor et initEditor
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; |
