cacheable_flash 0.3.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 961455be26c61651eb110faf6af10b4bfccd10bf
4
- data.tar.gz: 9c8087e7e479bf5c8d763871d4a090dde48810ff
3
+ metadata.gz: 521a436267aa47429182e2543c6e31484b5a26a7
4
+ data.tar.gz: caa107e1cf418fa914f15841a216dd56907bf047
5
5
  SHA512:
6
- metadata.gz: 2b86f36dce97b83134ba04e0609e4860e41716b2f5471870354e9e1ac7ca4cd351f59d8e8615209ce8f85b653dc346c40a435acfa0c9442b40464ffba3d01bbf
7
- data.tar.gz: e893e5b5bb52d187dc2a792038aabec34f5316a8d98ca545beae27237c6ef9a967269f5b3e165cc2a7f007402e4f74ee8f055df33750d44c709db5b79503cca3
6
+ metadata.gz: ec4cb4e9f1e8d4851c69fc437d23fb7dcc89bf831774ce7710f580b1d40cc3efdc9d3bfd4b6082f523cbc0ed9d32ccd804f1788440280e4f2b5e63f337254182
7
+ data.tar.gz: 6cc0f31452e25ea430027c07725f9cdcbdfb6966fbc66145735d7ecab781cd2fdad7adef3a7c42a9cdb3777eb9be36fbc7dce92afab6a28169757655a34da62b
data/CHANGELOG CHANGED
@@ -1,26 +1,38 @@
1
- 0.3.4 - SEP.28.2015
1
+ ### 1.0.0 - APR.11.2017
2
+ * Moved from jquery.cookie to js.cookie
3
+
4
+
5
+ ### 0.3.5 - AUG.18.2016 (unreleased)
6
+ * `around_filter` is deprecated in Rails 5 and will be removed in Rails 5.1. Uses `around_action` if available and falls back to `around_filter` otherwise.
7
+
8
+
9
+ ### 0.3.4 - SEP.28.2015
2
10
  * Maintenance release with minor changes and a security fix
3
11
  * fix JS error when flash cookie is not set (new version of jquery.cookie returns undefined when a cookie does not exist) [nickurban]
4
12
  * Reflected XSS vulnerability fix [rubyconvict]
5
13
  * If domain is not set, do not force as empty string. Breaks IE. [ndreckshage]
6
14
  * Update CacheableFlash::RspecMatchers and rspec test suite for latest Rspec v3.3 [Peter Boling]
7
15
 
8
- 0.3.3 - SEP.13.2013
16
+
17
+ ### 0.3.3 - SEP.13.2013
9
18
  * Maintenance release with lots of minor changes and fixes.
10
19
  * Main gem should be API compatible.
11
20
  * Small changes to test helpers which will require updating tests using them.
12
21
 
13
- 0.3.2 - AUG.23.2012
22
+
23
+ ### 0.3.2 - AUG.23.2012
14
24
  * Properly handles stacked flash in cookie flash according to config :append_as option [Peter Boling]
15
25
 
16
- 0.3.1 - AUG.22.2012
26
+
27
+ ### 0.3.1 - AUG.22.2012
17
28
  * Add specs for non stacking use [Peter Boling]
18
29
  * Use stackable_flash/test_helpers instead of reinventing the wheel [Peter Boling]
19
30
  * Config now works! [Peter Boling]
20
31
  * Update to stackable_flash 0.0.7 (working config) [Peter Boling]
21
32
  * default to non stacking [Peter Boling]
22
33
 
