updated js.cookie.js

This commit is contained in:
2021-04-08 10:13:13 +01:00
parent 9ff8752e26
commit fc5600d75c
3 changed files with 123 additions and 124 deletions

View File

@@ -111,7 +111,7 @@ $(document).ready(function() {
} }
$('table tr td:first-child input').each(function(chkbx) { $('table tr td:first-child input').each(function(chkbx) {
row = $(this); row = $(this);
if (row.prop('checked') != cb.prop('checked')){ if (row.prop('checked') !== cb.prop('checked')){
row.click(); row.click();
} }
}); });

View File

@@ -1,145 +1,142 @@
/*! /*! js-cookie v3.0.0-rc.1 | MIT */
* JavaScript Cookie v2.1.0 ;
* https://github.com/js-cookie/js-cookie (function (global, factory) {
* typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack typeof define === 'function' && define.amd ? define(factory) :
* Released under the MIT license (global = global || self, (function () {
*/ var current = global.Cookies;
(function (factory) { var exports = global.Cookies = factory();
if (typeof define === 'function' && define.amd) { exports.noConflict = function () { global.Cookies = current; return exports; };
define(factory); }()));
} else if (typeof exports === 'object') { }(this, (function () { 'use strict';
module.exports = factory();
} else { function assign (target) {
var _OldCookies = window.Cookies; for (var i = 1; i < arguments.length; i++) {
var api = window.Cookies = factory(); var source = arguments[i];
api.noConflict = function () { for (var key in source) {
window.Cookies = _OldCookies; target[key] = source[key];
return api; }
}
return target
}
var defaultConverter = {
read: function (value) {
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
},
write: function (value) {
return encodeURIComponent(value).replace(
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
)
}
}; };
}
}(function () { function init (converter, defaultAttributes) {
function extend () { function set (key, value, attributes) {
var i = 0; if (typeof document === 'undefined') {
var result = {}; return
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
} }
function init (converter) { attributes = assign({}, defaultAttributes, attributes);
function api (key, value, attributes) {
var result;
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') { if (typeof attributes.expires === 'number') {
var expires = new Date(); attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); }
attributes.expires = expires; if (attributes.expires) {
attributes.expires = attributes.expires.toUTCString();
} }
try { key = encodeURIComponent(key)
result = JSON.stringify(value); .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
if (/^[\{\[]/.test(result)) { .replace(/[()]/g, escape);
value = result;
}
} catch (e) {}
if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key); value = converter.write(value, key);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue
} }
key = encodeURIComponent(String(key)); stringifiedAttributes += '; ' + attributeName;
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
return (document.cookie = [ if (attributes[attributeName] === true) {
key, '=', value, continue
attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
attributes.path && '; path=' + attributes.path,
attributes.domain && '; domain=' + attributes.domain,
attributes.secure ? '; secure' : ''
].join(''));
} }
// Read // Considers RFC 6265 section 5.2:
// ...
// 3. If the remaining unparsed-attributes contains a %x3B (";")
// character:
// Consume the characters of the unparsed-attributes up to,
// not including, the first %x3B (";") character.
// ...
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
}
if (!key) { return (document.cookie = key + '=' + value + stringifiedAttributes)
result = {}; }
function get (key) {
if (typeof document === 'undefined' || (arguments.length && !key)) {
return
} }
// To prevent the for loop in the first place assign an empty array // To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when // in case there are no cookies at all.
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : []; var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g; var jar = {};
var i = 0; for (var i = 0; i < cookies.length; i++) {
for (; i < cookies.length; i++) {
var parts = cookies[i].split('='); var parts = cookies[i].split('=');
var name = parts[0].replace(rdecode, decodeURIComponent); var value = parts.slice(1).join('=');
var cookie = parts.slice(1).join('=');
if (cookie.charAt(0) === '"') { if (value[0] === '"') {
cookie = cookie.slice(1, -1); value = value.slice(1, -1);
} }
try { try {
cookie = converter.read ? var foundKey = defaultConverter.read(parts[0]);
converter.read(cookie, name) : converter(cookie, name) || jar[foundKey] = converter.read(value, foundKey);
cookie.replace(rdecode, decodeURIComponent);
if (this.json) { if (key === foundKey) {
try { break
cookie = JSON.parse(cookie);
} catch (e) {}
}
if (key === name) {
result = cookie;
break;
}
if (!key) {
result[name] = cookie;
} }
} catch (e) {} } catch (e) {}
} }
return result; return key ? jar[key] : jar
} }
api.get = api.set = api; return Object.create(
api.getJSON = function () { {
return api.apply({ set: set,
json: true get: get,
}, [].slice.call(arguments)); remove: function (key, attributes) {
}; set(
api.defaults = {}; key,
'',
api.remove = function (key, attributes) { assign({}, attributes, {
api(key, '', extend(attributes, {
expires: -1 expires: -1
})); })
}; );
},
withAttributes: function (attributes) {
return init(this.converter, assign({}, this.attributes, attributes))
},
withConverter: function (converter) {
return init(assign({}, this.converter, converter), this.attributes)
}
},
{
attributes: { value: Object.freeze(defaultAttributes) },
converter: { value: Object.freeze(converter) }
}
)
}
api.withConverter = init; var api = init(defaultConverter, { path: '/' });
return api; return api;
}
return init(function () {}); })));
}));

2
static/js/js.cookie.min.js vendored Normal file
View File

@@ -0,0 +1,2 @@
/*! js-cookie v3.0.0-rc.1 | MIT */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,r=e.Cookies=t();r.noConflict=function(){return e.Cookies=n,r}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})});