summaryrefslogtreecommitdiff
path: root/share/www/script/jquery.cookies.js
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-10-01 13:52:59 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-10-01 13:52:59 +0000
commit57f2e6a118dc57af6dbd6c377b60bae7fdcd3d22 (patch)
tree9ed078c70e49c2a3e62f91783b5f60b019599d01 /share/www/script/jquery.cookies.js
parenta502eb9880d20dbd69ac206e5145c646fdb26232 (diff)
Make the database list in the sidebar in Futon a list of the 10 most recently used databases, to avoid excessive script/render time with instances containing very many databases.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@700767 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/jquery.cookies.js')
-rw-r--r--share/www/script/jquery.cookies.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/share/www/script/jquery.cookies.js b/share/www/script/jquery.cookies.js
index a2817461..77c5e0a9 100644
--- a/share/www/script/jquery.cookies.js
+++ b/share/www/script/jquery.cookies.js
@@ -15,7 +15,7 @@
$.fn.extend($.cookies, {
/* Return the value of a cookie. */
- get: function(name) {
+ get: function(name, defaultValue) {
var nameEq = name + "=";
var parts = document.cookie.split(';');
for (var i = 0; i < parts.length; i++) {
@@ -24,23 +24,26 @@
return unescape(part.substring(nameEq.length, part.length));
}
}
- return null;
+ return defaultValue !== undefined ? defaultValue : null;
},
/* Create or update a cookie. */
- set: function(name, value, days) {
- var expires = "";
+ set: function(name, value, path, days) {
+ var params = [];
+ if (path) {
+ params.push("; path=" + path);
+ }
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24*60*60*1000));
- expires = "; expires=" + date.toGMTString();
+ params.push("; expires=" + date.toGMTString());
}
- document.cookie = name + "=" + escape(value) + expires;
+ document.cookie = name + "=" + escape(value) + params.join();
},
/* Remove a cookie. */
- remove: function(name) {
- $.cookies.set(name, "", -1);
+ remove: function(name, path) {
+ $.cookies.set(name, "", path, -1);
}
});