PageSourceSearch

https://www.textmagic.com/wp-content/themes/textmagic-new/lib/js/js.cookie.js?ver=7.0.1

js textmagic.com collected 2026-09-24 08:28:11 UTC 3,285 bytes, 139 lines download raw bytes

vendor: 3,285 bytes, lines 1-139
1/*!
2 * JavaScript Cookie v2.0.3
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(function (factory) {
9	if (typeof define === 'function' && define.amd) {
10		define(factory);
11	} else if (typeof exports === 'object') {
12		module.exports = factory();
13	} else {
14		var _OldCookies = window.Cookies;
15		var api = window.Cookies = factory();
16		api.noConflict = function () {
17			window.Cookies = _OldCookies;
18			return api;
19		};
20	}
21}(function () {
22	function extend () {
23		var i = 0;
24		var result = {};
25		for (; i < arguments.length; i++) {
26			var attributes = arguments[ i ];
27			for (var key in attributes) {
28				result[key] = attributes[key];
29			}
30		}
31		return result;
32	}
33
34	function init (converter) {
35		function api (key, value, attributes) {
36			var result;
37
38			// Write
39
40			if (arguments.length > 1) {
41				attributes = extend({
42					path: '/'
43				}, api.defaults, attributes);
44
45				if (typeof attributes.expires === 'number') {
46					var expires = new Date();
47					expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
48					attributes.expires = expires;
49				}
50
51				try {
52					result = JSON.stringify(value);
53					if (/^[\{\[]/.test(result)) {
54						value = result;
55					}
56				} catch (e) {}
57
58				value = encodeURIComponent(String(value));
59				value = value.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
60
61				key = encodeURIComponent(String(key));
62				key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
63				key = key.replace(/[\(\)]/g, escape);
64
65				return (document.cookie = [
66					key, '=', value,
67					attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
68					attributes.path    && '; path=' + attributes.path,
69					attributes.domain  && '; domain=' + attributes.domain,
70					attributes.secure ? '; secure' : ''
71				].join(''));
72			}
73
74			// Read
75
76			if (!key) {
77				result = {};
78			}
79
80			// To prevent the for loop in the first place assign an empty array
81			// in case there are no cookies at all. Also prevents odd result when
82			// calling "get()"
83			var cookies = document.cookie ? document.cookie.split('; ') : [];
84			var rdecode = /(%[0-9A-Z]{2})+/g;
85			var i = 0;
86
87			for (; i < cookies.length; i++) {
88				var parts = cookies[i].split('=');
89				var name = parts[0].replace(rdecode, decodeURIComponent);
90				var cookie = parts.slice(1).join('=');
91
92				if (cookie.charAt(0) === '"') {
93					cookie = cookie.slice(1, -1);
94				}
95
96				try {
97					cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);
98
99					if (this.json) {
100						try {
101							cookie = JSON.parse(cookie);
102						} catch (e) {}
103					}
104
105					if (key === name) {
106						result = cookie;
107						break;
108					}
109
110					if (!key) {
111						result[name] = cookie;
112					}
113				} catch (e) {}
114			}
115
116			return result;
117		}
118
119		api.get = api.set = api;
120		api.getJSON = function () {
121			return api.apply({
122				json: true
123			}, [].slice.call(arguments));
124		};
125		api.defaults = {};
126
127		api.remove = function (key, attributes) {
128			api(key, '', extend(attributes, {
129				expires: -1
130			}));
131		};
132
133		api.withConverter = init;
134
135		return api;
136	}
137
138	return init();
139}));

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.