diff --git a/dist/js/app.js b/dist/js/app.js
index 3de1851..4574124 100644
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -1 +1 @@
-!function(){"use strict";var t={758:function(t){t.exports=function makeYoutubeEmbed(t){if("string"===typeof t){var a=function getId(t){var a=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);if(a&&11==a[2].length)return a[2]}(t);return a?"//www.youtube.com/embed/"+a:void 0}}}},a={};function __webpack_require__(o){var i=a[o];if(void 0!==i)return i.exports;var c=a[o]={exports:{}};return t[o](c,c.exports,__webpack_require__),c.exports}!function(){var t="ajax-load",a="load-ready";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var o=function e(t){function r(t,a,o){var i,c={};if(Array.isArray(t))return t.concat(a);for(i in t)c[o?i.toLowerCase():i]=t[i];for(i in a){var s=o?i.toLowerCase():i,l=a[i];c[s]=s in c&&"object"==_typeof(l)?r(c[s],l,"headers"===s):l}return c}function n(a,o,i,c){"string"!=typeof a&&(a=(o=a).url);var s={config:o},l=r(t,o),d={},u=c||l.data;(l.transformRequest||[]).map((function(t){u=t(u,l.headers)||u})),u&&"object"==_typeof(u)&&"function"!=typeof u.append&&(u=JSON.stringify(u),d["content-type"]="application/json");var p="undefined"!=typeof document&&document.cookie.match(RegExp("(^|; )"+l.xsrfCookieName+"=([^;]*)"));if(p&&(d[l.xsrfHeaderName]=p[2]),l.auth&&(d.authorization=l.auth),l.baseURL&&(a=a.replace(/^(?!.*\/\/)\/?(.*)$/,l.baseURL+"/$1")),l.params){var m=~a.indexOf("?")?"&":"?";a+=m+(l.paramsSerializer?l.paramsSerializer(l.params):new URLSearchParams(l.params))}return(l.fetch||fetch)(a,{method:i||l.method,body:u,headers:r(l.headers,d,!0),credentials:l.withCredentials?"include":"same-origin"}).then((function(t){for(var a in t)"function"!=typeof t[a]&&(s[a]=t[a]);var o=l.validateStatus?l.validateStatus(t.status):t.ok;return"stream"==l.responseType?(s.data=t.body,s):t[l.responseType||"text"]().then((function(t){s.data=t,s.data=JSON.parse(t)})).catch(Object).then((function(){return o?s:Promise.reject(s)}))}))}return t=t||{},n.request=n,n.get=function(t,a){return n(t,a,"get")},n.delete=function(t,a){return n(t,a,"delete")},n.head=function(t,a){return n(t,a,"head")},n.options=function(t,a){return n(t,a,"options")},n.post=function(t,a,o){return n(t,o,"post",a)},n.put=function(t,a,o){return n(t,o,"put",a)},n.patch=function(t,a,o){return n(t,o,"patch",a)},n.all=Promise.all.bind(Promise),n.spread=function(t){return function(a){return t.apply(this,a)}},n.CancelToken="function"==typeof AbortController?AbortController:Object,n.defaults=t,n.create=e,n}();function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function _unsupportedIterableToArray(t,a){if(!t)return;if("string"===typeof t)return _arrayLikeToArray(t,a);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return _arrayLikeToArray(t,a)}(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,a){(null==a||a>t.length)&&(a=t.length);for(var o=0,i=new Array(a);o0&&void 0!==arguments[0]?arguments[0]:{shown:!1},c=arguments.length>1?arguments[1]:void 0;_classCallCheck(this,MetaWindow),_defineProperty(this,"state",{content:"",type:["empty"],shown:!1,loading:!1,error:!1,embed:!1,collections:[],current:null,target:null,extraClass:null}),_defineProperty(this,"show",(function(){var a=t;console.log("".concat(a.name,": show")),a.setState({shown:!0}),i.dispatchEvent(new Event("{ui.name}.show"))})),_defineProperty(this,"hide",(function(){var a=t;console.log("".concat(a.name,": hide")),a.setState({shown:!1}),i.dispatchEvent(new Event("{ui.name}.hide"))})),_defineProperty(this,"next",(function(){var a=t,o=a.state.current.getAttribute("data-gallery"),c=a._currIndex();c0?c--:c=a.state.collections[o].length-1,a.state.collections[o][c].click(),console.log("".concat(a.name,": prev")),i.dispatchEvent(new Event("{ui.name}.prev"))})),_defineProperty(this,"reset",(function(){t.setState({content:"",type:["empty"],shown:!1,loading:!1,error:!1,embed:!1})})),_defineProperty(this,"load",(function(a){var o=t,c=o.axios;o.reset(),o.setState({loading:!0}),o.show(),c.get(a,{responseType:"arraybuffer"}).then((function(t){console.log("".concat(o.name,": response content-type: ").concat(t.headers["content-type"]));switch(t.headers["content-type"]){case"image/jpeg":case"image/png":case"image/svg+xml":case"image/bmp":case"image/gif":case"image/tiff":case"image/webp":case"image/jpg":case"image/svg":o.setContent(''),"meta-".concat(o.name,"--image"));break;case"application/json":case"application/ld+json":case"application/json; charset=UTF-8":o.setContent("".concat((!1).Content),["meta-".concat(o.name,"--text"),"meta-".concat(o.name,"--html"),"meta-".concat(o.name,"--json")]);break;case"video/mp4":o.setContent(''),["meta-".concat(o.name,"--image"),"meta-".concat(o.name,"--video")]);break;case"text/html":case"application/xhtml+xml":case"text/plain":case"text/html; charset=UTF-8":case"application/xhtml+xml; charset=UTF-8":case"text/plain; charset=UTF-8":o.setContent(o._abToString(t.data),["meta-".concat(o.name,"--text"),"meta-".concat(o.name,"--html"),"meta-".concat(o.name,"--pajax")]);break;default:console.warn("".concat(o.name,": Unknown response content-type!"))}i.dispatchEvent(new Event("{ui.name}.loaded"))})).catch((function(t){console.error(t);var a="";if(t.response)switch(t.response.status){case 404:a="Not Found.";break;case 500:a="Server issue, please try again latter.";break;default:a="Something went wrong."}else t.request?a="No response received":console.warn("Error",t.message);o.setState({error:a}),i.dispatchEvent(new Event("{ui.name}.error"))})).then((function(){o.setState({loading:!1}),setTimeout((function(){o.state.current.classList.remove("loading")}),3e3)}))})),_defineProperty(this,"_currIndex",(function(){var a=t,o=a.state.current,i=o.getAttribute("data-gallery");return a.state.collections[i].indexOf(o)})),_defineProperty(this,"embed",(function(a){var o=t;console.log("".concat(o.name,": embed")),o.reset(),o.setState({embed:a,loading:!1,type:["meta-".concat(o.name,"--embed"),"meta-".concat(o.name,"--video")]}),o.show()})),_defineProperty(this,"setCaption",(function(a){var o=t;console.log("".concat(o.name,": setCaption")),o.state.caption=a})),_defineProperty(this,"addExtraClass",(function(a){var o=t;a.length&&(console.log("".concat(o.name,": addExtraClass(").concat(a,")")),o.state.extraClass=a)})),_defineProperty(this,"getCaption",(function(){return t.state.caption})),_defineProperty(this,"_abToString",(function(t){return String.fromCharCode.apply(null,new Uint8Array(t))})),_defineProperty(this,"_imageEncode",(function(t){new Uint8Array(t);return btoa([].reduce.call(new Uint8Array(t),(function(t,a){return t+String.fromCharCode(a)}),""))})),_defineProperty(this,"setContent",(function(a,o){var i=t;console.log("".concat(i.name,": setContent"));var c=o||["meta-".concat(i.name,"--html"),"meta-".concat(i.name,"--text")];Array.isArray(c)||(c=o.split(" ")),i.setState({content:a,type:c})})),_defineProperty(this,"getHtml",(function(){var a=t;if(a.state.embed){var o=__webpack_require__(758)(a.state.embed);a.state.content='')}return a.state.content}));var s=this;switch(s.name=s.constructor.name,console.log("".concat(s.name,": init")),s.axios=o,s.setState(a),c){case"show":case"hide":s.hide()}i.dispatchEvent(new Event("{ui.name}.init"))}return function _createClass(t,a,o){return a&&_defineProperties(t.prototype,a),o&&_defineProperties(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}(MetaWindow,[{key:"init",value:function init(){var t=this;console.log("MetaWindow: [links] init"),document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((function(a){var o=a.getAttribute("data-gallery");o&&(t.state.collections[o]=[],document.querySelectorAll('[data-toggle="lightbox"][data-gallery="'.concat(o,'"]')).forEach((function(a){t.state.collections[o].push(a)}))),a.addEventListener("click",(function(a){a.preventDefault(),console.log("MetaWindow: [link] click");var o=a.currentTarget,i=o.getAttribute("href")||o.getAttribute("data-href"),c=o.getAttribute("data-embed");o.classList.add("loading"),t.state.current=o,c?t.embed(i):t.load(i);var s=o.getAttribute("data-title");s&&t.setCaption(s),t.addExtraClass(o.getAttribute("data-lightbox-class"))}))}))}},{key:"setState",value:function setState(t){var a=this;a.state=Object.assign({},a.state,t),a.render()}},{key:"render",value:function render(){var t,a=this,o=a.name,i=a.state.current;a.state.target.innerHTML="";var c=document.createElement("div");c.classList.add("meta-".concat(o)),(t=c.classList).add.apply(t,_toConsumableArray(a.state.type)),a.state.target.append(c);var s=document.createElement("div");s.classList.add("meta-".concat(o,"-overlay")),a.state.shown&&s.classList.add("meta-".concat(o,"-overlay--open")),a.state.loading&&s.classList.add("meta-".concat(o,"-overlay--loading")),a.state.error&&s.classList.add("meta-".concat(o,"-overlay--error")),c.append(s);var l=document.createElement("div");l.classList.add("meta-content"),s.append(l);var d=document.createElement("button");if(d.classList.add("meta-nav","meta-close","a"),d.innerHTML=' Close',d.addEventListener("click",(function(t){t.preventDefault(),a.hide()})),l.append(d),i){var u=i.getAttribute("data-gallery");if(u&&a.state.collections[u].length>1){var p=document.createElement("nav");p.classList.add("meta-navs");var m=document.createElement("button");m.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__prev","a"),m.innerHTML=' Previous',m.addEventListener("click",(function(t){t.preventDefault(),a.prev()})),p.append(m);var f=document.createElement("button");f.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__next","a"),f.innerHTML=' Next',f.addEventListener("click",(function(t){t.preventDefault(),a.next()})),p.append(f),l.append(p)}}var v=document.createElement("section");if(v.classList.add("meta-wrap","typography"),a.state.extraClass&&v.classList.add(a.state.extraClass),v.innerHTML=a.getHtml(),l.append(v),a.state.error){var y=document.createElement("div");y.classList.add("meta-error"),y.innerHTML=a.state.error,l.append(y)}else if(a.state.caption){var h=document.createElement("div");h.classList.add("meta-caption"),h.innerHTML=a.getCaption(),l.append(h)}return"undefined"!==typeof window.FontAwesome&&window.FontAwesome.dom.i2svg(),a}}]),MetaWindow}(),s=c,l=document.getElementById("MetaLightboxApp");l||console.log("MetaWindow: missing container #MetaLightboxApp");var d=function init(){var t=window.MetaWindow;"undefined"===typeof t&&(t=new s({target:l}),window.MetaWindow=t),t.init()};window.addEventListener("".concat(a),d),window.addEventListener("".concat(t),d),window.addEventListener("MetaWindow.initLinks",d)}()}();
\ No newline at end of file
+!function(){"use strict";var e={758:function(e){e.exports=function makeYoutubeEmbed(e){if("string"===typeof e){var t=function getId(e){var t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);if(t&&11==t[2].length)return t[2]}(e);return t?"//www.youtube.com/embed/"+t:void 0}}}},t={};function __webpack_require__(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,__webpack_require__),r.exports}!function(){var e="ajax-load",t="load-ready";function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){if(!e)return;if("string"===typeof e)return _arrayLikeToArray(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(e,t)}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a0&&void 0!==arguments[0]?arguments[0]:{shown:!1},n=arguments.length>1?arguments[1]:void 0;_classCallCheck(this,MetaWindow),_defineProperty(this,"state",{content:"",type:["empty"],shown:!1,loading:!1,error:!1,embed:!1,collections:[],current:null,target:null,extraClass:null}),_defineProperty(this,"show",(function(){var t=e;console.log("".concat(t.name,": show")),t.setState({shown:!0}),a.dispatchEvent(new Event("{ui.name}.show"))})),_defineProperty(this,"hide",(function(){var t=e;console.log("".concat(t.name,": hide")),t.setState({shown:!1}),a.dispatchEvent(new Event("{ui.name}.hide"))})),_defineProperty(this,"next",(function(){var t=e,n=t.state.current.getAttribute("data-gallery"),r=t._currIndex();r0?r--:r=t.state.collections[n].length-1,t.state.collections[n][r].click(),console.log("".concat(t.name,": prev")),a.dispatchEvent(new Event("{ui.name}.prev"))})),_defineProperty(this,"reset",(function(){e.setState({content:"",type:["empty"],shown:!1,loading:!1,error:!1,embed:!1})})),_defineProperty(this,"load",(function(t){var n=e;n.reset(),n.setState({loading:!0}),n.show(),fetch(t).then((function(e){var r=e.headers.get("content-type");console.log(e),console.log("".concat(n.name,": response content-type: ").concat(r));switch(r){case"image/jpeg":case"image/png":case"image/svg+xml":case"image/bmp":case"image/gif":case"image/tiff":case"image/webp":case"image/jpg":case"image/svg":e.arrayBuffer().then((function(e){n.setContent(''),"meta-".concat(n.name,"--image"))}));break;case"application/json":case"application/ld+json":case"application/json; charset=UTF-8":n.setContent("".concat((!1).Content),["meta-".concat(n.name,"--text"),"meta-".concat(n.name,"--html"),"meta-".concat(n.name,"--json")]);break;case"video/mp4":n.setContent(''),["meta-".concat(n.name,"--image"),"meta-".concat(n.name,"--video")]);break;case"text/html":case"application/xhtml+xml":case"text/plain":case"text/html; charset=UTF-8":case"application/xhtml+xml; charset=UTF-8":case"text/plain; charset=UTF-8":n.setContent(e.data,["meta-".concat(n.name,"--text"),"meta-".concat(n.name,"--html"),"meta-".concat(n.name,"--pajax")]);break;default:console.warn("".concat(n.name,": Unknown response content-type!"))}a.dispatchEvent(new Event("{ui.name}.loaded"))})).catch((function(e){console.error(e);var t="";if(e.response)switch(e.response.status){case 404:t="Not Found.";break;case 500:t="Server issue, please try again latter.";break;default:t="Something went wrong."}else e.request?t="No response received":console.warn("Error",e.message);n.setState({error:t}),a.dispatchEvent(new Event("{ui.name}.error"))})).then((function(){n.setState({loading:!1}),setTimeout((function(){n.state.current.classList.remove("loading")}),3e3)}))})),_defineProperty(this,"_currIndex",(function(){var t=e,a=t.state.current,n=a.getAttribute("data-gallery");return t.state.collections[n].indexOf(a)})),_defineProperty(this,"embed",(function(t){var a=e;console.log("".concat(a.name,": embed")),a.reset(),a.setState({embed:t,loading:!1,type:["meta-".concat(a.name,"--embed"),"meta-".concat(a.name,"--video")]}),a.show()})),_defineProperty(this,"setCaption",(function(t){var a=e;console.log("".concat(a.name,": setCaption")),a.state.caption=t})),_defineProperty(this,"addExtraClass",(function(t){var a=e;t&&t.length&&(console.log("".concat(a.name,": addExtraClass(").concat(t,")")),a.state.extraClass=t)})),_defineProperty(this,"getCaption",(function(){return e.state.caption})),_defineProperty(this,"_imageEncode",(function(e){var t="";return[].slice.call(new Uint8Array(e)).forEach((function(e){return t+=String.fromCharCode(e)})),window.btoa(t)})),_defineProperty(this,"setContent",(function(t,a){var n=e;console.log("".concat(n.name,": setContent"));var r=a||["meta-".concat(n.name,"--html"),"meta-".concat(n.name,"--text")];Array.isArray(r)||(r=a.split(" ")),n.setState({content:t,type:r})})),_defineProperty(this,"getHtml",(function(){var t=e;if(t.state.embed){var a=__webpack_require__(758)(t.state.embed);t.state.content='')}return t.state.content}));var r=this;switch(r.name=r.constructor.name,console.log("".concat(r.name,": init")),r.setState(t),n){case"show":case"hide":r.hide()}a.dispatchEvent(new Event("{ui.name}.init"))}return function _createClass(e,t,a){return t&&_defineProperties(e.prototype,t),a&&_defineProperties(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}(MetaWindow,[{key:"init",value:function init(){var e=this;console.log("MetaWindow: [links] init"),document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((function(t){var a=t.getAttribute("data-gallery");a&&(e.state.collections[a]=[],document.querySelectorAll('[data-toggle="lightbox"][data-gallery="'.concat(a,'"]')).forEach((function(t){e.state.collections[a].push(t)}))),t.addEventListener("click",(function(t){t.preventDefault(),console.log("MetaWindow: [link] click");var a=t.currentTarget,n=a.getAttribute("href")||a.getAttribute("data-href"),r=a.getAttribute("data-embed");a.classList.add("loading"),e.state.current=a,r?e.embed(n):e.load(n);var o=a.getAttribute("data-title");o&&e.setCaption(o),e.addExtraClass(a.getAttribute("data-lightbox-class"))}))}))}},{key:"setState",value:function setState(e){var t=this;t.state=Object.assign({},t.state,e),t.render()}},{key:"render",value:function render(){var e,t=this,a=t.name,n=t.state.current;t.state.target.innerHTML="";var r=document.createElement("div");r.classList.add("meta-".concat(a)),(e=r.classList).add.apply(e,_toConsumableArray(t.state.type)),t.state.target.append(r);var o=document.createElement("div");o.classList.add("meta-".concat(a,"-overlay")),t.state.shown&&o.classList.add("meta-".concat(a,"-overlay--open")),t.state.loading&&o.classList.add("meta-".concat(a,"-overlay--loading")),t.state.error&&o.classList.add("meta-".concat(a,"-overlay--error")),r.append(o);var i=document.createElement("div");i.classList.add("meta-content"),o.append(i);var c=document.createElement("button");if(c.classList.add("meta-nav","meta-close","a"),c.innerHTML=' Close',c.addEventListener("click",(function(e){e.preventDefault(),t.hide()})),i.append(c),n){var s=n.getAttribute("data-gallery");if(s&&t.state.collections[s].length>1){var l=document.createElement("nav");l.classList.add("meta-navs");var d=document.createElement("button");d.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__prev","a"),d.innerHTML=' Previous',d.addEventListener("click",(function(e){e.preventDefault(),t.prev()})),l.append(d);var u=document.createElement("button");u.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__next","a"),u.innerHTML=' Next',u.addEventListener("click",(function(e){e.preventDefault(),t.next()})),l.append(u),i.append(l)}}var m=document.createElement("section");if(m.classList.add("meta-wrap","typography"),t.state.extraClass&&m.classList.add(t.state.extraClass),m.innerHTML=t.getHtml(),i.append(m),t.state.error){var p=document.createElement("div");p.classList.add("meta-error"),p.innerHTML=t.state.error,i.append(p)}else if(t.state.caption){var f=document.createElement("div");f.classList.add("meta-caption"),f.innerHTML=t.getCaption(),i.append(f)}return"undefined"!==typeof window.FontAwesome&&window.FontAwesome.dom.i2svg(),t}}]),MetaWindow}(),r=n,o=document.getElementById("MetaLightboxApp");o||console.log("MetaWindow: missing container #MetaLightboxApp");var i=function init(){var e=window.MetaWindow;"undefined"===typeof e&&(e=new r({target:o}),window.MetaWindow=e),e.init()};window.addEventListener("".concat(t),i),window.addEventListener("".concat(e),i),window.addEventListener("MetaWindow.initLinks",i)}()}();
\ No newline at end of file
diff --git a/dist/records.json b/dist/records.json
index 6fd0e86..5b795e9 100644
--- a/dist/records.json
+++ b/dist/records.json
@@ -40,11 +40,11 @@
"modules": {
"byIdentifier": {
"./node_modules/.pnpm/babel-loader@8.2.4_acba72ea4bf9d339cdfcd8f55cdb7006/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/youtube-embed@1.0.0/node_modules/youtube-embed/index.js": 758,
- "./node_modules/.pnpm/babel-loader@8.2.4_acba72ea4bf9d339cdfcd8f55cdb7006/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./src/js/test-build.js|1ed43bc8d29104c7b835ffb17c3534db": 929
+ "./node_modules/.pnpm/babel-loader@8.2.4_acba72ea4bf9d339cdfcd8f55cdb7006/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./src/js/test-build.js|89bc82bff836a55d46c449c4ba13ebb9": 822
},
"usedIds": [
758,
- 929
+ 822
]
}
}
\ No newline at end of file
diff --git a/dist/report.html b/dist/report.html
index 74a5bd8..abbd949 100644
--- a/dist/report.html
+++ b/dist/report.html
@@ -3,7 +3,7 @@
- @a2nt/meta-lightbox-js [12 Apr 2022 at 13:43]
+ @a2nt/meta-lightbox-js [12 Apr 2022 at 15:16]
diff --git a/package.json b/package.json
index f194bac..d198bfb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@a2nt/meta-lightbox-js",
- "version": "4.2.0",
+ "version": "4.2.1",
"description": "Universal lightbox",
"author": "Tony Air ",
"license": "BSD-2-Clause",
@@ -53,7 +53,6 @@
"dependencies": {
"es6-template": "^1.0.4",
"material-design-color": "^2.3.2",
- "redaxios": "^0.4.1",
"youtube-embed": "^1.0.0"
},
"devDependencies": {
diff --git a/src/js/window.js b/src/js/window.js
index 7422774..46d8229 100755
--- a/src/js/window.js
+++ b/src/js/window.js
@@ -1,8 +1,6 @@
/*
* Lightbox window
*/
-import axios from "redaxios";
-
import Events from './_events';
const W = window;
@@ -77,7 +75,6 @@ class MetaWindow {
ui.name = ui.constructor.name;
console.log(`${ui.name}: init`);
- ui.axios = axios;
ui.setState(state);
switch (action) {
@@ -167,7 +164,6 @@ class MetaWindow {
load = (link) => {
const ui = this;
- const axios = ui.axios;
ui.reset();
ui.setState({
@@ -175,73 +171,72 @@ class MetaWindow {
});
ui.show();
- axios
- .get(link, {
- responseType: 'arraybuffer',
- })
- .then((resp) => {
- // handle success
- console.log(
- `${ui.name}: response content-type: ${resp.headers['content-type']}`
- );
- const json = false;
+ fetch(link).then((resp) => {
+ // handle success
+ const type = resp.headers.get("content-type");
+ console.log(resp);
- switch (resp.headers['content-type']) {
- case 'image/jpeg':
- case 'image/png':
- case 'image/svg+xml':
- case 'image/bmp':
- case 'image/gif':
- case 'image/tiff':
- case 'image/webp':
+ console.log(
+ `${ui.name}: response content-type: ${type}`
+ );
+ const json = false;
+
+ switch (type) {
+ case 'image/jpeg':
+ case 'image/png':
+ case 'image/svg+xml':
+ case 'image/bmp':
+ case 'image/gif':
+ case 'image/tiff':
+ case 'image/webp':
// irregular types:
- case 'image/jpg':
- case 'image/svg':
- //json = JSON.parse(ui._abToString(resp.data));
+ case 'image/jpg':
+ case 'image/svg':
+ //json = JSON.parse(ui._abToString(resp.data));
+ resp.arrayBuffer().then((buffer) => {
ui.setContent(
- ``,
+ ``,
`meta-${ui.name}--image`
);
- break;
- case 'application/json':
- case 'application/ld+json':
+ });
+ break;
+ case 'application/json':
+ case 'application/ld+json':
// irregular types:
- case 'application/json; charset=UTF-8':
- ui.setContent(`${json['Content']}`, [
- `meta-${ui.name}--text`,
- `meta-${ui.name}--html`,
- `meta-${ui.name}--json`,
- ]);
+ case 'application/json; charset=UTF-8':
+ ui.setContent(`${json['Content']}`, [
+ `meta-${ui.name}--text`,
+ `meta-${ui.name}--html`,
+ `meta-${ui.name}--json`,
+ ]);
- break;
- case 'video/mp4':
- ui.setContent(``, [
- `meta-${ui.name}--image`,
- `meta-${ui.name}--video`,
- ]);
- break;
- case 'text/html':
- case 'application/xhtml+xml':
- case 'text/plain':
+ break;
+ case 'video/mp4':
+ ui.setContent(``, [
+ `meta-${ui.name}--image`,
+ `meta-${ui.name}--video`,
+ ]);
+ break;
+ case 'text/html':
+ case 'application/xhtml+xml':
+ case 'text/plain':
// irregular types:
- case 'text/html; charset=UTF-8':
- case 'application/xhtml+xml; charset=UTF-8':
- case 'text/plain; charset=UTF-8':
- ui.setContent(ui._abToString(resp.data), [
- `meta-${ui.name}--text`,
- `meta-${ui.name}--html`,
- `meta-${ui.name}--pajax`,
- ]);
- break;
- default:
- console.warn(`${ui.name}: Unknown response content-type!`);
- break;
- }
+ case 'text/html; charset=UTF-8':
+ case 'application/xhtml+xml; charset=UTF-8':
+ case 'text/plain; charset=UTF-8':
+ ui.setContent(resp.data, [
+ `meta-${ui.name}--text`,
+ `meta-${ui.name}--html`,
+ `meta-${ui.name}--pajax`,
+ ]);
+ break;
+ default:
+ console.warn(`${ui.name}: Unknown response content-type!`);
+ break;
+ }
- W.dispatchEvent(new Event(`{ui.name}.loaded`));
- })
+ W.dispatchEvent(new Event(`{ui.name}.loaded`));
+ })
.catch((error) => {
console.error(error);
@@ -314,7 +309,7 @@ class MetaWindow {
addExtraClass = (cls) => {
const ui = this;
- if (!cls.length) {
+ if (!cls || !cls.length) {
return;
}
@@ -327,24 +322,15 @@ class MetaWindow {
return ui.state.caption;
};
- _abToString = (arrayBuffer) => {
+ /*_abToString = (arrayBuffer) => {
return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
- };
+ };*/
- _imageEncode = (arrayBuffer) => {
- const u8 = new Uint8Array(arrayBuffer);
- const b64encoded = btoa(
- [].reduce.call(
- new Uint8Array(arrayBuffer),
- (p, c) => {
- return p + String.fromCharCode(c);
- },
-
- ''
- )
- );
-
- return b64encoded;
+ _imageEncode = (buffer) => {
+ let binary = '';
+ const bytes = [].slice.call(new Uint8Array(buffer));
+ bytes.forEach((b) => binary += String.fromCharCode(b));
+ return window.btoa(binary);
};
setContent = (html, type) => {