Files
DF-Ghost-Dawn-Theme/assets/built/main.min.js
T

1 line
94 KiB
JavaScript
Raw Normal View History

2026-06-13 21:33:23 -05:00
function dropdown(){let n=window.matchMedia("(max-width: 767px)"),s=document.querySelector(".gh-head-menu"),o=s?.querySelector(".nav");if(o){let t=document.querySelector(".gh-head-logo"),e=o.innerHTML;n.matches&&o.querySelectorAll("li").forEach(function(t,e){t.style.transitionDelay=.03*(e+1)+"s"});let i=function(){if(!n.matches){for(var t=[];o.offsetWidth+64>s.offsetWidth&&o.lastElementChild;)t.unshift(o.lastElementChild),o.lastElementChild.remove();if(t.length){let e=document.createElement("button"),i=(e.setAttribute("class","nav-more-toggle gh-icon-btn"),e.setAttribute("aria-label","More"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M21.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM13.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM5.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0z"></path></svg>',document.createElement("div"));i.setAttribute("class","gh-dropdown"),10<=t.length?(document.body.classList.add("is-dropdown-mega"),i.style.gridTemplateRows=`repeat(${Math.ceil(t.length/2)}, 1fr)`):document.body.classList.remove("is-dropdown-mega"),t.forEach(function(t){i.appendChild(t)}),e.appendChild(i),o.appendChild(e),document.body.classList.add("is-dropdown-loaded"),window.addEventListener("click",function(t){document.body.classList.contains("is-dropdown-open")?document.body.classList.remove("is-dropdown-open"):e.contains(t.target)&&document.body.classList.add("is-dropdown-open")})}else document.body.classList.add("is-dropdown-loaded")}};imagesLoaded(t,function(){i()}),window.addEventListener("load",function(){t||i()}),window.addEventListener("resize",function(){setTimeout(()=>{o.innerHTML=e,i()},1)})}}function lightbox(t){document.querySelectorAll(t).forEach(function(t){t.addEventListener("click",function(t){var e=t;e.preventDefault();for(var i,n=[],s=0,o=e.target.closest(".kg-card").previousElementSibling;o&&(o.classList.contains("kg-image-card")||o.classList.contains("kg-gallery-card"));){var r=[];o.querySelectorAll("img").forEach(function(t){r.push({src:t.getAttribute("src"),msrc:t.getAttribute("src"),w:t.getAttribute("width"),h:t.getAttribute("height"),el:t}),s+=1}),o=o.previousElementSibling,n=r.concat(n)}e.target.classList.contains("kg-image")?n.push({src:e.target.getAttribute("src"),msrc:e.target.getAttribute("src"),w:e.target.getAttribute("width"),h:e.target.getAttribute("height"),el:e.target}):(i=!1,e.target.closest(".kg-gallery-card").querySelectorAll("img").forEach(function(t){n.push({src:t.getAttribute("src"),msrc:t.getAttribute("src"),w:t.getAttribute("width"),h:t.getAttribute("height"),el:t}),i||t===e.target?i=!0:s+=1}));for(var a=e.target.closest(".kg-card").nextElementSibling;a&&(a.classList.contains("kg-image-card")||a.classList.contains("kg-gallery-card"));)a.querySelectorAll("img").forEach(function(t){n.push({src:t.getAttribute("src"),msrc:t.getAttribute("src"),w:t.getAttribute("width"),h:t.getAttribute("height"),el:t})}),a=a.nextElementSibling;t=document.querySelectorAll(".pswp")[0];new PhotoSwipe(t,PhotoSwipeUI_Default,n,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:s,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(t){var t=n[t].el,e=window.pageYOffset||document.documentElement.scrollTop,t=t.getBoundingClientRect();return{x:t.left,y:t.top+e,w:t.width}}}).init()})})}function pagination(t,a,l=!1){let c=document.querySelector(".gh-feed");if(!c)return;let e=!1,i=c.nextElementSibling||c.parentElement.nextElementSibling||document.querySelector(".gh-foot"),h=document.querySelector(".gh-loadmore"),n=(!document.querySelector("link[rel=next]")&&h&&h.remove(),async function(){var n=document.querySelector("link[rel=next]");if(n)try{var t=await(await fetch(n.href)).text(),s=(new DOMParser).parseFromString(t,"text/html"),o=s.querySelectorAll(".gh-feed:n