Merge branch 'develop' into 'master'

Develop

Configurable cookie path
This commit is contained in:
Manuel Friedli 2014-06-28 23:39:52 +02:00
commit 0fb0551783
2 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,5 @@
CACHE MANIFEST
# 6.1.2
# 6.2
COPYING
README.md

17
uhr.js
View file

@ -68,7 +68,7 @@ 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, path: '/'});
this._setCookie('uhr-status', 'on');
} else {
}
},
@ -77,7 +77,7 @@ 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, path: '/'});
this._setCookie('uhr-status', 'off');
}
},
toggle: function() {
@ -96,7 +96,7 @@ 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, path: '/'});
this._setCookie('uhr-language', languageKey);
this._update();
}
},
@ -105,7 +105,7 @@ 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, path: '/'});
this._setCookie('uhr-theme', theme);
}
},
time: function(time) {
@ -327,6 +327,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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);
}
});
/**