From 43688cfa012911ff70cfe7154a759f982c3a4ff3 Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Wed, 23 Aug 2023 16:55:41 +0800 Subject: [PATCH 1/2] Added lightbox support --- assets/built/casper.js | 2 +- assets/built/casper.js.map | 2 +- assets/built/screen.css | 2 +- assets/built/screen.css.map | 2 +- assets/css/screen.css | 503 +++++++++++++++++++++ assets/images/default-skin.png | Bin 0 -> 547 bytes assets/images/default-skin.svg | 1 + assets/images/preloader.gif | Bin 0 -> 866 bytes assets/js/lib/photoswipe-ui-default.min.js | 4 + assets/js/lib/photoswipe.min.js | 4 + assets/js/lightbox.js | 109 +++++ default.hbs | 3 + partials/lightbox.hbs | 41 ++ 13 files changed, 669 insertions(+), 4 deletions(-) create mode 100755 assets/images/default-skin.png create mode 100755 assets/images/default-skin.svg create mode 100755 assets/images/preloader.gif create mode 100755 assets/js/lib/photoswipe-ui-default.min.js create mode 100755 assets/js/lib/photoswipe.min.js create mode 100644 assets/js/lightbox.js create mode 100644 partials/lightbox.hbs diff --git a/assets/built/casper.js b/assets/built/casper.js index d51be29..60a8254 100644 --- a/assets/built/casper.js +++ b/assets/built/casper.js @@ -1,2 +1,2 @@ -!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},e=i[e]=i[e]||[];return-1==e.indexOf(t)&&e.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{};return(i[e]=i[e]||{})[t]=!0,this}},t.off=function(e,t){e=this._events&&this._events[e];if(e&&e.length){t=e.indexOf(t);return-1!=t&&e.splice(t,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;ox

',t.appendChild(i.childNodes[1])),e&&r.extend(o,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];o.customSelector&&e.push(o.customSelector);var n=".fitvidsignore";o.ignore&&(n=n+", "+o.ignore);e=r(this).find(e.join(","));(e=(e=e.not("object object")).not(n)).each(function(){var e,t,i=r(this);0
').parent(".fluid-width-video-wrapper").css("padding-top",100*e+"%"),i.removeAttr("height").removeAttr("width"))})})},r.fn.fitVids._count=0}(window.jQuery||window.Zepto),function(){var n=window.matchMedia("(max-width: 767px)");const e=document.querySelector(".gh-head"),o=e.querySelector(".gh-head-menu"),r=o.querySelector(".nav");if(r){document.querySelector(".gh-head-logo");var s,t=r.innerHTML;if(n.matches){const d=r.querySelectorAll("li");d.forEach(function(e,t){e.style.transitionDelay=.03*(t+1)+"s"})}function i(){if(!n.matches){const e=[];for(;r.offsetWidth+64>o.offsetWidth;){if(!r.lastElementChild)return;e.unshift(r.lastElementChild),r.lastElementChild.remove()}if(e.length){const t=document.createElement("button");t.setAttribute("class","nav-more-toggle"),t.setAttribute("aria-label","More"),t.innerHTML='';const i=document.createElement("div");i.setAttribute("class","gh-dropdown"),10<=e.length?(document.body.classList.add("is-dropdown-mega"),i.style.gridTemplateRows="repeat("+Math.ceil(e.length/2)+", 1fr)"):document.body.classList.remove("is-dropdown-mega"),e.forEach(function(e){i.appendChild(e)}),t.appendChild(i),r.appendChild(t),document.body.classList.add("is-dropdown-loaded"),t.addEventListener("click",function(){document.body.classList.toggle("is-dropdown-open")}),s=function(e){!t.contains(e.target)&&document.body.classList.contains("is-dropdown-open")&&document.body.classList.remove("is-dropdown-open")},window.addEventListener("click",s)}else document.body.classList.add("is-dropdown-loaded")}}imagesLoaded(e,function(){i()}),window.addEventListener("resize",function(){setTimeout(function(){window.removeEventListener("click",s),r.innerHTML=t,i()},1)})}}(),function(t,i){var n,o,r,s,d,a,h,c;function l(){if(404===this.status)return t.removeEventListener("scroll",m),void t.removeEventListener("resize",p);this.response.querySelectorAll("article.post-card").forEach(function(e){o.appendChild(i.importNode(e,!0))});var e=this.response.querySelector("link[rel=next]");e?n.href=e.href:(t.removeEventListener("scroll",m),t.removeEventListener("resize",p)),c=i.documentElement.scrollHeight,d=s=!1}function e(){var e;d||(a+h<=c-r?s=!1:(d=!0,(e=new t.XMLHttpRequest).responseType="document",e.addEventListener("load",l),e.open("GET",n.href),e.send(null)))}function u(){s||t.requestAnimationFrame(e),s=!0}function m(){a=t.scrollY,u()}function p(){h=t.innerHeight,c=i.documentElement.scrollHeight,u()}i.documentElement.classList.contains("no-infinite-scroll")||(!(n=i.querySelector("link[rel=next]"))||(o=i.querySelector(".post-feed"))&&(d=s=!(r=300),a=t.scrollY,h=t.innerHeight,c=i.documentElement.scrollHeight,t.addEventListener("scroll",m,{passive:!0}),t.addEventListener("resize",p),u()))}(window,document); +function lightbox(e){document.querySelectorAll(e).forEach(function(e){e.addEventListener("click",function(e){!function(t){t.preventDefault();for(var n,o=[],i=0,e=t.target.closest(".kg-card").previousElementSibling;e&&(e.classList.contains("kg-image-card")||e.classList.contains("kg-gallery-card"));){var r=[];e.querySelectorAll("img").forEach(function(e){r.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),i+=1}),e=e.previousElementSibling,o=r.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 a=t.target.closest(".kg-card").nextElementSibling;a&&(a.classList.contains("kg-image-card")||a.classList.contains("kg-gallery-card"));)a.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})}),a=a.nextElementSibling;var s=document.querySelectorAll(".pswp")[0];new PhotoSwipe(s,PhotoSwipeUI_Default,o,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:i,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(e){var t=o[e].el,e=window.pageYOffset||document.documentElement.scrollTop,t=t.getBoundingClientRect();return{x:t.left,y:t.top+e,w:t.width}}}).init()}(e)})})}!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var n=this._events=this._events||{},e=n[e]=n[e]||[];return-1==e.indexOf(t)&&e.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var n=this._onceEvents=this._onceEvents||{};return(n[e]=n[e]||{})[t]=!0,this}},t.off=function(e,t){e=this._events&&this._events[e];if(e&&e.length){t=e.indexOf(t);return-1!=t&&e.splice(t,1),this}},t.emitEvent=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){n=n.slice(0),t=t||[];for(var o=this._onceEvents&&this._onceEvents[e],i=0;ix

',t.appendChild(n.childNodes[1])),e&&r.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var o=".fitvidsignore";i.ignore&&(o=o+", "+i.ignore);e=r(this).find(e.join(","));(e=(e=e.not("object object")).not(o)).each(function(){var e,t,n=r(this);0
').parent(".fluid-width-video-wrapper").css("padding-top",100*e+"%"),n.removeAttr("height").removeAttr("width"))})})},r.fn.fitVids._count=0}(window.jQuery||window.Zepto),function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.PhotoSwipeUI_Default=t()}(this,function(){"use strict";return function(o,s){function e(e){if(k)return!0;e=e||window.event,S.timeToIdle&&S.mouseUsed&&!x&&Z();for(var t,n,o=(e.target||e.srcElement).getAttribute("class")||"",i=0;iS.fitControlsWidth?(t=S.barsSize,S.captionEl&&"auto"===t.bottom?(h||((h=s.createEl("pswp__caption pswp__caption--fake")).appendChild(s.createEl("pswp__caption__center")),m.insertBefore(h,f),s.addClass(m,"pswp__ui--fit")),S.addCaptionHTMLFn(e,h,!0)?(e=h.clientHeight,n.bottom=parseInt(e,10)||44):n.bottom=t.top):n.bottom="auto"===t.bottom?0:t.bottom,n.top=t.top):n.top=n.bottom=0}function d(){function e(e){if(e)for(var t=e.length,n=0;n