pages/assets/js/scripts.min.js

1 line
2 KiB
JavaScript
Raw Normal View History

2024-02-23 16:27:50 +01:00
document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".navbar__toggle"),t=document.querySelector(".navbar__menu");e.addEventListener("click",function(){var i=t.classList.contains("is-active");i?(t.classList.remove("is-active"),t.classList.add("is-hidden"),e.classList.remove("is-active")):(t.classList.add("is-active"),t.classList.remove("is-hidden"),e.classList.add("is-active")),e.setAttribute("aria-expanded",!i)})}),function(){let e=document.querySelector(".js-post__share-button"),t=document.querySelector(".js-post__share-popup");e&&(t.addEventListener("click",function(e){e.stopPropagation()}),e.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),t.classList.toggle("is-visible")}),document.body.addEventListener("click",function(){t.classList.remove("is-visible")}));for(var i={Link:".js-share",Width:500,Height:500},s=document.querySelectorAll(i.Link),a=0;a<s.length;a++)s[a].onclick=r;function r(e){var s=(e=e||window.event).target?e.target:e.srcElement;t&&t.classList.remove("is-visible");var a=Math.floor(((screen.availWidth||1024)-i.Width)/2),r=Math.floor(((screen.availHeight||700)-i.Height)/2),n=s.href?s.href:s.parentNode.href,o=window.open(n,"social","width="+i.Width+",height="+i.Height+",left="+a+",top="+r+",location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1");return o&&(o.focus(),e.preventDefault&&e.preventDefault(),e.returnValue=!1),!!o}}(),function(){let e=document.querySelectorAll(".post__video, .post__iframe");for(let t=0;t<e.length;t++){let i=e[t].querySelector("iframe, embed, video, object");if(!i||"false"===i.getAttribute("data-responsive"))continue;let s=i.getAttribute("width"),a=i.getAttribute("height"),r=!1;if(s&&a&&(s.indexOf("%")>-1&&a.indexOf("%")>-1?(s=parseFloat(s.replace("%","")),r=(a=parseFloat(a.replace("%","")))/s):-1===s.indexOf("%")&&-1===a.indexOf("%")&&(s=parseInt(s,10),r=(a=parseInt(a,10))/s),!1!==r)){let n=100*r+"%";e[t].setAttribute("style","--embed-aspect-ratio:"+n)}}}();