1// spellabs cookie management 2// xelby, 2001,2002 3 4 5function getCookie(szName) 6{ 7 // cookies are separated by semicolons 8 var aCookie = document.cookie.split("; "); 9 for (var i = 0; i < aCookie.length; i++) { 10 // a name/value pair (a crumb) is separated by an equal sign 11 var aCrumb = aCookie[i].split("="); 12 if (szName == aCrumb[0]) { 13 var sValue = decodeURI(aCrumb[1]); 14 return unescape(sValue); 15 } 16 } 17 18 // a cookie with the requested name does not exist 19 return null; 20} 21 22function getCookieDef(szName, szDefValue) 23{ 24 var Result = getCookie(szName); 25 return (Result=='' || Result==null) ? szDefValue : Result; 26} 27 28function getCookieEx(szName, szAttrName) 29{ 30 var result; 31 szCookie = getCookie(szName); 32 33 var aAttr = szCookie.split('&'); 34 for (var i = 0; i<aAttr.length; i++) 35 { 36 var tagInfo = aAttr[i].split('='); 37 if (unescape(tagInfo[0]) == szAttrName) return tagInfo[1]; 38 } 39 return ''; 40} 41 42function setCookie(szName, szValue, uDaysExpires, szPath) 43{ 44 var dtExpires = new Date(); 45 var szExpireDate = ''; 46 47 if (szPath == '') szPath = "/"; 48 49 dtExpires.setTime(dtExpires.getTime() + uDaysExpires * 24 * 60 * 60 * 1000); 50 szExpireDate = dtExpires.toGMTString(); 51 szValue = encodeURI(szValue); 52 document.cookie = szName + '=' + szValue + '; path=' + szPath + '; expires=' + szExpireDate; 53} 54 55function setCookieEx(szName, szAttrName, szAttrValue, uDaysExpires, szPath) 56{ 57 var result = ''; 58 var fAttrExists = false; 59 60 var dtExpires = new Date(); 61 var szExpireDate = ''; 62 63 if (szPath='') szPath = "/"; 64 65 dtExpires.setTime(dtExpires.getTime() + uDaysExpires * 24 * 60 * 60 * 1000); 66 szExpireDate = dtExpires.toGMTString(); 67 68 szCookie = getCookie(szName); 69 70 var aAttr = szCookie.split('&'); 71 for (var i = 0; i<aAttr.length; i++) 72 { 73 var tagInfo = aAttr[i].split('='); 74 if (unescape(tagInfo[0]) == szAttrName) 75 { 76 tagInfo[1] = escape(szAttrValue); 77 fAttrExists = true; 78 } 79 result += i ? '&' : ''; 80 result += tagInfo[0] + '=' + tagInfo[1]; 81 } 82 83 if (! fAttrExists) result += '&' + szAttrName + '=' + escape(szAttrValue); 84 85 document.cookie = szName + '=' + result + '; path=/; expires=' + szExpireDate; 86 87 return; 88} 89 90function delCookie(sName) 91{ 92 document.cookie = sName + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT";//work in chrome 93 setCookie(sName, "", -10, '/'); //work in ie 94} 95
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.