diff options
| author | ianb <devnull@localhost> | 2005-07-06 09:06:43 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-07-06 09:06:43 +0000 |
| commit | b5acb104f1cc92caa0f92c797baaf476b92fdeef (patch) | |
| tree | 2c7ca3789102b1c6bfe7e45f2445e94026fe9ec5 /examples/filebrowser | |
| parent | d451a5cffeb80f6f86fcec5156208b2e07338712 (diff) | |
| download | paste-b5acb104f1cc92caa0f92c797baaf476b92fdeef.tar.gz | |
Added cookie functions; fixed Prototype extend change
Diffstat (limited to 'examples/filebrowser')
| -rw-r--r-- | examples/filebrowser/js-lib/common.js | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/examples/filebrowser/js-lib/common.js b/examples/filebrowser/js-lib/common.js index 31a9162..08ec63a 100644 --- a/examples/filebrowser/js-lib/common.js +++ b/examples/filebrowser/js-lib/common.js @@ -9,7 +9,7 @@ Element.hidden = function() { } function lazyToggle(container, url, options) { - options = ({method: 'get'}).extend(options); + options = extend({method: 'get'}, options || {}); if (Element.hidden(container)) { Element.show(container); if (! $(container).lazy_loaded) { @@ -55,3 +55,35 @@ function toggle(container, options) { } } } + +/* From: http://www.quirksmode.org/js/cookies.html */ + +function createCookie(name,value,days) +{ + if (days) + { + var date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + } + else var expires = ""; + document.cookie = name+"="+value+expires+"; path=/"; +} + +function readCookie(name) +{ + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) + { + var c = ca[i]; + while (c.charAt(0)==' ') c = c.substring(1,c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + } + return null; +} + +function eraseCookie(name) +{ + createCookie(name,"",-1); +} |
