aboutsummaryrefslogtreecommitdiff
path: root/public/js/main.js
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-01-15 23:14:05 +0100
committerpolo <ordipolo@gmx.fr>2026-01-15 23:14:05 +0100
commit600fbca86951c28b4cf96a93b1a5fe5ba6149161 (patch)
tree8035923f595cce6ef98598c072ec3297569c0dde /public/js/main.js
parent972d0c1e95894898f6d34bebb811a2637b4e1c5a (diff)
downloadcms-600fbca86951c28b4cf96a93b1a5fe5ba6149161.tar.gz
cms-600fbca86951c28b4cf96a93b1a5fe5ba6149161.tar.bz2
cms-600fbca86951c28b4cf96a93b1a5fe5ba6149161.zip
amélioration code calendar.jsHEADmain
Diffstat (limited to 'public/js/main.js')
-rw-r--r--public/js/main.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/public/js/main.js b/public/js/main.js
index c8e10b0..825699f 100644
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -36,6 +36,23 @@ function toastNotify(message){
36 setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, 5000); 36 setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, 5000);
37} 37}
38 38
39
40// réussite de getElementById
41function getElementOrThrow(id) {
42 const elem = document.getElementById(id);
43 if (!elem) {
44 throw new Error("l'élément d'id: " + id + " non trouvé");
45 }
46 return elem;
47}
48// l'erreur attribut "value" non trouvé devient l'élement attrapé n'a pas le bon type (c'est un peu plus clair)
49function assertElementType(elem, ctor) {
50 if (!(elem instanceof ctor)) {
51 throw new Error(`l'élement attrapé n'a pas le bon type. type attendu: ${ctor.name}, type obtenu: ${elem.tagName}`);
52 }
53}
54
55
39function controlURL(input){ 56function controlURL(input){
40 const url = input.value.trim(); 57 const url = input.value.trim();
41 if(!url){ 58 if(!url){