PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.4
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.4
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / src / js / vendor / jquery / jquery-cookie.js

jquery-cookie.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.4, at assets/src/js/vendor/jquery/jquery-cookie.js

73 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // jQuery cookie plugin
2 (function (factory) {
3 if (typeof define === 'function' && define.amd) {
4 define(['jquery'], factory);
5 } else if (typeof exports === 'object') {
6 module.exports = factory(require('jquery'));
7 } else {
8 factory(jQuery);
9 }
10 }(function ($) {
11 var pluses = /\+/g;
12 function encode(s) {
13 return config.raw ? s : encodeURIComponent(s);
14 }
15 function decode(s) {
16 return config.raw ? s : decodeURIComponent(s);
17 }
18 function stringifyCookieValue(value) {
19 return encode(config.json ? JSON.stringify(value) : String(value));
20 }
21 function parseCookieValue(s) {
22 if (s.indexOf('"') === 0) {
23 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
24 }
25 try {
26 s = decodeURIComponent(s.replace(pluses, ' '));
27 return config.json ? JSON.parse(s) : s;
28 } catch (e) {
29 }
30 }
31 function read(s, converter) {
32 var value = config.raw ? s : parseCookieValue(s);
33 return $.isFunction(converter) ? converter(value) : value;
34 }
35 var config = $.cookie = function (key, value, options) {
36 if (arguments.length > 1 && !$.isFunction(value)) {
37 options = $.extend({}, config.defaults, options);
38 if (typeof options.expires === 'number') {
39 var days = options.expires, t = options.expires = new Date();
40 t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
41 }
42 return (document.cookie = [
43 encode(key), '=', stringifyCookieValue(value),
44 options.expires ? '; expires=' + options.expires.toUTCString() : '',
45 options.path ? '; path=' + options.path : '',
46 options.domain ? '; domain=' + options.domain : '',
47 options.secure ? '; secure' : ''
48 ].join(''));
49 }
50 var result = key ? undefined : {},
51 cookies = document.cookie ? document.cookie.split('; ') : [],
52 i = 0,
53 l = cookies.length;
54 for (; i < l; i++) {
55 var parts = cookies[i].split('='),
56 name = decode(parts.shift()),
57 cookie = parts.join('=');
58 if (key === name) {
59 result = read(cookie, value);
60 break;
61 }
62 if (!key && (cookie = read(cookie)) !== undefined) {
63 result[name] = cookie;
64 }
65 }
66 return result;
67 };
68 config.defaults = {};
69 $.removeCookie = function (key, options) {
70 $.cookie(key, '', $.extend({}, options, {expires: -1}));
71 return !$.cookie(key);
72 };
73 }));