🏠 Root
/
home
/
artorgp
/
www
/
wp-content
/
plugins
/
visual-portfolio
/
build
/
assets
/
js
/
Editing: popup-gallery.js
(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.jQuery;var r=t.n(e);function o(t){return o="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},o(t)}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r<e;r++)o[r]=t[r];return o}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var p=window.VPData.settingsPopupGallery,c="content"in document.createElement("template"),u={vendor:!1,vendors:[{vendor:"youtube",embedUrl:"https://www.youtube.com/embed/{{video_id}}?{{params}}",pattern:/(https?:\/\/)?(www.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?:embed\/|shorts\/|v\/|watch\?v=|watch\?list=(.*)&v=|watch\?(.*[^&]&)v=)?((\w|-){11})(&list=(\w+)&?)?(.*)/,patternIndex:6,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramsIndex:10,embedCallback:function(t,e){var r=!1,o=this,i=!(!e||!e[o.patternIndex])&&e[o.patternIndex];if(i){var n=/\/shorts\//.test(t),a=n?476:1920,p=n?847:1080;r=u.embedCallback(l(l({},o),{},{width:a,height:p}),i,t,e)}return r}},{vendor:"vimeo",embedUrl:"https://player.vimeo.com/video/{{video_id}}?{{params}}",pattern:/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(.*)/,patternIndex:3,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramsIndex:4}],init:function(){},open:function(){},close:function(){},getQueryStringParams:function(t){return t?(/^[?#]/.test(t)?t.slice(1):t).split("&").reduce(function(t,e){var r,o,n=(r=e.split("="),o=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,i,n,l,a=[],p=!0,c=!1;try{if(n=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;p=!1}else for(;!(p=(o=n.call(r)).done)&&(a.push(o.value),a.length!==e);p=!0);}catch(t){c=!0,i=t}finally{try{if(!p&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw i}}return a}}(r,o)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(r,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],a=n[1];return t[l]=a?decodeURIComponent(a.replace(/\+/g," ")):"",t},{}):{}},prepareParams:function(t,e){var r="",i=e.params||{};if(e.paramsIndex&&t&&t[e.paramsIndex]){var n=u.getQueryStringParams(t[e.paramsIndex]);n&&"object"===o(n)&&Object.keys(n).forEach(function(t){t&&n[t]&&(i[t]=n[t])})}return i&&Object.keys(i).length&&Object.keys(i).forEach(function(t){t&&i[t]&&(r&&(r+="&"),r+="".concat(t,"=").concat(i[t]))}),r},embedCallback:function(t,e,r){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=t.embedUrl;i=(i=(i=(i=i.replace(/{{video_id}}/g,e)).replace(/{{video_url}}/g,r)).replace(/{{video_url_encoded}}/g,encodeURIComponent(r))).replace(/{{params}}/g,o?u.prepareParams(o,t):"");var n=t.width||1920,l=t.height||1080;return{vendor:t.vendor,id:e,embed:'<iframe width="'.concat(n,'" height="').concat(l,'" src="').concat(i,'" scrolling="no" frameborder="0" allowTransparency="true" allow="accelerometer; autoplay; clipboard-write; fullscreen; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'),embedUrl:i,url:r,width:n,height:l}},parseVideo:function(t,e){var r=!1;return u.vendors.forEach(function(o){if(!r){var i=t.match(o.pattern),n=!(!i||!i[o.patternIndex])&&i[o.patternIndex];n&&(r=o.embedCallback?o.embedCallback(t,i,e):u.embedCallback(o,n,t,i))}}),r||(r=u.embedCallback({vendor:"unknown",embedUrl:t},t,t,!1)),r},parseItem:function(t){var e,r,o=!1,i=t&&t.querySelector(".vp-portfolio__item-popup");return i&&(o={$dataElement:i,$content:i,data:i.dataset},c&&"TEMPLATE"===i.nodeName&&i.content&&(o.$content=i.content),o.$title=null===(e=o)||void 0===e||null===(e=e.$content)||void 0===e?void 0:e.querySelector(".vp-portfolio__item-popup-title"),o.$description=null===(r=o)||void 0===r||null===(r=r.$content)||void 0===r?void 0:r.querySelector(".vp-portfolio__item-popup-description")),o},parseGallery:function(t){var e,r,o,i,n=[];return t.find(".vp-portfolio__item-wrap:not(.swiper-slide-duplicate)").each(function(){var t=u.parseItem(this);if(t){var l,a,p,c,d;if(e=((null==t||null===(l=t.data)||void 0===l?void 0:l.vpPopupImgSize)||"1920x1080").split("x"),o=null==t||null===(a=t.data)||void 0===a?void 0:a.vpPopupVideo,i=!1,o&&(i=u.parseVideo(o,null==t||null===(p=t.data)||void 0===p?void 0:p.vpPopupPoster)),i)r={type:"embed",el:this,poster:i.poster,src:i.embedUrl,embed:i.embed,width:i.width||1920,height:i.height||1080};else{var s,m,f,v;r={type:"image",el:this,src:null==t||null===(s=t.data)||void 0===s?void 0:s.vpPopupImg,srcset:null==t||null===(m=t.data)||void 0===m?void 0:m.vpPopupImgSrcset,width:parseInt(e[0],10),height:parseInt(e[1],10)};var y=(null==t||null===(f=t.data)||void 0===f?void 0:f.vpPopupSmImg)||r.src;if(y){var h,g,b=((null==t||null===(h=t.data)||void 0===h?void 0:h.vpPopupSmImgSize)||(null==t||null===(g=t.data)||void 0===g?void 0:g.vpPopupImgSize)||"1920x1080").split("x");r.srcSmall=y,r.srcSmallWidth=parseInt(b[0],10),r.srcSmallHeight=parseInt(b[1],10)}var w=(null==t||null===(v=t.data)||void 0===v?void 0:v.vpPopupMdImg)||r.src;if(w){var _,P,I=((null==t||null===(_=t.data)||void 0===_?void 0:_.vpPopupMdImgSize)||(null==t||null===(P=t.data)||void 0===P?void 0:P.vpPopupImgSize)||"1920x1080").split("x");r.srcMedium=w,r.srcMediumWidth=parseInt(I[0],10),r.srcMediumHeight=parseInt(I[1],10)}}(null!=t&&t.$title||null!=t&&t.$description)&&(r.caption=((null==t||null===(c=t.$title)||void 0===c?void 0:c.outerHTML)||"")+((null==t||null===(d=t.$description)||void 0===d?void 0:d.outerHTML)||"")),n.push(r)}}),n},maybeFocusGalleryItem:function(t){p.restore_focus&&(t.linkEl?r()(t.linkEl).focus():t.el&&r()(t.el).find(".vp-portfolio__item-img > a").focus())},emitEvent:function(t,e,o){if(o&&o.emitEvent)o.emitEvent(t,e);else{var i=[null].concat(e);r()(document).trigger("".concat(t,".vpf"),i)}}};function d(t){return/(.png|.jpg|.jpeg|.gif|.tiff|.tif|.jfif|.jpe|.svg|.bmp|.webp)$/.test(t.href.toLowerCase().split("?")[0].split("#")[0])}function s(t){var e=r()(t),o=t.childNodes[0],i=e.next("figcaption");return"NOSCRIPT"===o.nodeName&&t.childNodes[1]&&(o=t.childNodes[1]),!i.length&&e.parent(".gallery-icon").length&&(i=e.parent(".gallery-icon").next("figcaption")),(i=i.html())&&(i='<div class="vp-portfolio__item-popup-description">'.concat(i,"</div>")),{type:"image",el:o,linkEl:t,src:t.href,caption:i}}window.VPPopupAPI=u,r()(document).on("extendClass.vpf",function(t,e){"vpf"===t.namespace&&(e.prototype.initPopupGallery=function(){var t=this;t.options.itemsClickAction&&"url"!==t.options.itemsClickAction&&(t.isPreview()||t.$item.on("click.vpf-uid-".concat(t.uid),"\n .vp-portfolio__item a.vp-portfolio__item-meta,\n .vp-portfolio__item .vp-portfolio__item-img > a,\n .vp-portfolio__item .vp-portfolio__item-meta-title > a,\n .vp-portfolio__item a.vp-portfolio__item-overlay\n ",function(e){if(!e.isDefaultPrevented()){var o=r()(this).closest(".vp-portfolio__item-wrap");if(o.hasClass("swiper-slide-duplicate")&&o.attr("data-swiper-slide-index")&&(o=t.$item.find('[data-swiper-slide-index="'.concat(o.attr("data-swiper-slide-index"),'"].swiper-slide:not(.swiper-slide-duplicate)'))),o.find(".vp-portfolio__item-popup").length){var i=u.parseGallery(t.$item),n=-1;i.forEach(function(t,e){t.el===o[0]&&(n=e)}),-1!==n&&(e.preventDefault(),u.open(i,n,t))}}}))},e.prototype.destroyPopupGallery=function(){var t=this;t.options.itemsClickAction&&"url"!==t.options.itemsClickAction&&(t.$item.off("click.vpf-uid-".concat(t.uid)),t.emitEvent("destroyPopupGallery"))})}),r()(document).on("init.vpf",function(t,e){"vpf"===t.namespace&&e.initPopupGallery()}),r()(document).on("destroy.vpf",function(t,e){"vpf"===t.namespace&&e.destroyPopupGallery()}),p.enable_on_wordpress_images&&r()(document).on("click","\n\t\t\t.wp-block-image > a,\n\t\t\t.wp-block-image > figure > a,\n\t\t\t.wp-block-gallery .blocks-gallery-item > figure > a,\n\t\t\t.wp-block-gallery .wp-block-image > a,\n\t\t\t.wp-block-media-text > figure > a,\n\t\t\t.gallery .gallery-icon > a,\n\t\t\tfigure.wp-caption > a,\n\t\t\tfigure.tiled-gallery__item > a,\n\t\t\tp > a,\n\t\t\ta.vp-lightbox-gallery,\n\t\t\t.vp-lightbox-gallery a\n\t\t",function(t){if(!t.isDefaultPrevented()&&this.childNodes.length){var e=this.childNodes[0];if("NOSCRIPT"===e.nodeName&&this.childNodes[1]&&(e=this.childNodes[1]),("IMG"===e.nodeName||"PICTURE"===e.nodeName)&&d(this)){t.preventDefault();var o=r()(this),i=[],n=s(this),l=o.closest(".wp-block-gallery, .gallery, .tiled-gallery__gallery, .vp-lightbox-gallery"),a=0;if(l.length){var p=l.hasClass("vp-lightbox-gallery")?l.find("a"):l.find("\n\t\t\t\t\t\t\t\t.blocks-gallery-item > figure > a,\n\t\t\t\t\t\t\t\t.wp-block-image > a,\n\t\t\t\t\t\t\t\t.gallery-icon > a,\n\t\t\t\t\t\t\t\tfigure.tiled-gallery__item > a\n\t\t\t\t\t\t\t"),c=0;p.each(function(){d(this)&&(this===n.linkEl&&(a=c),i.push(s(this)),c+=1)})}else i.push(n);u.open(i,a)}}})})();
Save
Cancel