aboutsummaryrefslogtreecommitdiffstats
path: root/hesla.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2012-11-19 10:42:12 +0100
committerMatěj Cepl <mcepl@redhat.com>2012-11-19 10:42:12 +0100
commit3d0c8ac713ec35e943f001308bc7b9590a06eeef (patch)
treec38e9b6520027c72f9e351b378717415fe15d7aa /hesla.js
parentdc88e52f22cf9787acd6c31a62cb518f38e86f46 (diff)
downloadhesla-3d0c8ac713ec35e943f001308bc7b9590a06eeef.tar.gz
JSLintization.
Diffstat (limited to 'hesla.js')
-rw-r--r--hesla.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/hesla.js b/hesla.js
index 5e6d3b4..af1802f 100644
--- a/hesla.js
+++ b/hesla.js
@@ -1,3 +1,5 @@
+"use strict";
+
if (!Date.prototype.toISODateString) {
(function() {
@@ -20,17 +22,18 @@ if (!Date.prototype.toISODateString) {
(function () {
function Page() {
+ var that = this;
this.cur_date = null;
document.getElementById("czech_nav").addEventListener("click",
function(evt) {
localStorage.language = "cs";
- lang_reload();
+ that.lang_reload();
}, false);
document.getElementById("german_nav").addEventListener("click",
function(evt) {
localStorage.language = "de";
- lang_reload();
+ that.lang_reload();
}, false);
}
@@ -38,7 +41,7 @@ if (!Date.prototype.toISODateString) {
// Display cur_date losungen
Page.prototype.display = function display(new_date) {
if (this.cur_date !== null) {
- document.getElementById(cur_date.toISODateString()).style.display = 'none';
+ document.getElementById(this.cur_date.toISODateString()).style.display = 'none';
}
if (new_date === undefined) {
@@ -64,14 +67,13 @@ if (!Date.prototype.toISODateString) {
// Switch langauge
Page.prototype.lang_reload = function lang_reload() {
- var new_basename = "index.html";
- var new_url = "NOURL";
+ var new_basename = "index.html", new_url = "NOURL",
+ old_basename = window.location.pathname.split("/").slice(-1);
+
if (localStorage.language && (localStorage.language === "de")) {
new_basename = "index_de.html";
}
- var old_basename = window.location.pathname.split("/").slice(-1);
-
if ((old_basename !== new_basename) || (window.location.pathname.length === 0)) {
new_url = window.location.href.replace(/(index[a-zA-Z-_]*\.html)?$/,
new_basename);