vendor/assets/javascripts/js.cookie.js in js_cookie_rails-1.0.0 vs vendor/assets/javascripts/js.cookie.js in js_cookie_rails-1.0.1
- old
+ new
@@ -1,20 +1,20 @@
/*!
- * JavaScript Cookie v2.0.0-pre
+ * JavaScript Cookie v2.0.3
* https://github.com/js-cookie/js-cookie
*
- * Copyright 2006, 2015 Klaus Hartl
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
var _OldCookies = window.Cookies;
- var api = window.Cookies = factory(window.jQuery);
+ var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = _OldCookies;
return api;
};
}
@@ -65,11 +65,11 @@
return (document.cookie = [
key, '=', value,
attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
attributes.path && '; path=' + attributes.path,
attributes.domain && '; domain=' + attributes.domain,
- attributes.secure && '; secure'
+ attributes.secure ? '; secure' : ''
].join(''));
}
// Read
@@ -91,25 +91,27 @@
if (cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
- cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);
+ try {
+ cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);
- if (this.json) {
- try {
- cookie = JSON.parse(cookie);
- } catch (e) {}
- }
+ if (this.json) {
+ try {
+ cookie = JSON.parse(cookie);
+ } catch (e) {}
+ }
- if (key === name) {
- result = cookie;
- break;
- }
+ if (key === name) {
+ result = cookie;
+ break;
+ }
- if (!key) {
- result[name] = cookie;
- }
+ if (!key) {
+ result[name] = cookie;
+ }
+ } catch (e) {}
}
return result;
}