/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
- I;21;Foundation/CPObject.jI;21;Foundation/CPString.jc;1385;
- var _1=objj_allocateClassPair(CPObject,"CPCookie"),_2=_1.isa;
- class_addIvars(_1,[new objj_ivar("_cookieName"),new objj_ivar("_cookieValue"),new objj_ivar("_expires")]);
- objj_registerClassPair(_1);
- objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
- class_addMethods(_1,[new objj_method(sel_getUid("initWithName:"),function(_3,_4,_5){
- with(_3){
- _3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPObject")},"init");
- _cookieName=_5;
- _cookieValue=objj_msgSend(_3,"_readCookieValue");
- return _3;
- }
- }),new objj_method(sel_getUid("value"),function(_6,_7){
- with(_6){
- return _cookieValue;
- }
- }),new objj_method(sel_getUid("name"),function(_8,_9){
- with(_8){
- return _cookieName;
- }
- }),new objj_method(sel_getUid("expires"),function(_a,_b){
- with(_a){
- return _expires;
- }
- }),new objj_method(sel_getUid("setValue:expires:domain:"),function(_c,_d,_e,_f,_10){
- with(_c){
- if(_f){
- var _11="; expires="+_f.toGMTString();
- }else{
- var _11="";
- }
- if(_10){
- _10="; domain="+_10;
- }else{
- _10="";
- }
- document.cookie=_cookieName+"="+_e+_11+"; path=/"+_10;
- }
- }),new objj_method(sel_getUid("_readCookieValue"),function(_12,_13){
- with(_12){
- var _14=_cookieName+"=";
- 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(_14)==0){
- return c.substring(_14.length,c.length);
- }
- }
- return "";
- }
- })]);