From b45b6bcaad970338b4db2f042d7c994c87deb7e2 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 14:34:20 +0200 Subject: [PATCH 1/5] use default cookie-path instead of / --- uhr.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uhr.js b/uhr.js index a2e4e46..303fc92 100644 --- a/uhr.js +++ b/uhr.js @@ -57,7 +57,7 @@ along with this program. If not, see . uhr._update(); }, 1000); this._update(); - $.cookie('uhr-status' + this._id, 'on', {expires: 365, path: '/'}); + $.cookie('uhr-status' + this._id, 'on', {expires: 365}); } else { } }, @@ -66,7 +66,7 @@ along with this program. If not, see . window.clearInterval(this._timer); this._timer = null; this._update(); - $.cookie('uhr-status' + this._id, 'off', {expires: 365, path: '/'}); + $.cookie('uhr-status' + this._id, 'off', {expires: 365}); } }, toggle: function() { @@ -85,7 +85,7 @@ along with this program. If not, see . uhr._currentMinute = -1; uhr._update(); }); - $.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: '/'}); + $.cookie('uhr-language' + this._id, languageKey, {expires: 365}); this._update(); } }, @@ -94,7 +94,7 @@ along with this program. If not, see . this.element.removeClass(this.options.theme).addClass(theme); $('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme); this.options.theme = theme; - $.cookie('uhr-theme' + this._id, theme, {expires: 365, path: '/'}); + $.cookie('uhr-theme' + this._id, theme, {expires: 365}); } }, time: function(time) { From d334101ae05b5f7b2598715120360fd6eeea8a14 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 14:36:46 +0200 Subject: [PATCH 2/5] updated version in manifest.appcache --- manifest.appcache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.appcache b/manifest.appcache index 90703e1..029c844 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# 5.1 +# 5.1.1 COPYING README.md From 135a180e128a3653ae6bdd3c3d38fa4ae2f99baf Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 14:41:30 +0200 Subject: [PATCH 3/5] make cookie path configurable --- uhr.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/uhr.js b/uhr.js index 303fc92..1f79bfb 100644 --- a/uhr.js +++ b/uhr.js @@ -57,7 +57,11 @@ along with this program. If not, see . uhr._update(); }, 1000); this._update(); - $.cookie('uhr-status' + this._id, 'on', {expires: 365}); + if (this.options.cookiePath !== undefined) { + $.cookie('uhr-status' + this._id, 'on', {expires: 365, path: this.options.cookiePath}); + } else { + $.cookie('uhr-status' + this._id, 'on', {expires: 365}); + } } else { } }, @@ -66,7 +70,11 @@ along with this program. If not, see . window.clearInterval(this._timer); this._timer = null; this._update(); - $.cookie('uhr-status' + this._id, 'off', {expires: 365}); + if (this.options.cookiePath !== undefined) { + $.cookie('uhr-status' + this._id, 'off', {expires: 365, path: this.options.cookiePath}); + } else { + $.cookie('uhr-status' + this._id, 'off', {expires: 365}); + } } }, toggle: function() { @@ -85,7 +93,11 @@ along with this program. If not, see . uhr._currentMinute = -1; uhr._update(); }); - $.cookie('uhr-language' + this._id, languageKey, {expires: 365}); + if (this.options.cookiePath !== undefined) { + $.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: this.options.cookiePath}); + } else { + $.cookie('uhr-language' + this._id, languageKey, {expires: 365}); + } this._update(); } }, @@ -94,7 +106,11 @@ along with this program. If not, see . this.element.removeClass(this.options.theme).addClass(theme); $('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme); this.options.theme = theme; - $.cookie('uhr-theme' + this._id, theme, {expires: 365}); + if (this.options.cookiePath !== undefined) { + $.cookie('uhr-theme' + this._id, theme, {expires: 365, path: this.options.cookiePath}); + } else { + $.cookie('uhr-theme' + this._id, theme, {expires: 365}); + } } }, time: function(time) { From c890429dd6c0357d0eeebd7938bb8a915cca4e80 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 23:27:41 +0200 Subject: [PATCH 4/5] consider the path when setting a cookie, but make it overridable with the configuration parameter 'cookiePath'. --- uhr.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/uhr.js b/uhr.js index d2c6f3c..94e2280 100644 --- a/uhr.js +++ b/uhr.js @@ -68,11 +68,7 @@ along with this program. If not, see . uhr._update(); }, 1000); this._update(); - if (this.options.cookiePath !== undefined) { - $.cookie('uhr-status' + this._id, 'on', {expires: 365, path: this.options.cookiePath}); - } else { - $.cookie('uhr-status' + this._id, 'on', {expires: 365}); - } + this._setCookie('uhr-status', 'on'); } else { } }, @@ -81,11 +77,7 @@ along with this program. If not, see . window.clearInterval(this._timer); this._timer = null; this._update(); - if (this.options.cookiePath !== undefined) { - $.cookie('uhr-status' + this._id, 'off', {expires: 365, path: this.options.cookiePath}); - } else { - $.cookie('uhr-status' + this._id, 'off', {expires: 365}); - } + this._setCookie('uhr-status', 'off'); } }, toggle: function() { @@ -104,11 +96,7 @@ along with this program. If not, see . uhr._currentMinute = -1; uhr._update(); }); - if (this.options.cookiePath !== undefined) { - $.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: this.options.cookiePath}); - } else { - $.cookie('uhr-language' + this._id, languageKey, {expires: 365}); - } + this._setCookie('uhr-language', languageKey); this._update(); } }, @@ -117,11 +105,7 @@ along with this program. If not, see . this.element.removeClass(this.options.theme).addClass(theme); $('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme); this.options.theme = theme; - if (this.options.cookiePath !== undefined) { - $.cookie('uhr-theme' + this._id, theme, {expires: 365, path: this.options.cookiePath}); - } else { - $.cookie('uhr-theme' + this._id, theme, {expires: 365}); - } + this._setCookie('uhr-theme', theme); } }, time: function(time) { @@ -343,6 +327,15 @@ along with this program. If not, see . themeChooser.val(selectedTheme); this.options.theme = ""; this.theme(selectedTheme); + }, + _setCookie: function(cookieName, cookieValue) { + var options = {}; + if (this.options.cookiePath !== undefined) { + options = {expires: 365, path: this.options.cookiePath}; + } else { + options = {expires: 365}; + } + $.cookie(cookieName + this._id, cookieValue, options); } }); /** From 719a2a83430ca7ac134b1aaa0f7297ba4a34f7d9 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 23:31:47 +0200 Subject: [PATCH 5/5] update manifest version --- manifest.appcache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.appcache b/manifest.appcache index 57166d8..577fdf4 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# 6.1.2 +# 6.2 COPYING README.md