Changeset 3396625
- Timestamp:
- 11/16/2025 03:37:14 PM (5 months ago)
- Location:
- shutterpress-gallery
- Files:
-
- 16 edited
- 1 copied
-
tags/1.7.10 (copied) (copied from shutterpress-gallery/trunk)
-
tags/1.7.10/README.txt (modified) (3 diffs)
-
tags/1.7.10/includes/js/shutterpress-gallery-editor.js (modified) (1 diff)
-
tags/1.7.10/includes/js/shutterpress-gallery-public.js (modified) (1 diff)
-
tags/1.7.10/shutterpress-gallery.php (modified) (2 diffs)
-
tags/1.7.10/src/public/js/layouts.js (modified) (3 diffs)
-
tags/1.7.10/src/public/js/shutterpress-gallery-isotope.js (modified) (1 diff)
-
tags/1.7.10/vendor/composer/autoload_static.php (modified) (3 diffs)
-
tags/1.7.10/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/includes/js/shutterpress-gallery-editor.js (modified) (1 diff)
-
trunk/includes/js/shutterpress-gallery-public.js (modified) (1 diff)
-
trunk/shutterpress-gallery.php (modified) (2 diffs)
-
trunk/src/public/js/layouts.js (modified) (3 diffs)
-
trunk/src/public/js/shutterpress-gallery-isotope.js (modified) (1 diff)
-
trunk/vendor/composer/autoload_static.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shutterpress-gallery/tags/1.7.10/README.txt
r3385981 r3396625 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.7. 98 Stable tag: 1.7.10 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 ### **Wordpress Gallery Plugin** 17 17 18 **ShutterPress Gallery** is a flexible, photographer-focused WordPress gallery plugin designed for professionals who need to share and deliver images online. Build stunning, responsive galleries with reusable **Gallery Templates** and fine-grained **styling options** that let you control colors, icons, and hover effects — all from an easy-to-use admin panel.18 **ShutterPress Gallery** is a flexible, WordPress gallery plugin designed for photgraphers or artisits who need to share and deliver images online. Build stunning, responsive galleries with reusable **Gallery Templates** and fine-grained **styling options** that let you control colors, icons, and hover effects — all from an easy-to-use admin panel. 19 19 20 20 With built-in support for Gutenberg and Elementor, you can display each gallery on its own dedicated page, or embed it anywhere on your site using Gutenberg blocks, Elementor widgets, or shortcodes. Each gallery can be customized with templates, layout settings, and feature toggles, including optional favorites, downloads, and lightbox. … … 119 119 120 120 == Changelog == 121 122 = 1.7.10 = 123 124 * Fix - Add Isotope layout mode registration guard to prevent conflict with other Isotope instances 121 125 122 126 = 1.7.9 = -
shutterpress-gallery/tags/1.7.10/includes/js/shutterpress-gallery-editor.js
r3383402 r3396625 1 (()=>{var t={997:()=>{ var t,e,i;(t=Isotope.LayoutMode.create("spGridLayout")).prototype._resetLayout=function(){this.itemIndex=0;var t=this.isotope.element,e=parseInt(t.getAttribute("data-gap"))||0,i=JSON.parse(t.getAttribute("data-breakpoints")),o=JSON.parse(t.getAttribute("data-columns")),s=window.innerWidth,n=o.desktop;s<=i.mobile?n=o.mobile:s<=i.tablet&&(n=o.tablet),this.cols=n;var a=(n-1)*e,r=(this.isotope.size.innerWidth-a)/n;this.columnWidth=r,this.rowHeight=r,this.gap=e,this.positions=[]},t.prototype._getItemLayoutPosition=function(t){var e=this.itemIndex%this.cols,i=Math.floor(this.itemIndex/this.cols),o=e*(this.columnWidth+this.gap),s=i*(this.rowHeight+this.gap),n=t.element;return n.style.width=this.columnWidth+"px",n.style.height=this.rowHeight+"px",this.positions.push({x:o,y:s}),this.itemIndex++,{x:o,y:s}},t.prototype._getContainerSize=function(){return{height:Math.ceil(this.itemIndex/this.cols)*(this.rowHeight+this.gap)-this.gap}},t.prototype.needsResizeLayout=function(){return!0},Isotope.LayoutMode.modes.spGridLayout=t,(e=Isotope.LayoutMode.create("spJustifiedLayout")).prototype._resetLayout=function(){var t=this.isotope.element;this.rowHeight=parseInt(t.getAttribute("data-row-height"))||200,this.gap=parseInt(t.getAttribute("data-gap"),10)||10,this.containerWidth=this.isotope.size.innerWidth,this._posCache=new Map},e.prototype._getItemLayoutPosition=function(t){var e=this._posCache.get(t.id);if(e)return t.element.style.width=e.width+"px",t.element.style.height=e.height+"px",this._posCache.delete(t.id),{x:e.x,y:e.y};var i=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,o=i.indexOf(t);if(o<0)return{x:0,y:0};for(var s=0,n=0;s<o;){for(var a=0,r=0,l=s;l<i.length;){var d=i[l].element,p=d.querySelector("img"),c=parseInt(d.getAttribute("data-width"))||p&&parseInt(p.getAttribute("width")),u=parseInt(d.getAttribute("data-height"))||p&&parseInt(p.getAttribute("height")),g=parseFloat(d.getAttribute("data-ratio"))||(c&&u?c/u:1);if(r++,(a+=this.rowHeight*g)+this.gap*(r-1)>this.containerWidth&&r>1)break;l++}var h=(r-1)*this.gap,y=a+h>0?(this.containerWidth-h)/a:1;n+=Math.round(this.rowHeight*y)+this.gap,s+=r}for(var m=[],f=0,b=o;b<i.length;){var w=i[b],v=w.element,x=v.querySelector("img"),A=parseInt(v.getAttribute("data-width"))||x&&parseInt(x.getAttribute("width")),$=parseInt(v.getAttribute("data-height"))||x&&parseInt(x.getAttribute("height")),I=parseFloat(v.getAttribute("data-ratio"))||(A&&$?A/$:1),S=this.rowHeight*I;if(m.push({id:w.id,w:S}),(f+=S)+this.gap*(m.length-1)>this.containerWidth&&m.length>1)break;b++}for(var C=(m.length-1)*this.gap,k=b>=i.length,D=f+C>0?(this.containerWidth-C)/f:1,_=k?Math.min(1,D):D,z=Math.round(this.rowHeight*_),L=0,W=0;W<m.length;W++){var M=Math.floor(m[W].w*_);this._posCache.set(m[W].id,{x:L,y:n,width:M,height:z}),L+=M+this.gap,m.length}var P=this._posCache.get(t.id);return P?(t.element.style.width=P.width+"px",t.element.style.height=P.height+"px",this._posCache.delete(t.id),{x:P.x,y:P.y}):{x:0,y:n}},e.prototype._getContainerSize=function(){for(var t=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,e=0,i=0;e<t.length;){for(var o=0,s=0,n=e;n<t.length;){var a=t[n].element,r=a.querySelector("img"),l=parseInt(a.getAttribute("data-width"))||r&&parseInt(r.getAttribute("width")),d=parseInt(a.getAttribute("data-height"))||r&&parseInt(r.getAttribute("height")),p=parseFloat(a.getAttribute("data-ratio"))||(l&&d?l/d:1);if(s++,(o+=this.rowHeight*p)+this.gap*(s-1)>this.containerWidth&&s>1)break;n++}var c=(s-1)*this.gap,u=n>=t.length,g=o+c>0?(this.containerWidth-c)/o:1,h=u?Math.min(1,g):g;i+=Math.round(this.rowHeight*h)+this.gap,e+=s}return i>0&&(i-=this.gap),{height:i}},e.prototype.needsResizeLayout=function(){return!0},Isotope.LayoutMode.modes.spJustifiedLayout=e,(i=Isotope.LayoutMode.create("none")).prototype._resetLayout=function(){return!1},i.prototype._getItemLayoutPosition=function(){return{}},i.prototype._getContainerSize=function(){return{height:0}},i.prototype.needsResizeLayout=function(){return!1},Isotope.LayoutMode.modes.none=i}},e={};function i(o){var s=e[o];if(void 0!==s)return s.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,i),n.exports}(()=>{"use strict";function t(){const t=jQuery,e=t('[id^="sp-gallery-"].sp-gallery');if(0===e.length)return;let i="";e.each(function(){const e=t(this),o=e.data("id"),s=`.lg-sp-gallery-${o}`,n=e.data("breakpoints"),a=e.data("layout"),r=e.get(0).clientWidth,l=e.data("gap"),d=e.data("lg"),p=e.data("icon-size"),c=e.data("icon-size-h"),u=e.data("columns"),g=e.data("colors"),h=e.attr("data-custom-css");function y(t){return(t-1)*l}if(i+=`\n \n #sp-gallery-buttons-${o}, \n #sp-gallery-${o}, \n #sp-gallery-page-load-container-${o}, \n #sp-gallery-pagination-${o} {\n --sp-gallery-color-primary: ${g.primary};\n --sp-gallery-color-accent: ${g.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${o} {\n ${c&&c.desktop?`--sp-gallery-hover-icon-size: ${c.desktop}px;`:""}\n ${p&&p.desktop?`--sp-gallery-icon-size: ${p.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${n.tablet}px) */\n @media (max-width: ${n.tablet}px) {\n #sp-gallery-${o} {\n ${c&&c.tablet?`--sp-gallery-hover-icon-size: ${c.tablet}px;`:""}\n ${p&&p.tablet?`--sp-gallery-icon-size: ${p.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${n.mobile}px) */\n @media (max-width: ${n.mobile}px) {\n #sp-gallery-${o} {\n ${c&&c.mobile?`--sp-gallery-hover-icon-size: ${c.mobile}px;`:""}\n ${p&&p.mobile?`--sp-gallery-icon-size: ${p.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${s} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${g.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const t=`#sp-gallery-${o}.sp-gallery-grid-gallery `;i+=`\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${n.tablet}px) {\n ${t} { grid-template-columns: repeat(${u.tablet}, 1fr); }\n }\n @media (max-width: ${n.mobile}px) {\n ${t} { grid-template-columns: repeat(${u.mobile}, 1fr); }\n }\n `}if("masonry"===a){const t=`#sp-gallery-${o}.sp-gallery-masonry-gallery `;i+=`\n\n ${t} {\n --sp-gallery-width: ${r}px;\n }\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${t} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(u.desktop)}px) / ${u.desktop});\n }\n\n @media (max-width: ${n.tablet}px) {\n ${t} {\n grid-template-columns: repeat(${u.tablet}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.tablet)}px) / ${u.tablet});\n }\n }\n\n @media (max-width: ${n.mobile}px) {\n ${t} {\n grid-template-columns: repeat(${u.mobile}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.mobile)}px) / ${u.mobile});\n }\n }\n `}h&&(i+=h)});let o=jQuery("#shutterpress-gallery-inline-style");0===o.length&&(o=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),o.text(i)}function e(t){Array.isArray(t)||(t=[]),t.forEach(function(t){jQuery('.sp-gallery-like-icon[data-image-id="'+t+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+t).addClass("sp-gallery-item-liked")})}i(997);let o=[];function s(){return o}jQuery(document).ready(function(i){function o(){const i=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");i?.contentDocument||document;let o=(i?.contentWindow?.jQuery||jQuery)(".sp-gallery").not("[data-sp-initialized]");o.length&&o.each(function(){const i=this,o=i.ownerDocument,n=o.defaultView?.jQuery||jQuery;!function t(e,o=0){const s=i.clientWidth;return s&&s>0||o>40?e():void setTimeout(()=>t(e,o+1),50)}(()=>{("function"==typeof n.fn.imagesLoaded?(t,e)=>n(t).imagesLoaded(e):(t,e)=>e())(i,()=>{const a="shutterpress-gallery-inline-style";jQuery("#"+a).remove(),t();const r=document.getElementById(a);if(r&&o!==document){const t=o.getElementById(a);t&&t.remove();const e=o.createElement("style");e.id=a,e.textContent=r.textContent||"",o.head.appendChild(e)}n(i).one("layoutComplete.spInit",function(){n(this).removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){const t=n(i);t.hasClass("sp-gallery-hidden")&&t.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500),function(i=jQuery,o=!1){i(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",i(this).attr("id"));const n=i(this),a=n[0]?.ownerDocument?.defaultView||window;if(n.data("spLayoutsInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",n.attr("id")));n.data("spLayoutsInit",!0);const r=n.data("layout"),l=n.attr("id"),d=n.data("gap"),p=n.data("columns")||{desktop:3,tablet:2,mobile:1},c=n.data("breakpoints"),u=n.get(0).clientWidth;let g=p.desktop;const h=a.innerWidth;h<=c.mobile?g=p.mobile:h<=c.tablet&&(g=p.tablet);const y=(u-(g-1)*d)/g;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",u),console.log("columnWidth",y),console.log("activeColumns",g),console.log("columns",p.desktop),console.log("columnsTablet",p.tablet),console.log("columnsMobile",p.mobile),console.log("breakpointTablet",c.tablet),console.log("breakpointMobile",c.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[r];if(!m)return;const f=function(){let d;!function(t,e){const i=t&&t[0];if(!i)return e();const o=()=>i.clientWidth>0&&null!==i.offsetParent;if(o())return e();let s=!1;const n=()=>{if(!s){s=!0;try{a.disconnect()}catch(t){}e()}},a=new ResizeObserver(()=>{o()&&n()});a.observe(i),setTimeout(()=>{o()&&n()},1200)}(n,function(){n.isotope(m.options),o||e(s());const t="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(n.data("filterActive")||i(t).hasClass("sp-gallery-filter-active"))&&(n.data("filterActive",!0),n.isotope({filter:".sp-gallery-item-liked"})),n.isotope("layout"),"masonry"===r&&function(){const t=()=>{n.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),n.off(".spClearWHInit")};n.off(".spClearWHInit"),n.one("arrangeComplete.spClearWHInit",t),n.one("layoutComplete.spClearWHInit",t),setTimeout(t,1200)}(),a.spVirtualisers||(a.spVirtualisers={}),a.spVirtualisers[l]=function(t,e={}){const i=e.maxActive||120,o=e.enterMargin||"1200px",s=e.exitMargin||"2000px",n=new Set;let a=!1;function r(t){t.forEach(t=>{d.observe(t),p.observe(t)})}const l=t.find(".sp-gallery-item img").toArray();for(const t of l)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");const d=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting&&c(e.target)},{rootMargin:o,threshold:.01}),p=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting||u(e.target)},{rootMargin:s,threshold:0});async function c(t){if(!a&&!n.has(t)){t.dataset.srcset&&t.setAttribute("srcset",t.dataset.srcset),t.dataset.sizes&&t.setAttribute("sizes",t.dataset.sizes),t.dataset.src&&t.setAttribute("src",t.dataset.src),t.loading="lazy",t.decoding="async",t.fetchpriority="low";try{await t.decode()}catch(t){}if(n.add(t),n.size>i){let t=null,e=-1;for(const i of n){const o=i.getBoundingClientRect(),s=Math.min(Math.abs(o.top),Math.abs(o.bottom));s>e&&(e=s,t=i)}t&&u(t)}}}function u(t){!a&&n.has(t)&&(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),n.delete(t))}return r(l),{freeze(){a=!0},unfreeze(){a=!1},add(t){const e=Array.isArray(t)?t:[t];for(const t of e)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");r(e)},destroy(){d.disconnect(),p.disconnect(),n.clear()}}}(n,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),n.on("layoutComplete",function(){a.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===o&&function(t,o,n){const a=t[0]?.ownerDocument?.defaultView||window;if(t.data("is")&&i(".sp-gallery").length<=1){const r=()=>{const e=t.data("columns"),i=t.data("breakpoints");return{layout:t.data("layout"),gap:t.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:i.tablet,breakpoint_mobile:i.mobile,use_lightbox:t.data("lightbox"),gallery_width:t.get(0).clientWidth,viewport_width:a.innerWidth}};i(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(n).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",r())),t.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",n));if(t.data("spInfScrollInit",!0),(parseInt(t.data("pages"),10)||1)<=1)return t.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let p=2;t.off("load.infiniteScroll.shutterpress");let c={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(c["X-WP-Nonce"]=shutterpressData.nonce),t.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const t=r();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:c,body:JSON.stringify({gallery_id:d,page:p,attributes:t})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),t.on("load.infiniteScroll.shutterpress",function(r,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(p=l.nextPage,t.data("spNoMorePages",!1)):d=!0;const c=l&&l.html?l.html:"";if(!c||!c.trim()){if(d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let u=i(c);const g=u.filter(o);if(g.length)u=g;else{const t=u.find(o);t.length&&(u=t)}if(u.find("img").attr({decoding:"async",fetchpriority:"low"}),u.css({opacity:0}),t.infiniteScroll("appendItems",u.get()),u.imagesLoaded(function(){const i=t=>{t.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},r=u.filter(o).length?u.filter(o):u;let l=!1;const d=()=>{l||(l=!0,"masonry"===t.data("layout")&&i(r),t.off(".spClearWHAppend"))};t.off(".spClearWHAppend"),t.one("arrangeComplete.spClearWHAppend",function(){d()}),t.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),t.isotope("appended",u),t.isotope("layout"),t.off("layoutComplete.spEnsureVisible"),t.one("layoutComplete.spEnsureVisible",function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:t.data("filterActive")?"":1})},600),u.css({willChange:"transform, opacity, width, height",opacity:0}),t.data("filterActive")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),t.off("arrangeComplete.spFirstAppend"),t.one("arrangeComplete.spFirstAppend",function(){u.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),t.off("arrangeComplete.spFirstAppend")})):"justified"==t.data("layout")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[n]&&a.spVirtualisers[n].add(u.find("img").toArray()),e(s()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[n]){const e=a.spGalleries[n],i=t.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==i&&(e.settings.selector=i),e.refresh()}if(t.data("filterActive")&&t.isotope({filter:".sp-gallery-item-liked"}),d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(n,m.itemSelector,l)}),i(a).on("resize",function(){clearTimeout(d),d=setTimeout(function(){i("#shutterpress-gallery-inline-style").remove(),t(),n.isotope()},300)})};if("function"==typeof i.fn.imagesLoaded&&"function"==typeof n.imagesLoaded)n.imagesLoaded(f);else{const t=n.find("img").get();if(t.length){let e=t.length;const o=()=>{--e<=0&&f()};t.forEach(t=>{t.complete?o():i(t).one("load error",o)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){n.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",n.is(":visible")),console.log("Gallery height:",n.height()),console.log("Forced layout after LightGallery closed."))})})}(n,!0)})})})}"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),window.spVirtualisers||(window.spVirtualisers={}),window.spGalleries||(window.spGalleries={}),o();const n=document.querySelector(".block-editor-block-list__layout")||document.querySelector('iframe[name="editor-canvas"]')?.contentDocument?.querySelector(".block-editor-block-list__layout")||document.body,a=new MutationObserver(t=>{for(const e of t)if(e.addedNodes&&e.addedNodes.length){o();break}});a.observe(n,{childList:!0,subtree:!0});const r=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");if(r&&r.contentWindow&&r.addEventListener("load",()=>{try{const t=r.contentDocument?.querySelector(".block-editor-block-list__layout")||r.contentDocument?.body;t&&(a.observe(t,{childList:!0,subtree:!0}),o())}catch(t){}}),window.wp&&wp.domReady&&wp.domReady(o),window.wp?.data?.subscribe){let t;wp.data.subscribe(()=>{clearTimeout(t),t=setTimeout(o,150)})}})})()})();1 (()=>{var t={997:()=>{!function(){function t(){!function(){var t=window.Isotope;if(t&&t.LayoutMode){var e=t.LayoutMode;!function(t){if(!t.modes.spGridLayout){var e=t.create("spGridLayout");e.prototype._resetLayout=function(){this.itemIndex=0;var t=this.isotope.element,e=parseInt(t.getAttribute("data-gap"))||0,i=JSON.parse(t.getAttribute("data-breakpoints")),o=JSON.parse(t.getAttribute("data-columns")),s=window.innerWidth,n=o.desktop;s<=i.mobile?n=o.mobile:s<=i.tablet&&(n=o.tablet),this.cols=n;var a=(n-1)*e,r=(this.isotope.size.innerWidth-a)/n;this.columnWidth=r,this.rowHeight=r,this.gap=e,this.positions=[]},e.prototype._getItemLayoutPosition=function(t){var e=this.itemIndex%this.cols,i=Math.floor(this.itemIndex/this.cols),o=e*(this.columnWidth+this.gap),s=i*(this.rowHeight+this.gap),n=t.element;return n.style.width=this.columnWidth+"px",n.style.height=this.rowHeight+"px",this.positions.push({x:o,y:s}),this.itemIndex++,{x:o,y:s}},e.prototype._getContainerSize=function(){return{height:Math.ceil(this.itemIndex/this.cols)*(this.rowHeight+this.gap)-this.gap}},e.prototype.needsResizeLayout=function(){return!0},t.modes.spGridLayout=e}}(e),function(t){if(!t.modes.spJustifiedLayout){var e=t.create("spJustifiedLayout");e.prototype._resetLayout=function(){var t=this.isotope.element;this.rowHeight=parseInt(t.getAttribute("data-row-height"))||200,this.gap=parseInt(t.getAttribute("data-gap"),10)||10,this.containerWidth=this.isotope.size.innerWidth,this._posCache=new Map},e.prototype._getItemLayoutPosition=function(t){var e=this._posCache.get(t.id);if(e)return t.element.style.width=e.width+"px",t.element.style.height=e.height+"px",this._posCache.delete(t.id),{x:e.x,y:e.y};var i=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,o=i.indexOf(t);if(o<0)return{x:0,y:0};for(var s=0,n=0;s<o;){for(var a=0,r=0,l=s;l<i.length;){var d=i[l].element,c=d.querySelector("img"),p=parseInt(d.getAttribute("data-width"))||c&&parseInt(c.getAttribute("width")),u=parseInt(d.getAttribute("data-height"))||c&&parseInt(c.getAttribute("height")),h=parseFloat(d.getAttribute("data-ratio"))||(p&&u?p/u:1);if(r++,(a+=this.rowHeight*h)+this.gap*(r-1)>this.containerWidth&&r>1)break;l++}var g=(r-1)*this.gap,y=a+g>0?(this.containerWidth-g)/a:1;n+=Math.round(this.rowHeight*y)+this.gap,s+=r}for(var m=[],f=0,b=o;b<i.length;){var w=i[b],v=w.element,x=v.querySelector("img"),A=parseInt(v.getAttribute("data-width"))||x&&parseInt(x.getAttribute("width")),I=parseInt(v.getAttribute("data-height"))||x&&parseInt(x.getAttribute("height")),$=parseFloat(v.getAttribute("data-ratio"))||(A&&I?A/I:1),S=this.rowHeight*$;if(m.push({id:w.id,w:S}),(f+=S)+this.gap*(m.length-1)>this.containerWidth&&m.length>1)break;b++}for(var C=(m.length-1)*this.gap,k=b>=i.length,D=f+C>0?(this.containerWidth-C)/f:1,z=k?Math.min(1,D):D,_=Math.round(this.rowHeight*z),P=0,L=0;L<m.length;L++){var W=Math.floor(m[L].w*z);this._posCache.set(m[L].id,{x:P,y:n,width:W,height:_}),P+=W+this.gap}var M=this._posCache.get(t.id);return M?(t.element.style.width=M.width+"px",t.element.style.height=M.height+"px",this._posCache.delete(t.id),{x:M.x,y:M.y}):{x:0,y:n}},e.prototype._getContainerSize=function(){for(var t=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,e=0,i=0;e<t.length;){for(var o=0,s=0,n=e;n<t.length;){var a=t[n].element,r=a.querySelector("img"),l=parseInt(a.getAttribute("data-width"))||r&&parseInt(r.getAttribute("width")),d=parseInt(a.getAttribute("data-height"))||r&&parseInt(r.getAttribute("height")),c=parseFloat(a.getAttribute("data-ratio"))||(l&&d?l/d:1);if(s++,(o+=this.rowHeight*c)+this.gap*(s-1)>this.containerWidth&&s>1)break;n++}var p=(s-1)*this.gap,u=n>=t.length,h=o+p>0?(this.containerWidth-p)/o:1,g=u?Math.min(1,h):h;i+=Math.round(this.rowHeight*g)+this.gap,e+=s}return i>0&&(i-=this.gap),{height:i}},e.prototype.needsResizeLayout=function(){return!0},t.modes.spJustifiedLayout=e}}(e),function(t){if(!t.modes.none){var e=t.create("none");e.prototype._resetLayout=function(){return!1},e.prototype._getItemLayoutPosition=function(){return{}},e.prototype._getContainerSize=function(){return{height:0}},e.prototype.needsResizeLayout=function(){return!1},t.modes.none=e}}(e),window.spGallery.Isotope=t}}()}"undefined"!=typeof window&&(window.spGallery=window.spGallery||{},window.spGallery.ensureIsotopeLayouts=t,t(),window.spGallery._isotopeEnsurer||(window.spGallery._isotopeEnsurer=setInterval(t,1e3)),document&&document.addEventListener&&document.addEventListener("readystatechange",t),window&&window.addEventListener&&window.addEventListener("load",t),function(t){if(!t||!t.fn||"function"!=typeof t.fn.isotope)return;const e=new WeakMap,i=t=>t&&null!==t.offsetParent&&t.clientWidth>0&&t.clientHeight>=0;function o(){t(".sp-gallery").each(function(){var o;o=this,e.has(o)||e.set(o,i(o)),function(o){const s=t(o);if(!s.data("isotope"))return;const n=e.get(o),a=i(o);a&&!1===n&&(window.shutterpressData&&window.shutterpressData.debug&&console.log("[SP] Gallery visible again, relayout forced for",o.id||o),s.isotope("layout")),e.set(o,a)}(this)})}t(document).ready(function(){window.spGallery&&window.spGallery.visibilityPoller||(o(),window.spGallery=window.spGallery||{},window.spGallery.visibilityPoller=setInterval(o,400))})}(window.jQuery))}()}},e={};function i(o){var s=e[o];if(void 0!==s)return s.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,i),n.exports}(()=>{"use strict";function t(){const t=jQuery,e=t('[id^="sp-gallery-"].sp-gallery');if(0===e.length)return;let i="";e.each(function(){const e=t(this),o=e.data("id"),s=`.lg-sp-gallery-${o}`,n=e.data("breakpoints"),a=e.data("layout"),r=e.get(0).clientWidth,l=e.data("gap"),d=e.data("lg"),c=e.data("icon-size"),p=e.data("icon-size-h"),u=e.data("columns"),h=e.data("colors"),g=e.attr("data-custom-css");function y(t){return(t-1)*l}if(i+=`\n \n #sp-gallery-buttons-${o}, \n #sp-gallery-${o}, \n #sp-gallery-page-load-container-${o}, \n #sp-gallery-pagination-${o} {\n --sp-gallery-color-primary: ${h.primary};\n --sp-gallery-color-accent: ${h.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${o} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${n.tablet}px) */\n @media (max-width: ${n.tablet}px) {\n #sp-gallery-${o} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${n.mobile}px) */\n @media (max-width: ${n.mobile}px) {\n #sp-gallery-${o} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${s} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${h.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const t=`#sp-gallery-${o}.sp-gallery-grid-gallery `;i+=`\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${n.tablet}px) {\n ${t} { grid-template-columns: repeat(${u.tablet}, 1fr); }\n }\n @media (max-width: ${n.mobile}px) {\n ${t} { grid-template-columns: repeat(${u.mobile}, 1fr); }\n }\n `}if("masonry"===a){const t=`#sp-gallery-${o}.sp-gallery-masonry-gallery `;i+=`\n\n ${t} {\n --sp-gallery-width: ${r}px;\n }\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${t} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(u.desktop)}px) / ${u.desktop});\n }\n\n @media (max-width: ${n.tablet}px) {\n ${t} {\n grid-template-columns: repeat(${u.tablet}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.tablet)}px) / ${u.tablet});\n }\n }\n\n @media (max-width: ${n.mobile}px) {\n ${t} {\n grid-template-columns: repeat(${u.mobile}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.mobile)}px) / ${u.mobile});\n }\n }\n `}g&&(i+=g)});let o=jQuery("#shutterpress-gallery-inline-style");0===o.length&&(o=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),o.text(i)}function e(t){Array.isArray(t)||(t=[]),t.forEach(function(t){jQuery('.sp-gallery-like-icon[data-image-id="'+t+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+t).addClass("sp-gallery-item-liked")})}i(997);let o=[];function s(){return o}jQuery(document).ready(function(i){function o(){const i=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");i?.contentDocument||document;let o=(i?.contentWindow?.jQuery||jQuery)(".sp-gallery").not("[data-sp-initialized]");o.length&&o.each(function(){const i=this,o=i.ownerDocument,n=o.defaultView?.jQuery||jQuery;!function t(e,o=0){const s=i.clientWidth;return s&&s>0||o>40?e():void setTimeout(()=>t(e,o+1),50)}(()=>{("function"==typeof n.fn.imagesLoaded?(t,e)=>n(t).imagesLoaded(e):(t,e)=>e())(i,()=>{const a="shutterpress-gallery-inline-style";jQuery("#"+a).remove(),t();const r=document.getElementById(a);if(r&&o!==document){const t=o.getElementById(a);t&&t.remove();const e=o.createElement("style");e.id=a,e.textContent=r.textContent||"",o.head.appendChild(e)}n(i).one("layoutComplete.spInit",function(){n(this).removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){const t=n(i);t.hasClass("sp-gallery-hidden")&&t.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500),function(i=jQuery,o=!1){i(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",i(this).attr("id"));const n=i(this),a=n[0]?.ownerDocument?.defaultView||window;if(n.data("spLayoutsInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",n.attr("id")));n.data("spLayoutsInit",!0);const r=n.data("layout"),l=n.attr("id"),d=n.data("gap"),c=n.data("columns")||{desktop:3,tablet:2,mobile:1},p=n.data("breakpoints"),u=n.get(0).clientWidth;let h=c.desktop;const g=a.innerWidth;g<=p.mobile?h=c.mobile:g<=p.tablet&&(h=c.tablet);const y=(u-(h-1)*d)/h;shutterpressData.debug&&(console.log("windowWidth",g),console.log("galleryWidth",u),console.log("columnWidth",y),console.log("activeColumns",h),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[r];if(!m)return;const f=function(){let d;!function(t,e){const i=t&&t[0];if(!i)return e();const o=()=>i.clientWidth>0&&null!==i.offsetParent;if(o())return e();let s=!1;const n=()=>{if(!s){s=!0;try{a.disconnect()}catch(t){}e()}};let a;"undefined"!=typeof ResizeObserver&&(a=new ResizeObserver(()=>{o()&&n()}),a.observe(i)),setTimeout(()=>{o()&&n()},1200)}(n,function(){n.isotope(m.options),o||e(s());const t="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(n.data("filterActive")||i(t).hasClass("sp-gallery-filter-active"))&&(n.data("filterActive",!0),n.isotope({filter:".sp-gallery-item-liked"})),n.isotope("layout"),function(t){const e=t&&t[0];if(!e)return;const i=()=>e.clientWidth>0&&null!==e.offsetParent;let o=i();const s=()=>{"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("[SP] Gallery became visible again, forcing layout"),t.isotope("layout")};if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver(()=>{const t=i();t&&!o&&s(),o=t});return n.observe(e),void t.data("spVisibilityObserver",n)}const n=setInterval(()=>{if(!document.body.contains(e))return void clearInterval(n);const t=i();t&&!o&&s(),o=t},400);t.data("spVisibilityInterval",n)}(n),"masonry"===r&&function(){const t=()=>{n.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),n.off(".spClearWHInit")};n.off(".spClearWHInit"),n.one("arrangeComplete.spClearWHInit",t),n.one("layoutComplete.spClearWHInit",t),setTimeout(t,1200)}(),a.spVirtualisers||(a.spVirtualisers={}),a.spVirtualisers[l]=function(t,e={}){const i=e.maxActive||120,o=e.enterMargin||"1200px",s=e.exitMargin||"2000px",n=new Set;let a=!1;function r(t){t.forEach(t=>{d.observe(t),c.observe(t)})}const l=t.find(".sp-gallery-item img").toArray();for(const t of l)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");const d=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting&&p(e.target)},{rootMargin:o,threshold:.01}),c=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting||u(e.target)},{rootMargin:s,threshold:0});async function p(t){if(!a&&!n.has(t)){t.dataset.srcset&&t.setAttribute("srcset",t.dataset.srcset),t.dataset.sizes&&t.setAttribute("sizes",t.dataset.sizes),t.dataset.src&&t.setAttribute("src",t.dataset.src),t.loading="lazy",t.decoding="async",t.fetchpriority="low";try{await t.decode()}catch(t){}if(n.add(t),n.size>i){let t=null,e=-1;for(const i of n){const o=i.getBoundingClientRect(),s=Math.min(Math.abs(o.top),Math.abs(o.bottom));s>e&&(e=s,t=i)}t&&u(t)}}}function u(t){!a&&n.has(t)&&(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),n.delete(t))}return r(l),{freeze(){a=!0},unfreeze(){a=!1},add(t){const e=Array.isArray(t)?t:[t];for(const t of e)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");r(e)},destroy(){d.disconnect(),c.disconnect(),n.clear()}}}(n,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),n.on("layoutComplete",function(){a.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===o&&function(t,o,n){const a=t[0]?.ownerDocument?.defaultView||window;if(t.data("is")&&i(".sp-gallery").length<=1){const r=()=>{const e=t.data("columns"),i=t.data("breakpoints");return{layout:t.data("layout"),gap:t.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:i.tablet,breakpoint_mobile:i.mobile,use_lightbox:t.data("lightbox"),gallery_width:t.get(0).clientWidth,viewport_width:a.innerWidth}};i(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(n).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",r())),t.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",n));if(t.data("spInfScrollInit",!0),(parseInt(t.data("pages"),10)||1)<=1)return t.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;t.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),t.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const t=r();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:t})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),t.on("load.infiniteScroll.shutterpress",function(r,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(c=l.nextPage,t.data("spNoMorePages",!1)):d=!0;const p=l&&l.html?l.html:"";if(!p||!p.trim()){if(d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let u=i(p);const h=u.filter(o);if(h.length)u=h;else{const t=u.find(o);t.length&&(u=t)}if(u.find("img").attr({decoding:"async",fetchpriority:"low"}),u.css({opacity:0}),t.infiniteScroll("appendItems",u.get()),u.imagesLoaded(function(){const i=t=>{t.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},r=u.filter(o).length?u.filter(o):u;let l=!1;const d=()=>{l||(l=!0,"masonry"===t.data("layout")&&i(r),t.off(".spClearWHAppend"))};t.off(".spClearWHAppend"),t.one("arrangeComplete.spClearWHAppend",function(){d()}),t.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),t.isotope("appended",u),t.isotope("layout"),t.off("layoutComplete.spEnsureVisible"),t.one("layoutComplete.spEnsureVisible",function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:t.data("filterActive")?"":1})},600),u.css({willChange:"transform, opacity, width, height",opacity:0}),t.data("filterActive")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),t.off("arrangeComplete.spFirstAppend"),t.one("arrangeComplete.spFirstAppend",function(){u.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),t.off("arrangeComplete.spFirstAppend")})):"justified"==t.data("layout")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[n]&&a.spVirtualisers[n].add(u.find("img").toArray()),e(s()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[n]){const e=a.spGalleries[n],i=t.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==i&&(e.settings.selector=i),e.refresh()}if(t.data("filterActive")&&t.isotope({filter:".sp-gallery-item-liked"}),d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(n,m.itemSelector,l)}),i(a).on("resize",function(){clearTimeout(d),d=setTimeout(function(){i("#shutterpress-gallery-inline-style").remove(),t(),n.isotope()},300)})};if("function"==typeof i.fn.imagesLoaded&&"function"==typeof n.imagesLoaded)n.imagesLoaded(f);else{const t=n.find("img").get();if(t.length){let e=t.length;const o=()=>{--e<=0&&f()};t.forEach(t=>{t.complete?o():i(t).one("load error",o)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){n.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",n.is(":visible")),console.log("Gallery height:",n.height()),console.log("Forced layout after LightGallery closed."))})})}(n,!0)})})})}"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),window.spVirtualisers||(window.spVirtualisers={}),window.spGalleries||(window.spGalleries={}),o();const n=document.querySelector(".block-editor-block-list__layout")||document.querySelector('iframe[name="editor-canvas"]')?.contentDocument?.querySelector(".block-editor-block-list__layout")||document.body,a=new MutationObserver(t=>{for(const e of t)if(e.addedNodes&&e.addedNodes.length){o();break}});a.observe(n,{childList:!0,subtree:!0});const r=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");if(r&&r.contentWindow&&r.addEventListener("load",()=>{try{const t=r.contentDocument?.querySelector(".block-editor-block-list__layout")||r.contentDocument?.body;t&&(a.observe(t,{childList:!0,subtree:!0}),o())}catch(t){}}),window.wp&&wp.domReady&&wp.domReady(o),window.wp?.data?.subscribe){let t;wp.data.subscribe(()=>{clearTimeout(t),t=setTimeout(o,150)})}})})()})(); -
shutterpress-gallery/tags/1.7.10/includes/js/shutterpress-gallery-public.js
r3383402 r3396625 1 (()=>{"use strict";function e(e){Array.isArray(e)||(e=[]),e.forEach(function(e){jQuery('.sp-gallery-like-icon[data-image-id="'+e+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+e).addClass("sp-gallery-item-liked")})}function t(e,t){let i=Cookies.get("liked_images")?JSON.parse(Cookies.get("liked_images")):[];return t&&!i.includes(e)?i.push(e):t||(i=i.filter(t=>t!==e)),Cookies.set("liked_images",JSON.stringify(i),{expires:365,path:"/",sameSite:"Strict"}),i}let i=[],s=!1;function o(e){i=Array.isArray(e)?e:[]}function r(){return i}function a(e){s=!!e}function l(){return s}function n(){const e=jQuery,t=e('[id^="sp-gallery-"].sp-gallery');if(0===t.length)return;let i="";t.each(function(){const t=e(this),s=t.data("id"),o=`.lg-sp-gallery-${s}`,r=t.data("breakpoints"),a=t.data("layout"),l=t.get(0).clientWidth,n=t.data("gap"),d=t.data("lg"),c=t.data("icon-size"),p=t.data("icon-size-h"),g=t.data("columns"),u=t.data("colors"),h=t.attr("data-custom-css");function m(e){return(e-1)*n}if(i+=`\n \n #sp-gallery-buttons-${s}, \n #sp-gallery-${s}, \n #sp-gallery-page-load-container-${s}, \n #sp-gallery-pagination-${s} {\n --sp-gallery-color-primary: ${u.primary};\n --sp-gallery-color-accent: ${u.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${s} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${r.tablet}px) */\n @media (max-width: ${r.tablet}px) {\n #sp-gallery-${s} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${r.mobile}px) */\n @media (max-width: ${r.mobile}px) {\n #sp-gallery-${s} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${o} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${u.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const e=`#sp-gallery-${s}.sp-gallery-grid-gallery `;i+=`\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${n}px;\n }\n @media (max-width: ${r.tablet}px) {\n ${e} { grid-template-columns: repeat(${g.tablet}, 1fr); }\n }\n @media (max-width: ${r.mobile}px) {\n ${e} { grid-template-columns: repeat(${g.mobile}, 1fr); }\n }\n `}if("masonry"===a){const e=`#sp-gallery-${s}.sp-gallery-masonry-gallery `;i+=`\n\n ${e} {\n --sp-gallery-width: ${l}px;\n }\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${n}px;\n }\n\n ${e} .sp-gallery-masonry-item {\n margin-bottom: ${n}px;\n width: calc((var(--sp-gallery-width) - ${m(g.desktop)}px) / ${g.desktop});\n }\n\n @media (max-width: ${r.tablet}px) {\n ${e} {\n grid-template-columns: repeat(${g.tablet}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${m(g.tablet)}px) / ${g.tablet});\n }\n }\n\n @media (max-width: ${r.mobile}px) {\n ${e} {\n grid-template-columns: repeat(${g.mobile}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${m(g.mobile)}px) / ${g.mobile});\n }\n }\n `}h&&(i+=h)});let s=jQuery("#shutterpress-gallery-inline-style");0===s.length&&(s=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),s.text(i)}jQuery(document).ready(function(i){if(window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),o([]),a(!1),window.isLoggedIn=!1,"undefined"!=typeof shutterpressData&&null!==shutterpressData)if(shutterpressData.debug&&console.log("shutterpressData:",shutterpressData),l())fetch(`${shutterpressData.rest_url}shutterpress/v1/user-data`,{method:"GET",credentials:"include",headers:{"X-WP-Nonce":shutterpressData.nonce}}).then(e=>{if(!e.ok)throw new Error("Failed to fetch user data");return e.json()}).catch(e=>{throw shutterpressData.debug&&console.error("Fetch failed:",e),e}).then(function(t){Array.isArray(t.liked_images)&&(o(t.liked_images),e(r()));const i=!!t.logged_in;a(i),window.isLoggedIn=i,shutterpressData.debug&&(console.log("Liked Images:",r()),console.log("Logged In:",l()))}).catch(function(t){shutterpressData.debug&&console.error("User data fetch error:",t),e(r())});else{const t=Cookies.get("liked_images");if(t)try{o(JSON.parse(t)),e(r())}catch(e){shutterpressData.debug&&console.error("Invalid liked_images cookie")}}shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleries={},window.spVirtualisers={},n(),function(t=jQuery,i=!1){t(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",t(this).attr("id"));const s=t(this),o=s[0]?.ownerDocument?.defaultView||window;if(s.data("spLayoutsInit"))return void(o.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",s.attr("id")));s.data("spLayoutsInit",!0);const a=s.data("layout"),l=s.attr("id"),d=s.data("gap"),c=s.data("columns")||{desktop:3,tablet:2,mobile:1},p=s.data("breakpoints"),g=s.get(0).clientWidth;let u=c.desktop;const h=o.innerWidth;h<=p.mobile?u=c.mobile:h<=p.tablet&&(u=c.tablet);const m=(g-(u-1)*d)/u;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",g),console.log("columnWidth",m),console.log("activeColumns",u),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const y={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[a];if(!y)return;const f=function(){let d;!function(e,t){const i=e&&e[0];if(!i)return t();const s=()=>i.clientWidth>0&&null!==i.offsetParent;if(s())return t();let o=!1;const r=()=>{if(!o){o=!0;try{a.disconnect()}catch(e){}t()}},a=new ResizeObserver(()=>{s()&&r()});a.observe(i),setTimeout(()=>{s()&&r()},1200)}(s,function(){s.isotope(y.options),i||e(r());const n="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(s.data("filterActive")||t(n).hasClass("sp-gallery-filter-active"))&&(s.data("filterActive",!0),s.isotope({filter:".sp-gallery-item-liked"})),s.isotope("layout"),"masonry"===a&&function(){const e=()=>{s.find(y.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),s.off(".spClearWHInit")};s.off(".spClearWHInit"),s.one("arrangeComplete.spClearWHInit",e),s.one("layoutComplete.spClearWHInit",e),setTimeout(e,1200)}(),o.spVirtualisers||(o.spVirtualisers={}),o.spVirtualisers[l]=function(e,t={}){const i=t.maxActive||120,s=t.enterMargin||"1200px",o=t.exitMargin||"2000px",r=new Set;let a=!1;function l(e){e.forEach(e=>{d.observe(e),c.observe(e)})}const n=e.find(".sp-gallery-item img").toArray();for(const e of n)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");const d=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting&&p(t.target)},{rootMargin:s,threshold:.01}),c=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting||g(t.target)},{rootMargin:o,threshold:0});async function p(e){if(!a&&!r.has(e)){e.dataset.srcset&&e.setAttribute("srcset",e.dataset.srcset),e.dataset.sizes&&e.setAttribute("sizes",e.dataset.sizes),e.dataset.src&&e.setAttribute("src",e.dataset.src),e.loading="lazy",e.decoding="async",e.fetchpriority="low";try{await e.decode()}catch(e){}if(r.add(e),r.size>i){let e=null,t=-1;for(const i of r){const s=i.getBoundingClientRect(),o=Math.min(Math.abs(s.top),Math.abs(s.bottom));o>t&&(t=o,e=i)}e&&g(e)}}}function g(e){!a&&r.has(e)&&(e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),r.delete(e))}return l(n),{freeze(){a=!0},unfreeze(){a=!1},add(e){const t=Array.isArray(e)?e:[e];for(const e of t)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");l(t)},destroy(){d.disconnect(),c.disconnect(),r.clear()}}}(s,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),s.on("layoutComplete",function(){o.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===i&&function(i,s,o){const a=i[0]?.ownerDocument?.defaultView||window;if(i.data("is")&&t(".sp-gallery").length<=1){const l=()=>{const e=i.data("columns"),t=i.data("breakpoints");return{layout:i.data("layout"),gap:i.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:t.tablet,breakpoint_mobile:t.mobile,use_lightbox:i.data("lightbox"),gallery_width:i.get(0).clientWidth,viewport_width:a.innerWidth}};t(".sp-gallery-page-load-container").css("display","block");const n=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(o).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",n),console.log("[SP] Attributes",l())),i.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",o));if(i.data("spInfScrollInit",!0),(parseInt(i.data("pages"),10)||1)<=1)return i.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;i.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),i.infiniteScroll({path:function(){return`${n}`},fetchOptions:function(){const e=l();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:e})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),i.on("load.infiniteScroll.shutterpress",function(l,n){shutterpressData.debug&&console.log("Response:",n);let d=!1;n&&void 0!==n.nextPage&&!1!==n.nextPage?(c=n.nextPage,i.data("spNoMorePages",!1)):d=!0;const p=n&&n.html?n.html:"";if(!p||!p.trim()){if(d){i.infiniteScroll("option",{loadOnScroll:!1}),i.data("spNoMorePages",!0);const e=i.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let g=t(p);const u=g.filter(s);if(u.length)g=u;else{const e=g.find(s);e.length&&(g=e)}if(g.find("img").attr({decoding:"async",fetchpriority:"low"}),g.css({opacity:0}),i.infiniteScroll("appendItems",g.get()),g.imagesLoaded(function(){const t=e=>{e.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},l=g.filter(s).length?g.filter(s):g;let n=!1;const d=()=>{n||(n=!0,"masonry"===i.data("layout")&&t(l),i.off(".spClearWHAppend"))};i.off(".spClearWHAppend"),i.one("arrangeComplete.spClearWHAppend",function(){d()}),i.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),i.isotope("appended",g),i.isotope("layout"),i.off("layoutComplete.spEnsureVisible"),i.one("layoutComplete.spEnsureVisible",function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:i.data("filterActive")?"":1})},600),g.css({willChange:"transform, opacity, width, height",opacity:0}),i.data("filterActive")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),i.off("arrangeComplete.spFirstAppend"),i.one("arrangeComplete.spFirstAppend",function(){g.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),i.off("arrangeComplete.spFirstAppend")})):"justified"==i.data("layout")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[o]&&a.spVirtualisers[o].add(g.find("img").toArray()),e(r()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[o]){const e=a.spGalleries[o],t=i.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==t&&(e.settings.selector=t),e.refresh()}if(i.data("filterActive")&&i.isotope({filter:".sp-gallery-item-liked"}),d){i.infiniteScroll("option",{loadOnScroll:!1}),i.data("spNoMorePages",!0);const e=i.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(s,y.itemSelector,l)}),t(o).on("resize",function(){clearTimeout(d),d=setTimeout(function(){t("#shutterpress-gallery-inline-style").remove(),n(),s.isotope()},300)})};if("function"==typeof t.fn.imagesLoaded&&"function"==typeof s.imagesLoaded)s.imagesLoaded(f);else{const e=s.find("img").get();if(e.length){let i=e.length;const s=()=>{--i<=0&&f()};e.forEach(e=>{e.complete?s():t(e).one("load error",s)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){s.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",s.is(":visible")),console.log("Gallery height:",s.height()),console.log("Forced layout after LightGallery closed."))})})}(),jQuery(".sp-gallery").each(function(){const e=jQuery(this);e.one("layoutComplete.spInit",function(){e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){e.hasClass("sp-gallery-hidden")&&e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500)}),function(){const i=jQuery(document);i.off("click.sp-like"),i.on("click.sp-like",".sp-gallery-like-icon",function(){const i=jQuery(this),s=i.data("image-id"),a=l();if(i.toggleClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+s).toggleClass("sp-gallery-item-liked"),a)fetch(`${shutterpressData.rest_url}shutterpress/v1/toggle-like`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":shutterpressData.nonce},credentials:"include",body:JSON.stringify({image_id:s})}).then(e=>e.json()).then(i=>{void 0!==i.liked&&(o(t(s,i.liked)),e(r()))}).catch(e=>{shutterpressData.debug&&console.error("Toggle like failed:",e)});else try{const a=i.hasClass("sp-gallery-liked-image");o(t(s,a)),e(r()),shutterpressData.debug&&console.log("Liked Images:",r())}catch(e){shutterpressData.debug&&console.error("Cookie update failed:",e)}})}(),jQuery('[id^="sp-gallery-filter-liked-photos-"]').each(function(){var e=jQuery(this),t=e.attr("id").replace("sp-gallery-filter-liked-photos-","");e.off("click").on("click",function(){var i=function(e){return e.hasClass("wp-block-button")?"#"+e.attr("id")+" .wp-element-button":e.hasClass("elementor-button")?"#"+e.attr("id")+" .elementor-button-text":e.hasClass("sp-gallery-button")?"#"+e.attr("id"):null}(e);!function(e,t,i,s){e.blur();var o="#sp-gallery-"+s,r=jQuery(o),a=r.data("filterActive")||!1,l=r.find(".sp-gallery-item-liked").length>0;if(!a&&!l)return void(shutterpressData.debug&&console.log("Filter ignored: no liked photos in gallery",s));a?(jQuery(t).removeClass("sp-gallery-filter-active"),null!==i&&jQuery(i).text(wp.i18n.__("Show Favorite Photos","shutterpress-gallery")),r.isotope({filter:"*"}),r.isotope()):(jQuery(t).addClass("sp-gallery-filter-active"),null!==i&&jQuery(i).text(wp.i18n.__("Show All Photos","shutterpress-gallery")),function(e){jQuery(e).isotope({filter:".sp-gallery-item-liked"}),shutterpressData.debug&&console.log("Isotope filtering applied")}(o)),document.getElementById("sp-gallery-"+s);const n=!a,d="sp-gallery-"+s,c=window.spGalleries[d];if(c&&c.settings){const e=n?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(c.settings.selector!==e){c.settings.selector=e;try{c.refresh()}catch(e){}}}r.data("filterActive",!a)}(e,"#"+e.attr("id"),i,t)})}),jQuery('.sp-gallery[id^="sp-gallery-"]').each(function(){const e=jQuery(this),t=e.attr("id"),i=e.data("lg-mode"),s=e.attr("data-download-icon"),o="1"===String(e.data("downloads"));void 0===e.data("spLoadingNext")&&e.data("spLoadingNext",!1),void 0===e.data("spPrefetchBudget")&&e.data("spPrefetchBudget",3),shutterpressData.debug&&console.log("Download:",o),window.spGalleries[t]=lightGallery(document.getElementById(t),{plugins:[lgThumbnail,lgZoom,lgAutoplay,lgFullscreen],selector:".sp-gallery-item .sp-gallery-item-lightbox",download:o,autoplay:!0,addClass:"lg-"+t,getCaptionFromTitleOrAlt:!1,zoomFromOrigin:!0,thumbnail:!0,mode:i,allowMediaOverlap:!1,toggleThumb:!1,exThumbImage:"data-external-thumb-image",replaceIcons:[{selector:".lg-close",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'},{selector:".lg-zoom-in",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-zoom-in-icon lucide-zoom-in"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:"#lg-actual-size",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:".lg-autoplay-button",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play-icon lucide-play"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause-icon lucide-pause"><rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/></svg>'},{selector:".lg-download",html:s},{selector:".lg-fullscreen",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-expand-icon lucide-expand"><path d="m15 15 6 6"/><path d="m15 9 6-6"/><path d="M21 16v5h-5"/><path d="M21 8V3h-5"/><path d="M3 16v5h5"/><path d="m3 21 6-6"/><path d="M3 8V3h5"/><path d="M9 9 3 3"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shrink-icon lucide-shrink"><path d="m15 15 6 6m-6-6v4.8m0-4.8h4.8"/><path d="M9 19.8V15m0 0H4.2M9 15l-6 6"/><path d="M15 4.2V9m0 0h4.8M15 9l6-6"/><path d="M9 4.2V9m0 0H4.2M9 9 3 3"/></svg>'}]});const r=window.spGalleries[t];document.getElementById(t).addEventListener("lgBeforeOpen",function(){e.data("filterActive")&&e.find('.sp-gallery-item-liked img[loading="lazy"]').removeAttr("loading"),(()=>{const t=e.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(r&&r.settings&&r.settings.selector!==t){r.settings.selector=t;try{r.refresh()}catch(e){}}})(),window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].freeze()}),document.getElementById(t).addEventListener("lgAfterClose",function(){window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].unfreeze()}),document.getElementById(t).addEventListener("lgAfterSlide",function(t){shutterpressData.debug&&(console.log("lgAfterSlide event triggered"),console.log("Event index:",t.detail.index),console.log("Gallery items length:",r.galleryItems.length));const i=e.data("filterActive");if(e.data("spNoMorePages"))return;const s=r.galleryItems.length;if(t.detail.index>=s-4&&!e.data("spLoadingNext")){e.data("spLoadingNext",!0);const t=()=>{e.data("infiniteScroll")&&e.data("infiniteScroll").canLoad?e.infiniteScroll("loadNextPage").then(function(s){let{response:o,body:r,items:a}=s;if(e.data("spNoMorePages"))return void e.data("spLoadingNext",!1);jQuery(a).find('img[loading="lazy"]').removeAttr("loading"),e.infiniteScroll("appendItems",a);const l=jQuery(a),n=l.filter(".sp-gallery-item-liked").length||l.find(".sp-gallery-item-liked").length;if(i&&!n){let i=Number(e.data("spPrefetchBudget"))||0;if(i>0)return e.data("spPrefetchBudget",i-1),t()}else e.data("spPrefetchBudget",3);e.data("spLoadingNext",!1),l.imagesLoaded(function(){e.isotope("appended",l),shutterpressData.debug&&(console.log("Incremental layout after loadNextPage"),console.log(o&&o.path))})}).catch(function(){e.data("spLoadingNext",!1)}):e.data("spLoadingNext",!1)};t()}})}),jQuery(document).on("click",".sp-gallery-download-icon , .lg-download",function(e){e.preventDefault();const t=jQuery(this).attr("href");if(!t)return void(shutterpressData.debug&&console.error("Missing download URL."));const i=new URL(t,window.location.origin),s=i.searchParams.get("gallery_id"),o=i.searchParams.get("image_id");if(i.searchParams.get("download_nonce"),!s||!o)return void(shutterpressData.debug&&console.error("Missing download parameters."));const r={};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(r["X-WP-Nonce"]=shutterpressData.nonce),fetch(t,{method:"GET",headers:r,credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("Download failed");const t=e.headers.get("Content-Disposition");let i=`image-${o}.jpg`;if(t&&t.includes("filename=")){const e=t.match(/filename="?([^\";]+)"?/);e&&e[1]&&(i=e[1])}return e.blob().then(e=>({blob:e,filename:i}))}).then(({blob:e,filename:t})=>{const i=window.URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),s.remove()}).catch(e=>{shutterpressData.debug&&console.error("Download error:",e)})}),jQuery(document).on("click","#sp-gallery-back-to-top",function(){shutterpressData.debug&&console.log("Back to top clicked"),jQuery("html, body").animate({scrollTop:0},1e3)})})})();1 (()=>{"use strict";function e(e){Array.isArray(e)||(e=[]),e.forEach(function(e){jQuery('.sp-gallery-like-icon[data-image-id="'+e+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+e).addClass("sp-gallery-item-liked")})}function t(e,t){let s=Cookies.get("liked_images")?JSON.parse(Cookies.get("liked_images")):[];return t&&!s.includes(e)?s.push(e):t||(s=s.filter(t=>t!==e)),Cookies.set("liked_images",JSON.stringify(s),{expires:365,path:"/",sameSite:"Strict"}),s}let s=[],i=!1;function o(e){s=Array.isArray(e)?e:[]}function r(){return s}function n(e){i=!!e}function a(){return i}function l(){const e=jQuery,t=e('[id^="sp-gallery-"].sp-gallery');if(0===t.length)return;let s="";t.each(function(){const t=e(this),i=t.data("id"),o=`.lg-sp-gallery-${i}`,r=t.data("breakpoints"),n=t.data("layout"),a=t.get(0).clientWidth,l=t.data("gap"),d=t.data("lg"),c=t.data("icon-size"),p=t.data("icon-size-h"),g=t.data("columns"),u=t.data("colors"),h=t.attr("data-custom-css");function y(e){return(e-1)*l}if(s+=`\n \n #sp-gallery-buttons-${i}, \n #sp-gallery-${i}, \n #sp-gallery-page-load-container-${i}, \n #sp-gallery-pagination-${i} {\n --sp-gallery-color-primary: ${u.primary};\n --sp-gallery-color-accent: ${u.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${i} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${r.tablet}px) */\n @media (max-width: ${r.tablet}px) {\n #sp-gallery-${i} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${r.mobile}px) */\n @media (max-width: ${r.mobile}px) {\n #sp-gallery-${i} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(s+=`\n\n ${o} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${u.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===n){const e=`#sp-gallery-${i}.sp-gallery-grid-gallery `;s+=`\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${r.tablet}px) {\n ${e} { grid-template-columns: repeat(${g.tablet}, 1fr); }\n }\n @media (max-width: ${r.mobile}px) {\n ${e} { grid-template-columns: repeat(${g.mobile}, 1fr); }\n }\n `}if("masonry"===n){const e=`#sp-gallery-${i}.sp-gallery-masonry-gallery `;s+=`\n\n ${e} {\n --sp-gallery-width: ${a}px;\n }\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${e} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(g.desktop)}px) / ${g.desktop});\n }\n\n @media (max-width: ${r.tablet}px) {\n ${e} {\n grid-template-columns: repeat(${g.tablet}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(g.tablet)}px) / ${g.tablet});\n }\n }\n\n @media (max-width: ${r.mobile}px) {\n ${e} {\n grid-template-columns: repeat(${g.mobile}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(g.mobile)}px) / ${g.mobile});\n }\n }\n `}h&&(s+=h)});let i=jQuery("#shutterpress-gallery-inline-style");0===i.length&&(i=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),i.text(s)}jQuery(document).ready(function(s){if(window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),o([]),n(!1),window.isLoggedIn=!1,"undefined"!=typeof shutterpressData&&null!==shutterpressData)if(shutterpressData.debug&&console.log("shutterpressData:",shutterpressData),a())fetch(`${shutterpressData.rest_url}shutterpress/v1/user-data`,{method:"GET",credentials:"include",headers:{"X-WP-Nonce":shutterpressData.nonce}}).then(e=>{if(!e.ok)throw new Error("Failed to fetch user data");return e.json()}).catch(e=>{throw shutterpressData.debug&&console.error("Fetch failed:",e),e}).then(function(t){Array.isArray(t.liked_images)&&(o(t.liked_images),e(r()));const s=!!t.logged_in;n(s),window.isLoggedIn=s,shutterpressData.debug&&(console.log("Liked Images:",r()),console.log("Logged In:",a()))}).catch(function(t){shutterpressData.debug&&console.error("User data fetch error:",t),e(r())});else{const t=Cookies.get("liked_images");if(t)try{o(JSON.parse(t)),e(r())}catch(e){shutterpressData.debug&&console.error("Invalid liked_images cookie")}}shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleries={},window.spVirtualisers={},l(),function(t=jQuery,s=!1){t(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",t(this).attr("id"));const i=t(this),o=i[0]?.ownerDocument?.defaultView||window;if(i.data("spLayoutsInit"))return void(o.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",i.attr("id")));i.data("spLayoutsInit",!0);const n=i.data("layout"),a=i.attr("id"),d=i.data("gap"),c=i.data("columns")||{desktop:3,tablet:2,mobile:1},p=i.data("breakpoints"),g=i.get(0).clientWidth;let u=c.desktop;const h=o.innerWidth;h<=p.mobile?u=c.mobile:h<=p.tablet&&(u=c.tablet);const y=(g-(u-1)*d)/u;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",g),console.log("columnWidth",y),console.log("activeColumns",u),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[n];if(!m)return;const f=function(){let d;!function(e,t){const s=e&&e[0];if(!s)return t();const i=()=>s.clientWidth>0&&null!==s.offsetParent;if(i())return t();let o=!1;const r=()=>{if(!o){o=!0;try{n.disconnect()}catch(e){}t()}};let n;"undefined"!=typeof ResizeObserver&&(n=new ResizeObserver(()=>{i()&&r()}),n.observe(s)),setTimeout(()=>{i()&&r()},1200)}(i,function(){i.isotope(m.options),s||e(r());const l="#sp-gallery-filter-liked-photos-"+String(a).replace("sp-gallery-","");(i.data("filterActive")||t(l).hasClass("sp-gallery-filter-active"))&&(i.data("filterActive",!0),i.isotope({filter:".sp-gallery-item-liked"})),i.isotope("layout"),function(e){const t=e&&e[0];if(!t)return;const s=()=>t.clientWidth>0&&null!==t.offsetParent;let i=s();const o=()=>{"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("[SP] Gallery became visible again, forcing layout"),e.isotope("layout")};if("undefined"!=typeof ResizeObserver){const r=new ResizeObserver(()=>{const e=s();e&&!i&&o(),i=e});return r.observe(t),void e.data("spVisibilityObserver",r)}const r=setInterval(()=>{if(!document.body.contains(t))return void clearInterval(r);const e=s();e&&!i&&o(),i=e},400);e.data("spVisibilityInterval",r)}(i),"masonry"===n&&function(){const e=()=>{i.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),i.off(".spClearWHInit")};i.off(".spClearWHInit"),i.one("arrangeComplete.spClearWHInit",e),i.one("layoutComplete.spClearWHInit",e),setTimeout(e,1200)}(),o.spVirtualisers||(o.spVirtualisers={}),o.spVirtualisers[a]=function(e,t={}){const s=t.maxActive||120,i=t.enterMargin||"1200px",o=t.exitMargin||"2000px",r=new Set;let n=!1;function a(e){e.forEach(e=>{d.observe(e),c.observe(e)})}const l=e.find(".sp-gallery-item img").toArray();for(const e of l)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");const d=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting&&p(t.target)},{rootMargin:i,threshold:.01}),c=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting||g(t.target)},{rootMargin:o,threshold:0});async function p(e){if(!n&&!r.has(e)){e.dataset.srcset&&e.setAttribute("srcset",e.dataset.srcset),e.dataset.sizes&&e.setAttribute("sizes",e.dataset.sizes),e.dataset.src&&e.setAttribute("src",e.dataset.src),e.loading="lazy",e.decoding="async",e.fetchpriority="low";try{await e.decode()}catch(e){}if(r.add(e),r.size>s){let e=null,t=-1;for(const s of r){const i=s.getBoundingClientRect(),o=Math.min(Math.abs(i.top),Math.abs(i.bottom));o>t&&(t=o,e=s)}e&&g(e)}}}function g(e){!n&&r.has(e)&&(e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),r.delete(e))}return a(l),{freeze(){n=!0},unfreeze(){n=!1},add(e){const t=Array.isArray(e)?e:[e];for(const e of t)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");a(t)},destroy(){d.disconnect(),c.disconnect(),r.clear()}}}(i,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),i.on("layoutComplete",function(){o.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===s&&function(s,i,o){const n=s[0]?.ownerDocument?.defaultView||window;if(s.data("is")&&t(".sp-gallery").length<=1){const a=()=>{const e=s.data("columns"),t=s.data("breakpoints");return{layout:s.data("layout"),gap:s.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:t.tablet,breakpoint_mobile:t.mobile,use_lightbox:s.data("lightbox"),gallery_width:s.get(0).clientWidth,viewport_width:n.innerWidth}};t(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(o).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",a())),s.data("spInfScrollInit"))return void(n.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",o));if(s.data("spInfScrollInit",!0),(parseInt(s.data("pages"),10)||1)<=1)return s.data("spNoMorePages",!0),void(n.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;s.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),s.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const e=a();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:e})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!n.shutterpressData||!shutterpressData.debug)}),s.on("load.infiniteScroll.shutterpress",function(a,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(c=l.nextPage,s.data("spNoMorePages",!1)):d=!0;const p=l&&l.html?l.html:"";if(!p||!p.trim()){if(d){s.infiniteScroll("option",{loadOnScroll:!1}),s.data("spNoMorePages",!0);const e=s.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let g=t(p);const u=g.filter(i);if(u.length)g=u;else{const e=g.find(i);e.length&&(g=e)}if(g.find("img").attr({decoding:"async",fetchpriority:"low"}),g.css({opacity:0}),s.infiniteScroll("appendItems",g.get()),g.imagesLoaded(function(){const t=e=>{e.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},a=g.filter(i).length?g.filter(i):g;let l=!1;const d=()=>{l||(l=!0,"masonry"===s.data("layout")&&t(a),s.off(".spClearWHAppend"))};s.off(".spClearWHAppend"),s.one("arrangeComplete.spClearWHAppend",function(){d()}),s.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),s.isotope("appended",g),s.isotope("layout"),s.off("layoutComplete.spEnsureVisible"),s.one("layoutComplete.spEnsureVisible",function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:s.data("filterActive")?"":1})},600),g.css({willChange:"transform, opacity, width, height",opacity:0}),s.data("filterActive")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),s.off("arrangeComplete.spFirstAppend"),s.one("arrangeComplete.spFirstAppend",function(){g.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),s.off("arrangeComplete.spFirstAppend")})):"justified"==s.data("layout")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),n.spVirtualisers&&n.spVirtualisers[o]&&n.spVirtualisers[o].add(g.find("img").toArray()),e(r()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),n.spGalleries[o]){const e=n.spGalleries[o],t=s.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==t&&(e.settings.selector=t),e.refresh()}if(s.data("filterActive")&&s.isotope({filter:".sp-gallery-item-liked"}),d){s.infiniteScroll("option",{loadOnScroll:!1}),s.data("spNoMorePages",!0);const e=s.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(i,m.itemSelector,a)}),t(o).on("resize",function(){clearTimeout(d),d=setTimeout(function(){t("#shutterpress-gallery-inline-style").remove(),l(),i.isotope()},300)})};if("function"==typeof t.fn.imagesLoaded&&"function"==typeof i.imagesLoaded)i.imagesLoaded(f);else{const e=i.find("img").get();if(e.length){let s=e.length;const i=()=>{--s<=0&&f()};e.forEach(e=>{e.complete?i():t(e).one("load error",i)}),setTimeout(f,1200)}else f()}document.getElementById(a).addEventListener("lgAfterClose",function(){i.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",i.is(":visible")),console.log("Gallery height:",i.height()),console.log("Forced layout after LightGallery closed."))})})}(),jQuery(".sp-gallery").each(function(){const e=jQuery(this);e.one("layoutComplete.spInit",function(){e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){e.hasClass("sp-gallery-hidden")&&e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500)}),function(){const s=jQuery(document);s.off("click.sp-like"),s.on("click.sp-like",".sp-gallery-like-icon",function(){const s=jQuery(this),i=s.data("image-id"),n=a();if(s.toggleClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+i).toggleClass("sp-gallery-item-liked"),n)fetch(`${shutterpressData.rest_url}shutterpress/v1/toggle-like`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":shutterpressData.nonce},credentials:"include",body:JSON.stringify({image_id:i})}).then(e=>e.json()).then(s=>{void 0!==s.liked&&(o(t(i,s.liked)),e(r()))}).catch(e=>{shutterpressData.debug&&console.error("Toggle like failed:",e)});else try{const n=s.hasClass("sp-gallery-liked-image");o(t(i,n)),e(r()),shutterpressData.debug&&console.log("Liked Images:",r())}catch(e){shutterpressData.debug&&console.error("Cookie update failed:",e)}})}(),jQuery('[id^="sp-gallery-filter-liked-photos-"]').each(function(){var e=jQuery(this),t=e.attr("id").replace("sp-gallery-filter-liked-photos-","");e.off("click").on("click",function(){var s=function(e){return e.hasClass("wp-block-button")?"#"+e.attr("id")+" .wp-element-button":e.hasClass("elementor-button")?"#"+e.attr("id")+" .elementor-button-text":e.hasClass("sp-gallery-button")?"#"+e.attr("id"):null}(e);!function(e,t,s,i){e.blur();var o="#sp-gallery-"+i,r=jQuery(o),n=r.data("filterActive")||!1,a=r.find(".sp-gallery-item-liked").length>0;if(!n&&!a)return void(shutterpressData.debug&&console.log("Filter ignored: no liked photos in gallery",i));n?(jQuery(t).removeClass("sp-gallery-filter-active"),null!==s&&jQuery(s).text(wp.i18n.__("Show Favorite Photos","shutterpress-gallery")),r.isotope({filter:"*"}),r.isotope()):(jQuery(t).addClass("sp-gallery-filter-active"),null!==s&&jQuery(s).text(wp.i18n.__("Show All Photos","shutterpress-gallery")),function(e){jQuery(e).isotope({filter:".sp-gallery-item-liked"}),shutterpressData.debug&&console.log("Isotope filtering applied")}(o)),document.getElementById("sp-gallery-"+i);const l=!n,d="sp-gallery-"+i,c=window.spGalleries[d];if(c&&c.settings){const e=l?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(c.settings.selector!==e){c.settings.selector=e;try{c.refresh()}catch(e){}}}r.data("filterActive",!n)}(e,"#"+e.attr("id"),s,t)})}),jQuery('.sp-gallery[id^="sp-gallery-"]').each(function(){const e=jQuery(this),t=e.attr("id"),s=e.data("lg-mode"),i=e.attr("data-download-icon"),o="1"===String(e.data("downloads"));void 0===e.data("spLoadingNext")&&e.data("spLoadingNext",!1),void 0===e.data("spPrefetchBudget")&&e.data("spPrefetchBudget",3),shutterpressData.debug&&console.log("Download:",o),window.spGalleries[t]=lightGallery(document.getElementById(t),{plugins:[lgThumbnail,lgZoom,lgAutoplay,lgFullscreen],selector:".sp-gallery-item .sp-gallery-item-lightbox",download:o,autoplay:!0,addClass:"lg-"+t,getCaptionFromTitleOrAlt:!1,zoomFromOrigin:!0,thumbnail:!0,mode:s,allowMediaOverlap:!1,toggleThumb:!1,exThumbImage:"data-external-thumb-image",replaceIcons:[{selector:".lg-close",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'},{selector:".lg-zoom-in",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-zoom-in-icon lucide-zoom-in"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:"#lg-actual-size",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:".lg-autoplay-button",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play-icon lucide-play"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause-icon lucide-pause"><rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/></svg>'},{selector:".lg-download",html:i},{selector:".lg-fullscreen",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-expand-icon lucide-expand"><path d="m15 15 6 6"/><path d="m15 9 6-6"/><path d="M21 16v5h-5"/><path d="M21 8V3h-5"/><path d="M3 16v5h5"/><path d="m3 21 6-6"/><path d="M3 8V3h5"/><path d="M9 9 3 3"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shrink-icon lucide-shrink"><path d="m15 15 6 6m-6-6v4.8m0-4.8h4.8"/><path d="M9 19.8V15m0 0H4.2M9 15l-6 6"/><path d="M15 4.2V9m0 0h4.8M15 9l6-6"/><path d="M9 4.2V9m0 0H4.2M9 9 3 3"/></svg>'}]});const r=window.spGalleries[t];document.getElementById(t).addEventListener("lgBeforeOpen",function(){e.data("filterActive")&&e.find('.sp-gallery-item-liked img[loading="lazy"]').removeAttr("loading"),(()=>{const t=e.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(r&&r.settings&&r.settings.selector!==t){r.settings.selector=t;try{r.refresh()}catch(e){}}})(),window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].freeze()}),document.getElementById(t).addEventListener("lgAfterClose",function(){window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].unfreeze()}),document.getElementById(t).addEventListener("lgAfterSlide",function(t){shutterpressData.debug&&(console.log("lgAfterSlide event triggered"),console.log("Event index:",t.detail.index),console.log("Gallery items length:",r.galleryItems.length));const s=e.data("filterActive");if(e.data("spNoMorePages"))return;const i=r.galleryItems.length;if(t.detail.index>=i-4&&!e.data("spLoadingNext")){e.data("spLoadingNext",!0);const t=()=>{e.data("infiniteScroll")&&e.data("infiniteScroll").canLoad?e.infiniteScroll("loadNextPage").then(function(i){let{response:o,body:r,items:n}=i;if(e.data("spNoMorePages"))return void e.data("spLoadingNext",!1);jQuery(n).find('img[loading="lazy"]').removeAttr("loading"),e.infiniteScroll("appendItems",n);const a=jQuery(n),l=a.filter(".sp-gallery-item-liked").length||a.find(".sp-gallery-item-liked").length;if(s&&!l){let s=Number(e.data("spPrefetchBudget"))||0;if(s>0)return e.data("spPrefetchBudget",s-1),t()}else e.data("spPrefetchBudget",3);e.data("spLoadingNext",!1),a.imagesLoaded(function(){e.isotope("appended",a),shutterpressData.debug&&(console.log("Incremental layout after loadNextPage"),console.log(o&&o.path))})}).catch(function(){e.data("spLoadingNext",!1)}):e.data("spLoadingNext",!1)};t()}})}),jQuery(document).on("click",".sp-gallery-download-icon , .lg-download",function(e){e.preventDefault();const t=jQuery(this).attr("href");if(!t)return void(shutterpressData.debug&&console.error("Missing download URL."));const s=new URL(t,window.location.origin),i=s.searchParams.get("gallery_id"),o=s.searchParams.get("image_id");if(s.searchParams.get("download_nonce"),!i||!o)return void(shutterpressData.debug&&console.error("Missing download parameters."));const r={};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(r["X-WP-Nonce"]=shutterpressData.nonce),fetch(t,{method:"GET",headers:r,credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("Download failed");const t=e.headers.get("Content-Disposition");let s=`image-${o}.jpg`;if(t&&t.includes("filename=")){const e=t.match(/filename="?([^\";]+)"?/);e&&e[1]&&(s=e[1])}return e.blob().then(e=>({blob:e,filename:s}))}).then(({blob:e,filename:t})=>{const s=window.URL.createObjectURL(e),i=document.createElement("a");i.href=s,i.download=t,document.body.appendChild(i),i.click(),i.remove()}).catch(e=>{shutterpressData.debug&&console.error("Download error:",e)})}),jQuery(document).on("click","#sp-gallery-back-to-top",function(){shutterpressData.debug&&console.log("Back to top clicked"),jQuery("html, body").animate({scrollTop:0},1e3)})})})(); -
shutterpress-gallery/tags/1.7.10/shutterpress-gallery.php
r3385981 r3396625 12 12 * Plugin URI: https://shutterpress.io 13 13 * Description: WordPress photo gallery plugin for photographers and creatives. Build fast, responsive image galleries with Masonry, Justified, and Grid layouts, lightbox support, and Infinite Scroll. 14 * Version: 1.7. 914 * Version: 1.7.10 15 15 * Author: ShutterPress 16 16 * Author URI: https://shutterpress.io … … 29 29 * Current plugin version. 30 30 */ 31 define( 'SP_GALLERY_VERSION', '1.7. 9' );31 define( 'SP_GALLERY_VERSION', '1.7.10' ); 32 32 define( 'SP_GALLERY_NAME', 'shutterpress-gallery' ); 33 33 -
shutterpress-gallery/tags/1.7.10/src/public/js/layouts.js
r3383402 r3396625 23 23 }; 24 24 25 const ro = new ResizeObserver(() => { 26 if (hasSize()) finish(); 27 }); 28 ro.observe(el); 25 let ro; 26 if (typeof ResizeObserver !== "undefined") { 27 ro = new ResizeObserver(() => { 28 if (hasSize()) finish(); 29 }); 30 ro.observe(el); 31 } 29 32 30 33 // Fallback so we do not stall if ResizeObserver is unavailable … … 32 35 if (hasSize()) finish(); 33 36 }, 1200); 37 } 38 39 function watchForVisibilityReturn($el) { 40 const el = $el && $el[0]; 41 if (!el) return; 42 const hasRenderableSize = () => 43 el.clientWidth > 0 && el.offsetParent !== null; 44 let lastVisible = hasRenderableSize(); 45 46 const triggerLayout = () => { 47 if ( 48 typeof shutterpressData !== "undefined" && 49 shutterpressData && 50 shutterpressData.debug 51 ) { 52 console.log("[SP] Gallery became visible again, forcing layout"); 53 } 54 $el.isotope("layout"); 55 }; 56 57 if (typeof ResizeObserver !== "undefined") { 58 const ro = new ResizeObserver(() => { 59 const nowVisible = hasRenderableSize(); 60 if (nowVisible && !lastVisible) { 61 triggerLayout(); 62 } 63 lastVisible = nowVisible; 64 }); 65 ro.observe(el); 66 $el.data("spVisibilityObserver", ro); 67 return; 68 } 69 70 // Fallback: poll visibility periodically 71 const interval = setInterval(() => { 72 if (!document.body.contains(el)) { 73 clearInterval(interval); 74 return; 75 } 76 const nowVisible = hasRenderableSize(); 77 if (nowVisible && !lastVisible) { 78 triggerLayout(); 79 } 80 lastVisible = nowVisible; 81 }, 400); 82 $el.data("spVisibilityInterval", interval); 34 83 } 35 84 … … 451 500 452 501 $gallery.isotope("layout"); 502 watchForVisibilityReturn($gallery); 453 503 454 504 // Masonry, clear server inline width and height after first layout -
shutterpress-gallery/tags/1.7.10/src/public/js/shutterpress-gallery-isotope.js
r3371808 r3396625 1 // Keep Shutterpress custom Isotope layouts available even if other plugins 2 // replace the global Isotope instance after we load. 1 3 (function () { 2 var LayoutMode = Isotope.LayoutMode; 3 var SpGridLayout = LayoutMode.create('spGridLayout'); 4 5 SpGridLayout.prototype._resetLayout = function () { 6 this.itemIndex = 0; 7 8 // Get the data attributes from the container element 9 var container = this.isotope.element; 10 var gap = parseInt(container.getAttribute('data-gap')) || 0; 11 var breakpoints = JSON.parse(container.getAttribute('data-breakpoints')); 12 var dataColumns = JSON.parse(container.getAttribute('data-columns')); 13 var containerWidth = window.innerWidth; 14 15 var columns = dataColumns.desktop; 16 17 if (containerWidth <= breakpoints.mobile) { 18 columns = dataColumns.mobile; 19 } else if (containerWidth <= breakpoints.tablet) { 20 columns = dataColumns.tablet; 21 } 22 23 this.cols = columns; 24 var totalGap = (columns - 1) * gap; 25 var columnWidth = (this.isotope.size.innerWidth - totalGap) / columns; 26 27 this.columnWidth = columnWidth; 28 this.rowHeight = columnWidth; // Make square if needed 29 this.gap = gap; 30 this.positions = []; 31 }; 32 SpGridLayout.prototype._getItemLayoutPosition = function (item) { 33 var col = this.itemIndex % this.cols; 34 var row = Math.floor(this.itemIndex / this.cols); 35 var x = col * (this.columnWidth + this.gap); 36 var y = row * (this.rowHeight + this.gap); 37 38 // Set item size 39 var element = item.element; 40 element.style.width = this.columnWidth + 'px'; 41 element.style.height = this.rowHeight + 'px'; 42 43 this.positions.push({ x, y }); 44 this.itemIndex++; 45 46 return { x, y }; 47 }; 48 49 SpGridLayout.prototype._getContainerSize = function () { 50 var rowCount = Math.ceil(this.itemIndex / this.cols); 51 return { 52 height: rowCount * (this.rowHeight + this.gap) - this.gap, 53 }; 54 }; 55 56 SpGridLayout.prototype.needsResizeLayout = function () { 57 return true; 58 }; 59 60 Isotope.LayoutMode.modes.spGridLayout = SpGridLayout; 4 if (typeof window === 'undefined') { 5 return; 6 } 7 8 window.spGallery = window.spGallery || {}; 9 10 function defineGridLayout(LayoutMode) { 11 if (LayoutMode.modes.spGridLayout) { 12 return; 13 } 14 15 var SpGridLayout = LayoutMode.create('spGridLayout'); 16 17 SpGridLayout.prototype._resetLayout = function () { 18 this.itemIndex = 0; 19 20 var container = this.isotope.element; 21 var gap = parseInt(container.getAttribute('data-gap')) || 0; 22 var breakpoints = JSON.parse(container.getAttribute('data-breakpoints')); 23 var dataColumns = JSON.parse(container.getAttribute('data-columns')); 24 var containerWidth = window.innerWidth; 25 26 var columns = dataColumns.desktop; 27 28 if (containerWidth <= breakpoints.mobile) { 29 columns = dataColumns.mobile; 30 } else if (containerWidth <= breakpoints.tablet) { 31 columns = dataColumns.tablet; 32 } 33 34 this.cols = columns; 35 var totalGap = (columns - 1) * gap; 36 var columnWidth = (this.isotope.size.innerWidth - totalGap) / columns; 37 38 this.columnWidth = columnWidth; 39 this.rowHeight = columnWidth; 40 this.gap = gap; 41 this.positions = []; 42 }; 43 44 SpGridLayout.prototype._getItemLayoutPosition = function (item) { 45 var col = this.itemIndex % this.cols; 46 var row = Math.floor(this.itemIndex / this.cols); 47 var x = col * (this.columnWidth + this.gap); 48 var y = row * (this.rowHeight + this.gap); 49 50 var element = item.element; 51 element.style.width = this.columnWidth + 'px'; 52 element.style.height = this.rowHeight + 'px'; 53 54 this.positions.push({ x: x, y: y }); 55 this.itemIndex++; 56 57 return { x: x, y: y }; 58 }; 59 60 SpGridLayout.prototype._getContainerSize = function () { 61 var rowCount = Math.ceil(this.itemIndex / this.cols); 62 return { 63 height: rowCount * (this.rowHeight + this.gap) - this.gap, 64 }; 65 }; 66 67 SpGridLayout.prototype.needsResizeLayout = function () { 68 return true; 69 }; 70 71 LayoutMode.modes.spGridLayout = SpGridLayout; 72 } 73 74 function defineJustifiedLayout(LayoutMode) { 75 if (LayoutMode.modes.spJustifiedLayout) { 76 return; 77 } 78 79 var SpJustifiedLayout = LayoutMode.create('spJustifiedLayout'); 80 81 SpJustifiedLayout.prototype._resetLayout = function () { 82 var el = this.isotope.element; 83 this.rowHeight = parseInt(el.getAttribute('data-row-height')) || 200; 84 this.gap = parseInt(el.getAttribute('data-gap'), 10) || 10; 85 this.containerWidth = this.isotope.size.innerWidth; 86 this._posCache = new Map(); 87 }; 88 89 SpJustifiedLayout.prototype._getItemLayoutPosition = function (item) { 90 var cached = this._posCache.get(item.id); 91 if (cached) { 92 item.element.style.width = cached.width + 'px'; 93 item.element.style.height = cached.height + 'px'; 94 this._posCache.delete(item.id); 95 return { x: cached.x, y: cached.y }; 96 } 97 98 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items; 99 var start = list.indexOf(item); 100 if (start < 0) { 101 return { x: 0, y: 0 }; 102 } 103 104 var i = 0; 105 var yBase = 0; 106 while (i < start) { 107 var wSumPrev = 0; 108 var rowLenPrev = 0; 109 var jPrev = i; 110 while (jPrev < list.length) { 111 var itPrev = list[jPrev]; 112 var elPrev = itPrev.element; 113 var imgPrev = elPrev.querySelector('img'); 114 var nwPrev = parseInt(elPrev.getAttribute('data-width')) || (imgPrev && parseInt(imgPrev.getAttribute('width'))); 115 var nhPrev = parseInt(elPrev.getAttribute('data-height')) || (imgPrev && parseInt(imgPrev.getAttribute('height'))); 116 var arPrev = parseFloat(elPrev.getAttribute('data-ratio')) || (nwPrev && nhPrev ? nwPrev / nhPrev : 1); 117 var wPrev = this.rowHeight * arPrev; 118 wSumPrev += wPrev; 119 rowLenPrev++; 120 if (wSumPrev + this.gap * (rowLenPrev - 1) > this.containerWidth && rowLenPrev > 1) { 121 break; 122 } 123 jPrev++; 124 } 125 var gapsPrev = (rowLenPrev - 1) * this.gap; 126 var scalePrev = wSumPrev + gapsPrev > 0 ? (this.containerWidth - gapsPrev) / wSumPrev : 1; 127 var rowHPrev = Math.round(this.rowHeight * scalePrev); 128 yBase += rowHPrev + this.gap; 129 i += rowLenPrev; 130 } 131 132 var row = []; 133 var wSum = 0; 134 var k = start; 135 while (k < list.length) { 136 var it = list[k]; 137 var el = it.element; 138 var img = el.querySelector('img'); 139 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width'))); 140 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height'))); 141 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1); 142 var w = this.rowHeight * ar; 143 row.push({ id: it.id, w: w }); 144 wSum += w; 145 if (wSum + this.gap * (row.length - 1) > this.containerWidth && row.length > 1) { 146 break; 147 } 148 k++; 149 } 150 151 var gaps = (row.length - 1) * this.gap; 152 var isLastRow = k >= list.length; 153 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1; 154 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale; 155 var rowH = Math.round(this.rowHeight * scale); 156 157 var x = 0; 158 for (var r = 0; r < row.length; r++) { 159 var targetW = Math.floor(row[r].w * scale); 160 this._posCache.set(row[r].id, { x: x, y: yBase, width: targetW, height: rowH }); 161 x += targetW + this.gap; 162 } 163 164 var now = this._posCache.get(item.id); 165 if (now) { 166 item.element.style.width = now.width + 'px'; 167 item.element.style.height = now.height + 'px'; 168 this._posCache.delete(item.id); 169 return { x: now.x, y: now.y }; 170 } 171 172 return { x: 0, y: yBase }; 173 }; 174 175 SpJustifiedLayout.prototype._getContainerSize = function () { 176 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items; 177 178 var i = 0; 179 var totalHeight = 0; 180 while (i < list.length) { 181 var wSum = 0; 182 var rowLen = 0; 183 var j = i; 184 while (j < list.length) { 185 var it = list[j]; 186 var el = it.element; 187 var img = el.querySelector('img'); 188 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width'))); 189 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height'))); 190 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1); 191 var w = this.rowHeight * ar; 192 wSum += w; 193 rowLen++; 194 if (wSum + this.gap * (rowLen - 1) > this.containerWidth && rowLen > 1) { 195 break; 196 } 197 j++; 198 } 199 var gaps = (rowLen - 1) * this.gap; 200 var isLastRow = j >= list.length; 201 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1; 202 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale; 203 var rowH = Math.round(this.rowHeight * scale); 204 totalHeight += rowH + this.gap; 205 i += rowLen; 206 } 207 208 if (totalHeight > 0) { 209 totalHeight -= this.gap; 210 } 211 212 return { height: totalHeight }; 213 }; 214 215 SpJustifiedLayout.prototype.needsResizeLayout = function () { 216 return true; 217 }; 218 219 LayoutMode.modes.spJustifiedLayout = SpJustifiedLayout; 220 } 221 222 function defineNoneLayout(LayoutMode) { 223 if (LayoutMode.modes.none) { 224 return; 225 } 226 227 var NoneLayout = LayoutMode.create('none'); 228 229 NoneLayout.prototype._resetLayout = function () { 230 return false; 231 }; 232 233 NoneLayout.prototype._getItemLayoutPosition = function () { 234 return {}; 235 }; 236 237 NoneLayout.prototype._getContainerSize = function () { 238 return { height: 0 }; 239 }; 240 241 NoneLayout.prototype.needsResizeLayout = function () { 242 return false; 243 }; 244 245 LayoutMode.modes.none = NoneLayout; 246 } 247 248 function registerLayouts() { 249 var iso = window.Isotope; 250 if (!iso || !iso.LayoutMode) { 251 return; 252 } 253 254 var LayoutMode = iso.LayoutMode; 255 256 defineGridLayout(LayoutMode); 257 defineJustifiedLayout(LayoutMode); 258 defineNoneLayout(LayoutMode); 259 260 window.spGallery.Isotope = iso; 261 } 262 263 function ensureLayouts() { 264 registerLayouts(); 265 } 266 267 window.spGallery.ensureIsotopeLayouts = ensureLayouts; 268 269 ensureLayouts(); 270 271 if (!window.spGallery._isotopeEnsurer) { 272 window.spGallery._isotopeEnsurer = setInterval(ensureLayouts, 1000); 273 } 274 275 if (document && document.addEventListener) { 276 document.addEventListener('readystatechange', ensureLayouts); 277 } 278 if (window && window.addEventListener) { 279 window.addEventListener('load', ensureLayouts); 280 } 281 282 // Watch for galleries that become visible after being display:none (e.g., tabs/modals) 283 (function ($) { 284 if (!$ || !$.fn || typeof $.fn.isotope !== 'function') { 285 return; 286 } 287 288 const visibilityMap = new WeakMap(); 289 const hasRenderableSize = (el) => 290 el && el.offsetParent !== null && el.clientWidth > 0 && el.clientHeight >= 0; 291 292 function handleVisibilityChange(el) { 293 const $el = $(el); 294 const isoInstance = $el.data('isotope'); 295 if (!isoInstance) { 296 return; 297 } 298 const wasVisible = visibilityMap.get(el); 299 const nowVisible = hasRenderableSize(el); 300 if (nowVisible && wasVisible === false) { 301 if (window.shutterpressData && window.shutterpressData.debug) { 302 console.log('[SP] Gallery visible again, relayout forced for', el.id || el); 303 } 304 $el.isotope('layout'); 305 } 306 visibilityMap.set(el, nowVisible); 307 } 308 309 function primeVisibilityState(el) { 310 if (!visibilityMap.has(el)) { 311 visibilityMap.set(el, hasRenderableSize(el)); 312 } 313 } 314 315 function pollGalleries() { 316 $('.sp-gallery').each(function () { 317 primeVisibilityState(this); 318 handleVisibilityChange(this); 319 }); 320 } 321 322 $(document).ready(function () { 323 if (window.spGallery && window.spGallery.visibilityPoller) { 324 return; 325 } 326 pollGalleries(); 327 window.spGallery = window.spGallery || {}; 328 window.spGallery.visibilityPoller = setInterval(pollGalleries, 400); 329 }); 330 })(window.jQuery); 61 331 })(); 62 63 // Updated SpJustifiedLayout to use proper Isotope layout engine integration64 (function () {65 var LayoutMode = Isotope.LayoutMode;66 var SpJustifiedLayout = LayoutMode.create('spJustifiedLayout');67 68 SpJustifiedLayout.prototype._resetLayout = function () {69 var el = this.isotope.element;70 this.rowHeight = parseInt(el.getAttribute('data-row-height')) || 200;71 this.gap = parseInt(el.getAttribute('data-gap'), 10) || 10;72 this.containerWidth = this.isotope.size.innerWidth;73 // Cache for positions of items in the current row during a call sequence74 this._posCache = new Map(); // id -> {x,y,width,height}75 };76 77 SpJustifiedLayout.prototype._getItemLayoutPosition = function (item) {78 // If precomputed for this item in this pass, apply size and return79 var cached = this._posCache.get(item.id);80 if (cached) {81 item.element.style.width = cached.width + 'px';82 item.element.style.height = cached.height + 'px';83 this._posCache.delete(item.id);84 return { x: cached.x, y: cached.y };85 }86 87 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items;88 89 // Find the true index of this item among the items being laid out90 var start = list.indexOf(item);91 if (start < 0) {92 // Fallback, should not happen93 return { x: 0, y: 0 };94 }95 96 // Walk from 0 up to `start` to compute the y offset of the current row97 var i = 0;98 var yBase = 0;99 while (i < start) {100 var wSumPrev = 0;101 var rowLenPrev = 0;102 var jPrev = i;103 while (jPrev < list.length) {104 var itPrev = list[jPrev];105 var elPrev = itPrev.element;106 var imgPrev = elPrev.querySelector('img');107 var nwPrev = parseInt(elPrev.getAttribute('data-width')) || (imgPrev && parseInt(imgPrev.getAttribute('width')));108 var nhPrev = parseInt(elPrev.getAttribute('data-height')) || (imgPrev && parseInt(imgPrev.getAttribute('height')));109 var arPrev = parseFloat(elPrev.getAttribute('data-ratio')) || (nwPrev && nhPrev ? nwPrev / nhPrev : 1);110 var wPrev = this.rowHeight * arPrev;111 wSumPrev += wPrev;112 rowLenPrev++;113 if (wSumPrev + this.gap * (rowLenPrev - 1) > this.containerWidth && rowLenPrev > 1) {114 break;115 }116 jPrev++;117 }118 var gapsPrev = (rowLenPrev - 1) * this.gap;119 var scalePrev = wSumPrev + gapsPrev > 0 ? (this.containerWidth - gapsPrev) / wSumPrev : 1;120 var rowHPrev = Math.round(this.rowHeight * scalePrev);121 yBase += rowHPrev + this.gap;122 i += rowLenPrev;123 }124 125 // Build the row that starts at `start` and cache positions for its items126 var row = [];127 var wSum = 0;128 var k = start;129 while (k < list.length) {130 var it = list[k];131 var el = it.element;132 var img = el.querySelector('img');133 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width')));134 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height')));135 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1);136 var w = this.rowHeight * ar;137 row.push({ id: it.id, w: w });138 wSum += w;139 if (wSum + this.gap * (row.length - 1) > this.containerWidth && row.length > 1) {140 break;141 }142 k++;143 }144 145 var gaps = (row.length - 1) * this.gap;146 // If this is the final row, do not justify, cap scale at 1 so items keep natural width for the row height147 var isLastRow = k >= list.length;148 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1;149 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale;150 var rowH = Math.round(this.rowHeight * scale);151 152 var x = 0;153 var assigned = 0;154 for (var r = 0; r < row.length; r++) {155 var targetW = Math.floor(row[r].w * scale);156 this._posCache.set(row[r].id, { x: x, y: yBase, width: targetW, height: rowH });157 x += targetW + this.gap;158 if (r !== row.length - 1) assigned += targetW;159 }160 161 var now = this._posCache.get(item.id);162 if (now) {163 item.element.style.width = now.width + 'px';164 item.element.style.height = now.height + 'px';165 this._posCache.delete(item.id);166 return { x: now.x, y: now.y };167 }168 169 return { x: 0, y: yBase };170 };171 172 SpJustifiedLayout.prototype._getContainerSize = function () {173 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items;174 175 var i = 0;176 var totalHeight = 0;177 while (i < list.length) {178 var wSum = 0;179 var rowLen = 0;180 var j = i;181 while (j < list.length) {182 var it = list[j];183 var el = it.element;184 var img = el.querySelector('img');185 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width')));186 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height')));187 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1);188 var w = this.rowHeight * ar;189 wSum += w;190 rowLen++;191 if (wSum + this.gap * (rowLen - 1) > this.containerWidth && rowLen > 1) {192 break;193 }194 j++;195 }196 var gaps = (rowLen - 1) * this.gap;197 var isLastRow = j >= list.length;198 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1;199 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale;200 var rowH = Math.round(this.rowHeight * scale);201 totalHeight += rowH + this.gap;202 i += rowLen;203 }204 205 // remove last gap206 if (totalHeight > 0) totalHeight -= this.gap;207 208 return { height: totalHeight };209 };210 211 SpJustifiedLayout.prototype.needsResizeLayout = function () {212 return true;213 };214 215 Isotope.LayoutMode.modes.spJustifiedLayout = SpJustifiedLayout;216 })();217 218 (function () {219 var LayoutMode = Isotope.LayoutMode;220 221 var NoneLayout = LayoutMode.create('none');222 223 NoneLayout.prototype._resetLayout = function () {224 return false;225 };226 227 NoneLayout.prototype._getItemLayoutPosition = function () {228 return {}; // Return dummy values229 };230 231 NoneLayout.prototype._getContainerSize = function () {232 return { height: 0 };233 };234 235 NoneLayout.prototype.needsResizeLayout = function () {236 return false;237 };238 239 Isotope.LayoutMode.modes.none = NoneLayout;240 })(); -
shutterpress-gallery/tags/1.7.10/vendor/composer/autoload_static.php
r3383402 r3396625 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'S' => 10 'S' => 11 11 array ( 12 12 'Shutterpress\\Gallery\\' => 21, 13 13 ), 14 'C' => 14 'C' => 15 15 array ( 16 16 'Composer\\Installers\\' => 20, … … 19 19 20 20 public static $prefixDirsPsr4 = array ( 21 'Shutterpress\\Gallery\\' => 21 'Shutterpress\\Gallery\\' => 22 22 array ( 23 23 0 => __DIR__ . '/../..' . '/src/admin', … … 25 25 2 => __DIR__ . '/../..' . '/src/public', 26 26 ), 27 'Composer\\Installers\\' => 27 'Composer\\Installers\\' => 28 28 array ( 29 29 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', -
shutterpress-gallery/tags/1.7.10/vendor/composer/installed.php
r3385981 r3396625 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' bfc4583ac863711708db2e8a2896da2b737d26a3',6 'reference' => 'cd688b899426f936380120d9fab79a90a7c6b4f7', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 35 35 'pretty_version' => 'dev-master', 36 36 'version' => 'dev-master', 37 'reference' => ' bfc4583ac863711708db2e8a2896da2b737d26a3',37 'reference' => 'cd688b899426f936380120d9fab79a90a7c6b4f7', 38 38 'type' => 'wordpress-plugin', 39 39 'install_path' => __DIR__ . '/../../', -
shutterpress-gallery/trunk/README.txt
r3385981 r3396625 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.7. 98 Stable tag: 1.7.10 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 ### **Wordpress Gallery Plugin** 17 17 18 **ShutterPress Gallery** is a flexible, photographer-focused WordPress gallery plugin designed for professionals who need to share and deliver images online. Build stunning, responsive galleries with reusable **Gallery Templates** and fine-grained **styling options** that let you control colors, icons, and hover effects — all from an easy-to-use admin panel.18 **ShutterPress Gallery** is a flexible, WordPress gallery plugin designed for photgraphers or artisits who need to share and deliver images online. Build stunning, responsive galleries with reusable **Gallery Templates** and fine-grained **styling options** that let you control colors, icons, and hover effects — all from an easy-to-use admin panel. 19 19 20 20 With built-in support for Gutenberg and Elementor, you can display each gallery on its own dedicated page, or embed it anywhere on your site using Gutenberg blocks, Elementor widgets, or shortcodes. Each gallery can be customized with templates, layout settings, and feature toggles, including optional favorites, downloads, and lightbox. … … 119 119 120 120 == Changelog == 121 122 = 1.7.10 = 123 124 * Fix - Add Isotope layout mode registration guard to prevent conflict with other Isotope instances 121 125 122 126 = 1.7.9 = -
shutterpress-gallery/trunk/includes/js/shutterpress-gallery-editor.js
r3383402 r3396625 1 (()=>{var t={997:()=>{ var t,e,i;(t=Isotope.LayoutMode.create("spGridLayout")).prototype._resetLayout=function(){this.itemIndex=0;var t=this.isotope.element,e=parseInt(t.getAttribute("data-gap"))||0,i=JSON.parse(t.getAttribute("data-breakpoints")),o=JSON.parse(t.getAttribute("data-columns")),s=window.innerWidth,n=o.desktop;s<=i.mobile?n=o.mobile:s<=i.tablet&&(n=o.tablet),this.cols=n;var a=(n-1)*e,r=(this.isotope.size.innerWidth-a)/n;this.columnWidth=r,this.rowHeight=r,this.gap=e,this.positions=[]},t.prototype._getItemLayoutPosition=function(t){var e=this.itemIndex%this.cols,i=Math.floor(this.itemIndex/this.cols),o=e*(this.columnWidth+this.gap),s=i*(this.rowHeight+this.gap),n=t.element;return n.style.width=this.columnWidth+"px",n.style.height=this.rowHeight+"px",this.positions.push({x:o,y:s}),this.itemIndex++,{x:o,y:s}},t.prototype._getContainerSize=function(){return{height:Math.ceil(this.itemIndex/this.cols)*(this.rowHeight+this.gap)-this.gap}},t.prototype.needsResizeLayout=function(){return!0},Isotope.LayoutMode.modes.spGridLayout=t,(e=Isotope.LayoutMode.create("spJustifiedLayout")).prototype._resetLayout=function(){var t=this.isotope.element;this.rowHeight=parseInt(t.getAttribute("data-row-height"))||200,this.gap=parseInt(t.getAttribute("data-gap"),10)||10,this.containerWidth=this.isotope.size.innerWidth,this._posCache=new Map},e.prototype._getItemLayoutPosition=function(t){var e=this._posCache.get(t.id);if(e)return t.element.style.width=e.width+"px",t.element.style.height=e.height+"px",this._posCache.delete(t.id),{x:e.x,y:e.y};var i=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,o=i.indexOf(t);if(o<0)return{x:0,y:0};for(var s=0,n=0;s<o;){for(var a=0,r=0,l=s;l<i.length;){var d=i[l].element,p=d.querySelector("img"),c=parseInt(d.getAttribute("data-width"))||p&&parseInt(p.getAttribute("width")),u=parseInt(d.getAttribute("data-height"))||p&&parseInt(p.getAttribute("height")),g=parseFloat(d.getAttribute("data-ratio"))||(c&&u?c/u:1);if(r++,(a+=this.rowHeight*g)+this.gap*(r-1)>this.containerWidth&&r>1)break;l++}var h=(r-1)*this.gap,y=a+h>0?(this.containerWidth-h)/a:1;n+=Math.round(this.rowHeight*y)+this.gap,s+=r}for(var m=[],f=0,b=o;b<i.length;){var w=i[b],v=w.element,x=v.querySelector("img"),A=parseInt(v.getAttribute("data-width"))||x&&parseInt(x.getAttribute("width")),$=parseInt(v.getAttribute("data-height"))||x&&parseInt(x.getAttribute("height")),I=parseFloat(v.getAttribute("data-ratio"))||(A&&$?A/$:1),S=this.rowHeight*I;if(m.push({id:w.id,w:S}),(f+=S)+this.gap*(m.length-1)>this.containerWidth&&m.length>1)break;b++}for(var C=(m.length-1)*this.gap,k=b>=i.length,D=f+C>0?(this.containerWidth-C)/f:1,_=k?Math.min(1,D):D,z=Math.round(this.rowHeight*_),L=0,W=0;W<m.length;W++){var M=Math.floor(m[W].w*_);this._posCache.set(m[W].id,{x:L,y:n,width:M,height:z}),L+=M+this.gap,m.length}var P=this._posCache.get(t.id);return P?(t.element.style.width=P.width+"px",t.element.style.height=P.height+"px",this._posCache.delete(t.id),{x:P.x,y:P.y}):{x:0,y:n}},e.prototype._getContainerSize=function(){for(var t=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,e=0,i=0;e<t.length;){for(var o=0,s=0,n=e;n<t.length;){var a=t[n].element,r=a.querySelector("img"),l=parseInt(a.getAttribute("data-width"))||r&&parseInt(r.getAttribute("width")),d=parseInt(a.getAttribute("data-height"))||r&&parseInt(r.getAttribute("height")),p=parseFloat(a.getAttribute("data-ratio"))||(l&&d?l/d:1);if(s++,(o+=this.rowHeight*p)+this.gap*(s-1)>this.containerWidth&&s>1)break;n++}var c=(s-1)*this.gap,u=n>=t.length,g=o+c>0?(this.containerWidth-c)/o:1,h=u?Math.min(1,g):g;i+=Math.round(this.rowHeight*h)+this.gap,e+=s}return i>0&&(i-=this.gap),{height:i}},e.prototype.needsResizeLayout=function(){return!0},Isotope.LayoutMode.modes.spJustifiedLayout=e,(i=Isotope.LayoutMode.create("none")).prototype._resetLayout=function(){return!1},i.prototype._getItemLayoutPosition=function(){return{}},i.prototype._getContainerSize=function(){return{height:0}},i.prototype.needsResizeLayout=function(){return!1},Isotope.LayoutMode.modes.none=i}},e={};function i(o){var s=e[o];if(void 0!==s)return s.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,i),n.exports}(()=>{"use strict";function t(){const t=jQuery,e=t('[id^="sp-gallery-"].sp-gallery');if(0===e.length)return;let i="";e.each(function(){const e=t(this),o=e.data("id"),s=`.lg-sp-gallery-${o}`,n=e.data("breakpoints"),a=e.data("layout"),r=e.get(0).clientWidth,l=e.data("gap"),d=e.data("lg"),p=e.data("icon-size"),c=e.data("icon-size-h"),u=e.data("columns"),g=e.data("colors"),h=e.attr("data-custom-css");function y(t){return(t-1)*l}if(i+=`\n \n #sp-gallery-buttons-${o}, \n #sp-gallery-${o}, \n #sp-gallery-page-load-container-${o}, \n #sp-gallery-pagination-${o} {\n --sp-gallery-color-primary: ${g.primary};\n --sp-gallery-color-accent: ${g.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${o} {\n ${c&&c.desktop?`--sp-gallery-hover-icon-size: ${c.desktop}px;`:""}\n ${p&&p.desktop?`--sp-gallery-icon-size: ${p.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${n.tablet}px) */\n @media (max-width: ${n.tablet}px) {\n #sp-gallery-${o} {\n ${c&&c.tablet?`--sp-gallery-hover-icon-size: ${c.tablet}px;`:""}\n ${p&&p.tablet?`--sp-gallery-icon-size: ${p.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${n.mobile}px) */\n @media (max-width: ${n.mobile}px) {\n #sp-gallery-${o} {\n ${c&&c.mobile?`--sp-gallery-hover-icon-size: ${c.mobile}px;`:""}\n ${p&&p.mobile?`--sp-gallery-icon-size: ${p.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${s} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${g.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const t=`#sp-gallery-${o}.sp-gallery-grid-gallery `;i+=`\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${n.tablet}px) {\n ${t} { grid-template-columns: repeat(${u.tablet}, 1fr); }\n }\n @media (max-width: ${n.mobile}px) {\n ${t} { grid-template-columns: repeat(${u.mobile}, 1fr); }\n }\n `}if("masonry"===a){const t=`#sp-gallery-${o}.sp-gallery-masonry-gallery `;i+=`\n\n ${t} {\n --sp-gallery-width: ${r}px;\n }\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${t} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(u.desktop)}px) / ${u.desktop});\n }\n\n @media (max-width: ${n.tablet}px) {\n ${t} {\n grid-template-columns: repeat(${u.tablet}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.tablet)}px) / ${u.tablet});\n }\n }\n\n @media (max-width: ${n.mobile}px) {\n ${t} {\n grid-template-columns: repeat(${u.mobile}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.mobile)}px) / ${u.mobile});\n }\n }\n `}h&&(i+=h)});let o=jQuery("#shutterpress-gallery-inline-style");0===o.length&&(o=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),o.text(i)}function e(t){Array.isArray(t)||(t=[]),t.forEach(function(t){jQuery('.sp-gallery-like-icon[data-image-id="'+t+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+t).addClass("sp-gallery-item-liked")})}i(997);let o=[];function s(){return o}jQuery(document).ready(function(i){function o(){const i=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");i?.contentDocument||document;let o=(i?.contentWindow?.jQuery||jQuery)(".sp-gallery").not("[data-sp-initialized]");o.length&&o.each(function(){const i=this,o=i.ownerDocument,n=o.defaultView?.jQuery||jQuery;!function t(e,o=0){const s=i.clientWidth;return s&&s>0||o>40?e():void setTimeout(()=>t(e,o+1),50)}(()=>{("function"==typeof n.fn.imagesLoaded?(t,e)=>n(t).imagesLoaded(e):(t,e)=>e())(i,()=>{const a="shutterpress-gallery-inline-style";jQuery("#"+a).remove(),t();const r=document.getElementById(a);if(r&&o!==document){const t=o.getElementById(a);t&&t.remove();const e=o.createElement("style");e.id=a,e.textContent=r.textContent||"",o.head.appendChild(e)}n(i).one("layoutComplete.spInit",function(){n(this).removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){const t=n(i);t.hasClass("sp-gallery-hidden")&&t.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500),function(i=jQuery,o=!1){i(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",i(this).attr("id"));const n=i(this),a=n[0]?.ownerDocument?.defaultView||window;if(n.data("spLayoutsInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",n.attr("id")));n.data("spLayoutsInit",!0);const r=n.data("layout"),l=n.attr("id"),d=n.data("gap"),p=n.data("columns")||{desktop:3,tablet:2,mobile:1},c=n.data("breakpoints"),u=n.get(0).clientWidth;let g=p.desktop;const h=a.innerWidth;h<=c.mobile?g=p.mobile:h<=c.tablet&&(g=p.tablet);const y=(u-(g-1)*d)/g;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",u),console.log("columnWidth",y),console.log("activeColumns",g),console.log("columns",p.desktop),console.log("columnsTablet",p.tablet),console.log("columnsMobile",p.mobile),console.log("breakpointTablet",c.tablet),console.log("breakpointMobile",c.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[r];if(!m)return;const f=function(){let d;!function(t,e){const i=t&&t[0];if(!i)return e();const o=()=>i.clientWidth>0&&null!==i.offsetParent;if(o())return e();let s=!1;const n=()=>{if(!s){s=!0;try{a.disconnect()}catch(t){}e()}},a=new ResizeObserver(()=>{o()&&n()});a.observe(i),setTimeout(()=>{o()&&n()},1200)}(n,function(){n.isotope(m.options),o||e(s());const t="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(n.data("filterActive")||i(t).hasClass("sp-gallery-filter-active"))&&(n.data("filterActive",!0),n.isotope({filter:".sp-gallery-item-liked"})),n.isotope("layout"),"masonry"===r&&function(){const t=()=>{n.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),n.off(".spClearWHInit")};n.off(".spClearWHInit"),n.one("arrangeComplete.spClearWHInit",t),n.one("layoutComplete.spClearWHInit",t),setTimeout(t,1200)}(),a.spVirtualisers||(a.spVirtualisers={}),a.spVirtualisers[l]=function(t,e={}){const i=e.maxActive||120,o=e.enterMargin||"1200px",s=e.exitMargin||"2000px",n=new Set;let a=!1;function r(t){t.forEach(t=>{d.observe(t),p.observe(t)})}const l=t.find(".sp-gallery-item img").toArray();for(const t of l)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");const d=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting&&c(e.target)},{rootMargin:o,threshold:.01}),p=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting||u(e.target)},{rootMargin:s,threshold:0});async function c(t){if(!a&&!n.has(t)){t.dataset.srcset&&t.setAttribute("srcset",t.dataset.srcset),t.dataset.sizes&&t.setAttribute("sizes",t.dataset.sizes),t.dataset.src&&t.setAttribute("src",t.dataset.src),t.loading="lazy",t.decoding="async",t.fetchpriority="low";try{await t.decode()}catch(t){}if(n.add(t),n.size>i){let t=null,e=-1;for(const i of n){const o=i.getBoundingClientRect(),s=Math.min(Math.abs(o.top),Math.abs(o.bottom));s>e&&(e=s,t=i)}t&&u(t)}}}function u(t){!a&&n.has(t)&&(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),n.delete(t))}return r(l),{freeze(){a=!0},unfreeze(){a=!1},add(t){const e=Array.isArray(t)?t:[t];for(const t of e)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");r(e)},destroy(){d.disconnect(),p.disconnect(),n.clear()}}}(n,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),n.on("layoutComplete",function(){a.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===o&&function(t,o,n){const a=t[0]?.ownerDocument?.defaultView||window;if(t.data("is")&&i(".sp-gallery").length<=1){const r=()=>{const e=t.data("columns"),i=t.data("breakpoints");return{layout:t.data("layout"),gap:t.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:i.tablet,breakpoint_mobile:i.mobile,use_lightbox:t.data("lightbox"),gallery_width:t.get(0).clientWidth,viewport_width:a.innerWidth}};i(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(n).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",r())),t.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",n));if(t.data("spInfScrollInit",!0),(parseInt(t.data("pages"),10)||1)<=1)return t.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let p=2;t.off("load.infiniteScroll.shutterpress");let c={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(c["X-WP-Nonce"]=shutterpressData.nonce),t.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const t=r();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:c,body:JSON.stringify({gallery_id:d,page:p,attributes:t})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),t.on("load.infiniteScroll.shutterpress",function(r,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(p=l.nextPage,t.data("spNoMorePages",!1)):d=!0;const c=l&&l.html?l.html:"";if(!c||!c.trim()){if(d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let u=i(c);const g=u.filter(o);if(g.length)u=g;else{const t=u.find(o);t.length&&(u=t)}if(u.find("img").attr({decoding:"async",fetchpriority:"low"}),u.css({opacity:0}),t.infiniteScroll("appendItems",u.get()),u.imagesLoaded(function(){const i=t=>{t.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},r=u.filter(o).length?u.filter(o):u;let l=!1;const d=()=>{l||(l=!0,"masonry"===t.data("layout")&&i(r),t.off(".spClearWHAppend"))};t.off(".spClearWHAppend"),t.one("arrangeComplete.spClearWHAppend",function(){d()}),t.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),t.isotope("appended",u),t.isotope("layout"),t.off("layoutComplete.spEnsureVisible"),t.one("layoutComplete.spEnsureVisible",function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:t.data("filterActive")?"":1})},600),u.css({willChange:"transform, opacity, width, height",opacity:0}),t.data("filterActive")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),t.off("arrangeComplete.spFirstAppend"),t.one("arrangeComplete.spFirstAppend",function(){u.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),t.off("arrangeComplete.spFirstAppend")})):"justified"==t.data("layout")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[n]&&a.spVirtualisers[n].add(u.find("img").toArray()),e(s()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[n]){const e=a.spGalleries[n],i=t.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==i&&(e.settings.selector=i),e.refresh()}if(t.data("filterActive")&&t.isotope({filter:".sp-gallery-item-liked"}),d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(n,m.itemSelector,l)}),i(a).on("resize",function(){clearTimeout(d),d=setTimeout(function(){i("#shutterpress-gallery-inline-style").remove(),t(),n.isotope()},300)})};if("function"==typeof i.fn.imagesLoaded&&"function"==typeof n.imagesLoaded)n.imagesLoaded(f);else{const t=n.find("img").get();if(t.length){let e=t.length;const o=()=>{--e<=0&&f()};t.forEach(t=>{t.complete?o():i(t).one("load error",o)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){n.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",n.is(":visible")),console.log("Gallery height:",n.height()),console.log("Forced layout after LightGallery closed."))})})}(n,!0)})})})}"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),window.spVirtualisers||(window.spVirtualisers={}),window.spGalleries||(window.spGalleries={}),o();const n=document.querySelector(".block-editor-block-list__layout")||document.querySelector('iframe[name="editor-canvas"]')?.contentDocument?.querySelector(".block-editor-block-list__layout")||document.body,a=new MutationObserver(t=>{for(const e of t)if(e.addedNodes&&e.addedNodes.length){o();break}});a.observe(n,{childList:!0,subtree:!0});const r=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");if(r&&r.contentWindow&&r.addEventListener("load",()=>{try{const t=r.contentDocument?.querySelector(".block-editor-block-list__layout")||r.contentDocument?.body;t&&(a.observe(t,{childList:!0,subtree:!0}),o())}catch(t){}}),window.wp&&wp.domReady&&wp.domReady(o),window.wp?.data?.subscribe){let t;wp.data.subscribe(()=>{clearTimeout(t),t=setTimeout(o,150)})}})})()})();1 (()=>{var t={997:()=>{!function(){function t(){!function(){var t=window.Isotope;if(t&&t.LayoutMode){var e=t.LayoutMode;!function(t){if(!t.modes.spGridLayout){var e=t.create("spGridLayout");e.prototype._resetLayout=function(){this.itemIndex=0;var t=this.isotope.element,e=parseInt(t.getAttribute("data-gap"))||0,i=JSON.parse(t.getAttribute("data-breakpoints")),o=JSON.parse(t.getAttribute("data-columns")),s=window.innerWidth,n=o.desktop;s<=i.mobile?n=o.mobile:s<=i.tablet&&(n=o.tablet),this.cols=n;var a=(n-1)*e,r=(this.isotope.size.innerWidth-a)/n;this.columnWidth=r,this.rowHeight=r,this.gap=e,this.positions=[]},e.prototype._getItemLayoutPosition=function(t){var e=this.itemIndex%this.cols,i=Math.floor(this.itemIndex/this.cols),o=e*(this.columnWidth+this.gap),s=i*(this.rowHeight+this.gap),n=t.element;return n.style.width=this.columnWidth+"px",n.style.height=this.rowHeight+"px",this.positions.push({x:o,y:s}),this.itemIndex++,{x:o,y:s}},e.prototype._getContainerSize=function(){return{height:Math.ceil(this.itemIndex/this.cols)*(this.rowHeight+this.gap)-this.gap}},e.prototype.needsResizeLayout=function(){return!0},t.modes.spGridLayout=e}}(e),function(t){if(!t.modes.spJustifiedLayout){var e=t.create("spJustifiedLayout");e.prototype._resetLayout=function(){var t=this.isotope.element;this.rowHeight=parseInt(t.getAttribute("data-row-height"))||200,this.gap=parseInt(t.getAttribute("data-gap"),10)||10,this.containerWidth=this.isotope.size.innerWidth,this._posCache=new Map},e.prototype._getItemLayoutPosition=function(t){var e=this._posCache.get(t.id);if(e)return t.element.style.width=e.width+"px",t.element.style.height=e.height+"px",this._posCache.delete(t.id),{x:e.x,y:e.y};var i=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,o=i.indexOf(t);if(o<0)return{x:0,y:0};for(var s=0,n=0;s<o;){for(var a=0,r=0,l=s;l<i.length;){var d=i[l].element,c=d.querySelector("img"),p=parseInt(d.getAttribute("data-width"))||c&&parseInt(c.getAttribute("width")),u=parseInt(d.getAttribute("data-height"))||c&&parseInt(c.getAttribute("height")),h=parseFloat(d.getAttribute("data-ratio"))||(p&&u?p/u:1);if(r++,(a+=this.rowHeight*h)+this.gap*(r-1)>this.containerWidth&&r>1)break;l++}var g=(r-1)*this.gap,y=a+g>0?(this.containerWidth-g)/a:1;n+=Math.round(this.rowHeight*y)+this.gap,s+=r}for(var m=[],f=0,b=o;b<i.length;){var w=i[b],v=w.element,x=v.querySelector("img"),A=parseInt(v.getAttribute("data-width"))||x&&parseInt(x.getAttribute("width")),I=parseInt(v.getAttribute("data-height"))||x&&parseInt(x.getAttribute("height")),$=parseFloat(v.getAttribute("data-ratio"))||(A&&I?A/I:1),S=this.rowHeight*$;if(m.push({id:w.id,w:S}),(f+=S)+this.gap*(m.length-1)>this.containerWidth&&m.length>1)break;b++}for(var C=(m.length-1)*this.gap,k=b>=i.length,D=f+C>0?(this.containerWidth-C)/f:1,z=k?Math.min(1,D):D,_=Math.round(this.rowHeight*z),P=0,L=0;L<m.length;L++){var W=Math.floor(m[L].w*z);this._posCache.set(m[L].id,{x:P,y:n,width:W,height:_}),P+=W+this.gap}var M=this._posCache.get(t.id);return M?(t.element.style.width=M.width+"px",t.element.style.height=M.height+"px",this._posCache.delete(t.id),{x:M.x,y:M.y}):{x:0,y:n}},e.prototype._getContainerSize=function(){for(var t=this.isotope.filteredItems&&this.isotope.filteredItems.length?this.isotope.filteredItems:this.isotope.items,e=0,i=0;e<t.length;){for(var o=0,s=0,n=e;n<t.length;){var a=t[n].element,r=a.querySelector("img"),l=parseInt(a.getAttribute("data-width"))||r&&parseInt(r.getAttribute("width")),d=parseInt(a.getAttribute("data-height"))||r&&parseInt(r.getAttribute("height")),c=parseFloat(a.getAttribute("data-ratio"))||(l&&d?l/d:1);if(s++,(o+=this.rowHeight*c)+this.gap*(s-1)>this.containerWidth&&s>1)break;n++}var p=(s-1)*this.gap,u=n>=t.length,h=o+p>0?(this.containerWidth-p)/o:1,g=u?Math.min(1,h):h;i+=Math.round(this.rowHeight*g)+this.gap,e+=s}return i>0&&(i-=this.gap),{height:i}},e.prototype.needsResizeLayout=function(){return!0},t.modes.spJustifiedLayout=e}}(e),function(t){if(!t.modes.none){var e=t.create("none");e.prototype._resetLayout=function(){return!1},e.prototype._getItemLayoutPosition=function(){return{}},e.prototype._getContainerSize=function(){return{height:0}},e.prototype.needsResizeLayout=function(){return!1},t.modes.none=e}}(e),window.spGallery.Isotope=t}}()}"undefined"!=typeof window&&(window.spGallery=window.spGallery||{},window.spGallery.ensureIsotopeLayouts=t,t(),window.spGallery._isotopeEnsurer||(window.spGallery._isotopeEnsurer=setInterval(t,1e3)),document&&document.addEventListener&&document.addEventListener("readystatechange",t),window&&window.addEventListener&&window.addEventListener("load",t),function(t){if(!t||!t.fn||"function"!=typeof t.fn.isotope)return;const e=new WeakMap,i=t=>t&&null!==t.offsetParent&&t.clientWidth>0&&t.clientHeight>=0;function o(){t(".sp-gallery").each(function(){var o;o=this,e.has(o)||e.set(o,i(o)),function(o){const s=t(o);if(!s.data("isotope"))return;const n=e.get(o),a=i(o);a&&!1===n&&(window.shutterpressData&&window.shutterpressData.debug&&console.log("[SP] Gallery visible again, relayout forced for",o.id||o),s.isotope("layout")),e.set(o,a)}(this)})}t(document).ready(function(){window.spGallery&&window.spGallery.visibilityPoller||(o(),window.spGallery=window.spGallery||{},window.spGallery.visibilityPoller=setInterval(o,400))})}(window.jQuery))}()}},e={};function i(o){var s=e[o];if(void 0!==s)return s.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,i),n.exports}(()=>{"use strict";function t(){const t=jQuery,e=t('[id^="sp-gallery-"].sp-gallery');if(0===e.length)return;let i="";e.each(function(){const e=t(this),o=e.data("id"),s=`.lg-sp-gallery-${o}`,n=e.data("breakpoints"),a=e.data("layout"),r=e.get(0).clientWidth,l=e.data("gap"),d=e.data("lg"),c=e.data("icon-size"),p=e.data("icon-size-h"),u=e.data("columns"),h=e.data("colors"),g=e.attr("data-custom-css");function y(t){return(t-1)*l}if(i+=`\n \n #sp-gallery-buttons-${o}, \n #sp-gallery-${o}, \n #sp-gallery-page-load-container-${o}, \n #sp-gallery-pagination-${o} {\n --sp-gallery-color-primary: ${h.primary};\n --sp-gallery-color-accent: ${h.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${o} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${n.tablet}px) */\n @media (max-width: ${n.tablet}px) {\n #sp-gallery-${o} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${n.mobile}px) */\n @media (max-width: ${n.mobile}px) {\n #sp-gallery-${o} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${s} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${h.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const t=`#sp-gallery-${o}.sp-gallery-grid-gallery `;i+=`\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${n.tablet}px) {\n ${t} { grid-template-columns: repeat(${u.tablet}, 1fr); }\n }\n @media (max-width: ${n.mobile}px) {\n ${t} { grid-template-columns: repeat(${u.mobile}, 1fr); }\n }\n `}if("masonry"===a){const t=`#sp-gallery-${o}.sp-gallery-masonry-gallery `;i+=`\n\n ${t} {\n --sp-gallery-width: ${r}px;\n }\n\n ${t} {\n display: grid;\n grid-template-columns: repeat(${u.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${t} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(u.desktop)}px) / ${u.desktop});\n }\n\n @media (max-width: ${n.tablet}px) {\n ${t} {\n grid-template-columns: repeat(${u.tablet}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.tablet)}px) / ${u.tablet});\n }\n }\n\n @media (max-width: ${n.mobile}px) {\n ${t} {\n grid-template-columns: repeat(${u.mobile}, 1fr);\n }\n ${t} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(u.mobile)}px) / ${u.mobile});\n }\n }\n `}g&&(i+=g)});let o=jQuery("#shutterpress-gallery-inline-style");0===o.length&&(o=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),o.text(i)}function e(t){Array.isArray(t)||(t=[]),t.forEach(function(t){jQuery('.sp-gallery-like-icon[data-image-id="'+t+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+t).addClass("sp-gallery-item-liked")})}i(997);let o=[];function s(){return o}jQuery(document).ready(function(i){function o(){const i=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");i?.contentDocument||document;let o=(i?.contentWindow?.jQuery||jQuery)(".sp-gallery").not("[data-sp-initialized]");o.length&&o.each(function(){const i=this,o=i.ownerDocument,n=o.defaultView?.jQuery||jQuery;!function t(e,o=0){const s=i.clientWidth;return s&&s>0||o>40?e():void setTimeout(()=>t(e,o+1),50)}(()=>{("function"==typeof n.fn.imagesLoaded?(t,e)=>n(t).imagesLoaded(e):(t,e)=>e())(i,()=>{const a="shutterpress-gallery-inline-style";jQuery("#"+a).remove(),t();const r=document.getElementById(a);if(r&&o!==document){const t=o.getElementById(a);t&&t.remove();const e=o.createElement("style");e.id=a,e.textContent=r.textContent||"",o.head.appendChild(e)}n(i).one("layoutComplete.spInit",function(){n(this).removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){const t=n(i);t.hasClass("sp-gallery-hidden")&&t.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500),function(i=jQuery,o=!1){i(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",i(this).attr("id"));const n=i(this),a=n[0]?.ownerDocument?.defaultView||window;if(n.data("spLayoutsInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",n.attr("id")));n.data("spLayoutsInit",!0);const r=n.data("layout"),l=n.attr("id"),d=n.data("gap"),c=n.data("columns")||{desktop:3,tablet:2,mobile:1},p=n.data("breakpoints"),u=n.get(0).clientWidth;let h=c.desktop;const g=a.innerWidth;g<=p.mobile?h=c.mobile:g<=p.tablet&&(h=c.tablet);const y=(u-(h-1)*d)/h;shutterpressData.debug&&(console.log("windowWidth",g),console.log("galleryWidth",u),console.log("columnWidth",y),console.log("activeColumns",h),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[r];if(!m)return;const f=function(){let d;!function(t,e){const i=t&&t[0];if(!i)return e();const o=()=>i.clientWidth>0&&null!==i.offsetParent;if(o())return e();let s=!1;const n=()=>{if(!s){s=!0;try{a.disconnect()}catch(t){}e()}};let a;"undefined"!=typeof ResizeObserver&&(a=new ResizeObserver(()=>{o()&&n()}),a.observe(i)),setTimeout(()=>{o()&&n()},1200)}(n,function(){n.isotope(m.options),o||e(s());const t="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(n.data("filterActive")||i(t).hasClass("sp-gallery-filter-active"))&&(n.data("filterActive",!0),n.isotope({filter:".sp-gallery-item-liked"})),n.isotope("layout"),function(t){const e=t&&t[0];if(!e)return;const i=()=>e.clientWidth>0&&null!==e.offsetParent;let o=i();const s=()=>{"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("[SP] Gallery became visible again, forcing layout"),t.isotope("layout")};if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver(()=>{const t=i();t&&!o&&s(),o=t});return n.observe(e),void t.data("spVisibilityObserver",n)}const n=setInterval(()=>{if(!document.body.contains(e))return void clearInterval(n);const t=i();t&&!o&&s(),o=t},400);t.data("spVisibilityInterval",n)}(n),"masonry"===r&&function(){const t=()=>{n.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),n.off(".spClearWHInit")};n.off(".spClearWHInit"),n.one("arrangeComplete.spClearWHInit",t),n.one("layoutComplete.spClearWHInit",t),setTimeout(t,1200)}(),a.spVirtualisers||(a.spVirtualisers={}),a.spVirtualisers[l]=function(t,e={}){const i=e.maxActive||120,o=e.enterMargin||"1200px",s=e.exitMargin||"2000px",n=new Set;let a=!1;function r(t){t.forEach(t=>{d.observe(t),c.observe(t)})}const l=t.find(".sp-gallery-item img").toArray();for(const t of l)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");const d=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting&&p(e.target)},{rootMargin:o,threshold:.01}),c=new IntersectionObserver(function(t){for(const e of t)e.isIntersecting||u(e.target)},{rootMargin:s,threshold:0});async function p(t){if(!a&&!n.has(t)){t.dataset.srcset&&t.setAttribute("srcset",t.dataset.srcset),t.dataset.sizes&&t.setAttribute("sizes",t.dataset.sizes),t.dataset.src&&t.setAttribute("src",t.dataset.src),t.loading="lazy",t.decoding="async",t.fetchpriority="low";try{await t.decode()}catch(t){}if(n.add(t),n.size>i){let t=null,e=-1;for(const i of n){const o=i.getBoundingClientRect(),s=Math.min(Math.abs(o.top),Math.abs(o.bottom));s>e&&(e=s,t=i)}t&&u(t)}}}function u(t){!a&&n.has(t)&&(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),n.delete(t))}return r(l),{freeze(){a=!0},unfreeze(){a=!1},add(t){const e=Array.isArray(t)?t:[t];for(const t of e)t.dataset.src||!t.getAttribute("src")&&!t.currentSrc||(t.dataset.src=t.getAttribute("src")||"",t.dataset.srcset=t.getAttribute("srcset")||"",t.dataset.sizes=t.getAttribute("sizes")||"");r(e)},destroy(){d.disconnect(),c.disconnect(),n.clear()}}}(n,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),n.on("layoutComplete",function(){a.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===o&&function(t,o,n){const a=t[0]?.ownerDocument?.defaultView||window;if(t.data("is")&&i(".sp-gallery").length<=1){const r=()=>{const e=t.data("columns"),i=t.data("breakpoints");return{layout:t.data("layout"),gap:t.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:i.tablet,breakpoint_mobile:i.mobile,use_lightbox:t.data("lightbox"),gallery_width:t.get(0).clientWidth,viewport_width:a.innerWidth}};i(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(n).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",r())),t.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",n));if(t.data("spInfScrollInit",!0),(parseInt(t.data("pages"),10)||1)<=1)return t.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;t.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),t.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const t=r();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:t})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),t.on("load.infiniteScroll.shutterpress",function(r,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(c=l.nextPage,t.data("spNoMorePages",!1)):d=!0;const p=l&&l.html?l.html:"";if(!p||!p.trim()){if(d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let u=i(p);const h=u.filter(o);if(h.length)u=h;else{const t=u.find(o);t.length&&(u=t)}if(u.find("img").attr({decoding:"async",fetchpriority:"low"}),u.css({opacity:0}),t.infiniteScroll("appendItems",u.get()),u.imagesLoaded(function(){const i=t=>{t.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},r=u.filter(o).length?u.filter(o):u;let l=!1;const d=()=>{l||(l=!0,"masonry"===t.data("layout")&&i(r),t.off(".spClearWHAppend"))};t.off(".spClearWHAppend"),t.one("arrangeComplete.spClearWHAppend",function(){d()}),t.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),t.isotope("appended",u),t.isotope("layout"),t.off("layoutComplete.spEnsureVisible"),t.one("layoutComplete.spEnsureVisible",function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){u.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:t.data("filterActive")?"":1})},600),u.css({willChange:"transform, opacity, width, height",opacity:0}),t.data("filterActive")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),t.off("arrangeComplete.spFirstAppend"),t.one("arrangeComplete.spFirstAppend",function(){u.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),t.off("arrangeComplete.spFirstAppend")})):"justified"==t.data("layout")?(u.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):u.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[n]&&a.spVirtualisers[n].add(u.find("img").toArray()),e(s()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[n]){const e=a.spGalleries[n],i=t.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==i&&(e.settings.selector=i),e.refresh()}if(t.data("filterActive")&&t.isotope({filter:".sp-gallery-item-liked"}),d){t.infiniteScroll("option",{loadOnScroll:!1}),t.data("spNoMorePages",!0);const e=t.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(n,m.itemSelector,l)}),i(a).on("resize",function(){clearTimeout(d),d=setTimeout(function(){i("#shutterpress-gallery-inline-style").remove(),t(),n.isotope()},300)})};if("function"==typeof i.fn.imagesLoaded&&"function"==typeof n.imagesLoaded)n.imagesLoaded(f);else{const t=n.find("img").get();if(t.length){let e=t.length;const o=()=>{--e<=0&&f()};t.forEach(t=>{t.complete?o():i(t).one("load error",o)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){n.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",n.is(":visible")),console.log("Gallery height:",n.height()),console.log("Forced layout after LightGallery closed."))})})}(n,!0)})})})}"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),window.spVirtualisers||(window.spVirtualisers={}),window.spGalleries||(window.spGalleries={}),o();const n=document.querySelector(".block-editor-block-list__layout")||document.querySelector('iframe[name="editor-canvas"]')?.contentDocument?.querySelector(".block-editor-block-list__layout")||document.body,a=new MutationObserver(t=>{for(const e of t)if(e.addedNodes&&e.addedNodes.length){o();break}});a.observe(n,{childList:!0,subtree:!0});const r=document.querySelector('iframe[name="editor-canvas"]')||document.querySelector(".editor-canvas__iframe")||document.querySelector(".block-editor__iframe");if(r&&r.contentWindow&&r.addEventListener("load",()=>{try{const t=r.contentDocument?.querySelector(".block-editor-block-list__layout")||r.contentDocument?.body;t&&(a.observe(t,{childList:!0,subtree:!0}),o())}catch(t){}}),window.wp&&wp.domReady&&wp.domReady(o),window.wp?.data?.subscribe){let t;wp.data.subscribe(()=>{clearTimeout(t),t=setTimeout(o,150)})}})})()})(); -
shutterpress-gallery/trunk/includes/js/shutterpress-gallery-public.js
r3383402 r3396625 1 (()=>{"use strict";function e(e){Array.isArray(e)||(e=[]),e.forEach(function(e){jQuery('.sp-gallery-like-icon[data-image-id="'+e+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+e).addClass("sp-gallery-item-liked")})}function t(e,t){let i=Cookies.get("liked_images")?JSON.parse(Cookies.get("liked_images")):[];return t&&!i.includes(e)?i.push(e):t||(i=i.filter(t=>t!==e)),Cookies.set("liked_images",JSON.stringify(i),{expires:365,path:"/",sameSite:"Strict"}),i}let i=[],s=!1;function o(e){i=Array.isArray(e)?e:[]}function r(){return i}function a(e){s=!!e}function l(){return s}function n(){const e=jQuery,t=e('[id^="sp-gallery-"].sp-gallery');if(0===t.length)return;let i="";t.each(function(){const t=e(this),s=t.data("id"),o=`.lg-sp-gallery-${s}`,r=t.data("breakpoints"),a=t.data("layout"),l=t.get(0).clientWidth,n=t.data("gap"),d=t.data("lg"),c=t.data("icon-size"),p=t.data("icon-size-h"),g=t.data("columns"),u=t.data("colors"),h=t.attr("data-custom-css");function m(e){return(e-1)*n}if(i+=`\n \n #sp-gallery-buttons-${s}, \n #sp-gallery-${s}, \n #sp-gallery-page-load-container-${s}, \n #sp-gallery-pagination-${s} {\n --sp-gallery-color-primary: ${u.primary};\n --sp-gallery-color-accent: ${u.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${s} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${r.tablet}px) */\n @media (max-width: ${r.tablet}px) {\n #sp-gallery-${s} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${r.mobile}px) */\n @media (max-width: ${r.mobile}px) {\n #sp-gallery-${s} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(i+=`\n\n ${o} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${u.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===a){const e=`#sp-gallery-${s}.sp-gallery-grid-gallery `;i+=`\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${n}px;\n }\n @media (max-width: ${r.tablet}px) {\n ${e} { grid-template-columns: repeat(${g.tablet}, 1fr); }\n }\n @media (max-width: ${r.mobile}px) {\n ${e} { grid-template-columns: repeat(${g.mobile}, 1fr); }\n }\n `}if("masonry"===a){const e=`#sp-gallery-${s}.sp-gallery-masonry-gallery `;i+=`\n\n ${e} {\n --sp-gallery-width: ${l}px;\n }\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${n}px;\n }\n\n ${e} .sp-gallery-masonry-item {\n margin-bottom: ${n}px;\n width: calc((var(--sp-gallery-width) - ${m(g.desktop)}px) / ${g.desktop});\n }\n\n @media (max-width: ${r.tablet}px) {\n ${e} {\n grid-template-columns: repeat(${g.tablet}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${m(g.tablet)}px) / ${g.tablet});\n }\n }\n\n @media (max-width: ${r.mobile}px) {\n ${e} {\n grid-template-columns: repeat(${g.mobile}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${m(g.mobile)}px) / ${g.mobile});\n }\n }\n `}h&&(i+=h)});let s=jQuery("#shutterpress-gallery-inline-style");0===s.length&&(s=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),s.text(i)}jQuery(document).ready(function(i){if(window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),o([]),a(!1),window.isLoggedIn=!1,"undefined"!=typeof shutterpressData&&null!==shutterpressData)if(shutterpressData.debug&&console.log("shutterpressData:",shutterpressData),l())fetch(`${shutterpressData.rest_url}shutterpress/v1/user-data`,{method:"GET",credentials:"include",headers:{"X-WP-Nonce":shutterpressData.nonce}}).then(e=>{if(!e.ok)throw new Error("Failed to fetch user data");return e.json()}).catch(e=>{throw shutterpressData.debug&&console.error("Fetch failed:",e),e}).then(function(t){Array.isArray(t.liked_images)&&(o(t.liked_images),e(r()));const i=!!t.logged_in;a(i),window.isLoggedIn=i,shutterpressData.debug&&(console.log("Liked Images:",r()),console.log("Logged In:",l()))}).catch(function(t){shutterpressData.debug&&console.error("User data fetch error:",t),e(r())});else{const t=Cookies.get("liked_images");if(t)try{o(JSON.parse(t)),e(r())}catch(e){shutterpressData.debug&&console.error("Invalid liked_images cookie")}}shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleries={},window.spVirtualisers={},n(),function(t=jQuery,i=!1){t(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",t(this).attr("id"));const s=t(this),o=s[0]?.ownerDocument?.defaultView||window;if(s.data("spLayoutsInit"))return void(o.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",s.attr("id")));s.data("spLayoutsInit",!0);const a=s.data("layout"),l=s.attr("id"),d=s.data("gap"),c=s.data("columns")||{desktop:3,tablet:2,mobile:1},p=s.data("breakpoints"),g=s.get(0).clientWidth;let u=c.desktop;const h=o.innerWidth;h<=p.mobile?u=c.mobile:h<=p.tablet&&(u=c.tablet);const m=(g-(u-1)*d)/u;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",g),console.log("columnWidth",m),console.log("activeColumns",u),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const y={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[a];if(!y)return;const f=function(){let d;!function(e,t){const i=e&&e[0];if(!i)return t();const s=()=>i.clientWidth>0&&null!==i.offsetParent;if(s())return t();let o=!1;const r=()=>{if(!o){o=!0;try{a.disconnect()}catch(e){}t()}},a=new ResizeObserver(()=>{s()&&r()});a.observe(i),setTimeout(()=>{s()&&r()},1200)}(s,function(){s.isotope(y.options),i||e(r());const n="#sp-gallery-filter-liked-photos-"+String(l).replace("sp-gallery-","");(s.data("filterActive")||t(n).hasClass("sp-gallery-filter-active"))&&(s.data("filterActive",!0),s.isotope({filter:".sp-gallery-item-liked"})),s.isotope("layout"),"masonry"===a&&function(){const e=()=>{s.find(y.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),s.off(".spClearWHInit")};s.off(".spClearWHInit"),s.one("arrangeComplete.spClearWHInit",e),s.one("layoutComplete.spClearWHInit",e),setTimeout(e,1200)}(),o.spVirtualisers||(o.spVirtualisers={}),o.spVirtualisers[l]=function(e,t={}){const i=t.maxActive||120,s=t.enterMargin||"1200px",o=t.exitMargin||"2000px",r=new Set;let a=!1;function l(e){e.forEach(e=>{d.observe(e),c.observe(e)})}const n=e.find(".sp-gallery-item img").toArray();for(const e of n)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");const d=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting&&p(t.target)},{rootMargin:s,threshold:.01}),c=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting||g(t.target)},{rootMargin:o,threshold:0});async function p(e){if(!a&&!r.has(e)){e.dataset.srcset&&e.setAttribute("srcset",e.dataset.srcset),e.dataset.sizes&&e.setAttribute("sizes",e.dataset.sizes),e.dataset.src&&e.setAttribute("src",e.dataset.src),e.loading="lazy",e.decoding="async",e.fetchpriority="low";try{await e.decode()}catch(e){}if(r.add(e),r.size>i){let e=null,t=-1;for(const i of r){const s=i.getBoundingClientRect(),o=Math.min(Math.abs(s.top),Math.abs(s.bottom));o>t&&(t=o,e=i)}e&&g(e)}}}function g(e){!a&&r.has(e)&&(e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),r.delete(e))}return l(n),{freeze(){a=!0},unfreeze(){a=!1},add(e){const t=Array.isArray(e)?e:[e];for(const e of t)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");l(t)},destroy(){d.disconnect(),c.disconnect(),r.clear()}}}(s,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),s.on("layoutComplete",function(){o.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===i&&function(i,s,o){const a=i[0]?.ownerDocument?.defaultView||window;if(i.data("is")&&t(".sp-gallery").length<=1){const l=()=>{const e=i.data("columns"),t=i.data("breakpoints");return{layout:i.data("layout"),gap:i.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:t.tablet,breakpoint_mobile:t.mobile,use_lightbox:i.data("lightbox"),gallery_width:i.get(0).clientWidth,viewport_width:a.innerWidth}};t(".sp-gallery-page-load-container").css("display","block");const n=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(o).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",n),console.log("[SP] Attributes",l())),i.data("spInfScrollInit"))return void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",o));if(i.data("spInfScrollInit",!0),(parseInt(i.data("pages"),10)||1)<=1)return i.data("spNoMorePages",!0),void(a.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;i.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),i.infiniteScroll({path:function(){return`${n}`},fetchOptions:function(){const e=l();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:e})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!a.shutterpressData||!shutterpressData.debug)}),i.on("load.infiniteScroll.shutterpress",function(l,n){shutterpressData.debug&&console.log("Response:",n);let d=!1;n&&void 0!==n.nextPage&&!1!==n.nextPage?(c=n.nextPage,i.data("spNoMorePages",!1)):d=!0;const p=n&&n.html?n.html:"";if(!p||!p.trim()){if(d){i.infiniteScroll("option",{loadOnScroll:!1}),i.data("spNoMorePages",!0);const e=i.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let g=t(p);const u=g.filter(s);if(u.length)g=u;else{const e=g.find(s);e.length&&(g=e)}if(g.find("img").attr({decoding:"async",fetchpriority:"low"}),g.css({opacity:0}),i.infiniteScroll("appendItems",g.get()),g.imagesLoaded(function(){const t=e=>{e.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},l=g.filter(s).length?g.filter(s):g;let n=!1;const d=()=>{n||(n=!0,"masonry"===i.data("layout")&&t(l),i.off(".spClearWHAppend"))};i.off(".spClearWHAppend"),i.one("arrangeComplete.spClearWHAppend",function(){d()}),i.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),i.isotope("appended",g),i.isotope("layout"),i.off("layoutComplete.spEnsureVisible"),i.one("layoutComplete.spEnsureVisible",function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:i.data("filterActive")?"":1})},600),g.css({willChange:"transform, opacity, width, height",opacity:0}),i.data("filterActive")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),i.off("arrangeComplete.spFirstAppend"),i.one("arrangeComplete.spFirstAppend",function(){g.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),i.off("arrangeComplete.spFirstAppend")})):"justified"==i.data("layout")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),a.spVirtualisers&&a.spVirtualisers[o]&&a.spVirtualisers[o].add(g.find("img").toArray()),e(r()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),a.spGalleries[o]){const e=a.spGalleries[o],t=i.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==t&&(e.settings.selector=t),e.refresh()}if(i.data("filterActive")&&i.isotope({filter:".sp-gallery-item-liked"}),d){i.infiniteScroll("option",{loadOnScroll:!1}),i.data("spNoMorePages",!0);const e=i.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(s,y.itemSelector,l)}),t(o).on("resize",function(){clearTimeout(d),d=setTimeout(function(){t("#shutterpress-gallery-inline-style").remove(),n(),s.isotope()},300)})};if("function"==typeof t.fn.imagesLoaded&&"function"==typeof s.imagesLoaded)s.imagesLoaded(f);else{const e=s.find("img").get();if(e.length){let i=e.length;const s=()=>{--i<=0&&f()};e.forEach(e=>{e.complete?s():t(e).one("load error",s)}),setTimeout(f,1200)}else f()}document.getElementById(l).addEventListener("lgAfterClose",function(){s.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",s.is(":visible")),console.log("Gallery height:",s.height()),console.log("Forced layout after LightGallery closed."))})})}(),jQuery(".sp-gallery").each(function(){const e=jQuery(this);e.one("layoutComplete.spInit",function(){e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){e.hasClass("sp-gallery-hidden")&&e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500)}),function(){const i=jQuery(document);i.off("click.sp-like"),i.on("click.sp-like",".sp-gallery-like-icon",function(){const i=jQuery(this),s=i.data("image-id"),a=l();if(i.toggleClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+s).toggleClass("sp-gallery-item-liked"),a)fetch(`${shutterpressData.rest_url}shutterpress/v1/toggle-like`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":shutterpressData.nonce},credentials:"include",body:JSON.stringify({image_id:s})}).then(e=>e.json()).then(i=>{void 0!==i.liked&&(o(t(s,i.liked)),e(r()))}).catch(e=>{shutterpressData.debug&&console.error("Toggle like failed:",e)});else try{const a=i.hasClass("sp-gallery-liked-image");o(t(s,a)),e(r()),shutterpressData.debug&&console.log("Liked Images:",r())}catch(e){shutterpressData.debug&&console.error("Cookie update failed:",e)}})}(),jQuery('[id^="sp-gallery-filter-liked-photos-"]').each(function(){var e=jQuery(this),t=e.attr("id").replace("sp-gallery-filter-liked-photos-","");e.off("click").on("click",function(){var i=function(e){return e.hasClass("wp-block-button")?"#"+e.attr("id")+" .wp-element-button":e.hasClass("elementor-button")?"#"+e.attr("id")+" .elementor-button-text":e.hasClass("sp-gallery-button")?"#"+e.attr("id"):null}(e);!function(e,t,i,s){e.blur();var o="#sp-gallery-"+s,r=jQuery(o),a=r.data("filterActive")||!1,l=r.find(".sp-gallery-item-liked").length>0;if(!a&&!l)return void(shutterpressData.debug&&console.log("Filter ignored: no liked photos in gallery",s));a?(jQuery(t).removeClass("sp-gallery-filter-active"),null!==i&&jQuery(i).text(wp.i18n.__("Show Favorite Photos","shutterpress-gallery")),r.isotope({filter:"*"}),r.isotope()):(jQuery(t).addClass("sp-gallery-filter-active"),null!==i&&jQuery(i).text(wp.i18n.__("Show All Photos","shutterpress-gallery")),function(e){jQuery(e).isotope({filter:".sp-gallery-item-liked"}),shutterpressData.debug&&console.log("Isotope filtering applied")}(o)),document.getElementById("sp-gallery-"+s);const n=!a,d="sp-gallery-"+s,c=window.spGalleries[d];if(c&&c.settings){const e=n?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(c.settings.selector!==e){c.settings.selector=e;try{c.refresh()}catch(e){}}}r.data("filterActive",!a)}(e,"#"+e.attr("id"),i,t)})}),jQuery('.sp-gallery[id^="sp-gallery-"]').each(function(){const e=jQuery(this),t=e.attr("id"),i=e.data("lg-mode"),s=e.attr("data-download-icon"),o="1"===String(e.data("downloads"));void 0===e.data("spLoadingNext")&&e.data("spLoadingNext",!1),void 0===e.data("spPrefetchBudget")&&e.data("spPrefetchBudget",3),shutterpressData.debug&&console.log("Download:",o),window.spGalleries[t]=lightGallery(document.getElementById(t),{plugins:[lgThumbnail,lgZoom,lgAutoplay,lgFullscreen],selector:".sp-gallery-item .sp-gallery-item-lightbox",download:o,autoplay:!0,addClass:"lg-"+t,getCaptionFromTitleOrAlt:!1,zoomFromOrigin:!0,thumbnail:!0,mode:i,allowMediaOverlap:!1,toggleThumb:!1,exThumbImage:"data-external-thumb-image",replaceIcons:[{selector:".lg-close",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'},{selector:".lg-zoom-in",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-zoom-in-icon lucide-zoom-in"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:"#lg-actual-size",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:".lg-autoplay-button",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play-icon lucide-play"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause-icon lucide-pause"><rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/></svg>'},{selector:".lg-download",html:s},{selector:".lg-fullscreen",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-expand-icon lucide-expand"><path d="m15 15 6 6"/><path d="m15 9 6-6"/><path d="M21 16v5h-5"/><path d="M21 8V3h-5"/><path d="M3 16v5h5"/><path d="m3 21 6-6"/><path d="M3 8V3h5"/><path d="M9 9 3 3"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shrink-icon lucide-shrink"><path d="m15 15 6 6m-6-6v4.8m0-4.8h4.8"/><path d="M9 19.8V15m0 0H4.2M9 15l-6 6"/><path d="M15 4.2V9m0 0h4.8M15 9l6-6"/><path d="M9 4.2V9m0 0H4.2M9 9 3 3"/></svg>'}]});const r=window.spGalleries[t];document.getElementById(t).addEventListener("lgBeforeOpen",function(){e.data("filterActive")&&e.find('.sp-gallery-item-liked img[loading="lazy"]').removeAttr("loading"),(()=>{const t=e.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(r&&r.settings&&r.settings.selector!==t){r.settings.selector=t;try{r.refresh()}catch(e){}}})(),window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].freeze()}),document.getElementById(t).addEventListener("lgAfterClose",function(){window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].unfreeze()}),document.getElementById(t).addEventListener("lgAfterSlide",function(t){shutterpressData.debug&&(console.log("lgAfterSlide event triggered"),console.log("Event index:",t.detail.index),console.log("Gallery items length:",r.galleryItems.length));const i=e.data("filterActive");if(e.data("spNoMorePages"))return;const s=r.galleryItems.length;if(t.detail.index>=s-4&&!e.data("spLoadingNext")){e.data("spLoadingNext",!0);const t=()=>{e.data("infiniteScroll")&&e.data("infiniteScroll").canLoad?e.infiniteScroll("loadNextPage").then(function(s){let{response:o,body:r,items:a}=s;if(e.data("spNoMorePages"))return void e.data("spLoadingNext",!1);jQuery(a).find('img[loading="lazy"]').removeAttr("loading"),e.infiniteScroll("appendItems",a);const l=jQuery(a),n=l.filter(".sp-gallery-item-liked").length||l.find(".sp-gallery-item-liked").length;if(i&&!n){let i=Number(e.data("spPrefetchBudget"))||0;if(i>0)return e.data("spPrefetchBudget",i-1),t()}else e.data("spPrefetchBudget",3);e.data("spLoadingNext",!1),l.imagesLoaded(function(){e.isotope("appended",l),shutterpressData.debug&&(console.log("Incremental layout after loadNextPage"),console.log(o&&o.path))})}).catch(function(){e.data("spLoadingNext",!1)}):e.data("spLoadingNext",!1)};t()}})}),jQuery(document).on("click",".sp-gallery-download-icon , .lg-download",function(e){e.preventDefault();const t=jQuery(this).attr("href");if(!t)return void(shutterpressData.debug&&console.error("Missing download URL."));const i=new URL(t,window.location.origin),s=i.searchParams.get("gallery_id"),o=i.searchParams.get("image_id");if(i.searchParams.get("download_nonce"),!s||!o)return void(shutterpressData.debug&&console.error("Missing download parameters."));const r={};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(r["X-WP-Nonce"]=shutterpressData.nonce),fetch(t,{method:"GET",headers:r,credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("Download failed");const t=e.headers.get("Content-Disposition");let i=`image-${o}.jpg`;if(t&&t.includes("filename=")){const e=t.match(/filename="?([^\";]+)"?/);e&&e[1]&&(i=e[1])}return e.blob().then(e=>({blob:e,filename:i}))}).then(({blob:e,filename:t})=>{const i=window.URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),s.remove()}).catch(e=>{shutterpressData.debug&&console.error("Download error:",e)})}),jQuery(document).on("click","#sp-gallery-back-to-top",function(){shutterpressData.debug&&console.log("Back to top clicked"),jQuery("html, body").animate({scrollTop:0},1e3)})})})();1 (()=>{"use strict";function e(e){Array.isArray(e)||(e=[]),e.forEach(function(e){jQuery('.sp-gallery-like-icon[data-image-id="'+e+'"]').addClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+e).addClass("sp-gallery-item-liked")})}function t(e,t){let s=Cookies.get("liked_images")?JSON.parse(Cookies.get("liked_images")):[];return t&&!s.includes(e)?s.push(e):t||(s=s.filter(t=>t!==e)),Cookies.set("liked_images",JSON.stringify(s),{expires:365,path:"/",sameSite:"Strict"}),s}let s=[],i=!1;function o(e){s=Array.isArray(e)?e:[]}function r(){return s}function n(e){i=!!e}function a(){return i}function l(){const e=jQuery,t=e('[id^="sp-gallery-"].sp-gallery');if(0===t.length)return;let s="";t.each(function(){const t=e(this),i=t.data("id"),o=`.lg-sp-gallery-${i}`,r=t.data("breakpoints"),n=t.data("layout"),a=t.get(0).clientWidth,l=t.data("gap"),d=t.data("lg"),c=t.data("icon-size"),p=t.data("icon-size-h"),g=t.data("columns"),u=t.data("colors"),h=t.attr("data-custom-css");function y(e){return(e-1)*l}if(s+=`\n \n #sp-gallery-buttons-${i}, \n #sp-gallery-${i}, \n #sp-gallery-page-load-container-${i}, \n #sp-gallery-pagination-${i} {\n --sp-gallery-color-primary: ${u.primary};\n --sp-gallery-color-accent: ${u.accent};\n }\n\n /* Default for desktop */\n #sp-gallery-${i} {\n ${p&&p.desktop?`--sp-gallery-hover-icon-size: ${p.desktop}px;`:""}\n ${c&&c.desktop?`--sp-gallery-icon-size: ${c.desktop}px;`:""}\n }\n\n /* For tablets (max-width: ${r.tablet}px) */\n @media (max-width: ${r.tablet}px) {\n #sp-gallery-${i} {\n ${p&&p.tablet?`--sp-gallery-hover-icon-size: ${p.tablet}px;`:""}\n ${c&&c.tablet?`--sp-gallery-icon-size: ${c.tablet}px;`:""}\n }\n }\n\n /* For mobile (max-width: ${r.mobile}px) */\n @media (max-width: ${r.mobile}px) {\n #sp-gallery-${i} {\n ${p&&p.mobile?`--sp-gallery-hover-icon-size: ${p.mobile}px;`:""}\n ${c&&c.mobile?`--sp-gallery-icon-size: ${c.mobile}px;`:""}\n }\n }`,d&&(s+=`\n\n ${o} {\n --lg-icon-color: ${d.iconColor};\n --lg-hover-color: ${u.primary};\n --lg-background-color: ${d.bgColor};\n }`),"grid"===n){const e=`#sp-gallery-${i}.sp-gallery-grid-gallery `;s+=`\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n @media (max-width: ${r.tablet}px) {\n ${e} { grid-template-columns: repeat(${g.tablet}, 1fr); }\n }\n @media (max-width: ${r.mobile}px) {\n ${e} { grid-template-columns: repeat(${g.mobile}, 1fr); }\n }\n `}if("masonry"===n){const e=`#sp-gallery-${i}.sp-gallery-masonry-gallery `;s+=`\n\n ${e} {\n --sp-gallery-width: ${a}px;\n }\n\n ${e} {\n display: grid;\n grid-template-columns: repeat(${g.desktop}, 1fr);\n grid-gap: ${l}px;\n }\n\n ${e} .sp-gallery-masonry-item {\n margin-bottom: ${l}px;\n width: calc((var(--sp-gallery-width) - ${y(g.desktop)}px) / ${g.desktop});\n }\n\n @media (max-width: ${r.tablet}px) {\n ${e} {\n grid-template-columns: repeat(${g.tablet}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(g.tablet)}px) / ${g.tablet});\n }\n }\n\n @media (max-width: ${r.mobile}px) {\n ${e} {\n grid-template-columns: repeat(${g.mobile}, 1fr);\n }\n ${e} .sp-gallery-masonry-item {\n width: calc((var(--sp-gallery-width) - ${y(g.mobile)}px) / ${g.mobile});\n }\n }\n `}h&&(s+=h)});let i=jQuery("#shutterpress-gallery-inline-style");0===i.length&&(i=jQuery("<style>",{type:"text/css",id:"shutterpress-gallery-inline-style"}).appendTo("head")),i.text(s)}jQuery(document).ready(function(s){if(window.spGalleriesIsotope||(window.spGalleriesIsotope={}),window.spGalleriesJustified||(window.spGalleriesJustified={}),o([]),n(!1),window.isLoggedIn=!1,"undefined"!=typeof shutterpressData&&null!==shutterpressData)if(shutterpressData.debug&&console.log("shutterpressData:",shutterpressData),a())fetch(`${shutterpressData.rest_url}shutterpress/v1/user-data`,{method:"GET",credentials:"include",headers:{"X-WP-Nonce":shutterpressData.nonce}}).then(e=>{if(!e.ok)throw new Error("Failed to fetch user data");return e.json()}).catch(e=>{throw shutterpressData.debug&&console.error("Fetch failed:",e),e}).then(function(t){Array.isArray(t.liked_images)&&(o(t.liked_images),e(r()));const s=!!t.logged_in;n(s),window.isLoggedIn=s,shutterpressData.debug&&(console.log("Liked Images:",r()),console.log("Logged In:",a()))}).catch(function(t){shutterpressData.debug&&console.error("User data fetch error:",t),e(r())});else{const t=Cookies.get("liked_images");if(t)try{o(JSON.parse(t)),e(r())}catch(e){shutterpressData.debug&&console.error("Invalid liked_images cookie")}}shutterpressData.debug&&console.log("Page loaded:",window.location.href),window.spGalleries={},window.spVirtualisers={},l(),function(t=jQuery,s=!1){t(".sp-gallery").each(function(){shutterpressData.debug&&console.log("Initializing layouts for gallery:",t(this).attr("id"));const i=t(this),o=i[0]?.ownerDocument?.defaultView||window;if(i.data("spLayoutsInit"))return void(o.shutterpressData&&shutterpressData.debug&&console.log("[SP] Layouts already initialized for",i.attr("id")));i.data("spLayoutsInit",!0);const n=i.data("layout"),a=i.attr("id"),d=i.data("gap"),c=i.data("columns")||{desktop:3,tablet:2,mobile:1},p=i.data("breakpoints"),g=i.get(0).clientWidth;let u=c.desktop;const h=o.innerWidth;h<=p.mobile?u=c.mobile:h<=p.tablet&&(u=c.tablet);const y=(g-(u-1)*d)/u;shutterpressData.debug&&(console.log("windowWidth",h),console.log("galleryWidth",g),console.log("columnWidth",y),console.log("activeColumns",u),console.log("columns",c.desktop),console.log("columnsTablet",c.tablet),console.log("columnsMobile",c.mobile),console.log("breakpointTablet",p.tablet),console.log("breakpointMobile",p.mobile));const m={masonry:{itemSelector:".sp-gallery-masonry-item",options:{itemSelector:".sp-gallery-masonry-item",layoutMode:"masonry",percentPosition:!0,resize:!1,transitionDuration:"0.4s",masonry:{gutter:d,columnWidth:".sp-gallery-masonry-item"},hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},grid:{itemSelector:".sp-gallery-grid-item",options:{itemSelector:".sp-gallery-grid-item",layoutMode:"spGridLayout",transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}},justified:{itemSelector:".sp-gallery-justified-item",options:{itemSelector:".sp-gallery-justified-item",layoutMode:"spJustifiedLayout",resize:!1,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}}}}[n];if(!m)return;const f=function(){let d;!function(e,t){const s=e&&e[0];if(!s)return t();const i=()=>s.clientWidth>0&&null!==s.offsetParent;if(i())return t();let o=!1;const r=()=>{if(!o){o=!0;try{n.disconnect()}catch(e){}t()}};let n;"undefined"!=typeof ResizeObserver&&(n=new ResizeObserver(()=>{i()&&r()}),n.observe(s)),setTimeout(()=>{i()&&r()},1200)}(i,function(){i.isotope(m.options),s||e(r());const l="#sp-gallery-filter-liked-photos-"+String(a).replace("sp-gallery-","");(i.data("filterActive")||t(l).hasClass("sp-gallery-filter-active"))&&(i.data("filterActive",!0),i.isotope({filter:".sp-gallery-item-liked"})),i.isotope("layout"),function(e){const t=e&&e[0];if(!t)return;const s=()=>t.clientWidth>0&&null!==t.offsetParent;let i=s();const o=()=>{"undefined"!=typeof shutterpressData&&shutterpressData&&shutterpressData.debug&&console.log("[SP] Gallery became visible again, forcing layout"),e.isotope("layout")};if("undefined"!=typeof ResizeObserver){const r=new ResizeObserver(()=>{const e=s();e&&!i&&o(),i=e});return r.observe(t),void e.data("spVisibilityObserver",r)}const r=setInterval(()=>{if(!document.body.contains(t))return void clearInterval(r);const e=s();e&&!i&&o(),i=e},400);e.data("spVisibilityInterval",r)}(i),"masonry"===n&&function(){const e=()=>{i.find(m.itemSelector).each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")}),i.off(".spClearWHInit")};i.off(".spClearWHInit"),i.one("arrangeComplete.spClearWHInit",e),i.one("layoutComplete.spClearWHInit",e),setTimeout(e,1200)}(),o.spVirtualisers||(o.spVirtualisers={}),o.spVirtualisers[a]=function(e,t={}){const s=t.maxActive||120,i=t.enterMargin||"1200px",o=t.exitMargin||"2000px",r=new Set;let n=!1;function a(e){e.forEach(e=>{d.observe(e),c.observe(e)})}const l=e.find(".sp-gallery-item img").toArray();for(const e of l)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");const d=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting&&p(t.target)},{rootMargin:i,threshold:.01}),c=new IntersectionObserver(function(e){for(const t of e)t.isIntersecting||g(t.target)},{rootMargin:o,threshold:0});async function p(e){if(!n&&!r.has(e)){e.dataset.srcset&&e.setAttribute("srcset",e.dataset.srcset),e.dataset.sizes&&e.setAttribute("sizes",e.dataset.sizes),e.dataset.src&&e.setAttribute("src",e.dataset.src),e.loading="lazy",e.decoding="async",e.fetchpriority="low";try{await e.decode()}catch(e){}if(r.add(e),r.size>s){let e=null,t=-1;for(const s of r){const i=s.getBoundingClientRect(),o=Math.min(Math.abs(i.top),Math.abs(i.bottom));o>t&&(t=o,e=s)}e&&g(e)}}}function g(e){!n&&r.has(e)&&(e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACw="),r.delete(e))}return a(l),{freeze(){n=!0},unfreeze(){n=!1},add(e){const t=Array.isArray(e)?e:[e];for(const e of t)e.dataset.src||!e.getAttribute("src")&&!e.currentSrc||(e.dataset.src=e.getAttribute("src")||"",e.dataset.srcset=e.getAttribute("srcset")||"",e.dataset.sizes=e.getAttribute("sizes")||"");a(t)},destroy(){d.disconnect(),c.disconnect(),r.clear()}}}(i,{maxActive:120,enterMargin:"1200px",exitMargin:"2000px"}),i.on("layoutComplete",function(){o.shutterpressData&&shutterpressData.debug&&console.log("Layout Complete:")}),!1===s&&function(s,i,o){const n=s[0]?.ownerDocument?.defaultView||window;if(s.data("is")&&t(".sp-gallery").length<=1){const a=()=>{const e=s.data("columns"),t=s.data("breakpoints");return{layout:s.data("layout"),gap:s.data("gap"),columns_desktop:e?.desktop??0,columns_tablet:e?.tablet??0,columns_mobile:e?.mobile??0,breakpoint_tablet:t.tablet,breakpoint_mobile:t.mobile,use_lightbox:s.data("lightbox"),gallery_width:s.get(0).clientWidth,viewport_width:n.innerWidth}};t(".sp-gallery-page-load-container").css("display","block");const l=shutterpressData.rest_url+"shutterpress/v1/gallery/",d=String(o).replace("sp-gallery-","");if(shutterpressData.debug&&(console.log("Base-Rest:",l),console.log("[SP] Attributes",a())),s.data("spInfScrollInit"))return void(n.shutterpressData&&shutterpressData.debug&&console.log("[SP] Infinite Scroll already initialized for",o));if(s.data("spInfScrollInit",!0),(parseInt(s.data("pages"),10)||1)<=1)return s.data("spNoMorePages",!0),void(n.shutterpressData&&shutterpressData.debug&&console.log("[SP] Single page gallery, Infinite Scroll disabled"));let c=2;s.off("load.infiniteScroll.shutterpress");let p={"Content-Type":"application/json"};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(p["X-WP-Nonce"]=shutterpressData.nonce),s.infiniteScroll({path:function(){return`${l}`},fetchOptions:function(){const e=a();return{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:p,body:JSON.stringify({gallery_id:d,page:c,attributes:e})}},responseBody:"json",append:!1,domParseResponse:!1,status:".sp-gallery-page-load-status",history:!1,hideNav:".sp-gallery-pagination",debug:!(!n.shutterpressData||!shutterpressData.debug)}),s.on("load.infiniteScroll.shutterpress",function(a,l){shutterpressData.debug&&console.log("Response:",l);let d=!1;l&&void 0!==l.nextPage&&!1!==l.nextPage?(c=l.nextPage,s.data("spNoMorePages",!1)):d=!0;const p=l&&l.html?l.html:"";if(!p||!p.trim()){if(d){s.infiniteScroll("option",{loadOnScroll:!1}),s.data("spNoMorePages",!0);const e=s.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}return}let g=t(p);const u=g.filter(i);if(u.length)g=u;else{const e=g.find(i);e.length&&(g=e)}if(g.find("img").attr({decoding:"async",fetchpriority:"low"}),g.css({opacity:0}),s.infiniteScroll("appendItems",g.get()),g.imagesLoaded(function(){const t=e=>{e.each(function(){this.style.removeProperty("width"),this.style.removeProperty("height")})},a=g.filter(i).length?g.filter(i):g;let l=!1;const d=()=>{l||(l=!0,"masonry"===s.data("layout")&&t(a),s.off(".spClearWHAppend"))};s.off(".spClearWHAppend"),s.one("arrangeComplete.spClearWHAppend",function(){d()}),s.one("layoutComplete.spClearWHAppend",function(){d()}),setTimeout(d,1200),s.isotope("appended",g),s.isotope("layout"),s.off("layoutComplete.spEnsureVisible"),s.one("layoutComplete.spEnsureVisible",function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible"})}),setTimeout(function(){g.filter(":not(.isotope-hidden)").css({visibility:"visible",opacity:s.data("filterActive")?"":1})},600),g.css({willChange:"transform, opacity, width, height",opacity:0}),s.data("filterActive")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),s.off("arrangeComplete.spFirstAppend"),s.one("arrangeComplete.spFirstAppend",function(){g.filter(":not(.isotope-hidden)").css({opacity:1}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})}),s.off("arrangeComplete.spFirstAppend")})):"justified"==s.data("layout")?(g.css({transitionProperty:"opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),requestAnimationFrame(function(){g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease"})})):g.css({transitionProperty:"transform, opacity, width, height",transitionDuration:"300ms",transitionTimingFunction:"ease",opacity:0}),n.spVirtualisers&&n.spVirtualisers[o]&&n.spVirtualisers[o].add(g.find("img").toArray()),e(r()),shutterpressData.debug&&console.log("[SP] Infinite Scroll: appended items and refreshed layout (post-clear)")}),n.spGalleries[o]){const e=n.spGalleries[o],t=s.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";e.settings&&e.settings.selector!==t&&(e.settings.selector=t),e.refresh()}if(s.data("filterActive")&&s.isotope({filter:".sp-gallery-item-liked"}),d){s.infiniteScroll("option",{loadOnScroll:!1}),s.data("spNoMorePages",!0);const e=s.data("infiniteScroll");e&&"function"==typeof e.lastPageReached&&e.lastPageReached()}})}}(i,m.itemSelector,a)}),t(o).on("resize",function(){clearTimeout(d),d=setTimeout(function(){t("#shutterpress-gallery-inline-style").remove(),l(),i.isotope()},300)})};if("function"==typeof t.fn.imagesLoaded&&"function"==typeof i.imagesLoaded)i.imagesLoaded(f);else{const e=i.find("img").get();if(e.length){let s=e.length;const i=()=>{--s<=0&&f()};e.forEach(e=>{e.complete?i():t(e).one("load error",i)}),setTimeout(f,1200)}else f()}document.getElementById(a).addEventListener("lgAfterClose",function(){i.isotope(),shutterpressData.debug&&(console.log("Gallery visible:",i.is(":visible")),console.log("Gallery height:",i.height()),console.log("Forced layout after LightGallery closed."))})})}(),jQuery(".sp-gallery").each(function(){const e=jQuery(this);e.one("layoutComplete.spInit",function(){e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")}),setTimeout(function(){e.hasClass("sp-gallery-hidden")&&e.removeClass("sp-gallery-hidden").attr("data-sp-initialized","1")},1500)}),function(){const s=jQuery(document);s.off("click.sp-like"),s.on("click.sp-like",".sp-gallery-like-icon",function(){const s=jQuery(this),i=s.data("image-id"),n=a();if(s.toggleClass("sp-gallery-liked-image"),jQuery(".sp-gallery-item-"+i).toggleClass("sp-gallery-item-liked"),n)fetch(`${shutterpressData.rest_url}shutterpress/v1/toggle-like`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":shutterpressData.nonce},credentials:"include",body:JSON.stringify({image_id:i})}).then(e=>e.json()).then(s=>{void 0!==s.liked&&(o(t(i,s.liked)),e(r()))}).catch(e=>{shutterpressData.debug&&console.error("Toggle like failed:",e)});else try{const n=s.hasClass("sp-gallery-liked-image");o(t(i,n)),e(r()),shutterpressData.debug&&console.log("Liked Images:",r())}catch(e){shutterpressData.debug&&console.error("Cookie update failed:",e)}})}(),jQuery('[id^="sp-gallery-filter-liked-photos-"]').each(function(){var e=jQuery(this),t=e.attr("id").replace("sp-gallery-filter-liked-photos-","");e.off("click").on("click",function(){var s=function(e){return e.hasClass("wp-block-button")?"#"+e.attr("id")+" .wp-element-button":e.hasClass("elementor-button")?"#"+e.attr("id")+" .elementor-button-text":e.hasClass("sp-gallery-button")?"#"+e.attr("id"):null}(e);!function(e,t,s,i){e.blur();var o="#sp-gallery-"+i,r=jQuery(o),n=r.data("filterActive")||!1,a=r.find(".sp-gallery-item-liked").length>0;if(!n&&!a)return void(shutterpressData.debug&&console.log("Filter ignored: no liked photos in gallery",i));n?(jQuery(t).removeClass("sp-gallery-filter-active"),null!==s&&jQuery(s).text(wp.i18n.__("Show Favorite Photos","shutterpress-gallery")),r.isotope({filter:"*"}),r.isotope()):(jQuery(t).addClass("sp-gallery-filter-active"),null!==s&&jQuery(s).text(wp.i18n.__("Show All Photos","shutterpress-gallery")),function(e){jQuery(e).isotope({filter:".sp-gallery-item-liked"}),shutterpressData.debug&&console.log("Isotope filtering applied")}(o)),document.getElementById("sp-gallery-"+i);const l=!n,d="sp-gallery-"+i,c=window.spGalleries[d];if(c&&c.settings){const e=l?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(c.settings.selector!==e){c.settings.selector=e;try{c.refresh()}catch(e){}}}r.data("filterActive",!n)}(e,"#"+e.attr("id"),s,t)})}),jQuery('.sp-gallery[id^="sp-gallery-"]').each(function(){const e=jQuery(this),t=e.attr("id"),s=e.data("lg-mode"),i=e.attr("data-download-icon"),o="1"===String(e.data("downloads"));void 0===e.data("spLoadingNext")&&e.data("spLoadingNext",!1),void 0===e.data("spPrefetchBudget")&&e.data("spPrefetchBudget",3),shutterpressData.debug&&console.log("Download:",o),window.spGalleries[t]=lightGallery(document.getElementById(t),{plugins:[lgThumbnail,lgZoom,lgAutoplay,lgFullscreen],selector:".sp-gallery-item .sp-gallery-item-lightbox",download:o,autoplay:!0,addClass:"lg-"+t,getCaptionFromTitleOrAlt:!1,zoomFromOrigin:!0,thumbnail:!0,mode:s,allowMediaOverlap:!1,toggleThumb:!1,exThumbImage:"data-external-thumb-image",replaceIcons:[{selector:".lg-close",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'},{selector:".lg-zoom-in",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-zoom-in-icon lucide-zoom-in"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:"#lg-actual-size",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-zoom-out-icon lucide-zoom-out"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>'},{selector:".lg-autoplay-button",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play-icon lucide-play"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause-icon lucide-pause"><rect x="14" y="3" width="5" height="18" rx="1"/><rect x="5" y="3" width="5" height="18" rx="1"/></svg>'},{selector:".lg-download",html:i},{selector:".lg-fullscreen",html:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-expand-icon lucide-expand"><path d="m15 15 6 6"/><path d="m15 9 6-6"/><path d="M21 16v5h-5"/><path d="M21 8V3h-5"/><path d="M3 16v5h5"/><path d="m3 21 6-6"/><path d="M3 8V3h5"/><path d="M9 9 3 3"/></svg><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-shrink-icon lucide-shrink"><path d="m15 15 6 6m-6-6v4.8m0-4.8h4.8"/><path d="M9 19.8V15m0 0H4.2M9 15l-6 6"/><path d="M15 4.2V9m0 0h4.8M15 9l6-6"/><path d="M9 4.2V9m0 0H4.2M9 9 3 3"/></svg>'}]});const r=window.spGalleries[t];document.getElementById(t).addEventListener("lgBeforeOpen",function(){e.data("filterActive")&&e.find('.sp-gallery-item-liked img[loading="lazy"]').removeAttr("loading"),(()=>{const t=e.data("filterActive")?".sp-gallery-item-liked .sp-gallery-item-lightbox":".sp-gallery-item .sp-gallery-item-lightbox";if(r&&r.settings&&r.settings.selector!==t){r.settings.selector=t;try{r.refresh()}catch(e){}}})(),window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].freeze()}),document.getElementById(t).addEventListener("lgAfterClose",function(){window.spVirtualisers&&window.spVirtualisers[t]&&window.spVirtualisers[t].unfreeze()}),document.getElementById(t).addEventListener("lgAfterSlide",function(t){shutterpressData.debug&&(console.log("lgAfterSlide event triggered"),console.log("Event index:",t.detail.index),console.log("Gallery items length:",r.galleryItems.length));const s=e.data("filterActive");if(e.data("spNoMorePages"))return;const i=r.galleryItems.length;if(t.detail.index>=i-4&&!e.data("spLoadingNext")){e.data("spLoadingNext",!0);const t=()=>{e.data("infiniteScroll")&&e.data("infiniteScroll").canLoad?e.infiniteScroll("loadNextPage").then(function(i){let{response:o,body:r,items:n}=i;if(e.data("spNoMorePages"))return void e.data("spLoadingNext",!1);jQuery(n).find('img[loading="lazy"]').removeAttr("loading"),e.infiniteScroll("appendItems",n);const a=jQuery(n),l=a.filter(".sp-gallery-item-liked").length||a.find(".sp-gallery-item-liked").length;if(s&&!l){let s=Number(e.data("spPrefetchBudget"))||0;if(s>0)return e.data("spPrefetchBudget",s-1),t()}else e.data("spPrefetchBudget",3);e.data("spLoadingNext",!1),a.imagesLoaded(function(){e.isotope("appended",a),shutterpressData.debug&&(console.log("Incremental layout after loadNextPage"),console.log(o&&o.path))})}).catch(function(){e.data("spLoadingNext",!1)}):e.data("spLoadingNext",!1)};t()}})}),jQuery(document).on("click",".sp-gallery-download-icon , .lg-download",function(e){e.preventDefault();const t=jQuery(this).attr("href");if(!t)return void(shutterpressData.debug&&console.error("Missing download URL."));const s=new URL(t,window.location.origin),i=s.searchParams.get("gallery_id"),o=s.searchParams.get("image_id");if(s.searchParams.get("download_nonce"),!i||!o)return void(shutterpressData.debug&&console.error("Missing download parameters."));const r={};"undefined"!=typeof shutterpressData&&shutterpressData.nonce&&(r["X-WP-Nonce"]=shutterpressData.nonce),fetch(t,{method:"GET",headers:r,credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error("Download failed");const t=e.headers.get("Content-Disposition");let s=`image-${o}.jpg`;if(t&&t.includes("filename=")){const e=t.match(/filename="?([^\";]+)"?/);e&&e[1]&&(s=e[1])}return e.blob().then(e=>({blob:e,filename:s}))}).then(({blob:e,filename:t})=>{const s=window.URL.createObjectURL(e),i=document.createElement("a");i.href=s,i.download=t,document.body.appendChild(i),i.click(),i.remove()}).catch(e=>{shutterpressData.debug&&console.error("Download error:",e)})}),jQuery(document).on("click","#sp-gallery-back-to-top",function(){shutterpressData.debug&&console.log("Back to top clicked"),jQuery("html, body").animate({scrollTop:0},1e3)})})})(); -
shutterpress-gallery/trunk/shutterpress-gallery.php
r3385981 r3396625 12 12 * Plugin URI: https://shutterpress.io 13 13 * Description: WordPress photo gallery plugin for photographers and creatives. Build fast, responsive image galleries with Masonry, Justified, and Grid layouts, lightbox support, and Infinite Scroll. 14 * Version: 1.7. 914 * Version: 1.7.10 15 15 * Author: ShutterPress 16 16 * Author URI: https://shutterpress.io … … 29 29 * Current plugin version. 30 30 */ 31 define( 'SP_GALLERY_VERSION', '1.7. 9' );31 define( 'SP_GALLERY_VERSION', '1.7.10' ); 32 32 define( 'SP_GALLERY_NAME', 'shutterpress-gallery' ); 33 33 -
shutterpress-gallery/trunk/src/public/js/layouts.js
r3383402 r3396625 23 23 }; 24 24 25 const ro = new ResizeObserver(() => { 26 if (hasSize()) finish(); 27 }); 28 ro.observe(el); 25 let ro; 26 if (typeof ResizeObserver !== "undefined") { 27 ro = new ResizeObserver(() => { 28 if (hasSize()) finish(); 29 }); 30 ro.observe(el); 31 } 29 32 30 33 // Fallback so we do not stall if ResizeObserver is unavailable … … 32 35 if (hasSize()) finish(); 33 36 }, 1200); 37 } 38 39 function watchForVisibilityReturn($el) { 40 const el = $el && $el[0]; 41 if (!el) return; 42 const hasRenderableSize = () => 43 el.clientWidth > 0 && el.offsetParent !== null; 44 let lastVisible = hasRenderableSize(); 45 46 const triggerLayout = () => { 47 if ( 48 typeof shutterpressData !== "undefined" && 49 shutterpressData && 50 shutterpressData.debug 51 ) { 52 console.log("[SP] Gallery became visible again, forcing layout"); 53 } 54 $el.isotope("layout"); 55 }; 56 57 if (typeof ResizeObserver !== "undefined") { 58 const ro = new ResizeObserver(() => { 59 const nowVisible = hasRenderableSize(); 60 if (nowVisible && !lastVisible) { 61 triggerLayout(); 62 } 63 lastVisible = nowVisible; 64 }); 65 ro.observe(el); 66 $el.data("spVisibilityObserver", ro); 67 return; 68 } 69 70 // Fallback: poll visibility periodically 71 const interval = setInterval(() => { 72 if (!document.body.contains(el)) { 73 clearInterval(interval); 74 return; 75 } 76 const nowVisible = hasRenderableSize(); 77 if (nowVisible && !lastVisible) { 78 triggerLayout(); 79 } 80 lastVisible = nowVisible; 81 }, 400); 82 $el.data("spVisibilityInterval", interval); 34 83 } 35 84 … … 451 500 452 501 $gallery.isotope("layout"); 502 watchForVisibilityReturn($gallery); 453 503 454 504 // Masonry, clear server inline width and height after first layout -
shutterpress-gallery/trunk/src/public/js/shutterpress-gallery-isotope.js
r3371808 r3396625 1 // Keep Shutterpress custom Isotope layouts available even if other plugins 2 // replace the global Isotope instance after we load. 1 3 (function () { 2 var LayoutMode = Isotope.LayoutMode; 3 var SpGridLayout = LayoutMode.create('spGridLayout'); 4 5 SpGridLayout.prototype._resetLayout = function () { 6 this.itemIndex = 0; 7 8 // Get the data attributes from the container element 9 var container = this.isotope.element; 10 var gap = parseInt(container.getAttribute('data-gap')) || 0; 11 var breakpoints = JSON.parse(container.getAttribute('data-breakpoints')); 12 var dataColumns = JSON.parse(container.getAttribute('data-columns')); 13 var containerWidth = window.innerWidth; 14 15 var columns = dataColumns.desktop; 16 17 if (containerWidth <= breakpoints.mobile) { 18 columns = dataColumns.mobile; 19 } else if (containerWidth <= breakpoints.tablet) { 20 columns = dataColumns.tablet; 21 } 22 23 this.cols = columns; 24 var totalGap = (columns - 1) * gap; 25 var columnWidth = (this.isotope.size.innerWidth - totalGap) / columns; 26 27 this.columnWidth = columnWidth; 28 this.rowHeight = columnWidth; // Make square if needed 29 this.gap = gap; 30 this.positions = []; 31 }; 32 SpGridLayout.prototype._getItemLayoutPosition = function (item) { 33 var col = this.itemIndex % this.cols; 34 var row = Math.floor(this.itemIndex / this.cols); 35 var x = col * (this.columnWidth + this.gap); 36 var y = row * (this.rowHeight + this.gap); 37 38 // Set item size 39 var element = item.element; 40 element.style.width = this.columnWidth + 'px'; 41 element.style.height = this.rowHeight + 'px'; 42 43 this.positions.push({ x, y }); 44 this.itemIndex++; 45 46 return { x, y }; 47 }; 48 49 SpGridLayout.prototype._getContainerSize = function () { 50 var rowCount = Math.ceil(this.itemIndex / this.cols); 51 return { 52 height: rowCount * (this.rowHeight + this.gap) - this.gap, 53 }; 54 }; 55 56 SpGridLayout.prototype.needsResizeLayout = function () { 57 return true; 58 }; 59 60 Isotope.LayoutMode.modes.spGridLayout = SpGridLayout; 4 if (typeof window === 'undefined') { 5 return; 6 } 7 8 window.spGallery = window.spGallery || {}; 9 10 function defineGridLayout(LayoutMode) { 11 if (LayoutMode.modes.spGridLayout) { 12 return; 13 } 14 15 var SpGridLayout = LayoutMode.create('spGridLayout'); 16 17 SpGridLayout.prototype._resetLayout = function () { 18 this.itemIndex = 0; 19 20 var container = this.isotope.element; 21 var gap = parseInt(container.getAttribute('data-gap')) || 0; 22 var breakpoints = JSON.parse(container.getAttribute('data-breakpoints')); 23 var dataColumns = JSON.parse(container.getAttribute('data-columns')); 24 var containerWidth = window.innerWidth; 25 26 var columns = dataColumns.desktop; 27 28 if (containerWidth <= breakpoints.mobile) { 29 columns = dataColumns.mobile; 30 } else if (containerWidth <= breakpoints.tablet) { 31 columns = dataColumns.tablet; 32 } 33 34 this.cols = columns; 35 var totalGap = (columns - 1) * gap; 36 var columnWidth = (this.isotope.size.innerWidth - totalGap) / columns; 37 38 this.columnWidth = columnWidth; 39 this.rowHeight = columnWidth; 40 this.gap = gap; 41 this.positions = []; 42 }; 43 44 SpGridLayout.prototype._getItemLayoutPosition = function (item) { 45 var col = this.itemIndex % this.cols; 46 var row = Math.floor(this.itemIndex / this.cols); 47 var x = col * (this.columnWidth + this.gap); 48 var y = row * (this.rowHeight + this.gap); 49 50 var element = item.element; 51 element.style.width = this.columnWidth + 'px'; 52 element.style.height = this.rowHeight + 'px'; 53 54 this.positions.push({ x: x, y: y }); 55 this.itemIndex++; 56 57 return { x: x, y: y }; 58 }; 59 60 SpGridLayout.prototype._getContainerSize = function () { 61 var rowCount = Math.ceil(this.itemIndex / this.cols); 62 return { 63 height: rowCount * (this.rowHeight + this.gap) - this.gap, 64 }; 65 }; 66 67 SpGridLayout.prototype.needsResizeLayout = function () { 68 return true; 69 }; 70 71 LayoutMode.modes.spGridLayout = SpGridLayout; 72 } 73 74 function defineJustifiedLayout(LayoutMode) { 75 if (LayoutMode.modes.spJustifiedLayout) { 76 return; 77 } 78 79 var SpJustifiedLayout = LayoutMode.create('spJustifiedLayout'); 80 81 SpJustifiedLayout.prototype._resetLayout = function () { 82 var el = this.isotope.element; 83 this.rowHeight = parseInt(el.getAttribute('data-row-height')) || 200; 84 this.gap = parseInt(el.getAttribute('data-gap'), 10) || 10; 85 this.containerWidth = this.isotope.size.innerWidth; 86 this._posCache = new Map(); 87 }; 88 89 SpJustifiedLayout.prototype._getItemLayoutPosition = function (item) { 90 var cached = this._posCache.get(item.id); 91 if (cached) { 92 item.element.style.width = cached.width + 'px'; 93 item.element.style.height = cached.height + 'px'; 94 this._posCache.delete(item.id); 95 return { x: cached.x, y: cached.y }; 96 } 97 98 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items; 99 var start = list.indexOf(item); 100 if (start < 0) { 101 return { x: 0, y: 0 }; 102 } 103 104 var i = 0; 105 var yBase = 0; 106 while (i < start) { 107 var wSumPrev = 0; 108 var rowLenPrev = 0; 109 var jPrev = i; 110 while (jPrev < list.length) { 111 var itPrev = list[jPrev]; 112 var elPrev = itPrev.element; 113 var imgPrev = elPrev.querySelector('img'); 114 var nwPrev = parseInt(elPrev.getAttribute('data-width')) || (imgPrev && parseInt(imgPrev.getAttribute('width'))); 115 var nhPrev = parseInt(elPrev.getAttribute('data-height')) || (imgPrev && parseInt(imgPrev.getAttribute('height'))); 116 var arPrev = parseFloat(elPrev.getAttribute('data-ratio')) || (nwPrev && nhPrev ? nwPrev / nhPrev : 1); 117 var wPrev = this.rowHeight * arPrev; 118 wSumPrev += wPrev; 119 rowLenPrev++; 120 if (wSumPrev + this.gap * (rowLenPrev - 1) > this.containerWidth && rowLenPrev > 1) { 121 break; 122 } 123 jPrev++; 124 } 125 var gapsPrev = (rowLenPrev - 1) * this.gap; 126 var scalePrev = wSumPrev + gapsPrev > 0 ? (this.containerWidth - gapsPrev) / wSumPrev : 1; 127 var rowHPrev = Math.round(this.rowHeight * scalePrev); 128 yBase += rowHPrev + this.gap; 129 i += rowLenPrev; 130 } 131 132 var row = []; 133 var wSum = 0; 134 var k = start; 135 while (k < list.length) { 136 var it = list[k]; 137 var el = it.element; 138 var img = el.querySelector('img'); 139 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width'))); 140 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height'))); 141 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1); 142 var w = this.rowHeight * ar; 143 row.push({ id: it.id, w: w }); 144 wSum += w; 145 if (wSum + this.gap * (row.length - 1) > this.containerWidth && row.length > 1) { 146 break; 147 } 148 k++; 149 } 150 151 var gaps = (row.length - 1) * this.gap; 152 var isLastRow = k >= list.length; 153 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1; 154 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale; 155 var rowH = Math.round(this.rowHeight * scale); 156 157 var x = 0; 158 for (var r = 0; r < row.length; r++) { 159 var targetW = Math.floor(row[r].w * scale); 160 this._posCache.set(row[r].id, { x: x, y: yBase, width: targetW, height: rowH }); 161 x += targetW + this.gap; 162 } 163 164 var now = this._posCache.get(item.id); 165 if (now) { 166 item.element.style.width = now.width + 'px'; 167 item.element.style.height = now.height + 'px'; 168 this._posCache.delete(item.id); 169 return { x: now.x, y: now.y }; 170 } 171 172 return { x: 0, y: yBase }; 173 }; 174 175 SpJustifiedLayout.prototype._getContainerSize = function () { 176 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items; 177 178 var i = 0; 179 var totalHeight = 0; 180 while (i < list.length) { 181 var wSum = 0; 182 var rowLen = 0; 183 var j = i; 184 while (j < list.length) { 185 var it = list[j]; 186 var el = it.element; 187 var img = el.querySelector('img'); 188 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width'))); 189 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height'))); 190 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1); 191 var w = this.rowHeight * ar; 192 wSum += w; 193 rowLen++; 194 if (wSum + this.gap * (rowLen - 1) > this.containerWidth && rowLen > 1) { 195 break; 196 } 197 j++; 198 } 199 var gaps = (rowLen - 1) * this.gap; 200 var isLastRow = j >= list.length; 201 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1; 202 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale; 203 var rowH = Math.round(this.rowHeight * scale); 204 totalHeight += rowH + this.gap; 205 i += rowLen; 206 } 207 208 if (totalHeight > 0) { 209 totalHeight -= this.gap; 210 } 211 212 return { height: totalHeight }; 213 }; 214 215 SpJustifiedLayout.prototype.needsResizeLayout = function () { 216 return true; 217 }; 218 219 LayoutMode.modes.spJustifiedLayout = SpJustifiedLayout; 220 } 221 222 function defineNoneLayout(LayoutMode) { 223 if (LayoutMode.modes.none) { 224 return; 225 } 226 227 var NoneLayout = LayoutMode.create('none'); 228 229 NoneLayout.prototype._resetLayout = function () { 230 return false; 231 }; 232 233 NoneLayout.prototype._getItemLayoutPosition = function () { 234 return {}; 235 }; 236 237 NoneLayout.prototype._getContainerSize = function () { 238 return { height: 0 }; 239 }; 240 241 NoneLayout.prototype.needsResizeLayout = function () { 242 return false; 243 }; 244 245 LayoutMode.modes.none = NoneLayout; 246 } 247 248 function registerLayouts() { 249 var iso = window.Isotope; 250 if (!iso || !iso.LayoutMode) { 251 return; 252 } 253 254 var LayoutMode = iso.LayoutMode; 255 256 defineGridLayout(LayoutMode); 257 defineJustifiedLayout(LayoutMode); 258 defineNoneLayout(LayoutMode); 259 260 window.spGallery.Isotope = iso; 261 } 262 263 function ensureLayouts() { 264 registerLayouts(); 265 } 266 267 window.spGallery.ensureIsotopeLayouts = ensureLayouts; 268 269 ensureLayouts(); 270 271 if (!window.spGallery._isotopeEnsurer) { 272 window.spGallery._isotopeEnsurer = setInterval(ensureLayouts, 1000); 273 } 274 275 if (document && document.addEventListener) { 276 document.addEventListener('readystatechange', ensureLayouts); 277 } 278 if (window && window.addEventListener) { 279 window.addEventListener('load', ensureLayouts); 280 } 281 282 // Watch for galleries that become visible after being display:none (e.g., tabs/modals) 283 (function ($) { 284 if (!$ || !$.fn || typeof $.fn.isotope !== 'function') { 285 return; 286 } 287 288 const visibilityMap = new WeakMap(); 289 const hasRenderableSize = (el) => 290 el && el.offsetParent !== null && el.clientWidth > 0 && el.clientHeight >= 0; 291 292 function handleVisibilityChange(el) { 293 const $el = $(el); 294 const isoInstance = $el.data('isotope'); 295 if (!isoInstance) { 296 return; 297 } 298 const wasVisible = visibilityMap.get(el); 299 const nowVisible = hasRenderableSize(el); 300 if (nowVisible && wasVisible === false) { 301 if (window.shutterpressData && window.shutterpressData.debug) { 302 console.log('[SP] Gallery visible again, relayout forced for', el.id || el); 303 } 304 $el.isotope('layout'); 305 } 306 visibilityMap.set(el, nowVisible); 307 } 308 309 function primeVisibilityState(el) { 310 if (!visibilityMap.has(el)) { 311 visibilityMap.set(el, hasRenderableSize(el)); 312 } 313 } 314 315 function pollGalleries() { 316 $('.sp-gallery').each(function () { 317 primeVisibilityState(this); 318 handleVisibilityChange(this); 319 }); 320 } 321 322 $(document).ready(function () { 323 if (window.spGallery && window.spGallery.visibilityPoller) { 324 return; 325 } 326 pollGalleries(); 327 window.spGallery = window.spGallery || {}; 328 window.spGallery.visibilityPoller = setInterval(pollGalleries, 400); 329 }); 330 })(window.jQuery); 61 331 })(); 62 63 // Updated SpJustifiedLayout to use proper Isotope layout engine integration64 (function () {65 var LayoutMode = Isotope.LayoutMode;66 var SpJustifiedLayout = LayoutMode.create('spJustifiedLayout');67 68 SpJustifiedLayout.prototype._resetLayout = function () {69 var el = this.isotope.element;70 this.rowHeight = parseInt(el.getAttribute('data-row-height')) || 200;71 this.gap = parseInt(el.getAttribute('data-gap'), 10) || 10;72 this.containerWidth = this.isotope.size.innerWidth;73 // Cache for positions of items in the current row during a call sequence74 this._posCache = new Map(); // id -> {x,y,width,height}75 };76 77 SpJustifiedLayout.prototype._getItemLayoutPosition = function (item) {78 // If precomputed for this item in this pass, apply size and return79 var cached = this._posCache.get(item.id);80 if (cached) {81 item.element.style.width = cached.width + 'px';82 item.element.style.height = cached.height + 'px';83 this._posCache.delete(item.id);84 return { x: cached.x, y: cached.y };85 }86 87 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items;88 89 // Find the true index of this item among the items being laid out90 var start = list.indexOf(item);91 if (start < 0) {92 // Fallback, should not happen93 return { x: 0, y: 0 };94 }95 96 // Walk from 0 up to `start` to compute the y offset of the current row97 var i = 0;98 var yBase = 0;99 while (i < start) {100 var wSumPrev = 0;101 var rowLenPrev = 0;102 var jPrev = i;103 while (jPrev < list.length) {104 var itPrev = list[jPrev];105 var elPrev = itPrev.element;106 var imgPrev = elPrev.querySelector('img');107 var nwPrev = parseInt(elPrev.getAttribute('data-width')) || (imgPrev && parseInt(imgPrev.getAttribute('width')));108 var nhPrev = parseInt(elPrev.getAttribute('data-height')) || (imgPrev && parseInt(imgPrev.getAttribute('height')));109 var arPrev = parseFloat(elPrev.getAttribute('data-ratio')) || (nwPrev && nhPrev ? nwPrev / nhPrev : 1);110 var wPrev = this.rowHeight * arPrev;111 wSumPrev += wPrev;112 rowLenPrev++;113 if (wSumPrev + this.gap * (rowLenPrev - 1) > this.containerWidth && rowLenPrev > 1) {114 break;115 }116 jPrev++;117 }118 var gapsPrev = (rowLenPrev - 1) * this.gap;119 var scalePrev = wSumPrev + gapsPrev > 0 ? (this.containerWidth - gapsPrev) / wSumPrev : 1;120 var rowHPrev = Math.round(this.rowHeight * scalePrev);121 yBase += rowHPrev + this.gap;122 i += rowLenPrev;123 }124 125 // Build the row that starts at `start` and cache positions for its items126 var row = [];127 var wSum = 0;128 var k = start;129 while (k < list.length) {130 var it = list[k];131 var el = it.element;132 var img = el.querySelector('img');133 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width')));134 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height')));135 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1);136 var w = this.rowHeight * ar;137 row.push({ id: it.id, w: w });138 wSum += w;139 if (wSum + this.gap * (row.length - 1) > this.containerWidth && row.length > 1) {140 break;141 }142 k++;143 }144 145 var gaps = (row.length - 1) * this.gap;146 // If this is the final row, do not justify, cap scale at 1 so items keep natural width for the row height147 var isLastRow = k >= list.length;148 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1;149 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale;150 var rowH = Math.round(this.rowHeight * scale);151 152 var x = 0;153 var assigned = 0;154 for (var r = 0; r < row.length; r++) {155 var targetW = Math.floor(row[r].w * scale);156 this._posCache.set(row[r].id, { x: x, y: yBase, width: targetW, height: rowH });157 x += targetW + this.gap;158 if (r !== row.length - 1) assigned += targetW;159 }160 161 var now = this._posCache.get(item.id);162 if (now) {163 item.element.style.width = now.width + 'px';164 item.element.style.height = now.height + 'px';165 this._posCache.delete(item.id);166 return { x: now.x, y: now.y };167 }168 169 return { x: 0, y: yBase };170 };171 172 SpJustifiedLayout.prototype._getContainerSize = function () {173 var list = this.isotope.filteredItems && this.isotope.filteredItems.length ? this.isotope.filteredItems : this.isotope.items;174 175 var i = 0;176 var totalHeight = 0;177 while (i < list.length) {178 var wSum = 0;179 var rowLen = 0;180 var j = i;181 while (j < list.length) {182 var it = list[j];183 var el = it.element;184 var img = el.querySelector('img');185 var nw = parseInt(el.getAttribute('data-width')) || (img && parseInt(img.getAttribute('width')));186 var nh = parseInt(el.getAttribute('data-height')) || (img && parseInt(img.getAttribute('height')));187 var ar = parseFloat(el.getAttribute('data-ratio')) || (nw && nh ? nw / nh : 1);188 var w = this.rowHeight * ar;189 wSum += w;190 rowLen++;191 if (wSum + this.gap * (rowLen - 1) > this.containerWidth && rowLen > 1) {192 break;193 }194 j++;195 }196 var gaps = (rowLen - 1) * this.gap;197 var isLastRow = j >= list.length;198 var fullFitScale = wSum + gaps > 0 ? (this.containerWidth - gaps) / wSum : 1;199 var scale = isLastRow ? Math.min(1, fullFitScale) : fullFitScale;200 var rowH = Math.round(this.rowHeight * scale);201 totalHeight += rowH + this.gap;202 i += rowLen;203 }204 205 // remove last gap206 if (totalHeight > 0) totalHeight -= this.gap;207 208 return { height: totalHeight };209 };210 211 SpJustifiedLayout.prototype.needsResizeLayout = function () {212 return true;213 };214 215 Isotope.LayoutMode.modes.spJustifiedLayout = SpJustifiedLayout;216 })();217 218 (function () {219 var LayoutMode = Isotope.LayoutMode;220 221 var NoneLayout = LayoutMode.create('none');222 223 NoneLayout.prototype._resetLayout = function () {224 return false;225 };226 227 NoneLayout.prototype._getItemLayoutPosition = function () {228 return {}; // Return dummy values229 };230 231 NoneLayout.prototype._getContainerSize = function () {232 return { height: 0 };233 };234 235 NoneLayout.prototype.needsResizeLayout = function () {236 return false;237 };238 239 Isotope.LayoutMode.modes.none = NoneLayout;240 })(); -
shutterpress-gallery/trunk/vendor/composer/autoload_static.php
r3383402 r3396625 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'S' => 10 'S' => 11 11 array ( 12 12 'Shutterpress\\Gallery\\' => 21, 13 13 ), 14 'C' => 14 'C' => 15 15 array ( 16 16 'Composer\\Installers\\' => 20, … … 19 19 20 20 public static $prefixDirsPsr4 = array ( 21 'Shutterpress\\Gallery\\' => 21 'Shutterpress\\Gallery\\' => 22 22 array ( 23 23 0 => __DIR__ . '/../..' . '/src/admin', … … 25 25 2 => __DIR__ . '/../..' . '/src/public', 26 26 ), 27 'Composer\\Installers\\' => 27 'Composer\\Installers\\' => 28 28 array ( 29 29 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', -
shutterpress-gallery/trunk/vendor/composer/installed.php
r3385981 r3396625 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' bfc4583ac863711708db2e8a2896da2b737d26a3',6 'reference' => 'cd688b899426f936380120d9fab79a90a7c6b4f7', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 35 35 'pretty_version' => 'dev-master', 36 36 'version' => 'dev-master', 37 'reference' => ' bfc4583ac863711708db2e8a2896da2b737d26a3',37 'reference' => 'cd688b899426f936380120d9fab79a90a7c6b4f7', 38 38 'type' => 'wordpress-plugin', 39 39 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.