summaryrefslogtreecommitdiff
path: root/scripts/localStorage.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/localStorage.js')
-rw-r--r--scripts/localStorage.js27
1 files changed, 27 insertions, 0 deletions
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;
+}