1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
!function(){"use strict";var t={n:function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,{a:i}),i},d:function(e,i){for(var o in i)t.o(i,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.jQuery,i=t.n(e);const{VPData:o}=window,{__:__}=o,s=i()(window);function n(){if("function"==typeof window.Event)window.dispatchEvent(new window.Event("resize"));else{const t=window.document.createEvent("UIEvents");t.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(t)}}const r={};let a=!1,l=!1,d=!1;function p(){if(clearTimeout(l),!a)return;const t=i()(".vp-portfolio__ready");if(t.length){let e=!1;t.each((function(){const{vpf:t}=this;if(!t)return;const i=r[t.uid]||"none";r[t.uid]=null===this.offsetParent?"hidden":"visible","hidden"===i&&"visible"===r[t.uid]&&(e=!0)})),e&&n()}else a=!1;l=setTimeout(p,500)}i()(document).on("inited.vpf",(t=>{"vpf"===t.namespace&&(a=!0,p())})),document.addEventListener("keydown",(function(t){t.metaKey||t.altKey||t.ctrlKey||(d=!0)}),!0),document.addEventListener("mousedown",(()=>{d=!1}),!0),document.addEventListener("pointerdown",(()=>{d=!1}),!0),document.addEventListener("touchstart",(()=>{d=!1}),!0);class v{constructor(t,e){const i=this;i.$item=t;const o=t[0].className.split(/\s+/);for(let t=0;t<o.length;t+=1)o[t]&&/^vp-uid-/.test(o[t])&&(i.uid=o[t].replace(/^vp-uid-/,"")),o[t]&&/^vp-id-/.test(o[t])&&(i.id=o[t].replace(/^vp-id-/,""));i.uid?(i.href=window.location.href,i.$items_wrap=t.find(".vp-portfolio__items"),i.$slider_thumbnails_wrap=t.find(".vp-portfolio__thumbnails"),i.$pagination=t.find(".vp-portfolio__pagination-wrap"),i.$filter=t.find(".vp-portfolio__filter-wrap"),i.$sort=t.find(".vp-portfolio__sort-wrap"),i.id&&(i.$filter=i.$filter.add(`.vp-single-filter.vp-id-${i.id} .vp-portfolio__filter-wrap`)),i.id&&(i.$sort=i.$sort.add(`.vp-single-sort.vp-id-${i.id} .vp-portfolio__sort-wrap`)),i.userOptions=e,i.firstRun=!0,i.init()):console.error(__.couldnt_retrieve_vp)}emitEvent(t,e){e=e?[this].concat(e):[this],this.$item.trigger(`${t}.vpf`,e),this.$item.trigger(`${t}.vpf-uid-${this.uid}`,e)}init(){const t=this;t.firstRun||t.destroy(),t.destroyed=!1,t.$item.addClass("vp-portfolio__ready"),t.initOptions(),t.initEvents(),t.initLayout(),t.initCustomColors(),t.emitEvent("init"),t.id&&(i()(`.vp-single-filter.vp-id-${t.id}`).addClass("vp-single-filter__ready").parent(".vp-portfolio__layout-elements").addClass("vp-portfolio__layout-elements__ready"),i()(`.vp-single-sort.vp-id-${t.id}`).addClass("vp-single-sort__ready").parent(".vp-portfolio__layout-elements").addClass("vp-portfolio__layout-elements__ready")),t.resized(),t.imagesLoaded(),t.emitEvent("inited"),t.firstRun=!1}isPreview(){return!!this.$item.closest("#vp_preview").length}resized(){n(),this.emitEvent("resized")}imagesLoaded(){this.$items_wrap.imagesLoaded&&this.$items_wrap.imagesLoaded().progress((()=>{this.emitEvent("imagesLoaded")}))}destroy(){const t=this;t.$item.removeClass("vp-portfolio__ready"),t.id&&(i()(`.vp-single-filter.vp-id-${t.id}`).removeClass("vp-single-filter__ready").parent(".vp-portfolio__layout-elements").removeClass("vp-portfolio__layout-elements__ready"),i()(`.vp-single-sort.vp-id-${t.id}`).removeClass("vp-single-sort__ready").parent(".vp-portfolio__layout-elements").removeClass("vp-portfolio__layout-elements__ready")),t.destroyEvents(),t.removeStyle(),t.renderStyle(),t.emitEvent("destroy"),t.destroyed=!0}addStyle(t,e,o){o=o||"";const s=this,{uid:n}=s;s.stylesList||(s.stylesList={}),void 0===s.stylesList[n]&&(s.stylesList[n]={}),void 0===s.stylesList[n][o]&&(s.stylesList[n][o]={}),void 0===s.stylesList[n][o][t]&&(s.stylesList[n][o][t]={}),s.stylesList[n][o][t]=i().extend(s.stylesList[n][o][t],e),s.emitEvent("addStyle",[t,e,o,s.stylesList])}removeStyle(t,e,i){i=i||"";const o=this,{uid:s}=o;o.stylesList||(o.stylesList={}),void 0===o.stylesList[s]||t||(o.stylesList[s]={}),void 0!==o.stylesList[s]&&void 0!==o.stylesList[s][i]&&void 0!==o.stylesList[s][i][t]&&t&&delete o.stylesList[s][i][t],o.emitEve
|