-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.bp.macaroon.min.js
More file actions
10 lines (9 loc) · 902 Bytes
/
jquery.bp.macaroon.min.js
File metadata and controls
10 lines (9 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
/*
* Macaroon Plugin - Simple cookie access
* @author Ben Plum
* @version 1.2.2
*
* Copyright © 2012 Ben Plum <mr@benplum.com>
* Released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
if(jQuery)(function(f){function g(a,d,c){var b=new Date;b.setTime(b.getTime()+864E5*c.expires);b="; expires="+b.toGMTString();document.cookie=a+"="+d+b+(null!=c.domain?"; domain="+c.domain:"")+("; path="+c.path)}var e={domain:null,expires:7,path:"/"};f.macaroon=function(a,d,c){if("object"==typeof a)return e=jQuery.extend(e,a),null;c=jQuery.extend(e,c);if("undefined"!=typeof a)if("undefined"!=typeof d)null==d?g(a,"",f.extend({},e,{expires:-1})):g(a,d,c);else{a:{a+="=";d=document.cookie.split(";");for(c=0;c< d.length;c++){for(var b=d[c];" "==b.charAt(0);)b=b.substring(1,b.length);if(0==b.indexOf(a)){a=b.substring(a.length,b.length);break a}}a=null}return a}}})(jQuery);