1/*! 2 * jQuery Cookie Plugin v1.3.1 3 * https://github.com/carhartl/jquery-cookie 4 * 5 * Copyright 2013 Klaus Hartl 6 * Released under the MIT license 7 */ 8(function ($) { 9 10 var pluses = /\+/g; 11 12 function raw(s) { 13 return s; 14 } 15 16 function decoded(s) { 17 return decodeURIComponent(s.replace(pluses, ' ')); 18 } 19 20 function converted(s) { 21 if (s.indexOf('"') === 0) { 22 // This is a quoted cookie as according to RFC2068, unescape 23 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 24 } 25 try { 26 return config.json ? JSON.parse(s) : s; 27 } catch(er) {} 28 } 29 30 var config = $.cookie = function (key, value, options) { 31 32 // write 33 if (value !== undefined) { 34 options = $.extend({}, config.defaults, options); 35 36 if (typeof options.expires === 'number') { 37 var days = options.expires, t = options.expires = new Date(); 38 t.setDate(t.getDate() + days); 39 } 40 41 value = config.json ? JSON.stringify(value) : String(value); 42 43 return (document.cookie = [ 44 config.raw ? key : encodeURIComponent(key), 45 '=', 46 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 ? undefined : {}; 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 (key && key === name) { 64 result = converted(cookie); 65 break; 66 } 67 68 if (!key) { 69 result[name] = converted(cookie); 70 } 71 } 72 73 return result; 74 }; 75 76 config.defaults = {}; 77 78 $.removeCookie = function (key, options) { 79 if ($.cookie(key) !== undefined) { 80 // Must not alter options, thus extending a fresh object... 81 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 82 return true; 83 } 84 return false; 85 }; 86 87})(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.