Skip to content

Commit

Permalink
Updated jquery-cookie lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Feb 2, 2015
1 parent 48d67c5 commit 621eeef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ module.exports = function( grunt ) {
'<%= dirs.js %>/admin/jquery.flot.stack.min.js': ['<%= dirs.js %>/admin/jquery.flot.stack.js'],
'<%= dirs.js %>/admin/jquery.flot.time.min.js': ['<%= dirs.js %>/admin/jquery.flot.time.js'],
'<%= dirs.js %>/jquery-payment/jquery.payment.min.js': ['<%= dirs.js %>/jquery-payment/jquery.payment.js'],
'<%= dirs.js %>/jquery-blockui/jquery.blockUI.min.js': ['<%= dirs.js %>/jquery-blockui/jquery.blockUI.js']
'<%= dirs.js %>/jquery-blockui/jquery.blockUI.min.js': ['<%= dirs.js %>/jquery-blockui/jquery.blockUI.js'],
'<%= dirs.js %>/jquery-cookie/jquery.cookie.min.js': ['<%= dirs.js %>/jquery-cookie/jquery.cookie.js'],
}
},
frontend: {
Expand Down
32 changes: 16 additions & 16 deletions assets/js/jquery-cookie/jquery.cookie.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
/*!
* jQuery Cookie Plugin v1.4.0
* jQuery Cookie Plugin v1.4.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.
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals.
// Browser globals
factory(jQuery);
}
}(function ($) {
Expand Down Expand Up @@ -38,13 +41,8 @@
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
} catch(e) {
return;
}

try {
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
Expand All @@ -57,12 +55,13 @@
var config = $.cookie = function (key, value, options) {

// Write

if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);

if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
t.setTime(+t + days * 864e+5);
}

return (document.cookie = [
Expand Down Expand Up @@ -106,12 +105,13 @@
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;
if ($.cookie(key) === undefined) {
return false;
}
return false;

// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};

}));
}));
5 changes: 3 additions & 2 deletions assets/js/jquery-cookie/jquery.cookie.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 621eeef

Please sign in to comment.