js-cookie 2.1.1 → 2.2.0
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.
- package/{MIT-LICENSE.txt → LICENSE} +0 -0
- package/README.md +39 -12
- package/package.json +17 -12
- package/src/js.cookie.js +27 -13
- package/.jshintignore +0 -2
- package/.jshintrc +0 -14
- package/.npmignore +0 -4
- package/.tm_properties +0 -11
- package/.travis.yml +0 -12
- package/Gruntfile.js +0 -243
- package/bower.json +0 -18
- package/src/.jshintrc +0 -13
- package/test/.jshintrc +0 -16
- package/test/amd-config.js +0 -9
- package/test/amd.html +0 -15
- package/test/amd.js +0 -14
- package/test/encoding.html +0 -18
- package/test/encoding.js +0 -628
- package/test/index.html +0 -18
- package/test/malformed_cookie.html +0 -17
- package/test/missing_semicolon.html +0 -24
- package/test/node.js +0 -29
- package/test/polyfill.js +0 -11
- package/test/tests.js +0 -403
- package/test/utils.js +0 -122
- package/travis.sh +0 -6
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://cloud.githubusercontent.com/assets/835857/14581711/ba623018-0436-11e6-8fce-d2ccd4d379c9.gif">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# JavaScript Cookie [](https://travis-ci.org/js-cookie/js-cookie) [](https://codeclimate.com/github/js-cookie/js-cookie) [](https://www.jsdelivr.com/package/npm/js-cookie)
|
|
2
6
|
|
|
3
7
|
A simple, lightweight JavaScript API for handling cookies
|
|
4
8
|
|
|
@@ -9,12 +13,12 @@ A simple, lightweight JavaScript API for handling cookies
|
|
|
9
13
|
* [Unobtrusive](#json) JSON support
|
|
10
14
|
* Supports AMD/CommonJS
|
|
11
15
|
* [RFC 6265](https://tools.ietf.org/html/rfc6265) compliant
|
|
12
|
-
*
|
|
16
|
+
* Useful [Wiki](https://github.com/js-cookie/js-cookie/wiki)
|
|
13
17
|
* Enable [custom encoding/decoding](#converters)
|
|
14
|
-
* **~
|
|
18
|
+
* **~900 bytes** gzipped!
|
|
15
19
|
|
|
16
20
|
**If you're viewing this at https://github.com/js-cookie/js-cookie, you're reading the documentation for the master branch.
|
|
17
|
-
[View documentation for the latest release
|
|
21
|
+
[View documentation for the latest release.](https://github.com/js-cookie/js-cookie/tree/latest#readme)**
|
|
18
22
|
|
|
19
23
|
## Build Status Matrix
|
|
20
24
|
|
|
@@ -22,18 +26,30 @@ A simple, lightweight JavaScript API for handling cookies
|
|
|
22
26
|
|
|
23
27
|
## Installation
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
### Direct download
|
|
30
|
+
|
|
31
|
+
Download the script [here](https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js) and include it (unless you are packaging scripts somehow else):
|
|
26
32
|
|
|
27
33
|
```html
|
|
28
34
|
<script src="/path/to/js.cookie.js"></script>
|
|
29
35
|
```
|
|
30
36
|
|
|
37
|
+
Or include it via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/js-cookie):
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
|
|
41
|
+
```
|
|
42
|
+
|
|
31
43
|
**Do not include the script directly from GitHub (http://raw.github.com/...).** The file is being served as text/plain and as such being blocked
|
|
32
44
|
in Internet Explorer on Windows 7 for instance (because of the wrong MIME type). Bottom line: GitHub is not a CDN.
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
### Package Managers
|
|
47
|
+
|
|
48
|
+
JavaScript Cookie supports [npm](https://www.npmjs.com/package/js-cookie) and [Bower](http://bower.io/search/?q=js-cookie) under the name `js-cookie`.
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
### Module Loaders
|
|
51
|
+
|
|
52
|
+
JavaScript Cookie can also be loaded as an AMD, CommonJS or [ES6](https://github.com/js-cookie/js-cookie/issues/233#issuecomment-233187386) module.
|
|
37
53
|
|
|
38
54
|
## Basic Usage
|
|
39
55
|
|
|
@@ -82,7 +98,9 @@ Cookies.remove('name'); // fail!
|
|
|
82
98
|
Cookies.remove('name', { path: '' }); // removed!
|
|
83
99
|
```
|
|
84
100
|
|
|
85
|
-
*IMPORTANT! when deleting a cookie, you must pass the exact same path
|
|
101
|
+
*IMPORTANT! when deleting a cookie, you must pass the exact same path and domain attributes that was used to set the cookie, unless you're relying on the [default attributes](#cookie-attributes).*
|
|
102
|
+
|
|
103
|
+
*Note: Removing unexisting cookie does not raise any exception nor return any value*
|
|
86
104
|
|
|
87
105
|
## Namespace conflicts
|
|
88
106
|
|
|
@@ -132,7 +150,7 @@ Cookies.getJSON(); // => { name: { foo: 'bar' } }
|
|
|
132
150
|
|
|
133
151
|
This project is [RFC 6265](http://tools.ietf.org/html/rfc6265#section-4.1.1) compliant. All special characters that are not allowed in the cookie-name or cookie-value are encoded with each one's UTF-8 Hex equivalent using [percent-encoding](http://en.wikipedia.org/wiki/Percent-encoding).
|
|
134
152
|
The only character in cookie-name or cookie-value that is allowed and still encoded is the percent `%` character, it is escaped in order to interpret percent input as literal.
|
|
135
|
-
To override the default
|
|
153
|
+
Please note that the default encoding/decoding strategy is meant to be interoperable [only between cookies that are read/written by js-cookie](https://github.com/js-cookie/js-cookie/pull/200#discussion_r63270778). To override the default encoding/decoding strategy you need to use a [converter](#converters).
|
|
136
154
|
|
|
137
155
|
## Cookie Attributes
|
|
138
156
|
|
|
@@ -142,6 +160,8 @@ Cookie attributes defaults can be set globally by setting properties of the `Coo
|
|
|
142
160
|
|
|
143
161
|
Define when the cookie will be removed. Value can be a [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) which will be interpreted as days from time of creation or a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. If omitted, the cookie becomes a session cookie.
|
|
144
162
|
|
|
163
|
+
To create a cookie that expires in less than a day, you can check the [FAQ on the Wiki](https://github.com/js-cookie/js-cookie/wiki/Frequently-Asked-Questions#expire-cookies-in-less-than-a-day).
|
|
164
|
+
|
|
145
165
|
**Default:** Cookie is removed when the user closes the browser.
|
|
146
166
|
|
|
147
167
|
**Examples:**
|
|
@@ -210,7 +230,7 @@ Either `true` or `false`, indicating if the cookie transmission requires a secur
|
|
|
210
230
|
```javascript
|
|
211
231
|
Cookies.set('name', 'value', { secure: true });
|
|
212
232
|
Cookies.get('name'); // => 'value'
|
|
213
|
-
Cookies.remove('name'
|
|
233
|
+
Cookies.remove('name');
|
|
214
234
|
```
|
|
215
235
|
|
|
216
236
|
## Converters
|
|
@@ -259,15 +279,22 @@ Check out the [Servers Docs](SERVER_SIDE.md)
|
|
|
259
279
|
|
|
260
280
|
Check out the [Contributing Guidelines](CONTRIBUTING.md)
|
|
261
281
|
|
|
282
|
+
## Security
|
|
283
|
+
|
|
284
|
+
For vulnerability reports, send an e-mail to `jscookieproject at gmail dot com`
|
|
285
|
+
|
|
262
286
|
## Manual release steps
|
|
263
287
|
|
|
264
288
|
* Increment the "version" attribute of `package.json`
|
|
265
289
|
* Increment the version number in the `src/js.cookie.js` file
|
|
290
|
+
* If `major` bump, update jsDelivr CDN major version link on README
|
|
266
291
|
* Commit with the message "Release version x.x.x"
|
|
267
292
|
* Create version tag in git
|
|
268
293
|
* Create a github release and upload the minified file
|
|
269
|
-
*
|
|
270
|
-
*
|
|
294
|
+
* Change the `latest` tag pointer to the latest commit
|
|
295
|
+
* `git tag -f latest`
|
|
296
|
+
* `git push <remote> :refs/tags/latest`
|
|
297
|
+
* `git push origin master --tags`
|
|
271
298
|
* Release on npm
|
|
272
299
|
|
|
273
300
|
## Authors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-cookie",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A simple, lightweight JavaScript API for handling cookies",
|
|
5
5
|
"main": "src/js.cookie.js",
|
|
6
6
|
"directories": {
|
|
@@ -24,21 +24,26 @@
|
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git://github.com/js-cookie/js-cookie.git"
|
|
26
26
|
},
|
|
27
|
+
"files": [
|
|
28
|
+
"src/**/*.js",
|
|
29
|
+
"SERVER_SIDE.md",
|
|
30
|
+
"CONTRIBUTING.md"
|
|
31
|
+
],
|
|
27
32
|
"author": "Klaus Hartl",
|
|
28
33
|
"license": "MIT",
|
|
29
34
|
"devDependencies": {
|
|
30
|
-
"grunt": "1.0.
|
|
31
|
-
"grunt-compare-size": "0.4.
|
|
32
|
-
"grunt-contrib-connect": "1.0.
|
|
33
|
-
"grunt-contrib-jshint": "1.
|
|
34
|
-
"grunt-contrib-nodeunit": "0.
|
|
35
|
-
"grunt-contrib-qunit": "
|
|
36
|
-
"grunt-contrib-uglify": "
|
|
35
|
+
"grunt": "1.0.1",
|
|
36
|
+
"grunt-compare-size": "0.4.2",
|
|
37
|
+
"grunt-contrib-connect": "1.0.2",
|
|
38
|
+
"grunt-contrib-jshint": "1.1.0",
|
|
39
|
+
"grunt-contrib-nodeunit": "1.0.0",
|
|
40
|
+
"grunt-contrib-qunit": "2.0.0",
|
|
41
|
+
"grunt-contrib-uglify": "2.3.0",
|
|
37
42
|
"grunt-contrib-watch": "1.0.0",
|
|
38
|
-
"grunt-jscs": "
|
|
39
|
-
"grunt-saucelabs": "
|
|
43
|
+
"grunt-jscs": "3.0.1",
|
|
44
|
+
"grunt-saucelabs": "9.0.0",
|
|
40
45
|
"gzip-js": "0.3.2",
|
|
41
|
-
"qunitjs": "1.23.
|
|
42
|
-
"requirejs": "2.
|
|
46
|
+
"qunitjs": "1.23.1",
|
|
47
|
+
"requirejs": "2.3.5"
|
|
43
48
|
}
|
|
44
49
|
}
|
package/src/js.cookie.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* JavaScript Cookie v2.
|
|
2
|
+
* JavaScript Cookie v2.2.0
|
|
3
3
|
* https://github.com/js-cookie/js-cookie
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*/
|
|
8
8
|
;(function (factory) {
|
|
9
|
+
var registeredInModuleLoader = false;
|
|
9
10
|
if (typeof define === 'function' && define.amd) {
|
|
10
11
|
define(factory);
|
|
11
|
-
|
|
12
|
+
registeredInModuleLoader = true;
|
|
13
|
+
}
|
|
14
|
+
if (typeof exports === 'object') {
|
|
12
15
|
module.exports = factory();
|
|
13
|
-
|
|
16
|
+
registeredInModuleLoader = true;
|
|
17
|
+
}
|
|
18
|
+
if (!registeredInModuleLoader) {
|
|
14
19
|
var OldCookies = window.Cookies;
|
|
15
20
|
var api = window.Cookies = factory();
|
|
16
21
|
api.noConflict = function () {
|
|
@@ -51,6 +56,9 @@
|
|
|
51
56
|
attributes.expires = expires;
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
// We're using "expires" because "max-age" is not supported by IE
|
|
60
|
+
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
|
61
|
+
|
|
54
62
|
try {
|
|
55
63
|
result = JSON.stringify(value);
|
|
56
64
|
if (/^[\{\[]/.test(result)) {
|
|
@@ -69,13 +77,19 @@
|
|
|
69
77
|
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
|
70
78
|
key = key.replace(/[\(\)]/g, escape);
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
attributes
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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);
|
|
79
93
|
}
|
|
80
94
|
|
|
81
95
|
// Read
|
|
@@ -93,14 +107,14 @@
|
|
|
93
107
|
|
|
94
108
|
for (; i < cookies.length; i++) {
|
|
95
109
|
var parts = cookies[i].split('=');
|
|
96
|
-
var name = parts[0].replace(rdecode, decodeURIComponent);
|
|
97
110
|
var cookie = parts.slice(1).join('=');
|
|
98
111
|
|
|
99
|
-
if (cookie.charAt(0) === '"') {
|
|
112
|
+
if (!this.json && cookie.charAt(0) === '"') {
|
|
100
113
|
cookie = cookie.slice(1, -1);
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
try {
|
|
117
|
+
var name = parts[0].replace(rdecode, decodeURIComponent);
|
|
104
118
|
cookie = converter.read ?
|
|
105
119
|
converter.read(cookie, name) : converter(cookie, name) ||
|
|
106
120
|
cookie.replace(rdecode, decodeURIComponent);
|
|
@@ -127,7 +141,7 @@
|
|
|
127
141
|
|
|
128
142
|
api.set = api;
|
|
129
143
|
api.get = function (key) {
|
|
130
|
-
return api(key);
|
|
144
|
+
return api.call(api, key);
|
|
131
145
|
};
|
|
132
146
|
api.getJSON = function () {
|
|
133
147
|
return api.apply({
|
package/.jshintignore
DELETED
package/.jshintrc
DELETED
package/.npmignore
DELETED
package/.tm_properties
DELETED
package/.travis.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
node_js:
|
|
3
|
-
- '5.1.1'
|
|
4
|
-
# Only use grunt-ci for commits pushed to this repo. Fall back to regular test
|
|
5
|
-
# for pull requests (as secure variables won't be exposed there).
|
|
6
|
-
script:
|
|
7
|
-
- ./travis.sh
|
|
8
|
-
env:
|
|
9
|
-
# Encrypted SAUCE_USERNAME and SAUCE_ACCESS_KEY used by travis
|
|
10
|
-
global:
|
|
11
|
-
- secure: IkMOa/8r4sWyzUMxecsfqoPzZyIqVAMwPkQ6/HxXPbT8X7UnvqAdaicAMeHEKtOnOac+rx6pGB9HQvC8P/ZzkEBtsKLP4nEh9vsAInZvb3pXg+qbIgIK6/19X0kU4UkpDqVdWmBuFTamJvMDMstUTgEaM3869bB5vGp9taBgfVo=
|
|
12
|
-
- secure: DKrQplF0CBiBh+cbQ8D7EKebCeklUWEELblIJdU4475Occ4G9b8ZFYO9HFwl1B8F/XapB7CsMyxbJCWor030FySeqn8bhJs9NoAVoYGg+MtWniv1EOHuZLWuOGfgQDv7qj5U0Af9Y655MmUpXSN2aDlCmQweWnYdpFTM9Dfsdd8=
|
package/Gruntfile.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/*jshint node:true */
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
module.exports = function (grunt) {
|
|
5
|
-
|
|
6
|
-
function encodingMiddleware(request, response, next) {
|
|
7
|
-
var url = require('url').parse(request.url, true, true);
|
|
8
|
-
var query = url.query;
|
|
9
|
-
var pathname = url.pathname;
|
|
10
|
-
|
|
11
|
-
if (pathname !== '/encoding') {
|
|
12
|
-
next();
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var cookieName = query.name;
|
|
17
|
-
var cookieValue = query.value;
|
|
18
|
-
|
|
19
|
-
response.setHeader('content-type', 'application/json');
|
|
20
|
-
response.end(JSON.stringify({
|
|
21
|
-
name: cookieName,
|
|
22
|
-
value: cookieValue
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
grunt.initConfig({
|
|
27
|
-
pkg: grunt.file.readJSON('package.json'),
|
|
28
|
-
qunit: {
|
|
29
|
-
all: {
|
|
30
|
-
options: {
|
|
31
|
-
urls: [
|
|
32
|
-
'http://127.0.0.1:9998/',
|
|
33
|
-
'http://127.0.0.1:9998/amd.html',
|
|
34
|
-
'http://127.0.0.1:9998/encoding.html?integration_baseurl=http://127.0.0.1:9998/'
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
nodeunit: {
|
|
40
|
-
all: 'test/node.js'
|
|
41
|
-
},
|
|
42
|
-
jshint: {
|
|
43
|
-
options: {
|
|
44
|
-
jshintrc: true
|
|
45
|
-
},
|
|
46
|
-
grunt: 'Gruntfile.js',
|
|
47
|
-
source: 'src/**/*.js',
|
|
48
|
-
tests: ['test/**/*.js', '!test/polyfill.js']
|
|
49
|
-
},
|
|
50
|
-
jscs: {
|
|
51
|
-
options: {
|
|
52
|
-
requireCommaBeforeLineBreak: true,
|
|
53
|
-
requireLineFeedAtFileEnd: true,
|
|
54
|
-
requireSemicolons: true,
|
|
55
|
-
requireSpaceBeforeKeywords: ['else', 'while', 'catch'],
|
|
56
|
-
requireSpaceAfterKeywords: true,
|
|
57
|
-
requireSpaceAfterLineComment: true,
|
|
58
|
-
requireSpaceBeforeBlockStatements: true,
|
|
59
|
-
requireSpaceBeforeObjectValues: true,
|
|
60
|
-
validateIndentation: '\t',
|
|
61
|
-
validateLineBreaks: 'LF',
|
|
62
|
-
validateQuoteMarks: true,
|
|
63
|
-
disallowSpacesInsideArrayBrackets: 'all',
|
|
64
|
-
disallowSpacesInsideParentheses: true,
|
|
65
|
-
disallowTrailingWhitespace: true
|
|
66
|
-
},
|
|
67
|
-
grunt: 'Gruntfile.js',
|
|
68
|
-
source: 'src/**/*.js',
|
|
69
|
-
tests: ['test/**/*.js', '!test/polyfill.js']
|
|
70
|
-
},
|
|
71
|
-
uglify: {
|
|
72
|
-
options: {
|
|
73
|
-
banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */\n'
|
|
74
|
-
},
|
|
75
|
-
build: {
|
|
76
|
-
files: {
|
|
77
|
-
'build/js.cookie-<%= pkg.version %>.min.js': 'src/js.cookie.js'
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
watch: {
|
|
82
|
-
options: {
|
|
83
|
-
livereload: true
|
|
84
|
-
},
|
|
85
|
-
files: '{src,test}/**/*.js',
|
|
86
|
-
tasks: 'default'
|
|
87
|
-
},
|
|
88
|
-
compare_size: {
|
|
89
|
-
files: [
|
|
90
|
-
'build/js.cookie-<%= pkg.version %>.min.js',
|
|
91
|
-
'src/js.cookie.js'
|
|
92
|
-
],
|
|
93
|
-
options: {
|
|
94
|
-
compress: {
|
|
95
|
-
gz: function (fileContents) {
|
|
96
|
-
return require('gzip-js').zip(fileContents, {}).length;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
connect: {
|
|
102
|
-
'build-qunit': {
|
|
103
|
-
options: {
|
|
104
|
-
port: 9998,
|
|
105
|
-
base: ['.', 'test'],
|
|
106
|
-
middleware: function (connect, options, middlewares) {
|
|
107
|
-
middlewares.unshift(encodingMiddleware);
|
|
108
|
-
return middlewares;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
'build-sauce': {
|
|
113
|
-
options: {
|
|
114
|
-
port: 9999,
|
|
115
|
-
base: ['.', 'test']
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
tests: {
|
|
119
|
-
options: {
|
|
120
|
-
port: 10000,
|
|
121
|
-
base: ['.', 'test'],
|
|
122
|
-
open: 'http://127.0.0.1:10000',
|
|
123
|
-
keepalive: true,
|
|
124
|
-
livereload: true,
|
|
125
|
-
middleware: function (connect, options, middlewares) {
|
|
126
|
-
middlewares.unshift(encodingMiddleware);
|
|
127
|
-
return middlewares;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
'saucelabs-qunit': {
|
|
133
|
-
all: {
|
|
134
|
-
options: {
|
|
135
|
-
urls: ['http://127.0.0.1:9999'],
|
|
136
|
-
testname: 'Sauce Test for js-cookie',
|
|
137
|
-
build: process.env.TRAVIS_JOB_ID,
|
|
138
|
-
pollInterval: 10000,
|
|
139
|
-
statusCheckAttempts: 90,
|
|
140
|
-
throttled: 3,
|
|
141
|
-
browsers: (function () {
|
|
142
|
-
var browsers = {
|
|
143
|
-
'iOS': [{
|
|
144
|
-
browserName: 'iphone',
|
|
145
|
-
platform: 'OS X 10.10',
|
|
146
|
-
version: '8.2',
|
|
147
|
-
deviceName: 'iPhone Simulator'
|
|
148
|
-
}, {
|
|
149
|
-
browserName: 'iphone',
|
|
150
|
-
platform: 'OS X 10.10',
|
|
151
|
-
version: '8.2',
|
|
152
|
-
deviceName: 'iPad Simulator'
|
|
153
|
-
}],
|
|
154
|
-
'android': [{
|
|
155
|
-
browserName: 'android',
|
|
156
|
-
platform: 'Linux',
|
|
157
|
-
version: '5.1',
|
|
158
|
-
deviceName: 'Android Emulator'
|
|
159
|
-
}],
|
|
160
|
-
'mac': [{
|
|
161
|
-
browserName: 'safari',
|
|
162
|
-
platform: 'OS X 10.10',
|
|
163
|
-
version: '8.0'
|
|
164
|
-
}, {
|
|
165
|
-
browserName: 'firefox',
|
|
166
|
-
platform: 'OS X 10.10',
|
|
167
|
-
version: '36.0'
|
|
168
|
-
}, {
|
|
169
|
-
browserName: 'chrome',
|
|
170
|
-
platform: 'OS X 10.10',
|
|
171
|
-
versiono: '41.0'
|
|
172
|
-
}],
|
|
173
|
-
'windows7': [{
|
|
174
|
-
browserName: 'internet explorer',
|
|
175
|
-
platform: 'Windows 7',
|
|
176
|
-
version: '11.0'
|
|
177
|
-
}, {
|
|
178
|
-
browserName: 'internet explorer',
|
|
179
|
-
platform: 'Windows 7',
|
|
180
|
-
version: '10.0'
|
|
181
|
-
}, {
|
|
182
|
-
browserName: 'internet explorer',
|
|
183
|
-
platform: 'Windows 7',
|
|
184
|
-
version: '9.0'
|
|
185
|
-
}, {
|
|
186
|
-
browserName: 'opera',
|
|
187
|
-
platform: 'Windows 7',
|
|
188
|
-
version: '12.12'
|
|
189
|
-
}],
|
|
190
|
-
'windowsXP': [{
|
|
191
|
-
browserName: 'internet explorer',
|
|
192
|
-
platform: 'Windows XP',
|
|
193
|
-
version: '8.0'
|
|
194
|
-
}, {
|
|
195
|
-
browserName: 'internet explorer',
|
|
196
|
-
platform: 'Windows XP',
|
|
197
|
-
version: '7.0'
|
|
198
|
-
}, {
|
|
199
|
-
browserName: 'internet explorer',
|
|
200
|
-
platform: 'Windows XP',
|
|
201
|
-
version: '6.0'
|
|
202
|
-
}],
|
|
203
|
-
'linux': [{
|
|
204
|
-
browserName: 'opera',
|
|
205
|
-
platform: 'Linux',
|
|
206
|
-
version: '12.15'
|
|
207
|
-
}, {
|
|
208
|
-
browserName: 'firefox',
|
|
209
|
-
platform: 'Linux',
|
|
210
|
-
version: '37.0'
|
|
211
|
-
}, {
|
|
212
|
-
browserName: 'chrome',
|
|
213
|
-
platform: 'Linux',
|
|
214
|
-
version: '41.0'
|
|
215
|
-
}]
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
var matrix = [];
|
|
219
|
-
for (var os in browsers) {
|
|
220
|
-
matrix = matrix.concat(browsers[os]);
|
|
221
|
-
}
|
|
222
|
-
return matrix;
|
|
223
|
-
}())
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// Loading dependencies
|
|
230
|
-
for (var key in grunt.file.readJSON('package.json').devDependencies) {
|
|
231
|
-
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
|
|
232
|
-
grunt.loadNpmTasks(key);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
grunt.registerTask('saucelabs', ['connect:build-sauce', 'saucelabs-qunit']);
|
|
237
|
-
grunt.registerTask('test', ['jshint', 'jscs', 'connect:build-qunit', 'qunit', 'nodeunit']);
|
|
238
|
-
|
|
239
|
-
grunt.registerTask('dev', ['test', 'uglify', 'compare_size']);
|
|
240
|
-
grunt.registerTask('ci', ['test', 'saucelabs']);
|
|
241
|
-
|
|
242
|
-
grunt.registerTask('default', 'dev');
|
|
243
|
-
};
|
package/bower.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "js-cookie",
|
|
3
|
-
"license": "MIT",
|
|
4
|
-
"main": [
|
|
5
|
-
"src/js.cookie.js"
|
|
6
|
-
],
|
|
7
|
-
"ignore": [
|
|
8
|
-
"travis.sh",
|
|
9
|
-
"test",
|
|
10
|
-
"Gruntfile.js",
|
|
11
|
-
"package.json",
|
|
12
|
-
".gitignore",
|
|
13
|
-
".jshintignore",
|
|
14
|
-
".jshintrc",
|
|
15
|
-
".tm_properties",
|
|
16
|
-
".travis.yml"
|
|
17
|
-
]
|
|
18
|
-
}
|
package/src/.jshintrc
DELETED
package/test/.jshintrc
DELETED
package/test/amd-config.js
DELETED
package/test/amd.html
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JavaScript Cookie Test Suite - AMD</title>
|
|
6
|
-
<link href="../node_modules/qunitjs/qunit/qunit.css" rel="stylesheet">
|
|
7
|
-
<script src="amd-config.js"></script>
|
|
8
|
-
<script src="../node_modules/requirejs/require.js"></script>
|
|
9
|
-
<script src="amd.js"></script>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="qunit"></div>
|
|
13
|
-
<div id="qunit-fixture"></div>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|
package/test/amd.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require(['qunit'], function (QUnit) {
|
|
2
|
-
QUnit.module('amd');
|
|
3
|
-
|
|
4
|
-
QUnit.start();
|
|
5
|
-
QUnit.test('module loading', function (assert) {
|
|
6
|
-
QUnit.expect(1);
|
|
7
|
-
var done = assert.async();
|
|
8
|
-
require(['/src/js.cookie.js'], function (Cookies) {
|
|
9
|
-
assert.ok(!!Cookies.get, 'should load the api');
|
|
10
|
-
done();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
});
|
package/test/encoding.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JavaScript Cookie Test Suite - Encoding</title>
|
|
6
|
-
<link href="../node_modules/qunitjs/qunit/qunit.css" rel="stylesheet">
|
|
7
|
-
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
|
8
|
-
<script src="../src/js.cookie.js"></script>
|
|
9
|
-
<script src="utils.js"></script>
|
|
10
|
-
<script src="encoding.js"></script>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<div id="qunit"></div>
|
|
14
|
-
<div id="qunit-fixture">
|
|
15
|
-
<iframe id="request_target"></iframe>
|
|
16
|
-
</div>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|