PageSourceSearch

https://mycosmos.gr/plugins/corpmail/jquery.cookie.js?s=1696744034

js mycosmos.gr collected 2026-09-27 05:33:55 UTC 3,275 bytes, 114 lines download raw bytes

vendor: 3,275 bytes, lines 1-114
1/*!
2 * jQuery Cookie Plugin v1.4.0
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) {
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 encode(s) {
20    return config.raw ? s : encodeURIComponent(s);
21  }
22
23  function decode(s) {
24    return config.raw ? s : decodeURIComponent(s);
25  }
26
27  function stringifyCookieValue(value) {
28    return encode(config.json ? JSON.stringify(value) : String(value));
29  }
30
31  function parseCookieValue(s) {
32    if (s.indexOf('"') === 0) {
33      // This is a quoted cookie as according to RFC2068, unescape...
34      s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\");
35    }
36
37    try {
38      // Replace server-side written pluses with spaces.
39      // If we can't decode the cookie, ignore it, it's unusable.
40      // If we can't parse the cookie, ignore it, it's unusable.
41      s = decodeURIComponent(s.replace(pluses, " "));
42      return config.json ? JSON.parse(s) : s;
43    } catch (e) {}
44  }
45
46  function read(s, converter) {
47    var value = config.raw ? s : parseCookieValue(s);
48    return $.isFunction(converter) ? converter(value) : value;
49  }
50
51  var config = ($.cookie = function (key, value, options) {
52    // Write
53
54    if (value !== undefined && !$.isFunction(value)) {
55      options = $.extend({}, config.defaults, options);
56
57      if (typeof options.expires === "number") {
58        var days = options.expires,
59          t = (options.expires = new Date());
60        t.setTime(+t + days * 864e5);
61      }
62
63      return (document.cookie = [
64        encode(key),
65        "=",
66        stringifyCookieValue(value),
67        options.expires ? "; expires=" + options.expires.toUTCString() : "", // use expires attribute, max-age is not supported by IE
68        options.path ? "; path=" + options.path : "",
69        options.domain ? "; domain=" + options.domain : "",
70        options.secure ? "; secure" : "",
71      ].join(""));
72    }
73
74    // Read
75
76    var result = key ? undefined : {};
77
78    // To prevent the for loop in the first place assign an empty array
79    // in case there are no cookies at all. Also prevents odd result when
80    // calling $.cookie().
81    var cookies = document.cookie ? document.cookie.split("; ") : [];
82
83    for (var i = 0, l = cookies.length; i < l; i++) {
84      var parts = cookies[i].split("=");
85      var name = decode(parts.shift());
86      var cookie = parts.join("=");
87
88      if (key && key === name) {
89        // If second argument (value) is a function it's a converter...
90        result = read(cookie, value);
91        break;
92      }
93
94      // Prevent storing a cookie that we couldn't decode.
95      if (!key && (cookie = read(cookie)) !== undefined) {
96        result[name] = cookie;
97      }
98    }
99
100    return result;
101  });
102
103  config.defaults = {};
104
105  $.removeCookie = function (key, options) {
106    if ($.cookie(key) === undefined) {
107      return false;
108    }
109
110    // Must not alter options, thus extending a fresh object...
111    $.cookie(key, "", $.extend({}, options, { expires: -1 }));
112    return !$.cookie(key);
113  };
114});

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.