1jQuery.cookie = function(name, value, options) { 2 if (typeof value != 'undefined') { // name and value given, set cookie 3 options = options || {}; 4 5 if (value === null) { 6 value = ''; 7 options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed 8 options.expires = -1; 9 } 10 if(!options.expires) { 11 options.expires = 1; 12 } 13 var expires = ''; 14 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { 15 var date; 16 if (typeof options.expires == 'number') { 17 date = new Date(); 18 date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); 19 } else { 20 date = options.expires; 21 } 22 expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE 23 } 24 // NOTE Needed to parenthesize options.path and options.domain 25 // in the following expressions, otherwise they evaluate to undefined 26 // in the packed version for some reason... 27 var path = options.path ? '; path=' + (options.path) : ''; 28 var domain = options.domain ? '; domain=' + (options.domain) : ''; 29 var secure = options.secure ? '; secure' : ''; 30 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); 31 } else { // only name given, get cookie 32 var cookieValue = null; 33 if (document.cookie && document.cookie != '') { 34 var cookies = document.cookie.split(';'); 35 for (var i = 0; i < cookies.length; i++) { 36 var cookie = jQuery.trim(cookies[i]); 37 // Does this cookie string begin with the name we want? 38 if (cookie.substring(0, name.length + 1) == (name + '=')) { 39 cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 40 break; 41 } 42 } 43 } 44 return cookieValue; 45 } 46};
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.