You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

84 lines
3.0 KiB

!function (e, t) {
"function" == typeof define && define.amd ? define(t) : "object" == typeof exports && exports ? module.exports = t() : e.cookie = t();
}
("undefined" == typeof window ? this : window, function ()
{
function e(e) {
return !!e && "[object Object]" === Object.prototype.toString.call(e);
}
function t(e) {
return Array.prototype.slice.call(e);
}
function n(e) {
for (var t = e.split(":"), n = 0, r = t.length; n < r; n++)
0 == t[n].split("")[0] && (t[n] = t[n].split("")[1]);
var o = new Date,
i = parseInt(t[0]) - o.getHours(),
a = parseInt(t[1]) - o.getMinutes(),
s = parseInt(t[2]) - o.getSeconds();
return 1e3 * (60 * i * 60 + 60 * a + s);
}
function r() {
if (!(this instanceof r))
return new r;
}
var o = Object.keys || function (e) {
var t = [], n = "";
for (n in e)
e.hasOwnProperty(n) && t.push(n);
return t;
},
i = Array.isArray || function (e) {
return "[object Array]" === Object.prototype.toString.call(e);
};
r.prototype = {
get: function (e) {
return e && "string" == typeof e ? this.all()[e] || null : null;
},
set: function (t, r, o) {
var i = e(o) ? o : {
expires: o
},
a = void 0 !== i.expires ? i.expires : "",
s = typeof a;
if ("string" === s && "" !== a) {
var u = /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d)$/;
a = u.test(a) ? new Date(+new Date + n(a)) : new Date(a);
} else
"number" === s && (a = new Date(+new Date + 864e5 * a));
"" !== a && "toGMTString" in a && (a = "; expires=" + a.toGMTString());
var c = "; path=" + (i.path ? i.path : "/"),
p = i.domain ? "; domain=" + i.domain : "",
f = i.secure ? "; secure" : "";
document.cookie = t + "=" + escape(r) + a + c + p + f;
},
remove: function (e) {
e = i(e) ? e : t(arguments);
for (var n = 0, r = e.length; n < r; n++)
this.set(e[n], "", -1);
return e;
},
clear: function () {
return this.remove(o(this.all()));
},
all: function () {
var e = {};
if (document.cookie)
for (var t = document.cookie.split("; "), n = 0, r = t.length; n < r; n++) {
var o = t[n].split("=");
e[unescape(o[0])] = unescape(o[1]);
}
return e;
}
};
var a = function (e, t, n) {
var o = r(),
i = arguments.length;
return 1 === i && "string" == typeof e ? o.get(e) : i > 1 && e && t ? o.set(e, t, n) : null === t ? o.remove(e) : o.all();
};
for (var s in r.prototype)
a[s] = r.prototype[s];
return a;
});