|
51
|
1 |
/* |
|
|
2 |
Copyright (c) 2004-2012, 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 |
|
|
5 |
*/ |
|
|
6 |
|
|
|
7 |
//>>built |
|
|
8 |
define("dojo/cookie",["./_base/kernel","./regexp"],function(_1,_2){ |
|
|
9 |
_1.cookie=function(_3,_4,_5){ |
|
|
10 |
var c=document.cookie,_6; |
|
|
11 |
if(arguments.length==1){ |
|
|
12 |
var _7=c.match(new RegExp("(?:^|; )"+_2.escapeString(_3)+"=([^;]*)")); |
|
|
13 |
_6=_7?decodeURIComponent(_7[1]):undefined; |
|
|
14 |
}else{ |
|
|
15 |
_5=_5||{}; |
|
|
16 |
var _8=_5.expires; |
|
|
17 |
if(typeof _8=="number"){ |
|
|
18 |
var d=new Date(); |
|
|
19 |
d.setTime(d.getTime()+_8*24*60*60*1000); |
|
|
20 |
_8=_5.expires=d; |
|
|
21 |
} |
|
|
22 |
if(_8&&_8.toUTCString){ |
|
|
23 |
_5.expires=_8.toUTCString(); |
|
|
24 |
} |
|
|
25 |
_4=encodeURIComponent(_4); |
|
|
26 |
var _9=_3+"="+_4,_a; |
|
|
27 |
for(_a in _5){ |
|
|
28 |
_9+="; "+_a; |
|
|
29 |
var _b=_5[_a]; |
|
|
30 |
if(_b!==true){ |
|
|
31 |
_9+="="+_b; |
|
|
32 |
} |
|
|
33 |
} |
|
|
34 |
document.cookie=_9; |
|
|
35 |
} |
|
|
36 |
return _6; |
|
|
37 |
}; |
|
|
38 |
_1.cookie.isSupported=function(){ |
|
|
39 |
if(!("cookieEnabled" in navigator)){ |
|
|
40 |
this("__djCookieTest__","CookiesAllowed"); |
|
|
41 |
navigator.cookieEnabled=this("__djCookieTest__")=="CookiesAllowed"; |
|
|
42 |
if(navigator.cookieEnabled){ |
|
|
43 |
this("__djCookieTest__","",{expires:-1}); |
|
|
44 |
} |
|
|
45 |
} |
|
|
46 |
return navigator.cookieEnabled; |
|
|
47 |
}; |
|
|
48 |
return _1.cookie; |
|
|
49 |
}); |