ad_login/wwwroot/assets/javascript/pages/photoswipe-demo.min.js

3 lines
2.7 KiB
JavaScript

"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}var PhotoswipeDemo=function(){function e(){_classCallCheck(this,e),this.init()}return _createClass(e,[{key:"init",value:function(){this.initPhotoSwipeFromDOM(".pswp-gallery"),$(document).ready(function(){$(".figure-action > a").on("click",function(e){return e.stopPropagation()})})}},{key:"initPhotoSwipeFromDOM",value:function(e){for(var t=function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1;var t=function e(t,n){return t&&(n(t)?t:e(t.parentNode,n))}(e.target||e.srcElement,function(e){return e.tagName&&"FIGURE"===e.tagName.toUpperCase()});if(t){for(var n,r=t.parentNode,i=t.parentNode.parentNode.parentNode.querySelectorAll(".figure"),o=i.length,a=0,l=0;l<o;l++)if(1===i[l].nodeType){if(i[l]===t){n=a;break}a++}return 0<=n&&u(n,r),!1}},u=function(e,t,n,r){var i,o,a=document.querySelectorAll(".pswp")[0];if(t=t.classList.contains("card-figure")?t.parentNode.parentNode:t,o=function(e){for(var t,n,r,i,o=e.childNodes,a=o.length,l=[],u=0;u<a;u++)1===(t=o[u]).nodeType&&(r=(n=t.querySelectorAll(".img-link")[0]).getAttribute("data-size").split("x"),i={src:n.getAttribute("href"),w:parseInt(r[0],10),h:parseInt(r[1],10)},1<n.children.length&&(i.title=n.querySelectorAll(".img-caption")[0].innerHTML),0<n.children.length&&(i.msrc=t.querySelectorAll("img")[0].getAttribute("src")),i.el=t,l.push(i));return l}(t),i={galleryUID:t.getAttribute("data-pswp-uid"),getThumbBoundsFn:function(e){var t=o[e].el.getElementsByTagName("img")[0],n=window.pageYOffset||document.documentElement.scrollTop,r=t.getBoundingClientRect();return{x:r.left,y:r.top+n,w:r.width}}},r)if(i.galleryPIDs){for(var l=0;l<o.length;l++)if(o[l].pid==e){i.index=l;break}}else i.index=parseInt(e,10)-1;else i.index=parseInt(e,10);isNaN(i.index)||(n&&(i.showAnimationDuration=0),new PhotoSwipe(a,PhotoSwipeUI_Default,o,i).init())},n=document.querySelectorAll(e),r=0,i=n.length;r<i;r++)n[r].setAttribute("data-pswp-uid",r+1),n[r].onclick=t;var o=function(){var e=window.location.hash.substring(1),t={};if(e.length<5)return t;for(var n=e.split("&"),r=0;r<n.length;r++)if(n[r]){var i=n[r].split("=");i.length<2||(t[i[0]]=i[1])}return t.gid&&(t.gid=parseInt(t.gid,10)),t}();o.pid&&o.gid&&u(o.pid,n[o.gid-1],!0,!0)}}]),e}();$(document).on("theme:init",function(){new PhotoswipeDemo});
//# sourceMappingURL=../../sourcemaps/pages/photoswipe-demo.min.js.map