-凯发官网注册

/*! * jquery cookie plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * 凯发官网注册 copyright 2013 klaus hartl * released under the mit license */ (function (factory) { if (typeof define === 'function' && define.amd) { // amd. register as anonymous module. define(['jquery'], factory); } else { // browser globals. factory(jquery); } }(function ($) { var pluses = /\ /g; function raw(s) { return s; } function decoded(s) { return decodeuricomponent(s.replace(pluses, ' ')); } function converted(s) { if (s.indexof('"') === 0) { // this is a quoted cookie as according to rfc2068, unescape s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { return config.json ? json.parse(s) : s; } catch(er) {} } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new date(); t.setdate(t.getdate() days); } value = config.json ? json.stringify(value) : string(value); return (document.cookie = [ config.raw ? key : encodeuricomponent(key), '=', config.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('')); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); var result = key ? undefined : {}; for (var i = 0, l = cookies.length; i < l; i ) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = decode(parts.join('=')); if (key && key === name) { result = converted(cookie); break; } if (!key) { result[name] = converted(cookie); } } return result; }; config.defaults = {}; $.removecookie = function (key, options) { if ($.cookie(key) !== undefined) { // must not alter options, thus extending a fresh object... $.cookie(key, '', $.extend({}, options, { expires: -1 })); return true; } return false; }; // 清空cookies $.clearcookie = function(){ var cookies = document.cookie.split('; '); for (var i = 0, l = cookies.length; i < l; i ) { var parts = cookies[i].split('='); var name = parts.shift(); $.cookie(name,''); } } }));