vendor: 2,839 bytes, lines 1-102
1/*! 2 * jQuery Cookie Plugin v1.4.1 3 * https://github.com/carhartl/jquery-cookie 4 * 5 * Copyright 2006, 2014 Klaus Hartl 6 * Released under the MIT license 7 */ 8(function ($) { 9 10 var pluses = /\+/g; 11 12 function encode(s) { 13 return config.raw ? s : encodeURIComponent(s); 14 } 15 16 function decode(s) { 17 return config.raw ? s : decodeURIComponent(s); 18 } 19 20 function stringifyCookieValue(value) { 21 return encode(config.json ? JSON.stringify(value) : String(value)); 22 } 23 24 function parseCookieValue(s) { 25 if (s.indexOf('"') === 0) { 26 // This is a quoted cookie as according to RFC2068, unescape... 27 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 28 } 29 30 try { 31 // Replace server-side written pluses with spaces. 32 // If we can't decode the cookie, ignore it, it's unusable. 33 // If we can't parse the cookie, ignore it, it's unusable. 34 s = decodeURIComponent(s.replace(pluses, ' ')); 35 return config.json ? JSON.parse(s) : s; 36 } catch(e) {} 37 } 38 39 function read(s, converter) { 40 var value = config.raw ? s : parseCookieValue(s); 41 return $.isFunction(converter) ? converter(value) : value; 42 } 43 44 var config = $.cookie = function (key, value, options) { 45 46 // Write 47 48 if (arguments.length > 1 && !$.isFunction(value)) { 49 options = $.extend({}, config.defaults, options); 50 51 if (typeof options.expires === 'number') { 52 var days = options.expires, t = options.expires = new Date(); 53 t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 54 } 55 56 return (document.cookie = [ 57 encode(key), '=', stringifyCookieValue(value), 58 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 59 options.path ? '; path=' + options.path : '', 60 options.domain ? '; domain=' + options.domain : '', 61 options.secure ? '; secure' : '' 62 ].join('')); 63 } 64 65 // Read 66 67 var result = key ? undefined : {}, 68 // To prevent the for loop in the first place assign an empty array 69 // in case there are no cookies at all. Also prevents odd result when 70 // calling $.cookie(). 71 cookies = document.cookie ? document.cookie.split('; ') : [], 72 i = 0, 73 l = cookies.length; 74 75 for (; i < l; i++) { 76 var parts = cookies[i].split('='), 77 name = decode(parts.shift()), 78 cookie = parts.join('='); 79 80 if (key === name) { 81 // If second argument (value) is a function it's a converter... 82 result = read(cookie, value); 83 break; 84 } 85 86 // Prevent storing a cookie that we couldn't decode. 87 if (!key && (cookie = read(cookie)) !== undefined) { 88 result[name] = cookie; 89 } 90 } 91 92 return result; 93 }; 94 95 config.defaults = {}; 96 97 $.removeCookie = function (key, options) { 98 // Must not alter options, thus extending a fresh object... 99 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 100 return !$.cookie(key); 101 }; 102})(jQuery1_11);
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.