2022-07-14 10:00:45 +03:00
|
|
|
function lightbox(e){document.querySelectorAll(e).forEach(function(e){e.addEventListener("click",function(e){var t=e;t.preventDefault();for(var n,o=[],i=0,r=t.target.closest(".kg-card").previousElementSibling;r&&(r.classList.contains("kg-image-card")||r.classList.contains("kg-gallery-card"));){var a=[];r.querySelectorAll("img").forEach(function(e){a.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),i+=1}),r=r.previousElementSibling,o=a.concat(o)}t.target.classList.contains("kg-image")?o.push({src:t.target.getAttribute("src"),msrc:t.target.getAttribute("src"),w:t.target.getAttribute("width"),h:t.target.getAttribute("height"),el:t.target}):(n=!1,t.target.closest(".kg-gallery-card").querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),n||e===t.target?n=!0:i+=1}));for(var s=t.target.closest(".kg-card").nextElementSibling;s&&(s.classList.contains("kg-image-card")||s.classList.contains("kg-gallery-card"));)s.querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e})}),s=s.nextElementSibling;e=document.querySelectorAll(".pswp")[0];new PhotoSwipe(e,PhotoSwipeUI_Default,o,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:i,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(e){var e=o[e].el,t=window.pageYOffset||document.documentElement.scrollTop,e=e.getBoundingClientRect();return{x:e.left,y:e.top+t,w:e.width}}}).init()})})}function pagination(o,i){var r,t,a,s,n,l,c,u=document.querySelector(".gh-loadmore"),d=document.querySelector("link[rel=next]");function m(){if(404===this.status)return window.removeEventListener("scroll",f),window.removeEventListener("resize",h),void u.remove();var e=this.response.querySelectorAll(".gh-feed:not(.gh-featured):not(.gh-related) > *"),t=document.createDocumentFragment(),n=[],e=(e.forEach(function(e){e=document.importNode(e,!0);i&&(e.style.position="absolute",e.style.visibility="hidden",n.push(e)),t.appendChild(e)}),r.appendChild(t),i&&i(n),this.response.querySelector("link[rel=next]"));e?d.href=e.href:(window.removeEventListener("scroll",f),window.removeEventListener("resize",h),u&&u.remove()),c=document.documentElement.scrollHeight,s=a=!1,o&&imagesLoaded(r,function(){r.getBoundingClientRect().bottom<=l&&(console.log(r.getBoundingClientRect().bottom,l),p())})}function e(){var e;s||(o&&n+l<=c-t?a=!1:(s=!0,(e=new window.XMLHttpRequest).responseType="document",e.addEventListener("load",m),e.open("GET",d.href),e.send(null)))}function p(){a||window.requestAnimationFrame(e),a=!0}function f(){n=window.scrollY,p()}function h(){l=window.innerHeight,c=document.documentElement.scrollHeight,p()}!d&&u?u.remove():(r=document.querySelector(".gh-feed:not(.gh-featured):not(.gh-related)"))&&(s=a=!(t=300),n=window.scrollY,l=window.innerHeight,c=document.documentElement.scrollHeight,o?(window.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",h),p()):u.addEventListener("click",p))}!function(e,t){"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let n=this._events=this._events||{},o=n[e]=n[e]||[];return o.includes(t)||o.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let n=this._onceEvents=this._onceEvents||{};return(n[e]=n[e]||{})[t]=!0,this},t.off=function(e,t){let n=this._events&&this._events[e];if(!n||!n.length)return this;e=n.indexOf(t);return-1!=e&&n.splice(e,1),this},t.emitEvent=function(e,t){let n=this._events&&this._events[e];if(!n||!n.length)return this;n=n.slice(0),t=t||[];let o=this._onceEvents&&this._onceEvents[e];for(var i of n)o&&o[i]&&(this.off(e,i),delete o[i]),i.apply(this,t);return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e}),function(e,t){"object"==typeof module&&modu
|