PluginProbe
Maps Widget for Google Maps / 1.93
Maps Widget for Google Maps v1.93
1.86 1.90 1.92 1.93 1.95 2.0 2.01 2.05 2.06 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.51 2.60 2.65 2.66 2.70 2.75 2.80 All 129 releases
google-maps-widget / js / jquery.cookie.js

jquery.cookie.js in Maps Widget for Google Maps 1.93, at js/jquery.cookie.js

95 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*!
2 * jQuery Cookie Plugin v1.3.1
3 * https://github.com/carhartl/jquery-cookie
4 *
5 * Copyright 2013 Klaus Hartl
6 * Released under the MIT license
7 */
8 (function (factory) {
9 if (typeof define === 'function' && define.amd) {
10 // AMD. Register as anonymous module.
11 define(['jquery'], factory);
12 } else {
13 // Browser globals.
14 factory(jQuery);
15 }
16 }(function ($) {
17
18 var pluses = /\+/g;
19
20 function raw(s) {
21 return s;
22 }
23
24 function decoded(s) {
25 return decodeURIComponent(s.replace(pluses, ' '));
26 }
27
28 function converted(s) {
29 if (s.indexOf('"') === 0) {
30 // This is a quoted cookie as according to RFC2068, unescape
31 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
32 }
33 try {
34 return config.json ? JSON.parse(s) : s;
35 } catch(er) {}
36 }
37
38 var config = $.cookie = function (key, value, options) {
39
40 // write
41 if (value !== undefined) {
42 options = $.extend({}, config.defaults, options);
43
44 if (typeof options.expires === 'number') {
45 var days = options.expires, t = options.expires = new Date();
46 t.setDate(t.getDate() + days);
47 }
48
49 value = config.json ? JSON.stringify(value) : String(value);
50
51 return (document.cookie = [
52 config.raw ? key : encodeURIComponent(key),
53 '=',
54 config.raw ? value : encodeURIComponent(value),
55 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
56 options.path ? '; path=' + options.path : '',
57 options.domain ? '; domain=' + options.domain : '',
58 options.secure ? '; secure' : ''
59 ].join(''));
60 }
61
62 // read
63 var decode = config.raw ? raw : decoded;
64 var cookies = document.cookie.split('; ');
65 var result = key ? undefined : {};
66 for (var i = 0, l = cookies.length; i < l; i++) {
67 var parts = cookies[i].split('=');
68 var name = decode(parts.shift());
69 var cookie = decode(parts.join('='));
70
71 if (key && key === name) {
72 result = converted(cookie);
73 break;
74 }
75
76 if (!key) {
77 result[name] = converted(cookie);
78 }
79 }
80
81 return result;
82 };
83
84 config.defaults = {};
85
86 $.removeCookie = function (key, options) {
87 if ($.cookie(key) !== undefined) {
88 // Must not alter options, thus extending a fresh object...
89 $.cookie(key, '', $.extend({}, options, { expires: -1 }));
90 return true;
91 }
92 return false;
93 };
94
95 }));