consider the path when setting a cookie, but make it overridable with the configuration parameter 'cookiePath'.
This commit is contained in:
parent
6047499a18
commit
c890429dd6
1 changed files with 13 additions and 20 deletions
33
uhr.js
33
uhr.js
|
@ -68,11 +68,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
uhr._update();
|
uhr._update();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this._update();
|
this._update();
|
||||||
if (this.options.cookiePath !== undefined) {
|
this._setCookie('uhr-status', 'on');
|
||||||
$.cookie('uhr-status' + this._id, 'on', {expires: 365, path: this.options.cookiePath});
|
|
||||||
} else {
|
|
||||||
$.cookie('uhr-status' + this._id, 'on', {expires: 365});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -81,11 +77,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
window.clearInterval(this._timer);
|
window.clearInterval(this._timer);
|
||||||
this._timer = null;
|
this._timer = null;
|
||||||
this._update();
|
this._update();
|
||||||
if (this.options.cookiePath !== undefined) {
|
this._setCookie('uhr-status', 'off');
|
||||||
$.cookie('uhr-status' + this._id, 'off', {expires: 365, path: this.options.cookiePath});
|
|
||||||
} else {
|
|
||||||
$.cookie('uhr-status' + this._id, 'off', {expires: 365});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
|
@ -104,11 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
uhr._currentMinute = -1;
|
uhr._currentMinute = -1;
|
||||||
uhr._update();
|
uhr._update();
|
||||||
});
|
});
|
||||||
if (this.options.cookiePath !== undefined) {
|
this._setCookie('uhr-language', languageKey);
|
||||||
$.cookie('uhr-language' + this._id, languageKey, {expires: 365, path: this.options.cookiePath});
|
|
||||||
} else {
|
|
||||||
$.cookie('uhr-language' + this._id, languageKey, {expires: 365});
|
|
||||||
}
|
|
||||||
this._update();
|
this._update();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -117,11 +105,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
this.element.removeClass(this.options.theme).addClass(theme);
|
this.element.removeClass(this.options.theme).addClass(theme);
|
||||||
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
|
$('#uhr-onoffswitch' + this._id).removeClass(this.options.theme).addClass(theme);
|
||||||
this.options.theme = theme;
|
this.options.theme = theme;
|
||||||
if (this.options.cookiePath !== undefined) {
|
this._setCookie('uhr-theme', theme);
|
||||||
$.cookie('uhr-theme' + this._id, theme, {expires: 365, path: this.options.cookiePath});
|
|
||||||
} else {
|
|
||||||
$.cookie('uhr-theme' + this._id, theme, {expires: 365});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
time: function(time) {
|
time: function(time) {
|
||||||
|
@ -343,6 +327,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
themeChooser.val(selectedTheme);
|
themeChooser.val(selectedTheme);
|
||||||
this.options.theme = "";
|
this.options.theme = "";
|
||||||
this.theme(selectedTheme);
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue