aboutsummaryrefslogtreecommitdiff
path: root/asset-sources/fietsboek.ts
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2024-02-10 17:54:37 +0100
committerDaniel Schadt <kingdread@gmx.de>2024-02-10 17:54:37 +0100
commit416419a357de2a2311d8b2f972c21f3444fd8c2f (patch)
treeab380a0185cfe39024b19aaecff8f00647c1e09c /asset-sources/fietsboek.ts
parentf3902c84e07514f252f02a38a2795946f70ba896 (diff)
downloadfietsboek-416419a357de2a2311d8b2f972c21f3444fd8c2f.tar.gz
fietsboek-416419a357de2a2311d8b2f972c21f3444fd8c2f.tar.bz2
fietsboek-416419a357de2a2311d8b2f972c21f3444fd8c2f.zip
offer a language choice at the bottom
Diffstat (limited to 'asset-sources/fietsboek.ts')
-rw-r--r--asset-sources/fietsboek.ts14
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.