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