]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/cookie.js
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo
._hasResource
["dojo.cookie"]){
9 dojo
._hasResource
["dojo.cookie"]=true;
10 dojo
.provide("dojo.cookie");
11 dojo
.require("dojo.regexp");
12 dojo
.cookie=function(_1
,_2
,_3
){
13 var c
=document
.cookie
;
14 if(arguments
.length
==1){
15 var _4
=c
.match(new RegExp("(?:^|; )"+dojo
.regexp
.escapeString(_1
)+"=([^;]*)"));
16 return _4
?decodeURIComponent(_4
[1]):undefined;
20 if(typeof _5
=="number"){
22 d
.setTime(d
.getTime()+_5
*24*60*60*1000);
25 if(_5
&&_5
.toUTCString
){
26 _3
.expires
=_5
.toUTCString();
28 _2
=encodeURIComponent(_2
);
40 dojo
.cookie
.isSupported=function(){
41 if(!("cookieEnabled" in navigator
)){
42 this("__djCookieTest__","CookiesAllowed");
43 navigator
.cookieEnabled
=this("__djCookieTest__")=="CookiesAllowed";
44 if(navigator
.cookieEnabled
){
45 this("__djCookieTest__","",{expires
:-1});
48 return navigator
.cookieEnabled
;