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 (factory) { 9 if (typeof define === "function" && define.amd && define.amd.jQuery) { 10 // AMD. Register as anonymous module. 11 define(["jquery"], factory); 12 } else { 13 // Browser globals. 14 factory(jQuery); 15 } 16})(function ($) { 17 var pluses = /\+/g; 18 19 function raw(s) { 20 return s; 21 } 22 23 function decoded(s) { 24 return decodeURIComponent(s.replace(pluses, " ")); 25 } 26 27 function converted(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 try { 33 return config.json ? JSON.parse(s) : s; 34 } catch (er) {} 35 } 36 37 var config = ($.cookie = function (key, value, options) { 38 // write 39 if (value !== undefined) { 40 options = $.extend({}, config.defaults, options); 41 42 if (typeof options.expires === "number") { 43 var days = options.expires, 44 t = (options.expires = new Date()); 45 t.setDate(t.getDate() + days); 46 } 47 48 value = config.json ? JSON.stringify(value) : String(value); 49 50 return (document.cookie = [ 51 encodeURIComponent(key), 52 "=", 53 config.raw ? value : encodeURIComponent(value), 54 options.expires ? "; expires=" + options.expires.toUTCString() : "", // use expires attribute, max-age is not supported by IE 55 options.path ? "; path=" + options.path : "", 56 options.domain ? "; domain=" + options.domain : "", 57 options.secure ? "; secure" : "", 58 ].join("")); 59 } 60 61 // read 62 var decode = config.raw ? raw : decoded; 63 var cookies = document.cookie.split("; "); 64 var result = key ? undefined : {}; 65 for (var i = 0, l = cookies.length; i < l; i++) { 66 var parts = cookies[i].split("="); 67 var name = decode(parts.shift()); 68 var cookie = decode(parts.join("=")); 69 70 if (key && key === name) { 71 result = converted(cookie); 72 break; 73 } 74 75 if (!key) { 76 result[name] = converted(cookie); 77 } 78 } 79 80 return result; 81 }); 82 83 config.defaults = {}; 84 85 $.removeCookie = function (key, options) { 86 if ($.cookie(key) !== undefined) { 87 $.cookie(key, "", $.extend(options, { expires: -1 })); 88 return true; 89 } 90 return false; 91 }; 92});
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.