PageRenderTime 14ms CodeModel.GetById 6ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Frameworks/AppKit/browser.platform/CPCookie.j

http://github.com/polymar/polish
Unknown | 54 lines | 54 code | 0 blank | 0 comment | 0 complexity | ba4b04138c28e8e6515168c76b3f46ee MD5 | raw file
 1I;21;Foundation/CPObject.jI;21;Foundation/CPString.jc;1385;
 2var _1=objj_allocateClassPair(CPObject,"CPCookie"),_2=_1.isa;
 3class_addIvars(_1,[new objj_ivar("_cookieName"),new objj_ivar("_cookieValue"),new objj_ivar("_expires")]);
 4objj_registerClassPair(_1);
 5objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 6class_addMethods(_1,[new objj_method(sel_getUid("initWithName:"),function(_3,_4,_5){
 7with(_3){
 8_3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPObject")},"init");
 9_cookieName=_5;
10_cookieValue=objj_msgSend(_3,"_readCookieValue");
11return _3;
12}
13}),new objj_method(sel_getUid("value"),function(_6,_7){
14with(_6){
15return _cookieValue;
16}
17}),new objj_method(sel_getUid("name"),function(_8,_9){
18with(_8){
19return _cookieName;
20}
21}),new objj_method(sel_getUid("expires"),function(_a,_b){
22with(_a){
23return _expires;
24}
25}),new objj_method(sel_getUid("setValue:expires:domain:"),function(_c,_d,_e,_f,_10){
26with(_c){
27if(_f){
28var _11="; expires="+_f.toGMTString();
29}else{
30var _11="";
31}
32if(_10){
33_10="; domain="+_10;
34}else{
35_10="";
36}
37document.cookie=_cookieName+"="+_e+_11+"; path=/"+_10;
38}
39}),new objj_method(sel_getUid("_readCookieValue"),function(_12,_13){
40with(_12){
41var _14=_cookieName+"=";
42var ca=document.cookie.split(";");
43for(var i=0;i<ca.length;i++){
44var c=ca[i];
45while(c.charAt(0)==" "){
46c=c.substring(1,c.length);
47}
48if(c.indexOf(_14)==0){
49return c.substring(_14.length,c.length);
50}
51}
52return "";
53}
54})]);