1 line
1.2 KiB
JavaScript
1 line
1.2 KiB
JavaScript
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(s){var n=/\+/g;function f(e){return x.raw?e:encodeURIComponent(e)}function m(e,o){e=x.raw?e:function(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(n," ")),x.json?JSON.parse(e):e}catch(e){}}(e);return s.isFunction(o)?o(e):e}var x=s.cookie=function(e,o,n){var i,r;if(void 0!==o&&!s.isFunction(o))return"number"==typeof(n=s.extend({},x.defaults,n)).expires&&(i=n.expires,(r=n.expires=new Date).setTime(+r+864e5*i)),document.cookie=[f(e),"=",(r=o,f(x.json?JSON.stringify(r):String(r))),n.expires?"; expires="+n.expires.toUTCString():"",n.path?"; path="+n.path:"",n.domain?"; domain="+n.domain:"",n.secure?"; secure":""].join("");for(var t=e?void 0:{},c=document.cookie?document.cookie.split("; "):[],u=0,a=c.length;u<a;u++){var d=c[u].split("="),p=(p=d.shift(),x.raw?p:decodeURIComponent(p)),d=d.join("=");if(e&&e===p){t=m(d,o);break}e||void 0===(d=m(d))||(t[p]=d)}return t};x.defaults={},s.removeCookie=function(e,o){return void 0!==s.cookie(e)&&(s.cookie(e,"",s.extend({},o,{expires:-1})),!s.cookie(e))}}); |