diff options
Diffstat (limited to 'asset-sources/fietsboek.ts')
-rw-r--r-- | asset-sources/fietsboek.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/asset-sources/fietsboek.ts b/asset-sources/fietsboek.ts index b76b98b..bdd56ef 100644 --- a/asset-sources/fietsboek.ts +++ b/asset-sources/fietsboek.ts @@ -52,6 +52,20 @@ function addHandler<K extends keyof GlobalEventHandlersEventMap>( } /** + * Handler for when a language is clicked. Sets the cookie to the correct locale. + * + * @param event - The triggering event. + */ +function languageClicked(event: MouseEvent) { + let language = (event.target as HTMLElement).getAttribute("data-langcode"); + document.cookie = "fietsboek_locale=" + language; + window.location.reload(); + event.preventDefault(); +} + +addHandler(".language-choice", "click", languageClicked); + +/** * Handler for when a tag is clicked. Removes the tag from the tag list. * * @param event - The triggering event. |