From 135a180e128a3653ae6bdd3c3d38fa4ae2f99baf Mon Sep 17 00:00:00 2001
From: Manuel Friedli <manuel@fritteli.ch>
Date: Sat, 28 Jun 2014 14:41:30 +0200
Subject: [PATCH] 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 <http://www.gnu.org/licenses/>.
 					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 <http://www.gnu.org/licenses/>.
 				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 <http://www.gnu.org/licenses/>.
 					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 <http://www.gnu.org/licenses/>.
 				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) {