[virtualcommons-developer] commit/vcweb: alllee: version bump on jquery.cookie plugin
Status: Beta
Brought to you by:
alllee
|
From: <com...@bi...> - 2013-03-19 19:57:57
|
1 new commit in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/4dbb0ffe297c/ changeset: 4dbb0ffe297c user: alllee date: 2013-03-19 20:57:54 summary: version bump on jquery.cookie plugin affected #: 1 file diff -r b077379cb082b25c8092b234d0669da7ef8ac189 -r 4dbb0ffe297cfd0e71a9ef19d20d0dbf97ddaf9d vcweb/static/js/jquery.cookie.js --- a/vcweb/static/js/jquery.cookie.js +++ b/vcweb/static/js/jquery.cookie.js @@ -1,72 +1,90 @@ /*! - * jQuery Cookie Plugin v1.3 + * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * - * Copyright 2011, Klaus Hartl - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://www.opensource.org/licenses/mit-license.php - * http://www.opensource.org/licenses/GPL-2.0 + * Copyright 2013 Klaus Hartl + * Released under the MIT license */ (function ($, document, undefined) { - var pluses = /\+/g; + var pluses = /\+/g; - function raw(s) { - return s; - } + function raw(s) { + return s; + } - function decoded(s) { - return decodeURIComponent(s.replace(pluses, ' ')); - } + function decoded(s) { + return unRfc2068(decodeURIComponent(s.replace(pluses, ' '))); + } - var config = $.cookie = function (key, value, options) { + function unRfc2068(value) { + if (value.indexOf('"') === 0) { + // This is a quoted cookie as according to RFC2068, unescape + value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); + } + return value; + } - // write - if (value !== undefined) { - options = $.extend({}, config.defaults, options); + function fromJSON(value) { + return config.json ? JSON.parse(value) : value; + } - if (value === null) { - options.expires = -1; - } + var config = $.cookie = function (key, value, options) { - if (typeof options.expires === 'number') { - var days = options.expires, t = options.expires = new Date(); - t.setDate(t.getDate() + days); - } + // write + if (value !== undefined) { + options = $.extend({}, config.defaults, options); - value = config.json ? JSON.stringify(value) : String(value); + if (value === null) { + options.expires = -1; + } - return (document.cookie = [ - encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(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('')); - } + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } - // read - var decode = config.raw ? raw : decoded; - var cookies = document.cookie.split('; '); - for (var i = 0, l = cookies.length; i < l; i++) { - var parts = cookies[i].split('='); - if (decode(parts.shift()) === key) { - var cookie = decode(parts.join('=')); - return config.json ? JSON.parse(cookie) : cookie; - } - } + value = config.json ? JSON.stringify(value) : String(value); - return null; - }; + return (document.cookie = [ + encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(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('')); + } - config.defaults = {}; + // read + var decode = config.raw ? raw : decoded; + var cookies = document.cookie.split('; '); + var result = key ? null : {}; + for (var i = 0, l = cookies.length; i < l; i++) { + var parts = cookies[i].split('='); + var name = decode(parts.shift()); + var cookie = decode(parts.join('=')); - $.removeCookie = function (key, options) { - if ($.cookie(key) !== null) { - $.cookie(key, null, options); - return true; - } - return false; - }; + if (key && key === name) { + result = fromJSON(cookie); + break; + } -})(jQuery, document); + if (!key) { + result[name] = fromJSON(cookie); + } + } + + return result; + }; + + config.defaults = {}; + + $.removeCookie = function (key, options) { + if ($.cookie(key) !== null) { + $.cookie(key, null, options); + return true; + } + return false; + }; + +})(jQuery, document); \ No newline at end of file Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |