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 diff --git a/uhr.js b/uhr.js index af451aa..94e2280 100644 --- a/uhr.js +++ b/uhr.js @@ -68,7 +68,7 @@ along with this program. If not, see . uhr._update(); }, 1000); this._update(); - $.cookie('uhr-status' + this._id, 'on', {expires: 365, path: '/'}); + this._setCookie('uhr-status', 'on'); } else { } }, @@ -77,7 +77,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: '/'}); + this._setCookie('uhr-status', 'off'); } }, toggle: function() { @@ -96,7 +96,7 @@ along with this program. If not, see . uhr._currentMinute = -1; uhr._update(); }); - $.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: '/'}); + this._setCookie('uhr-language', languageKey); this._update(); } }, @@ -105,7 +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; - $.cookie('uhr-theme' + this._id, theme, {expires: 365, path: '/'}); + this._setCookie('uhr-theme', theme); } }, time: function(time) { @@ -327,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); } }); /**