23
- 0.3.0 - AUG.21.2012
34
+
35
+ ### 0.3.0 - AUG.21.2012
24
36
  - Completed integration with stackable_flash (http://github.com/pboling/stackable_flash)
25
37
  - Test::Unit helpers and Rspec Matchers updated to be stackable
26
38
  - Expanded test suite
@@ -32,7 +44,8 @@
32
44
  - (v0.2.X converted everything to string)
33
45
  - the CacheableFlash::Config class is experimental, and no code uses the config settings yet.
34
46
 
35
- 0.2.10 - AUG.13.2012
47
+
48
+ ### 0.2.10 - AUG.13.2012
36
49
  - Split test_helpers from rspec_matchers (test_helpers may be useful in TestUnit
37
50
  - When using Middleware: Flash Cookies now stay in the cookie until cleared out by the javascript: closer to guaranteed delivery.
38
51
  - Improved spec suite
@@ -41,44 +54,54 @@
41
54
  - Added facets runtime dependency
42
55
  - corrected namespace of CacheableFlash::CookieFlash
43
56
 
44
- 0.2.9 - AUG.08.2012
57
+
58
+ ### 0.2.9 - AUG.08.2012
45
59
  - More rearranging
46
60
  - Improved integration test of CacheableFlash & CacheableFlash::TestHelpers
47
61
  - Updated to latest jquery.cookie
48
62
 
49
- 0.2.8 - AUG.07.2012
63
+
64
+ ### 0.2.8 - AUG.07.2012
50
65
  - switch from jeweler to gem-release for bumping and tagging
51
66
  - bundler update (1.0.24)
52
67
  - Escape HTML in flash values unless they're html_safe
53
68
  - Add CacheableFlash rack middleware
54
69
 
55
- 0.2.7 - JUN.21.2012
70
+
71
+ ### 0.2.7 - JUN.21.2012
56
72
  - Note: Does not support flash.now feature of the FlashHash in Rails
57
73
  - Corrected directory names for controllers/layouts
58
74
 
59
- 0.2.6 - unreleased
75
+
76
+ ### 0.2.6 - unreleased
60
77
  - all specs pass with rspec 2.10
61
78
 
62
- 0.2.5 - MAR.01.2012
79
+
80
+ ### 0.2.5 - MAR.01.2012
63
81
  - Real integration test!
64
82
 
65
- 0.2.4 - FEB.27.2012
83
+
84
+ ### 0.2.4 - FEB.27.2012
66
85
  - Dependency diet! No longer requires all of rails - only railties.
67
86
 
68
- 0.2.3 - JAN.13.2012
87
+
88
+ ### 0.2.3 - JAN.13.2012
69
89
  - Fixed problems loading assets: Sprockets::FileNotFound - thanks jlxw
70
90
  - reflect move back to pivotal's repo in README.
71
91
  - Updated specs, to running and passing condition!
72
92
  - Made rails > 3.0 a dependency, since it is (uses ::Rails::Engine and :Rails::Railtie)
73
93
 
74
- 0.2.2 - SEP.10.2011
94
+
95
+ ### 0.2.2 - SEP.10.2011
75
96
  - Improved deprecation warnings about using the generator (not needed with asset pipeline)
76
97
  - Improved README setup instructions
77
98
 
78
- 0.2.1 - SEP.10.2011
99
+
100
+ ### 0.2.1 - SEP.10.2011
79
101
  - Fixed bug in generator for those not using asset pipeline, or pre Rails 3.1
80
102
 
81
- 0.2.0 - SEP.10.2011 [Peter Boling begins gemification process]
103
+
104
+ ### 0.2.0 - SEP.10.2011 [Peter Boling begins gemification process]
82
105
  - Converted to a gem
83
106
  - Updated to improved, patched jquery.cookie from https://github.com/pboling/jquery-cookie
84
107
  - Merged a few other forks of cacheable-flash
@@ -89,21 +112,26 @@
89
112
  Unreleased
90
113
  - Implicitly adding js files to Rails include defaults (Patch from Michael Erb)
91
114
 
92
- 0.1.5
115
+
116
+ ### 0.1.5
93
117
  - Requiring version >= 1.1.2 of the json gem
94
118
  - Converted tests into specs
95
119
 
96
- 0.1.4
120
+
121
+ ### 0.1.4
97
122
  - Added TestHelpers
98
123
  - Added flash_cookie method for tests
99
124
 
100
- 0.1.3
125
+
126
+ ### 0.1.3
101
127
  - Require json in init.rb
102
128
 
103
- 0.1.2
129
+
130
+ ### 0.1.2
104
131
  - Flash on the Rails side is cleared when written to the cookie
105
132
  - Uses existing cookie flash value
106
133
  - Using Scriptaculous cookie.js library
107
134
 
108
- 0.1.1
135
+
136
+ ### 0.1.1
109
137
  - Added cookies.js
@@ -27,13 +27,13 @@ So if you have config.assets.enabled = false in application.rb then in your layo
27
27
  javascript_include_tag :cacheable_flash
28
28
 
29
29
  Otherwise, in your layout, just source them like normal:
30
- javascript_include_tag 'flash', 'jquery.cookie'
30
+ javascript_include_tag 'flash', 'js.cookie'
31
31
 
32
32
  === With asset pipeline (requires Rails 3.1)
33
33
 
34
34
  The asset pipeline should have access to the assets in this gem via your app/assets/javascripts/application.js:
35
35
  //= require flash
36
- //= require jquery.cookie
36
+ //= require js.cookie
37
37
 
38
38
  == Mailing List
39
39
 
@@ -95,6 +95,10 @@ Use this method if you set flash messages inside a rescue_from block:
95
95
  Flash.writeDataTo('notice', $('#notice_div_id'));
96
96
  </script>
97
97
 
98
+ == Security warning
99
+ The gem is susceptible to reflected XSS attack. Make sure no non-alphanumerical
100
+ user-generated content is stored inside flash messages (html or plain text).
101
+
98
102
  == Testing
99
103
  You can test your flash cookies by making assertions on the json of the "flash" cookie.
100
104
  Cacheable Flash provides test helpers which includes the flash_cookie method.
@@ -134,7 +138,7 @@ Cacheable Flash provides test helpers which includes the flash_cookie method.
134
138
 
135
139
  describe TestController, "#index" do
136
140
  include CacheableFlash::TestHelpers
137
-
141
+
138
142
  it "writes to the flash cookie" do
139
143
  get :index
140
144
  flash_cookie["notice"].should == "In index"
@@ -153,14 +157,14 @@ Cacheable Flash provides test helpers which includes the flash_cookie method.
153
157
  == Versioning
154
158
 
155
159
  This library aims to adhere to {Semantic Versioning 2.0.0}[http://semver.org/].
156
- Violations of this scheme should be reported as bugs. Specifically,
157
- if a minor or patch version is released that breaks backward
160
+ Violations of this scheme should be reported as bugs. Specifically,
161
+ if a minor or patch version is released that breaks backward
158
162
  compatibility, a new version should be immediately released that
159
- restores compatibility. Breaking changes to the public API will
163
+ restores compatibility. Breaking changes to the public API will
160
164
  only be introduced with new major versions.
161
165
 
162
- As a result of this policy, you can (and should) specify a
163
- dependency on this gem using the {Pessimistic Version Constraint}[http://docs.rubygems.org/read/chapter/16#page74] with two digits of precision.
166
+ As a result of this policy, you can (and should) specify a
167
+ dependency on this gem using the {Pessimistic Version Constraint}[http://docs.rubygems.org/read/chapter/16#page74] with two digits of precision.
164
168
 
165
169
  For example:
166
170
 
data/init.rb CHANGED
@@ -2,5 +2,5 @@ require "json"
2
2
  require "cacheable_flash"
3
3
  #use Rails::VERSION::STRING for rails < 1 somehow -- or perhaps, who cares??
4
4
  if ::Rails::VERSION::MAJOR == 2
5
- ActionView::Helpers::AssetTagHelper.register_javascript_include_default('jquery.cookie','flash')
5
+ ActionView::Helpers::AssetTagHelper.register_javascript_include_default('js.cookie','flash')
6
6
  end
data/install.rb CHANGED
@@ -10,9 +10,9 @@ rails_javascripts_dir = "#{Rails.root}/public/javascripts"
10
10
  puts "copying flash.js to #{rails_javascripts_dir}"
11
11
  cp "#{dir}/flash.js", rails_javascripts_dir
12
12
 
13
- if File.exists?("#{rails_javascripts_dir}/jquery.cookie.js")
14
- puts "#{rails_javascripts_dir}/jquery.cookie.js already exists"
13
+ if File.exists?("#{rails_javascripts_dir}/js.cookie.js")
14
+ puts "#{rails_javascripts_dir}/js.cookie.js already exists"
15
15
  else
16
- puts "copying jquery.cookie.js to #{rails_javascripts_dir}"
17
- cp "#{dir}/jquery.cookie.js", rails_javascripts_dir
16
+ puts "copying js.cookie.js to #{rails_javascripts_dir}"
17
+ cp "#{dir}/js.cookie.js", rails_javascripts_dir
18
18
  end
@@ -23,8 +23,15 @@ module CacheableFlash
23
23
  include CacheableFlash::CookieFlash
24
24
 
25
25
  def self.included(base)
26
- #base must define around_filter, as in Rails
27
- base.around_filter :write_flash_to_cookie
26
+ #base must define around_action or around_filter, as in Rails
27
+
28
+ around_method = if base.respond_to?(:around_action)
29
+ :around_action
30
+ else
31
+ :around_filter
32
+ end
33
+
34
+ base.send around_method, :write_flash_to_cookie
28
35
  end
29
36
 
30
37
  def write_flash_to_cookie
@@ -3,7 +3,7 @@ module CacheableFlash
3
3
  # Add cacheable flash JS to defaults for Rails < 3.1 (not needed with asset pipeline)
4
4
  if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
5
5
  config.before_configuration do
6
- config.action_view.javascript_expansions[:cacheable_flash] = %w(jquery.cookie flash)
6
+ config.action_view.javascript_expansions[:cacheable_flash] = %w(js.cookie flash)
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module CacheableFlash
2
- VERSION = "0.3.4"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module CacheableFlash
4
- # Copies javascript libraries flash.js and jquery.cookie.js to public/javascripts/ (Rails 3.0.X only, Rails 3.1 has asset pipeline)
4
+ # Copies javascript libraries flash.js and js.cookie.js to public/javascripts/ (Rails 3.0.X only, Rails 3.1 has asset pipeline)
5
5
  #
6
6
  # @example
7
7
  # $ rails generate cacheable_flash:install
@@ -18,7 +18,7 @@ module CacheableFlash
18
18
  ActiveSupport::Deprecation.warn("Rails 3.1 has the asset pipeline, so you only need to copy javascript files if you aren't using it.")
19
19
  end
20
20
  template 'flash.js', 'public/javascripts/flash.js'
21
- template 'jquery.cookie.js', 'public/javascripts/jquery.cookie.js'
21
+ template 'js.cookie.js', 'public/javascripts/js.cookie.js'
22
22
  end
23
23
  end
24
24
  end
@@ -4,7 +4,7 @@ describe 'CacheableFlash' do
4
4
  attr_reader :controller_class, :controller, :cookies
5
5
  before do
6
6
  @controller_class = Struct.new(:cookies, :flash)
7
- allow(@controller_class).to receive(:around_filter)
7
+ allow(@controller_class).to receive(:around_action)
8
8
  @controller_class.send(:include, CacheableFlash)
9
9
  @controller = @controller_class.new({}, {})
10
10
  @cookies = {}
@@ -120,8 +120,8 @@ describe 'CacheableFlash' do
120
120
  end
121
121
 
122
122
  describe ".included" do
123
- it "sets the around_filter on the controller to call #write_flash_to_cookie" do
124
- expect(@controller_class).to receive(:around_filter).with(:write_flash_to_cookie)
123
+ it "sets the around_action on the controller to call #write_flash_to_cookie" do
124
+ expect(@controller_class).to receive(:around_action).with(:write_flash_to_cookie)
125
125
  @controller_class.send(:include, CacheableFlash)
126
126
  end
127
127
  end
@@ -4,10 +4,10 @@ var Flash = new Object();
4
4
  Flash.data = {};
5
5
 
6
6
  Flash.transferFromCookies = function() {
7
- var data = JSON.parse(unescape($.cookie("flash") || '{}'));
7
+ var data = JSON.parse(unescape(Cookies.get("flash") || '{}'));
8
8
  if(!data) data = {};
9
9
  Flash.data = data;
10
- $.cookie('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
10
+ Cookies.set('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
11
11
  };
12
12
 
13
13
  Flash.writeDataTo = function(name, element, callback) {
@@ -15,7 +15,7 @@ Flash.writeDataTo = function(name, element, callback) {
15
15
  var message = "";
16
16
  if (Flash.data[name]) {
17
17
  message = Flash.data[name].toString().replace(/\+/g, ' ');
18
- element.text(message);
18
+ element.html(message);
19
19
  if (callback && typeof(callback) === 'function') {
20
20
  callback(element);
21
21
  } else {
@@ -0,0 +1,137 @@
1
+ /*!
2
+ * JavaScript Cookie v2.0.0-beta.1
3
+ * https://github.com/js-cookie/js-cookie
4
+ *
5
+ * Copyright 2006, 2015 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ define(factory);
11
+ } else if (typeof exports === 'object') {
12
+ module.exports = factory();
13
+ } else {
14
+ var _OldCookies = window.Cookies;
15
+ var api = window.Cookies = factory(window.jQuery);
16
+ api.noConflict = function () {
17
+ window.Cookies = _OldCookies;
18
+ return api;
19
+ };
20
+ }
21
+ }(function () {
22
+ function extend () {
23
+ var i = 0;
24
+ var result = {};
25
+ for (; i < arguments.length; i++) {
26
+ var attributes = arguments[ i ];
27
+ for (var key in attributes) {
28
+ result[key] = attributes[key];
29
+ }
30
+ }
31
+ return result;
32
+ }
33
+
34
+ function init (converter) {
35
+ function api (key, value, attributes) {
36
+ var result;
37
+
38
+ // Write
39
+
40
+ if (arguments.length > 1) {
41
+ attributes = extend({
42
+ path: '/'
43
+ }, api.defaults, attributes);
44
+
45
+ if (typeof attributes.expires === 'number') {
46
+ var expires = new Date();
47
+ expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
48
+ attributes.expires = expires;
49
+ }
50
+
51
+ try {
52
+ result = JSON.stringify(value);
53
+ if (/^[\{\[]/.test(result)) {
54
+ value = result;
55
+ }
56
+ } catch (e) {}
57
+
58
+ value = encodeURIComponent(String(value));
59
+ value = value.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
60
+
61
+ key = encodeURIComponent(String(key));
62
+ key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
63
+ key = key.replace(/[\(\)]/g, escape);
64
+
65
+ return (document.cookie = [
66
+ key, '=', value,
67
+ attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
68
+ attributes.path && '; path=' + attributes.path,
69
+ attributes.domain && '; domain=' + attributes.domain,
70
+ attributes.secure && '; secure'
71
+ ].join(''));
72
+ }
73
+
74
+ // Read
75
+
76
+ if (!key) {
77
+ result = {};
78
+ }
79
+
80
+ // To prevent the for loop in the first place assign an empty array
81
+ // in case there are no cookies at all. Also prevents odd result when
82
+ // calling "get()"
83
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
84
+ var rdecode = /(%[0-9A-Z]{2})+/g;
85
+ var i = 0;
86
+
87
+ for (; i < cookies.length; i++) {
88
+ var parts = cookies[i].split('=');
89
+ var name = parts[0].replace(rdecode, decodeURIComponent);
90
+ var cookie = parts.slice(1).join('=');
91
+
92
+ if (cookie.charAt(0) === '"') {
93
+ cookie = cookie.slice(1, -1);
94
+ }
95
+
96
+ cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);
97
+
98
+ if (this.json) {
99
+ try {
100
+ cookie = JSON.parse(cookie);
101
+ } catch (e) {}
102
+ }
103
+
104
+ if (key === name) {
105
+ result = cookie;
106
+ break;
107
+ }
108
+
109
+ if (!key) {
110
+ result[name] = cookie;
111
+ }
112
+ }
113
+
114
+ return result;
115
+ }
116
+
117
+ api.get = api.set = api;
118
+ api.getJSON = function () {
119
+ return api.apply({
120
+ json: true
121
+ }, [].slice.call(arguments));
122
+ };
123
+ api.defaults = {};
124
+
125
+ api.remove = function (key, attributes) {
126
+ api(key, '', extend(attributes, {
127
+ expires: -1
128
+ }));
129
+ };
130
+
131
+ api.withConverter = init;
132
+
133
+ return api;
134
+ }
135
+
136
+ return init();
137
+ }));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacheable_flash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-28 00:00:00.000000000 Z
12
+ date: 2017-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: stackable_flash
@@ -219,7 +219,7 @@ files:
219
219
  - spec/spec_helper.rb
220
220
  - tasks/cacheable_flash_tasks.rake
221
221
  - vendor/assets/javascripts/flash.js.erb
222
- - vendor/assets/javascripts/jquery.cookie.js
222
+ - vendor/assets/javascripts/js.cookie.js
223
223
  homepage: http://github.com/pivotal/cacheable-flash
224
224
  licenses:
225
225
  - MIT
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.4.8
243
+ rubygems_version: 2.6.8
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: Render flash messages from a cookie using JavaScript, instead of in your
@@ -292,4 +292,3 @@ test_files:
292
292
  - spec/js_unit/flash_test.html
293
293
  - spec/requests/integration_spec.rb
294
294
  - spec/spec_helper.rb
295
- has_rdoc:
@@ -1,47 +0,0 @@
1
- /*!
2
- * jQuery Cookie Plugin
3
- * https://github.com/carhartl/jquery-cookie
4
- *
5
- * Copyright 2011, Klaus Hartl
6
- * Dual licensed under the MIT or GPL Version 2 licenses.
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.opensource.org/licenses/GPL-2.0
9
- */
10
- (function($) {
11
- $.cookie = function(key, value, options) {
12
-
13
- // key and at least value given, set cookie...
14
- if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
15
- options = $.extend({}, options);
16
-
17
- if (value === null || value === undefined) {
18
- options.expires = -1;
19
- }
20
-
21
- if (typeof options.expires === 'number') {
22
- var days = options.expires, t = options.expires = new Date();
23
- t.setDate(t.getDate() + days);
24
- }
25
-
26
- value = String(value);
27
-
28
- return (document.cookie = [
29
- encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
30
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
31
- options.path ? '; path=' + options.path : '',
32
- options.domain ? '; domain=' + options.domain : '',
33
- options.secure ? '; secure' : ''
34
- ].join(''));
35
- }
36
-
37
- // key and possibly options given, get cookie...
38
- options = value || {};
39
- var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
40
-
41
- var pairs = document.cookie.split('; ');
42
- for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
43
- if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
44
- }
45
- return null;
46
- };
47
- })(jQuery);