summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Kirsch <kirschju@sec.in.tum.de>2014-11-18 16:42:09 +0100
committerJulian Kirsch <kirschju@sec.in.tum.de>2014-11-18 16:42:09 +0100
commite036707bd7e026b387ed06bb0de20bb44a1a4976 (patch)
tree8b4db4c6d897f0d42d69c9fdb04b2fd17c1822f2
parent0d59eda9946147382ed5e253be131761429ee89a (diff)
downloadwww-e036707bd7e026b387ed06bb0de20bb44a1a4976.tar.gz
www-e036707bd7e026b387ed06bb0de20bb44a1a4976.tar.bz2
www-e036707bd7e026b387ed06bb0de20bb44a1a4976.zip
Javascript - Language setting storage
-rw-r--r--about.html2
-rw-r--r--citizens.html2
-rw-r--r--common/header.inc1
-rw-r--r--developers.html2
-rw-r--r--governments.html2
-rw-r--r--investors.html2
-rw-r--r--lang.js28
-rw-r--r--main.html2
-rw-r--r--merchants.html2
-rw-r--r--news.html2
10 files changed, 37 insertions, 8 deletions
diff --git a/about.html b/about.html
index 1a6f7a56..7607de0a 100644
--- a/about.html
+++ b/about.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/citizens.html b/citizens.html
index 1f3964da..95eeba65 100644
--- a/citizens.html
+++ b/citizens.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/common/header.inc b/common/header.inc
index 11081912..163582c4 100644
--- a/common/header.inc
+++ b/common/header.inc
@@ -10,6 +10,7 @@
<link href="justified-nav.css" rel="stylesheet">
<link href="lang.css" rel="stylesheet">
<link href="styles.css" rel="stylesheet">
+ <script src="lang.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
diff --git a/developers.html b/developers.html
index 75f952a1..26c25d2c 100644
--- a/developers.html
+++ b/developers.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/governments.html b/governments.html
index 45313701..dab9bb18 100644
--- a/governments.html
+++ b/governments.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/investors.html b/investors.html
index 9fa62a58..49cf589d 100644
--- a/investors.html
+++ b/investors.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/lang.js b/lang.js
new file mode 100644
index 00000000..db23ba52
--- /dev/null
+++ b/lang.js
@@ -0,0 +1,28 @@
+function supports_html5_storage() {
+ try {
+ return 'sessionStorage' in window && window['sessionStorage'] !== null;
+ } catch (e) {
+ return false;
+ }
+}
+
+function setLang(l)
+{
+ document.body.className=l;
+ if (supports_html5_storage()) {
+ sessionStorage.setItem('lang', l);
+ }
+}
+
+function loadLang()
+{
+ if (supports_html5_storage()) {
+ l = sessionStorage.getItem('lang');
+ if (l == '') {
+ l = window.navigator.userLanguage || window.navigator.language;
+ }
+ } else {
+ l = window.navigator.userLanguage || window.navigator.language;
+ }
+ setLang(l);
+}
diff --git a/main.html b/main.html
index 0ae00ed3..66a74555 100644
--- a/main.html
+++ b/main.html
@@ -8,7 +8,7 @@
<meta name="description" content="Anonymous electronic payments for civil society">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/merchants.html b/merchants.html
index 6177f57d..203e1cde 100644
--- a/merchants.html
+++ b/merchants.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->
diff --git a/news.html b/news.html
index 3d9b7f29..ea0d3a0b 100644
--- a/news.html
+++ b/news.html
@@ -6,7 +6,7 @@
<meta name="description" content="">
<!--# include file="common/header.inc" -->
</head>
- <body class="en">
+ <body class="en" onLoad="loadLang();">
<div class="container">
<!--# include file="common/navigation.inc" -->
<!-- Jumbotron -->