Cookies

CookiesCookies

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/448416/1073888/Cookies.js

  1. /**
  2. * Minified by jsDelivr using Terser v3.14.1.
  3. * Original file: /npm/js-cookie@2.2.1/src/js.cookie.js
  4. *
  5. * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
  6. */
  7. !function (e) {
  8. var n;
  9. if ("function" == typeof define && define.amd && (define(e), n = !0), "object" == typeof exports && (module.exports = e(), n = !0), !n) {
  10. var t = window.Cookies,
  11. o = window.Cookies = e();
  12. o.noConflict = function () {
  13. return window.Cookies = t,
  14. o
  15. }
  16. }
  17. }
  18. (function () {
  19. function e() {
  20. for (var e = 0, n = {}; e < arguments.length; e++) {
  21. var t = arguments[e];
  22. for (var o in t)
  23. n[o] = t[o]
  24. }
  25. return n
  26. }
  27. function n(e) {
  28. return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent)
  29. }
  30. return function t(o) {
  31. function r() {}
  32. function i(n, t, i) {
  33. if ("undefined" != typeof document) {
  34. "number" == typeof(i = e({
  35. path: "/"
  36. }, r.defaults, i)).expires && (i.expires = new Date(1 * new Date + 864e5 * i.expires)),
  37. i.expires = i.expires ? i.expires.toUTCString() : "";
  38. try {
  39. var c = JSON.stringify(t);
  40. /^[\{\[]/.test(c) && (t = c)
  41. } catch (e) {}
  42. t = o.write ? o.write(t, n) : encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent),
  43. n = encodeURIComponent(String(n)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape);
  44. var f = "";
  45. for (var u in i)
  46. i[u] && (f += "; " + u, !0 !== i[u] && (f += "=" + i[u].split(";")[0]));
  47. return document.cookie = n + "=" + t + f
  48. }
  49. }
  50. function c(e, t) {
  51. if ("undefined" != typeof document) {
  52. for (var r = {}, i = document.cookie ? document.cookie.split("; ") : [], c = 0; c < i.length; c++) {
  53. var f = i[c].split("="),
  54. u = f.slice(1).join("=");
  55. t || '"' !== u.charAt(0) || (u = u.slice(1, -1));
  56. try {
  57. var a = n(f[0]);
  58. if (u = (o.read || o)(u, a) || n(u), t)
  59. try {
  60. u = JSON.parse(u)
  61. } catch (e) {}
  62. if (r[a] = u, e === a)
  63. break
  64. } catch (e) {}
  65. }
  66. return e ? r[e] : r
  67. }
  68. }
  69. return r.set = i,
  70. r.get = function (e) {
  71. return c(e, !1)
  72. },
  73. r.getJSON = function (e) {
  74. return c(e, !0)
  75. },
  76. r.remove = function (n, t) {
  77. i(n, "", e(t, {
  78. expires: -1
  79. }))
  80. },
  81. r.defaults = {},
  82. r.withConverter = t,
  83. r
  84. }
  85. (function () {})
  86. });
  87. //# sourceMappingURL=/sm/b0ce608ffc029736e9ac80a8dd6a7db2da8e1d45d2dcfc92043deb2214aa30d8.map