1 /*jshint eqnull:true */
 
   3  * jQuery Cookie Plugin v1.2
 
   4  * https://github.com/carhartl/jquery-cookie
 
   6  * Copyright 2011, Klaus Hartl
 
   7  * Dual licensed under the MIT or GPL Version 2 licenses.
 
   8  * http://www.opensource.org/licenses/mit-license.php
 
   9  * http://www.opensource.org/licenses/GPL-2.0
 
  11 (function ($, document, undefined) {
 
  20                 return decodeURIComponent(s.replace(pluses, ' '));
 
  23         var config = $.cookie = function (key, value, options) {
 
  26                 if (value !== undefined) {
 
  27                         options = $.extend({}, config.defaults, options);
 
  33                         if (typeof options.expires === 'number') {
 
  34                                 var days = options.expires, t = options.expires = new Date();
 
  35                                 t.setDate(t.getDate() + days);
 
  38                         value = config.json ? JSON.stringify(value) : String(value);
 
  40                         return (document.cookie = [
 
  41                                 encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
 
  42                                 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
 
  43                                 options.path    ? '; path=' + options.path : '',
 
  44                                 options.domain  ? '; domain=' + options.domain : '',
 
  45                                 options.secure  ? '; secure' : ''
 
  50                 var decode = config.raw ? raw : decoded;
 
  51                 var cookies = document.cookie.split('; ');
 
  52                 for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) {
 
  53                         if (decode(parts.shift()) === key) {
 
  54                                 var cookie = decode(parts.join('='));
 
  55                                 return config.json ? JSON.parse(cookie) : cookie;
 
  64         $.removeCookie = function (key, options) {
 
  65                 if ($.cookie(key) !== null) {
 
  66                         $.cookie(key, null, options);