zebra_cookie
Advanced tools
Comparing version
{ | ||
"name": "zebra_cookie", | ||
"version": "1.0.7", | ||
"main": "public/javascript/zebra_cookie.js", | ||
"homepage": "https://github.com/stefangabos/Zebra_Cookie", | ||
"description": "An ridiculously small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies", | ||
"author": { | ||
@@ -10,3 +8,4 @@ "name": "Stefan Gabos", | ||
}, | ||
"description": "An extremely small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies", | ||
"homepage": "https://github.com/stefangabos/Zebra_Cookie", | ||
"main": "dist/zebra_cookie.min.js", | ||
"repository": { | ||
@@ -16,6 +15,4 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/stefangabos/Zebra_Cookie/issues", | ||
"email": "contact@stefangabos.ro" | ||
}, | ||
"license": "LGPL-3.0", | ||
"version": "1.1.0", | ||
"keywords": [ | ||
@@ -27,17 +24,21 @@ "jquery-plugin", | ||
"client", | ||
"browser" | ||
"browser", | ||
"jquery" | ||
], | ||
"licenses": [ | ||
{ | ||
"type": "LGPL", | ||
"url": "https://www.gnu.org/licenses/lgpl-3.0.txt" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/stefangabos/Zebra_cookie/issues", | ||
"email": "contact@stefangabos.ro" | ||
}, | ||
"devDependencies": { | ||
"grunt": "*", | ||
"grunt-cli": "*", | ||
"grunt-contrib-copy": "*", | ||
"grunt-contrib-jshint": "*", | ||
"grunt-contrib-uglify": "*", | ||
"grunt-cli": "*", | ||
"grunt-contrib-watch": "*" | ||
"grunt-contrib-watch": "*", | ||
"grunt-eslint": "*", | ||
"grunt-newer": "*", | ||
"grunt-notify": "*", | ||
"time-grunt": "*" | ||
} | ||
} |
130
README.md
@@ -1,41 +0,63 @@ | ||
## Zebra_Cookie | ||
<img src="https://raw.githubusercontent.com/stefangabos/zebrajs/master/docs/images/logo.png" alt="zebrajs" align="right"> | ||
####An extremely small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies | ||
# Zebra_Cookie | ||
##Features | ||
*A ridiculously small (~500 bytes minified) jQuery plugin for writing, reading and deleting cookies* | ||
- easily write, read and delete cookies | ||
- very simple and intuitive syntax, blending perfectly with jQuery | ||
- extremely small: with around 500 bytes when minified is probably the smallest and most optimized jQuery plugin for handling cookies | ||
[](https://www.npmjs.com/package/zebra_cookie) [](https://www.npmjs.com/package/zebra_cookie) [](https://www.npmjs.com/package/zebra_cookie) [](https://www.npmjs.com/package/zebra_cookie) | ||
##Requirements | ||
## Support the development of this project | ||
**Zebra_Cookie** requires jQuery 1.0+ | ||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BB4S849EMJH48) | ||
##How to use | ||
## Features | ||
Zebra_Cookie is available as a [Bower](http://bower.io/) package. To install it use: | ||
- very easy to write, read and delete cookies | ||
- simple and intuitive syntax | ||
- extremely small: with around 500 bytes when minified, it is probably the smallest and most optimized jQuery plugin for handling cookies | ||
## Requirements | ||
Zebra_Cookie has no dependencies other than jQuery 1.0+ | ||
## Installation | ||
Zebra_Cookie is available as a [npm package](https://www.npmjs.com/package/zebra_cookie). To install it use: | ||
``` | ||
bower install zebra_cookie | ||
npm install zebra_cookie | ||
``` | ||
Zebra_Cookie is also available as a [npm](https://www.npmjs.com/) package. To install it use: | ||
Zebra_Cookie is also available as a [Bower package](http://bower.io/). To install it use: | ||
``` | ||
npm install zebra_cookie | ||
bower install zebra_cookie | ||
``` | ||
Load the latest version of jQuery from a CDN and provide a fallback to a local source, like: | ||
## How to use | ||
First, load jQuery from a CDN and provide a fallback to a local source like: | ||
```html | ||
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | ||
<script>window.jQuery || document.write('<script src="path/to/jquery-1.12.0.js"><\/script>')</script> | ||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | ||
<script>window.jQuery || document.write('<script src="path/to/jquery-3.2.1.js"><\/script>')</script> | ||
``` | ||
Load the Zebra_Cookie plugin | ||
Load the Zebra_Cookie jQuery plugin: | ||
```html | ||
<script type="text/javascript" src="path/to/zebra_cookie.js"></script> | ||
<script src="path/to/zebra_cookie.min.js"></script> | ||
``` | ||
Alternatively, you can load Zebra_Cookie from [JSDelivr CDN](https://www.jsdelivr.com/) like this: | ||
```html | ||
<!-- for the most recent version --> | ||
<script src="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Cookie/dist/zebra_cookie.min.js"></script> | ||
<!-- for a specific version --> | ||
<script src="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Cookie@1.1.0/dist/zebra_cookie.min.js"></script> | ||
<!-- replacing "min" with "src" will serve you the non-compressed version --> | ||
``` | ||
Usage | ||
@@ -68,2 +90,72 @@ | ||
Detailed description of available methods can be found on the **[project's homepage](http://stefangabos.ro/jquery/zebra_cookie/)** | ||
## Methods | ||
### `destroy(name)` | ||
Removes a cookie from the browser. | ||
Returns `TRUE` on success or `FALSE` otherwise. | ||
#### Arguments | ||
`name` - the name of the cookie to remove | ||
```javascript | ||
// create a session cookie (expires when the browser closes) | ||
$.cookie.write('cookie_name', 'cookie_value'); | ||
// delete the cookie | ||
$.cookie.destroy('cookie_name'); | ||
``` | ||
### `read(name)` | ||
Reads the value of a cookie. | ||
Returns the value of the requested cookie or `null` if the cookie doesn't exist. | ||
#### Arguments | ||
`name` - the name of the cookie to read | ||
```javascript | ||
// create a session cookie (expires when the browser closes) | ||
$.cookie.write('cookie_name', 'cookie_value'); | ||
// read a cookie's value | ||
// following the examples above, this should return "cookie_value" | ||
$.cookie.read('cookie_name'); | ||
``` | ||
### `write(name, value, [expire = 0], [path = /], [domain = ""], [secure = FALSE])` | ||
Sets a cookie in the browser. | ||
Returns `TRUE` if the cookie was successfully set, or `FALSE` otherwise. | ||
#### Arguments | ||
`name` - The name of the cookie to set | ||
`value` - The value to set | ||
`expire` - *(optional)* - The life time of the cookie, in seconds. If set to `0`, or omitted, the cookie will expire at the end of the session (when the browser closes). | ||
`path` - *(optional)* - The path on the server in which the cookie will be available on. If set to `/`, the cookie will be available within the entire domain. If set to `/foo/`, the cookie will only be available within the `/foo/` directory and all subdirectories such as `/foo/bar/` of the domain. If omitted, it will be set to `/`. | ||
`domain` - *(optional)* - The domain that the cookie will be available on. To make the cookie available on all sub-domains of `example.com`, domain should be set to to `.example.com`. The `.` (dot) is not required but makes it compatible with more browsers. Setting it to `www.example.com` will make the cookie available only in the `www` sub-domain. | ||
`secure` - *(optional)* - Indicates whether cookie information should only be transmitted over a HTTPS connection. Default is `FALSE`. | ||
```javascript | ||
// create a session cookie (expires when the browser closes) | ||
$.cookie.write('cookie_name', 'cookie_value'); | ||
// create a cookie that expires in 1 day | ||
$.cookie.write('cookie_name', 'cookie_value', 24 * 60 * 60); | ||
``` | ||
## Demo | ||
See the [demos](http://stefangabos.github.io/Zebra_Cookie/) |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
2
-50%161
133.33%29855
-82.2%10
100%10
-67.74%159
-86.86%1
Infinity%