diff options
author | shadlaws <shad@shadlaws.com> | 2013-03-04 19:14:47 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-03-04 19:14:47 +0100 |
commit | 1544a83279853acccccdf179b6c96d044fee1cf6 (patch) | |
tree | a392db6f75d4ff1a29a6c4c3e55c158e9fa19e16 /lib/jquery.cookie.js | |
parent | e77276736351700b3bbd1080369738620ff8be28 (diff) |
Minify (and re-minify) JS libraries (in sync with gallery3-vendor).
- minified jQuery libraries.
- re-minified flowplayer, json2-min, and extjs using new minimizer (more efficient, keeps copyrights).
Diffstat (limited to 'lib/jquery.cookie.js')
-rw-r--r-- | lib/jquery.cookie.js | 88 |
1 files changed, 3 insertions, 85 deletions
diff --git a/lib/jquery.cookie.js b/lib/jquery.cookie.js index 8463b44e..869ff3c8 100644 --- a/lib/jquery.cookie.js +++ b/lib/jquery.cookie.js @@ -5,88 +5,6 @@ * Copyright 2013 Klaus Hartl * Released under the MIT license */ -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as anonymous module. - define(['jquery'], factory); - } else { - // Browser globals. - factory(jQuery); - } -}(function ($) { - - var pluses = /\+/g; - - function raw(s) { - return s; - } - - function decoded(s) { - return decodeURIComponent(s.replace(pluses, ' ')); - } - - function converted(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 { - return config.json ? JSON.parse(s) : s; - } catch(er) {} - } - - var config = $.cookie = function (key, value, options) { - - // write - if (value !== undefined) { - options = $.extend({}, config.defaults, options); - - if (typeof options.expires === 'number') { - var days = options.expires, t = options.expires = new Date(); - t.setDate(t.getDate() + days); - } - - value = config.json ? JSON.stringify(value) : String(value); - - 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('')); - } - - // read - var decode = config.raw ? raw : decoded; - var cookies = document.cookie.split('; '); - var result = key ? undefined : {}; - 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('=')); - - if (key && key === name) { - result = converted(cookie); - break; - } - - if (!key) { - result[name] = converted(cookie); - } - } - - return result; - }; - - config.defaults = {}; - - $.removeCookie = function (key, options) { - if ($.cookie(key) !== undefined) { - $.cookie(key, '', $.extend(options, { expires: -1 })); - return true; - } - return false; - }; - -})); +(function(d){"function"===typeof define&&define.amd?define(["jquery"],d):d(jQuery)})(function(d){function m(a){return a}function n(a){return decodeURIComponent(a.replace(j," "))}function k(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e.json?JSON.parse(a):a}catch(c){}}var j=/\+/g,e=d.cookie=function(a,c,b){if(void 0!==c){b=d.extend({},e.defaults,b);if("number"===typeof b.expires){var g=b.expires,f=b.expires=new Date;f.setDate(f.getDate()+g)}c=e.json? +JSON.stringify(c):String(c);return document.cookie=[encodeURIComponent(a),"=",e.raw?c:encodeURIComponent(c),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join("")}c=e.raw?m:n;b=document.cookie.split("; ");for(var g=a?void 0:{},f=0,j=b.length;f<j;f++){var h=b[f].split("="),l=c(h.shift()),h=c(h.join("="));if(a&&a===l){g=k(h);break}a||(g[l]=k(h))}return g};e.defaults={};d.removeCookie=function(a,c){return void 0!== +d.cookie(a)?(d.cookie(a,"",d.extend(c,{expires:-1})),!0):!1}});
|