From fc5600d75ca6a9cab78f53f09a9920cb7b62d13b Mon Sep 17 00:00:00 2001 From: Ajurna Date: Thu, 8 Apr 2021 10:13:13 +0100 Subject: [PATCH] updated js.cookie.js --- comic/templates/comic/comic_list.html | 2 +- static/js/js.cookie.js | 243 +++++++++++++------------- static/js/js.cookie.min.js | 2 + 3 files changed, 123 insertions(+), 124 deletions(-) create mode 100644 static/js/js.cookie.min.js diff --git a/comic/templates/comic/comic_list.html b/comic/templates/comic/comic_list.html index d49a7d1..0e50756 100644 --- a/comic/templates/comic/comic_list.html +++ b/comic/templates/comic/comic_list.html @@ -111,7 +111,7 @@ $(document).ready(function() { } $('table tr td:first-child input').each(function(chkbx) { row = $(this); - if (row.prop('checked') != cb.prop('checked')){ + if (row.prop('checked') !== cb.prop('checked')){ row.click(); } }); diff --git a/static/js/js.cookie.js b/static/js/js.cookie.js index 9c76267..f634eff 100644 --- a/static/js/js.cookie.js +++ b/static/js/js.cookie.js @@ -1,145 +1,142 @@ -/*! - * JavaScript Cookie v2.1.0 - * https://github.com/js-cookie/js-cookie - * - * Copyright 2006, 2015 Klaus Hartl & Fagner Brack - * Released under the MIT license - */ -(function (factory) { - if (typeof define === 'function' && define.amd) { - define(factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - var _OldCookies = window.Cookies; - var api = window.Cookies = factory(); - api.noConflict = function () { - window.Cookies = _OldCookies; - return api; - }; - } -}(function () { - function extend () { - var i = 0; - var result = {}; - for (; i < arguments.length; i++) { - var attributes = arguments[ i ]; - for (var key in attributes) { - result[key] = attributes[key]; - } - } - return result; - } +/*! js-cookie v3.0.0-rc.1 | MIT */ +; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, (function () { + var current = global.Cookies; + var exports = global.Cookies = factory(); + exports.noConflict = function () { global.Cookies = current; return exports; }; + }())); +}(this, (function () { 'use strict'; - function init (converter) { - function api (key, value, attributes) { - var result; + function assign (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + target[key] = source[key]; + } + } + return target + } - // Write + 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 + ) + } + }; - if (arguments.length > 1) { - attributes = extend({ - path: '/' - }, api.defaults, attributes); + function init (converter, defaultAttributes) { + function set (key, value, attributes) { + if (typeof document === 'undefined') { + return + } - if (typeof attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); - attributes.expires = expires; - } + attributes = assign({}, defaultAttributes, attributes); - try { - result = JSON.stringify(value); - if (/^[\{\[]/.test(result)) { - value = result; - } - } catch (e) {} + if (typeof attributes.expires === 'number') { + attributes.expires = new Date(Date.now() + attributes.expires * 864e5); + } + if (attributes.expires) { + attributes.expires = attributes.expires.toUTCString(); + } - 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); - } + key = encodeURIComponent(key) + .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) + .replace(/[()]/g, escape); - key = encodeURIComponent(String(key)); - key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - key = key.replace(/[\(\)]/g, escape); + value = converter.write(value, key); - return (document.cookie = [ - key, '=', value, - 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('')); - } + var stringifiedAttributes = ''; + for (var attributeName in attributes) { + if (!attributes[attributeName]) { + continue + } - // Read + stringifiedAttributes += '; ' + attributeName; - if (!key) { - result = {}; - } + if (attributes[attributeName] === true) { + continue + } - // 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 - // calling "get()" - var cookies = document.cookie ? document.cookie.split('; ') : []; - var rdecode = /(%[0-9A-Z]{2})+/g; - var i = 0; + // 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]; + } - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - var name = parts[0].replace(rdecode, decodeURIComponent); - var cookie = parts.slice(1).join('='); + return (document.cookie = key + '=' + value + stringifiedAttributes) + } - if (cookie.charAt(0) === '"') { - cookie = cookie.slice(1, -1); - } + function get (key) { + if (typeof document === 'undefined' || (arguments.length && !key)) { + return + } - try { - cookie = converter.read ? - converter.read(cookie, name) : converter(cookie, name) || - cookie.replace(rdecode, decodeURIComponent); + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. + var cookies = document.cookie ? document.cookie.split('; ') : []; + var jar = {}; + for (var i = 0; i < cookies.length; i++) { + var parts = cookies[i].split('='); + var value = parts.slice(1).join('='); - if (this.json) { - try { - cookie = JSON.parse(cookie); - } catch (e) {} - } + if (value[0] === '"') { + value = value.slice(1, -1); + } - if (key === name) { - result = cookie; - break; - } + try { + var foundKey = defaultConverter.read(parts[0]); + jar[foundKey] = converter.read(value, foundKey); - if (!key) { - result[name] = cookie; - } - } catch (e) {} - } + if (key === foundKey) { + break + } + } catch (e) {} + } - return result; - } + return key ? jar[key] : jar + } - api.get = api.set = api; - api.getJSON = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - api.defaults = {}; + return Object.create( + { + set: set, + get: get, + remove: function (key, attributes) { + set( + key, + '', + assign({}, attributes, { + 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.remove = function (key, attributes) { - api(key, '', extend(attributes, { - expires: -1 - })); - }; + var api = init(defaultConverter, { path: '/' }); - api.withConverter = init; + return api; - return api; - } - - return init(function () {}); -})); +}))); diff --git a/static/js/js.cookie.min.js b/static/js/js.cookie.min.js new file mode 100644 index 0000000..1549485 --- /dev/null +++ b/static/js/js.cookie.min.js @@ -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