|
66 | 66 | })(); |
67 | 67 | </script> |
68 | 68 | <!-- End Matomo Code --> |
| 69 | + <script src="https://cdn.jsdelivr.net/npm/add-to-calendar-button@2" async defer></script> |
69 | 70 | </head> |
70 | 71 |
|
71 | 72 | <body class="goueliou-page"> |
@@ -104,9 +105,13 @@ <h1>Kerlandrier.cc</h1> |
104 | 105 | }, {}) |
105 | 106 | const goueliouElement = document.getElementById("goueliou"); |
106 | 107 | // Grist Timestamp to Readable Date |
107 | | - const date_formatted = new Date(timestamp * 1000); |
108 | | - const options = { weekday: 'long', day: 'numeric', month: 'short' }; |
109 | | - return date_formatted.toLocaleDateString('fr-FR', options); |
| 108 | + function formatDate(timestamp, options) { |
| 109 | + const date = new Date(timestamp * 1000); |
| 110 | + const style = { weekday: 'long', day: 'numeric', month: 'short' }; |
| 111 | + if (options == "calendar") { |
| 112 | + return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`; |
| 113 | + } |
| 114 | + return date.toLocaleDateString('fr-FR', style); |
110 | 115 | } |
111 | 116 | Object.entries(goueliou).forEach(([month, fest]) => { |
112 | 117 | // Creation des colonnes Mois |
@@ -143,7 +148,31 @@ <h1>Kerlandrier.cc</h1> |
143 | 148 |
|
144 | 149 | // Nom du festival |
145 | 150 | div.innerHTML = ` |
146 | | - <h2 id="gouel-title">${fest[i].Nom}</h2> |
| 151 | + <div id="gouel-fest-header"> |
| 152 | + <h2 id="gouel-title">${fest[i].Nom}</h2> |
| 153 | +
|
| 154 | + <add-to-calendar-button |
| 155 | + styleLight="--btn-background: unset; |
| 156 | + --btn-text: unset; |
| 157 | + --font: "Barlow Condensed", sans-serif; |
| 158 | +
|
| 159 | + id="goueliou-calendar-button" |
| 160 | + name="[Festival] ${fest[i].Nom}" |
| 161 | + description= |
| 162 | + "<p>Ajouté depuis https://kerlandrier.cc/goueliou/\nWebsite: ${fest[i].Website}\nDescription: ${fest[i].Mots_cles}" |
| 163 | + startDate="${formatDate(fest[i].Date_debut, "calendar")}" |
| 164 | + endDate="${formatDate(fest[i].Date_fin, "calendar")}" |
| 165 | + location="${fest[i].Ville}" |
| 166 | + options="['Apple','Google','iCal']" |
| 167 | + timeZone="Europe/Paris" |
| 168 | + trigger="click" |
| 169 | + hideBackground="true" |
| 170 | + iCalFileName="Reminder-Event" |
| 171 | + hideTextLabelButton = "true" |
| 172 | + size="3" |
| 173 | + language="fr" |
| 174 | + /> |
| 175 | + </div> |
147 | 176 | `; |
148 | 177 | // Lien vers le site du festival |
149 | 178 | if (fest[i].Website) { |
|
0 commit comments