1 line
7.1 KiB
JavaScript
1 line
7.1 KiB
JavaScript
!function(){"use strict";var e={n:function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,{a:o}),o},d:function(t,o){for(var i in o)e.o(o,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:o[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.jQuery,o=e.n(t);const{VPData:i}=window,{settingsPopupGallery:r}=i,n="content"in document.createElement("template"),a={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(e,t){let o=!1;const i=this,r=!(!t||!t[i.patternIndex])&&t[i.patternIndex];if(r){const n=/\/shorts\//.test(e),p=n?476:1920,l=n?847:1080;o=a.embedCallback({...i,width:p,height:l},r,e,t)}return o}},{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(){},open(){},close(){},getQueryStringParams(e){return e?(/^[?#]/.test(e)?e.slice(1):e).split("&").reduce(((e,t)=>{const[o,i]=t.split("=");return e[o]=i?decodeURIComponent(i.replace(/\+/g," ")):"",e}),{}):{}},prepareParams(e,t){let o="";const i=t.params||{};if(t.paramsIndex&&e&&e[t.paramsIndex]){const o=a.getQueryStringParams(e[t.paramsIndex]);o&&"object"==typeof o&&Object.keys(o).forEach((e=>{e&&o[e]&&(i[e]=o[e])}))}return i&&Object.keys(i).length&&Object.keys(i).forEach((e=>{e&&i[e]&&(o&&(o+="&"),o+=`${e}=${i[e]}`)})),o},embedCallback(e,t,o,i=!1){let{embedUrl:r}=e;r=r.replace(/{{video_id}}/g,t),r=r.replace(/{{video_url}}/g,o),r=r.replace(/{{video_url_encoded}}/g,encodeURIComponent(o)),r=r.replace(/{{params}}/g,i?a.prepareParams(i,e):"");const n=e.width||1920,p=e.height||1080;return{vendor:e.vendor,id:t,embed:`<iframe width="${n}" height="${p}" src="${r}" scrolling="no" frameborder="0" allowTransparency="true" allow="accelerometer; autoplay; clipboard-write; fullscreen; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,embedUrl:r,url:o,width:n,height:p}},parseVideo(e,t){let o=!1;return a.vendors.forEach((i=>{if(!o){const r=e.match(i.pattern),n=!(!r||!r[i.patternIndex])&&r[i.patternIndex];n&&(o=i.embedCallback?i.embedCallback(e,r,t):a.embedCallback(i,n,e,r))}})),o||(o=a.embedCallback({vendor:"unknown",embedUrl:e},e,e,!1)),o},parseItem(e){let t=!1;const o=e&&e.querySelector(".vp-portfolio__item-popup");return o&&(t={$dataElement:o,$content:o,data:o.dataset},n&&"TEMPLATE"===o.nodeName&&o.content&&(t.$content=o.content),t.$title=t?.$content?.querySelector(".vp-portfolio__item-popup-title"),t.$description=t?.$content?.querySelector(".vp-portfolio__item-popup-description")),t},parseGallery(e){const t=[];let o,i,r,n;return e.find(".vp-portfolio__item-wrap:not(.swiper-slide-duplicate)").each((function(){const e=a.parseItem(this);if(e){if(o=(e?.data?.vpPopupImgSize||"1920x1080").split("x"),r=e?.data?.vpPopupVideo,n=!1,r&&(n=a.parseVideo(r,e?.data?.vpPopupPoster)),n)i={type:"embed",el:this,poster:n.poster,src:n.embedUrl,embed:n.embed,width:n.width||1920,height:n.height||1080};else{i={type:"image",el:this,src:e?.data?.vpPopupImg,srcset:e?.data?.vpPopupImgSrcset,width:parseInt(o[0],10),height:parseInt(o[1],10)};const t=e?.data?.vpPopupSmImg||i.src;if(t){const o=(e?.data?.vpPopupSmImgSize||e?.data?.vpPopupImgSize||"1920x1080").split("x");i.srcSmall=t,i.srcSmallWidth=parseInt(o[0],10),i.srcSmallHeight=parseInt(o[1],10)}const r=e?.data?.vpPopupMdImg||i.src;if(r){const t=(e?.data?.vpPopupMdImgSize||e?.data?.vpPopupImgSize||"1920x1080").split("x");i.srcMedium=r,i.srcMediumWidth=parseInt(t[0],10),i.srcMediumHeight=parseInt(t[1],10)}}(e?.$title||e?.$description)&&(i.caption=(e?.$title?.outerHTML||"")+(e?.$description?.outerHTML||"")),t.push(i)}})),t},maybeFocusGalleryItem(e){r.restore_focus&&(e.linkEl?o()(e.linkEl).focus():e.el&&o()(e.el).find(".vp-portfolio__item-img > a").focus())}};function p(e){return/(.png|.jpg|.jpeg|.gif|.tiff|.tif|.jfif|.jpe|.svg|.bmp|.webp)$/.test(e.href.toLowerCase().split("?")[0].split("#")[0])}function l(e){const t=o()(e);let i=e.childNodes[0],r=t.next("figcaption");return"NOSCRIPT"===i.nodeName&&e.childNodes[1]&&(i=e.childNodes[1]),!r.length&&t.parent(".gallery-icon").length&&(r=t.parent(".gallery-icon").next("figcaption")),r=r.html(),r&&(r=`<div class="vp-portfolio__item-popup-description">${r}</div>`),{type:"image",el:i,linkEl:e,src:e.href,caption:r}}window.VPPopupAPI=a,o()(document).on("extendClass.vpf",((e,t)=>{"vpf"===e.namespace&&(t.prototype.initPopupGallery=function(){const e=this;e.options.itemsClickAction&&"url"!==e.options.itemsClickAction&&(e.isPreview()||e.$item.on(`click.vpf-uid-${e.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(t){if(t.isDefaultPrevented())return;let i=o()(this).closest(".vp-portfolio__item-wrap");if(i.hasClass("swiper-slide-duplicate")&&i.attr("data-swiper-slide-index")&&(i=e.$item.find(`[data-swiper-slide-index="${i.attr("data-swiper-slide-index")}"].swiper-slide:not(.swiper-slide-duplicate)`)),!i.find(".vp-portfolio__item-popup").length)return;const r=a.parseGallery(e.$item);let n=-1;r.forEach(((e,t)=>{e.el===i[0]&&(n=t)})),-1!==n&&(t.preventDefault(),a.open(r,n,e))})))},t.prototype.destroyPopupGallery=function(){const e=this;e.options.itemsClickAction&&"url"!==e.options.itemsClickAction&&(e.$item.off(`click.vpf-uid-${e.uid}`),e.emitEvent("destroyPopupGallery"))})})),o()(document).on("init.vpf",((e,t)=>{"vpf"===e.namespace&&t.initPopupGallery()})),o()(document).on("destroy.vpf",((e,t)=>{"vpf"===e.namespace&&t.destroyPopupGallery()})),r.enable_on_wordpress_images&&o()(document).on("click","\n .wp-block-image > a,\n .wp-block-image > figure > a,\n .wp-block-gallery .blocks-gallery-item > figure > a,\n .wp-block-gallery .wp-block-image > a,\n .wp-block-media-text > figure > a,\n .gallery .gallery-icon > a,\n figure.wp-caption > a,\n figure.tiled-gallery__item > a,\n p > a\n ",(function(e){if(e.isDefaultPrevented())return;if(!this.childNodes.length)return;let t=this.childNodes[0];if("NOSCRIPT"===t.nodeName&&this.childNodes[1]&&(t=this.childNodes[1]),"IMG"!==t.nodeName&&"PICTURE"!==t.nodeName)return;if(!p(this))return;e.preventDefault();const i=o()(this),r=[],n=l(this),s=i.closest(".wp-block-gallery, .gallery, .tiled-gallery__gallery");let c=0;if(s.length){const e=s.find(".blocks-gallery-item > figure > a, .wp-block-image > a, .gallery-icon > a, figure.tiled-gallery__item > a");let t=0;e.each((function(){p(this)&&(this===n.linkEl&&(c=t),r.push(l(this)),t+=1)}))}else r.push(n);a.open(r,c)}))}(); |