summaryrefslogtreecommitdiff
path: root/functions.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-03-20 17:53:11 +0100
committerAndrew Dolgov <[email protected]>2006-03-20 17:53:11 +0100
commit76b4eae177e8932f7c0ad0fb4feb702fa5e037e7 (patch)
treef375c25848e8bb6446257eda552cd34f5cb681d0 /functions.js
parent2055d4a6dcbfd7d0e791c37bd88db7100052fa3a (diff)
some UI frontend cookies respect session cookie lifetime, misc cookie cleanups (closes #52)
Diffstat (limited to 'functions.js')
-rw-r--r--functions.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/functions.js b/functions.js
index 1d45b1cbf..e016d8c8a 100644
--- a/functions.js
+++ b/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;