1/*! 2 * JavaScript Cookie v2.2.0 3 * https://github.com/js-cookie/js-cookie 4 * 5 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 6 * Released under the MIT license 7 */ 8; 9(function (factory) { 10 var registeredInModuleLoader = false; 11 if (typeof define === 'function' && define.amd) { 12 define(factory); 13 registeredInModuleLoader = true; 14 } 15 if (typeof exports === 'object') { 16 module.exports = factory(); 17 registeredInModuleLoader = true; 18 } 19 if (!registeredInModuleLoader) { 20 var OldCookies = window.Cookies; 21 var api = window.Cookies = factory(); 22 api.noConflict = function () { 23 window.Cookies = OldCookies; 24 return api; 25 }; 26 } 27}(function () { 28 function extend() { 29 var i = 0; 30 var result = {}; 31 for (; i < arguments.length; i++) { 32 var attributes = arguments[ i ]; 33 for (var key in attributes) { 34 result[key] = attributes[key]; 35 } 36 } 37 return result; 38 } 39 40 function init(converter) { 41 function api(key, value, attributes) { 42 var result; 43 if (typeof document === 'undefined') { 44 return; 45 } 46 47 // Write 48 49 if (arguments.length > 1) { 50 attributes = extend({ 51 path: '/' 52 }, api.defaults, attributes); 53 54 if (typeof attributes.expires === 'number') { 55 var expires = new Date(); 56 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 57 attributes.expires = expires; 58 } 59 60 // We're using "expires" because "max-age" is not supported by IE 61 attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 62 63 try { 64 result = JSON.stringify(value); 65 if (/^[\{\[]/.test(result)) { 66 value = result; 67 } 68 } catch (e) { 69 } 70 71 if (!converter.write) { 72 value = encodeURIComponent(String(value)) 73 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 74 } else { 75 value = converter.write(value, key); 76 } 77 78 key = encodeURIComponent(String(key)); 79 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 80 key = key.replace(/[\(\)]/g, escape); 81 82 var stringifiedAttributes = ''; 83 84 for (var attributeName in attributes) { 85 if (!attributes[attributeName]) { 86 continue; 87 } 88 stringifiedAttributes += '; ' + attributeName; 89 if (attributes[attributeName] === true) { 90 continue; 91 } 92 stringifiedAttributes += '=' + attributes[attributeName]; 93 } 94 return (document.cookie = key + '=' + value + stringifiedAttributes); 95 } 96 97 // Read 98 99 if (!key) { 100 result = {}; 101 } 102 103 // To prevent the for loop in the first place assign an empty array 104 // in case there are no cookies at all. Also prevents odd result when 105 // calling "get()" 106 var cookies = document.cookie ? document.cookie.split('; ') : []; 107 var rdecode = /(%[0-9A-Z]{2})+/g; 108 var i = 0; 109 110 for (; i < cookies.length; i++) { 111 var parts = cookies[i].split('='); 112 var cookie = parts.slice(1).join('='); 113 114 if (!this.json && cookie.charAt(0) === '"') { 115 cookie = cookie.slice(1, -1); 116 } 117 118 try { 119 var name = parts[0].replace(rdecode, decodeURIComponent); 120 cookie = converter.read ? 121 converter.read(cookie, name) : converter(cookie, name) || 122 cookie.replace(rdecode, decodeURIComponent); 123 124 if (this.json) { 125 try { 126 cookie = JSON.parse(cookie); 127 } catch (e) { 128 } 129 } 130 131 if (key === name) { 132 result = cookie; 133 break; 134 } 135 136 if (!key) { 137 result[name] = cookie; 138 } 139 } catch (e) { 140 } 141 } 142 143 return result; 144 } 145 146 api.set = api; 147 api.get = function (key) { 148 return api.call(api, key); 149 }; 150 api.getJSON = function () { 151 return api.apply({ 152 json: true 153 }, [].slice.call(arguments)); 154 }; 155 api.defaults = {}; 156 157 api.remove = function (key, attributes) { 158 api(key, '', extend(attributes, { 159 expires: -1 160 })); 161 }; 162 163 api.withConverter = init; 164 165 return api; 166 } 167 168 return init(function () {}); 169}));
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.