From 61441b65e953b424d021f52d33fcf1b62f48be1d Mon Sep 17 00:00:00 2001 From: Tony Air Date: Fri, 11 Sep 2020 04:26:11 +0700 Subject: [PATCH] FIX: iframe reload --- dist/js/app.js | 2 +- dist/js/app.js.map | 2 +- package.json | 2 +- src/js/meta-lightbox.js | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dist/js/app.js b/dist/js/app.js index 38e1ff5..ed3b947 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -1,3 +1,3 @@ /*! For license information please see app.js.LICENSE.txt */ -!function(t){var e={};function a(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=t,a.c=e,a.d=function(t,e,o){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},a.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(o,n,function(e){return t[e]}.bind(null,n));return o},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/mnt/data/srv/dist/repositories/meta-lightbox/dist",a(a.s="./src/js/app.js")}({"./src/js/_events.js":function(t,e){t.exports={AJAX:"ajax-load",AJAXMAIN:"ajax-main-load",MAININIT:"main-init",TABHIDDEN:"tab-hidden",TABFOCUSED:"tab-focused",OFFLINE:"offline",ONLINE:"online",BACKONLINE:"back-online",TOUCHENABLE:"touch-enabled",TOUCHDISABLED:"touch-disabled",LOADED:"load",SWIPELEFT:"swipeleft panleft",SWIPERIGHT:"swiperight panright",ALLERTAPPEARED:"alert-appeared",ALERTREMOVED:"alert-removed",LODEDANDREADY:"load-ready",LAZYIMAGEREADY:"image-lazy-bg-loaded",LAZYIMAGESREADY:"images-lazy-loaded",MAPLOADED:"map-loaded",MAPAPILOADED:"map-api-loaded",MAPMARKERCLICK:"map-marker-click",MAPPOPUPCLOSE:"map-popup-close",SCROLL:"scroll",RESIZE:"resize",CAROUSEL_READY:"bs.carousel.ready",SET_TARGET_UPDATE:"set-target-update",RESTORE_FIELD:"restore-field",FORM_INIT_BASICS:"form-basics",FORM_INIT_STEPPED:"form-init-stepped",FORM_INIT_VALIDATE:"form-init-validate",FORM_INIT_VALIDATE_FIELD:"form-init-validate-field",FORM_INIT_STORAGE:"form-init-storage",FORM_VALIDATION_FAILED:"form-validation-failed",FORM_STEPPED_NEW_STEP:"form-new-step",FORM_STEPPED_FIRST_STEP:"form-first-step",FORM_STEPPED_LAST_STEP:"form-last-step",FORM_FIELDS:"input,textarea,select"}},"./src/js/app.js":function(t,e,a){"use strict";a.r(e);a("./src/scss/app.scss");var o=a("jquery"),n=a.n(o),i=a("./src/js/_events.js"),r=a.n(i);function c(t){return(c="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})(t)}function l(t,e){for(var a=0;a
Connection failure.
',m=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,a,o;return e=t,o=[{key:"init",value:function(){console.log("".concat(p,": init ..."));var t=this;t.isMSIE=0;try{t.isHidpi=t.is_hdpi()}catch(e){console.log("".concat(p,": catch"))}s(".js".concat(p,',[data-toggle="lightbox"],[data-lightbox-gallery]')).on("click",(function(e){e.preventDefault(),e.stopPropagation();var a=s(e.currentTarget);t.show(a)}))}},{key:"is_hdpi",value:function(){return console.log("".concat(p,": isHidpi")),d.devicePixelRatio>1||d.matchMedia&&d.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches}},{key:"show",value:function(t){console.log("".concat(p,": show"));var e=this;if(e.constructLightbox()){var a=e.$content;if(a){if(h.addClass("meta-lightbox-body-effect-fade"),e.process(a,t),t.data("lightbox-gallery")){var o=s('[data-lightbox-gallery="'.concat(t.data("lightbox-gallery"),'"]'));1===o.length?s(".meta-lightbox-nav").hide():s(".meta-lightbox-nav").show(),s(".meta-lightbox-prev").off("click").on("click",(function(a){a.preventDefault();var n=o.index(t),i=o.eq(n-1);i.length||(i=o.last()),setTimeout((function(){e.show(i)}),10)})),s(".meta-lightbox-next").off("click").on("click",(function(a){a.preventDefault();var n=o.index(t),i=o.eq(n+1);i.length||(i=o.first()),setTimeout((function(){e.show(i)}),10)}))}setTimeout((function(){e.$overlay.addClass("meta-lightbox-open")}),1)}}}},{key:"constructLightbox",value:function(){console.log("".concat(p,": constructLightbox"));var t=this,e=s("
",{class:"meta-lightbox-overlay meta-lightbox-theme-default meta-lightbox-effect-fade"}),a=s("
",{class:"meta-lightbox-wrap"}),o=s("
",{class:"meta-lightbox-content"}),n=s(' Previous Next'),i=s('Close'),r=s("
",{class:"meta-lightbox-title-wrap"});return t.$overlay||(t.isMSIE&&e.addClass("meta-lightbox-ie"),a.append(o),a.append(r),e.append(a),e.append(n),e.append(i),h.append(e),e.on("click",(function(e){e.preventDefault(),t.hide()})),i.on("click",(function(e){e.preventDefault(),t.hide()})),t.$overlay=e,t.$content=o,t.$title=r),t.$overlay}},{key:"setTitle",value:function(t){this.$title.html(t)}},{key:"process",value:function(t,e){console.log("".concat(p,": process"));var a=this,o=e.attr("href")&&e.attr("href").length?e.attr("href"):e.data("href");a.$content.attr("class","meta-lightbox-content"),a.$content.addClass(e.data("lightbox-class")),o.length||(console.log(e),console.error("".concat(p,": href(attr/data) is missing")));var n=s("#PageLoading .loading-spinner"),i=n.length?n.clone():"";if(a.$content.append(i).addClass("meta-lightbox-loading"),o.match(/\.(jpeg|jpg|gif|png|svg)$/i)){s.ajax({url:o,success:function(){var e=s("",{src:o}),n=s('
'),i=s('');i.append(e),n.append(i),n.css({"line-height":"".concat(t.height(),"px"),height:"".concat(t.height(),"px")}),f.resize((function(){n.css({"line-height":"".concat(t.height(),"px"),height:"".concat(t.height(),"px")})})),"undefined"!==typeof i.zoom?i.zoom():i.addClass("no-zoom"),a.$content.html(n),a.contentLoaded()},error:function(t,e){var o=s(g);a.$content.html(o),a.contentLoaded()}});var r=e.data("title")?e.data("title"):e.attr("title");a.setTitle(r),"function"===typeof ga&&ga("send","event","meta","Image Click",o)}else if(o.match(/(youtube|youtube-nocookie|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/)){var l,h=o.match(/(youtube|youtube-nocookie|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/),m="meta-lightbox-video";"youtube"==h[1]&&(l="https://www.youtube.com/embed/".concat(h[4]),m="".concat(m," meta-lightbox-youtube")),"youtu"==h[1]&&(l="https://www.youtube.com/embed/".concat(h[3]),m="".concat(m," meta-lightbox-youtube")),"youtube-nocookie"==h[1]&&(l="https://www.youtube-nocookie.com/embed/".concat(h[4]),m="".concat(m," meta-lightbox-youtube")),"vimeo"==h[1]&&(l="https://player.vimeo.com/video/".concat(h[3]),m="".concat(m," meta-lightbox-vimeo")),l&&a.loadIframe(l,m);var b=e.data("title")?e.data("title"):e.attr("title");a.setTitle(b),"function"===typeof ga&&ga("send","event","meta","Video Click",h)}else if("#"==o.substring(0,1))s(o).length?(wrap=s('
'),wrap.append(s(o).clone().show()),wrap.outerHeight()');i.html(n.regions.LayoutAjax),a.$content.html(i),a.contentLoaded()}var r=o.getResponseHeader("X-Title"),l=o.getResponseHeader("X-Link");r&&r.length&&l&&l.length&&l!==d.location.href&&l.substring(0,l.indexOf("#"))!==d.location.href.replace(s("base").attr("href"),"/")&&(s(".meta-lightbox-ajax").data("curr-title",u.title),s(".meta-lightbox-ajax").data("curr-link",d.location.href),"undefined"!==typeof d.localStorage&&"/"!==l&&d.localStorage.setItem("current-page",l),u.URL!==l&&u.URL!==s("base").attr("href")+l&&u.URL!=="".concat(s("base").attr("href"),"/").concat(l)&&d.history.pushState({title:r,page:l,ajax:"true"},r,l),s(".meta-lightbox-title-wrap").html(""),"function"===typeof ga&&(ga("set",{page:l.replace(s("base").attr("href"),""),title:r}),ga("send","pageview")))}}catch(h){var f=s('
');f.append(t),a.$content.html(f),a.contentLoaded()}a.contentLoaded()}})}}},{key:"loadIframe",value:function(t,e){var a=this,o=s("