3 changed files with 12 additions and 47 deletions
@ -1,47 +0,0 @@ |
|||||
/** |
|
||||
* jQuery Cookie plugin |
|
||||
* |
|
||||
* Copyright (c) 2010 Klaus Hartl (stilbuero.de) |
|
||||
* Dual licensed under the MIT and GPL licenses: |
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
|
||||
* http://www.gnu.org/licenses/gpl.html
|
|
||||
* |
|
||||
*/ |
|
||||
(function($) { |
|
||||
$.cookie = function(key, value, options) { |
|
||||
|
|
||||
// key and at least value given, set cookie...
|
|
||||
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) { |
|
||||
options = $.extend({}, options); |
|
||||
|
|
||||
if (value === null || value === undefined) { |
|
||||
options.expires = -1; |
|
||||
} |
|
||||
|
|
||||
if (typeof options.expires === 'number') { |
|
||||
var days = options.expires, t = options.expires = new Date(); |
|
||||
t.setDate(t.getDate() + days); |
|
||||
} |
|
||||
|
|
||||
value = String(value); |
|
||||
|
|
||||
return (document.cookie = [ |
|
||||
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), |
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
|
||||
options.path ? '; path=' + options.path : '', |
|
||||
options.domain ? '; domain=' + options.domain : '', |
|
||||
options.secure ? '; secure' : '' |
|
||||
].join('')); |
|
||||
} |
|
||||
|
|
||||
// key and possibly options given, get cookie...
|
|
||||
options = value || {}; |
|
||||
var decode = options.raw ? function(s) { return s; } : decodeURIComponent; |
|
||||
|
|
||||
var pairs = document.cookie.split('; '); |
|
||||
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) { |
|
||||
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
|
|
||||
} |
|
||||
return null; |
|
||||
}; |
|
||||
})(jQuery); |
|
@ -0,0 +1,11 @@ |
|||||
|
/* |
||||
|
JavaScript Cookie v2.1.3 |
||||
|
https://github.com/js-cookie/js-cookie
|
||||
|
|
||||
|
Copyright 2006, 2015 Klaus Hartl & Fagner Brack |
||||
|
Released under the MIT license |
||||
|
*/ |
||||
|
(function(m){var h=!1;"function"===typeof define&&define.amd&&(define(m),h=!0);"object"===typeof exports&&(module.exports=m(),h=!0);if(!h){var e=window.Cookies,a=window.Cookies=m();a.noConflict=function(){window.Cookies=e;return a}}})(function(){function m(){for(var e=0,a={};e<arguments.length;e++){var b=arguments[e],c;for(c in b)a[c]=b[c]}return a}function h(e){function a(b,c,d){var f;if("undefined"!==typeof document){if(1<arguments.length){d=m({path:"/"},a.defaults,d);if("number"===typeof d.expires){var k= |
||||
|
new Date;k.setMilliseconds(k.getMilliseconds()+864E5*d.expires);d.expires=k}d.expires=d.expires?d.expires.toUTCString():"";try{f=JSON.stringify(c),/^[\{\[]/.test(f)&&(c=f)}catch(p){}c=e.write?e.write(c,b):encodeURIComponent(String(c)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);b=encodeURIComponent(String(b));b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);b=b.replace(/[\(\)]/g,escape);f="";for(var l in d)d[l]&&(f+="; "+l,!0!==d[l]&&(f+="="+d[l])); |
||||
|
return document.cookie=b+"="+c+f}b||(f={});l=document.cookie?document.cookie.split("; "):[];for(var h=/(%[0-9A-Z]{2})+/g,n=0;n<l.length;n++){var q=l[n].split("="),g=q.slice(1).join("=");'"'===g.charAt(0)&&(g=g.slice(1,-1));try{k=q[0].replace(h,decodeURIComponent);g=e.read?e.read(g,k):e(g,k)||g.replace(h,decodeURIComponent);if(this.json)try{g=JSON.parse(g)}catch(p){}if(b===k){f=g;break}b||(f[k]=g)}catch(p){}}return f}}a.set=a;a.get=function(b){return a.call(a,b)};a.getJSON=function(){return a.apply({json:!0}, |
||||
|
[].slice.call(arguments))};a.defaults={};a.remove=function(b,c){a(b,"",m(c,{expires:-1}))};a.withConverter=h;return a}return h(function(){})}); |
Loading…
Reference in new issue