mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-14 05:25:56 +00:00
some UI frontend cookies respect session cookie lifetime, misc cookie cleanups (closes #52)
This commit is contained in:
25
functions.js
25
functions.js
@@ -267,7 +267,20 @@ function getFeedIds() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
function setCookie(name, value, expires, path, domain, secure) {
|
||||
function setCookie(name, value, lifetime, path, domain, secure) {
|
||||
|
||||
var d = false;
|
||||
|
||||
if (lifetime) {
|
||||
d = new Date();
|
||||
d.setTime(lifetime * 1000);
|
||||
}
|
||||
|
||||
int_setCookie(name, value, d, path, domain, secure);
|
||||
|
||||
}
|
||||
|
||||
function int_setCookie(name, value, expires, path, domain, secure) {
|
||||
document.cookie= name + "=" + escape(value) +
|
||||
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
||||
((path) ? "; path=" + path : "") +
|
||||
@@ -275,6 +288,16 @@ function setCookie(name, value, expires, path, domain, secure) {
|
||||
((secure) ? "; secure" : "");
|
||||
}
|
||||
|
||||
function delCookie(name, path, domain) {
|
||||
if (getCookie(name)) {
|
||||
document.cookie = name + "=" +
|
||||
((path) ? ";path=" + path : "") +
|
||||
((domain) ? ";domain=" + domain : "" ) +
|
||||
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getCookie(name) {
|
||||
|
||||
var dc = document.cookie;
|
||||
|
||||
Reference in New Issue
Block a user