vendor: 2,353 bytes, lines 1-77
1/*! 2 * jQuery Cookie Plugin v1.4.1 3 * Copyright 2013 Klaus Hartl 4 */ 5(function (factory) { 6 if (typeof define === 'function' && define.amd) { 7 define(['jquery'], factory); 8 } else if (typeof exports === 'object') { 9 factory(require('jquery')); 10 } else { 11 factory(jQuery); 12 } 13}(function ($) { 14 var pluses = /\+/g; 15 function encode(s) { 16 return config.raw ? s : encodeURIComponent(s); 17 } 18 function decode(s) { 19 return config.raw ? s : decodeURIComponent(s); 20 } 21 function stringifyCookieValue(value) { 22 return encode(config.json ? JSON.stringify(value) : String(value)); 23 } 24 function parseCookieValue(s) { 25 if (s.indexOf('"') === 0) { 26 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 27 } 28 try { 29 s = decodeURIComponent(s.replace(pluses, ' ')); 30 return config.json ? JSON.parse(s) : s; 31 } catch(e) {} 32 } 33 function read(s, converter) { 34 var value = config.raw ? s : parseCookieValue(s); 35 return $.isFunction(converter) ? converter(value) : value; 36 } 37 var config = $.cookie = function (key, value, options) { 38 if (value !== undefined && !$.isFunction(value)) { 39 options = $.extend({}, config.defaults, options); 40 if (typeof options.expires === 'number') { 41 var days = options.expires, t = options.expires = new Date(); 42 t.setTime(+t + days * 864e+5); 43 } 44 return (document.cookie = [ 45 encode(key), '=', stringifyCookieValue(value), 46 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 47 options.path ? '; path=' + options.path : '', 48 options.domain ? '; domain=' + options.domain : '', 49 options.secure ? '; secure' : '' 50 ].join('')); 51 } 52 var result = key ? undefined : {}; 53 var cookies = document.cookie ? document.cookie.split('; ') : []; 54 for (var i = 0, l = cookies.length; i < l; i++) { 55 var parts = cookies[i].split('='); 56 var name = decode(parts.shift()); 57 var cookie = parts.join('='); 58 59 if (key && key === name) { 60 result = read(cookie, value); 61 break; 62 } 63 if (!key && (cookie = read(cookie)) !== undefined) { 64 result[name] = cookie; 65 } 66 } 67 return result; 68 }; 69 config.defaults = {}; 70 $.removeCookie = function (key, options) { 71 if ($.cookie(key) === undefined) { 72 return false; 73 } 74 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 75 return !$.cookie(key); 76 }; 77}));
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.