1/*! 2 * jQuery Cookie Plugin v1.3.0 3 * https://github.com/carhartl/jquery-cookie 4 * 5 * Copyright 2013 Klaus Hartl 6 * Released under the MIT license 7 */ 8(function ($, document, undefined) { 9 10 var pluses = /\+/g; 11 12 function raw(s) { 13 return s; 14 } 15 16 function decoded(s) { 17 return unRfc2068(decodeURIComponent(s.replace(pluses, ' '))); 18 } 19 20 function unRfc2068(value) { 21 if (value.indexOf('"') === 0) { 22 // This is a quoted cookie as according to RFC2068, unescape 23 value = value.slice(1, -1).replace('\\"', '"').replace('\\\\', '\\'); 24 } 25 return value; 26 }; 27 28 var config = $.cookie = function (key, value, options) { 29 30 // write 31 if (value !== undefined) { 32 options = $.extend({}, config.defaults, options); 33 34 if (value === null) { 35 options.expires = -1; 36 } 37 38 if (typeof options.expires === 'number') { 39 var days = options.expires, t = options.expires = new Date(); 40 t.setDate(t.getDate() + days); 41 } 42 43 value = config.json ? JSON.stringify(value) : String(value); 44 45 return (document.cookie = [ 46 encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), 47 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 48 options.path ? '; path=' + options.path : '', 49 options.domain ? '; domain=' + options.domain : '', 50 options.secure ? '; secure' : '' 51 ].join('')); 52 } 53 54 // read 55 var decode = config.raw ? raw : decoded; 56 var cookies = document.cookie.split('; '); 57 var result = key ? null : {}; 58 for (var i = 0, l = cookies.length; i < l; i++) { 59 var parts = cookies[i].split('='); 60 var name = decode(parts.shift()); 61 var cookie = decode(parts.join('=')); 62 63 if (config.json) { 64 cookie = JSON.parse(cookie); 65 } 66 67 if (key && key === name) { 68 result = cookie; 69 break; 70 } 71 72 if (!key) { 73 result[name] = cookie; 74 } 75 } 76 77 return result; 78 }; 79 80 config.defaults = {}; 81 82 $.removeCookie = function (key, options) { 83 if ($.cookie(key) !== null) { 84 $.cookie(key, null, options); 85 return true; 86 } 87 return false; 88 }; 89 90})(jQuery, document);
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.