-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<ol> | ||
<li> | ||
<b>1.4.1</b> | ||
<ul> | ||
<li>Added support for CommonJS.</li> | ||
<li>Added support for package managers: Jam (<a href="http://jamjs.org">http://jamjs.org</a>), volo (<a href="http://volojs.org">http://volojs.org</a>), Component (<a href="http://component.io">http://component.io</a>), jspm (<a href="http://jspm.io">http://jspm.io</a>).</li> | ||
<li>The expires option now interpretes fractions of numbers (e.g. days) correctly.</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<b>1.4.0</b> | ||
<ul> | ||
<li>Support for AMD.</li> | ||
<li>Removed deprecated method <code>$.cookie('name', null)</code> for deleting a cookie, use $.removeCookie('name')</code>.</li> | ||
<li><code>$.cookie('name')</code> now returns <code>undefined</code> in case such cookie does not exist (was <code>null</code>). Because the return value is still falsy, testing for existence of a cookie like <code>if ( $.cookie('foo') )</code> keeps working without change.</li> | ||
<li>Renamed bower package definition (component.json -> bower.json) for usage with up-to-date bower.</li> | ||
<li>Badly encoded cookies no longer throw exception upon reading but do return undefined (similar to how we handle JSON parse errors with json = true).</li> | ||
<li>Added conversion function as optional last argument for reading, so that values can be changed to a different representation easily on the fly. Useful for parsing numbers for instance: | ||
<pre><code>$.cookie('foo', '42'); | ||
$.cookie('foo', Number); // => 42</code></pre></li> | ||
</ul> | ||
</li> | ||
<li> | ||
<b>1.3.1</b> | ||
<ul> | ||
<li>Fixed issue where it was no longer possible to check for an arbitrary cookie, while json is set to true, there was a SyntaxError thrown from JSON.parse.</li> | ||
<li>Fixed issue where RFC 2068 decoded cookies were not properly read.</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<b>1.3.0</b> | ||
<ul> | ||
<li>Configuration options: <code>raw</code>, <code>json</code>. Replaces raw option, becomes config: | ||
<pre><code>$.cookie.raw = true; // bypass encoding/decoding the cookie value | ||
$.cookie.json = true; // automatically JSON stringify/parse value</code></pre> | ||
|
||
Thus the default options now cleanly contain cookie attributes only.</li> | ||
<li>Removing licensing under GPL Version 2, the plugin is now released under MIT License only (keeping it simple and following the jQuery library itself here).</li> | ||
<li>Bugfix: Properly handle RFC 2068 quoted cookie values.</li> | ||
<li>Added component.json for bower.</li> | ||
<li>Added jQuery plugin package manifest.</li> | ||
<li><code>$.cookie()</code> returns all available cookies.</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<b>1.2.0</b> | ||
<ul> | ||
<li>Adding <code>$.removeCookie('foo')</code> for deleting a cookie, using <code>$.cookie('foo', null)</code> is now deprecated.</li> | ||
</ul> | ||
</li> | ||
<li> | ||
<b>1.1</b> | ||
<ul> | ||
<li>Adding default options.</li> | ||
</ul> | ||
</li> | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>jQuery.cookie is <a href="https://github.com/carhartl/jquery-cookie/blob/v1.4.1/MIT-LICENSE.txt">MIT licensed by Klaus Hartl</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<dotnetnuke type="Package" version="5.0"> | ||
<packages> | ||
<package name="jQuery.cookie" type="JavaScript_Library" version="1.4.1"> | ||
<friendlyName>jQuery Cookie Plugin</friendlyName> | ||
<description>A simple, lightweight jQuery plugin for reading, writing and deleting cookies.</description> | ||
<owner> | ||
<name>Engage Software</name> | ||
<organization>Engage Software</organization> | ||
<url>http://www.engagesoftware.com</url> | ||
<email>[email protected]</email> | ||
</owner> | ||
<license src="LICENSE.htm" /> | ||
<releaseNotes src="CHANGES.htm" /> | ||
<azureCompatible>true</azureCompatible> | ||
<dependencies> | ||
<dependency type="managedPackage" version="1.2.0">jQuery</dependency> | ||
</dependencies> | ||
<components> | ||
<component type="JavaScript_Library"> | ||
<javaScriptLibrary> | ||
<libraryName>jQuery.cookie</libraryName> | ||
<fileName>jQuery.cookie.js</fileName> | ||
<objectName>jQuery.cookie</objectName> | ||
<preferredScriptLocation>BodyBottom</preferredScriptLocation> | ||
<CDNPath>https://cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js</CDNPath> | ||
</javaScriptLibrary> | ||
</component> | ||
<component type="JavaScriptFile"> | ||
<jsfiles> | ||
<libraryFolderName>jQuery.cookie</libraryFolderName> | ||
<jsfile> | ||
<name>jQuery.cookie.js</name> | ||
</jsfile> | ||
</jsfiles> | ||
</component> | ||
</components> | ||
</package> | ||
</packages> | ||
</dotnetnuke> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/*! | ||
* jQuery Cookie Plugin v1.4.1 | ||
* https://github.com/carhartl/jquery-cookie | ||
* | ||
* Copyright 2013 Klaus Hartl | ||
* Released under the MIT license | ||
*/ | ||
(function (factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
// AMD | ||
define(['jquery'], factory); | ||
} else if (typeof exports === 'object') { | ||
// CommonJS | ||
factory(require('jquery')); | ||
} else { | ||
// Browser globals | ||
factory(jQuery); | ||
} | ||
}(function ($) { | ||
|
||
var pluses = /\+/g; | ||
|
||
function encode(s) { | ||
return config.raw ? s : encodeURIComponent(s); | ||
} | ||
|
||
function decode(s) { | ||
return config.raw ? s : decodeURIComponent(s); | ||
} | ||
|
||
function stringifyCookieValue(value) { | ||
return encode(config.json ? JSON.stringify(value) : String(value)); | ||
} | ||
|
||
function parseCookieValue(s) { | ||
if (s.indexOf('"') === 0) { | ||
// This is a quoted cookie as according to RFC2068, unescape... | ||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); | ||
} | ||
|
||
try { | ||
// Replace server-side written pluses with spaces. | ||
// If we can't decode the cookie, ignore it, it's unusable. | ||
// If we can't parse the cookie, ignore it, it's unusable. | ||
s = decodeURIComponent(s.replace(pluses, ' ')); | ||
return config.json ? JSON.parse(s) : s; | ||
} catch(e) {} | ||
} | ||
|
||
function read(s, converter) { | ||
var value = config.raw ? s : parseCookieValue(s); | ||
return $.isFunction(converter) ? converter(value) : value; | ||
} | ||
|
||
var config = $.cookie = function (key, value, options) { | ||
|
||
// Write | ||
|
||
if (value !== undefined && !$.isFunction(value)) { | ||
options = $.extend({}, config.defaults, options); | ||
|
||
if (typeof options.expires === 'number') { | ||
var days = options.expires, t = options.expires = new Date(); | ||
t.setTime(+t + days * 864e+5); | ||
} | ||
|
||
return (document.cookie = [ | ||
encode(key), '=', stringifyCookieValue(value), | ||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE | ||
options.path ? '; path=' + options.path : '', | ||
options.domain ? '; domain=' + options.domain : '', | ||
options.secure ? '; secure' : '' | ||
].join('')); | ||
} | ||
|
||
// Read | ||
|
||
var result = key ? undefined : {}; | ||
|
||
// To prevent the for loop in the first place assign an empty array | ||
// in case there are no cookies at all. Also prevents odd result when | ||
// calling $.cookie(). | ||
var cookies = document.cookie ? document.cookie.split('; ') : []; | ||
|
||
for (var i = 0, l = cookies.length; i < l; i++) { | ||
var parts = cookies[i].split('='); | ||
var name = decode(parts.shift()); | ||
var cookie = parts.join('='); | ||
|
||
if (key && key === name) { | ||
// If second argument (value) is a function it's a converter... | ||
result = read(cookie, value); | ||
break; | ||
} | ||
|
||
// Prevent storing a cookie that we couldn't decode. | ||
if (!key && (cookie = read(cookie)) !== undefined) { | ||
result[name] = cookie; | ||
} | ||
} | ||
|
||
return result; | ||
}; | ||
|
||
config.defaults = {}; | ||
|
||
$.removeCookie = function (key, options) { | ||
if ($.cookie(key) === undefined) { | ||
return false; | ||
} | ||
|
||
// Must not alter options, thus extending a fresh object... | ||
$.cookie(key, '', $.extend({}, options, { expires: -1 })); | ||
return !$.cookie(key); | ||
}; | ||
|
||
})); |