make cookie path configurable
This commit is contained in:
parent
d334101ae0
commit
135a180e12
1 changed files with 20 additions and 4 deletions
16
uhr.js
16
uhr.js
|
@ -57,7 +57,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
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});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
},
|
||||
|
@ -66,8 +70,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
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});
|
||||
}
|
||||
}
|
||||
},
|
||||
toggle: function() {
|
||||
if(this._isOn()) {
|
||||
|
@ -85,7 +93,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
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._update();
|
||||
}
|
||||
},
|
||||
|
@ -94,8 +106,12 @@ 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;
|
||||
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) {
|
||||
this.options.time = time;
|
||||
|
|
Loading…
Reference in a new issue