js_cookie_rails 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99d98105c5b2c6141bb2b9b8738891b30d3aa7be
4
- data.tar.gz: 36207bdf92380b76a94536323a5dc27027836c8c
3
+ metadata.gz: 6918f292607b303cd4893242fd43954b021177d8
4
+ data.tar.gz: 63bc53ce8bdc4b48bff5b1ac8cf8f7b113d8a5c8
5
5
  SHA512:
6
- metadata.gz: 041f8211224d91f7d056429f21a4fd70e5302d0a57d941ae7361d076c2018c713e59be4143cf0fbbdea266b2cf994a6f14f39347073a4f5fe3e916b66a6050f6
7
- data.tar.gz: 34c079e566ec69c8282a0119c2dfa22e33b3e1477df7361114ab4fa60721757e2d3c5d8d5fee5a798af2db6eacfbb18aa995101a4af0f48f53a718a7ed3754ea
6
+ metadata.gz: eca07c0043caa4375f5108cc8dcbff122244d486ff745f027eb59b99d686f3155a474326118e383e069c9c018fe136ed652e43a4cdb6c3a22cc9c731fcced395
7
+ data.tar.gz: a3fa688895845cc61e087a46ce933fca31408745d1d5cf379792a6df91c4a06346091a77031e6f5fd682088df9acdea53b84c5d7835fa72c5024a8431383a9d4
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Alessandro Lepore
3
+ Copyright (c) 2017 Alessandro Lepore
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,3 +1,3 @@
1
1
  module JsCookieRails
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.4"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * JavaScript Cookie v2.1.3
2
+ * JavaScript Cookie v2.1.4
3
3
  * https://github.com/js-cookie/js-cookie
4
4
  *
5
5
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
@@ -56,6 +56,9 @@
56
56
  attributes.expires = expires;
57
57
  }
58
58
 
59
+ // We're using "expires" because "max-age" is not supported by IE
60
+ attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
61
+
59
62
  try {
60
63
  result = JSON.stringify(value);
61
64
  if (/^[\{\[]/.test(result)) {
@@ -74,13 +77,19 @@
74
77
  key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
75
78
  key = key.replace(/[\(\)]/g, escape);
76
79
 
77
- return (document.cookie = [
78
- key, '=', value,
79
- attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
80
- attributes.path ? '; path=' + attributes.path : '',
81
- attributes.domain ? '; domain=' + attributes.domain : '',
82
- attributes.secure ? '; secure' : ''
83
- ].join(''));
80
+ var stringifiedAttributes = '';
81
+
82
+ for (var attributeName in attributes) {
83
+ if (!attributes[attributeName]) {
84
+ continue;
85
+ }
86
+ stringifiedAttributes += '; ' + attributeName;
87
+ if (attributes[attributeName] === true) {
88
+ continue;
89
+ }
90
+ stringifiedAttributes += '=' + attributes[attributeName];
91
+ }
92
+ return (document.cookie = key + '=' + value + stringifiedAttributes);
84
93
  }
85
94
 
86
95
  // Read
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_cookie_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Lepore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.8
97
+ rubygems_version: 2.5.1
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Adds js-cookie to the Rails asset pipeline.