From cd34dc6fb1cd47e578f761a7609bd976f253eac7 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Wed, 17 Apr 2024 16:19:15 +0700 Subject: idk what i did, i forgot. go check the diffs --- scripts/localStorage.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/localStorage.js (limited to 'scripts/localStorage.js') diff --git a/scripts/localStorage.js b/scripts/localStorage.js new file mode 100644 index 0000000..c5eb43d --- /dev/null +++ b/scripts/localStorage.js @@ -0,0 +1,27 @@ +function langIndonesia() { + localStorage.setItem("lang", "id"); + window.location.reload(); +} + +function langEnglish() { + localStorage.setItem("lang", "en"); + window.location.reload(); +} + +function switchLang() { + switchLangStorage(); + window.location.reload(); +} + +function switchLangStorage() { + if (localStorage.getItem("lang") == "id") { + localStorage.setItem("lang", "en"); + } else { + localStorage.setItem("lang", "id"); + } +} + +function switchLangHref(destination) { + switchLangStorage(); + window.location.href = destination; +} -- cgit v1.2.3