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