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