← Back
Editing: script.js
!function(){"use strict";document.addEventListener("DOMContentLoaded",function(){var e=null;function t(e){return Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(function(e){return e.getClientRects().length&&"hidden"!==window.getComputedStyle(e).visibility})}function n(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e){var n=e,o=n.dialog,i=n.trigger;o.style.display="none",o.setAttribute("aria-hidden","true"),i.setAttribute("aria-expanded","false"),document.body.classList.remove("directorist-account-modal-open"),e=null,t&&document.contains(i)&&i.focus({preventScroll:!0})}}document.querySelectorAll(".directorist-account-block-logout-mode").forEach(function(o){var i=o.querySelector(".directorist-account-block__trigger"),r=document.getElementById(null==i?void 0:i.getAttribute("aria-controls")),c=null==r?void 0:r.querySelector(".directorist-account-block-close");if(i&&r&&c){var d=r.closest(".directorist-account-block-authentication-modal");(null==d?void 0:d.parentElement)!==document.body&&document.body.appendChild(d),i.addEventListener("click",function(){return function(o,i){e&&n(!1),e={dialog:o,trigger:i},o.style.display="block",o.setAttribute("aria-hidden","false"),i.setAttribute("aria-expanded","true"),document.body.classList.add("directorist-account-modal-open"),window.requestAnimationFrame(function(){var e;null===(e=t(o)[0])||void 0===e||e.focus({preventScroll:!0})})}(r,i)}),c.addEventListener("click",function(){return n()}),r.addEventListener("click",function(e){e.target===r&&n()})}}),document.querySelectorAll(".directorist-account-block-logged-mode").forEach(function(e){var t,n,o=e.querySelector(".directorist-account-block__trigger[aria-controls]"),i=e.querySelector(".directorist-account-block-logged-mode__navigation");if(o&&i){var r=e.querySelector(".directorist-account-block-logged-mode__overlay");r||((r=document.createElement("div")).className="directorist-account-block-logged-mode__overlay"),document.body.appendChild(r);var c=null,d="directorist-account-block-logged-mode__navigation--align-end";if(window.addEventListener("resize",s),null===(t=window.visualViewport)||void 0===t||t.addEventListener("resize",s),null===(n=window.visualViewport)||void 0===n||n.addEventListener("scroll",s),window.ResizeObserver){var a=new window.ResizeObserver(s);a.observe(e),a.observe(i)}o.addEventListener("click",function(){var e=!i.classList.contains("show");i.classList.toggle("show",e),i.setAttribute("aria-hidden",String(!e)),r.classList.toggle("show",e),o.setAttribute("aria-expanded",String(e)),e&&l()}),r.addEventListener("click",u),document.addEventListener("keydown",function(e){"Escape"===e.key&&i.classList.contains("show")&&(u(),o.focus())})}function l(){if(i.classList.contains("show")){var e=window.visualViewport,t=(null==e?void 0:e.width)||document.documentElement.clientWidth,n=((null==e?void 0:e.offsetLeft)||0)+8,o=n+t-16;i.style.setProperty("--directorist-account-menu-max-width","".concat(Math.max(0,t-16),"px")),i.style.setProperty("--directorist-account-menu-offset","0px"),i.classList.remove(d);var r=i.getBoundingClientRect();(r.left<n||r.right>o)&&(i.classList.add(d),r=i.getBoundingClientRect());var c=Math.max(n,Math.min(r.left,o-r.width));i.style.setProperty("--directorist-account-menu-offset","".concat(c-r.left,"px"))}}function s(){null===c&&(c=window.requestAnimationFrame(function(){c=null,l()}))}function u(){i.classList.remove("show"),i.setAttribute("aria-hidden","true"),r.classList.remove("show"),o.setAttribute("aria-expanded","false")}}),document.addEventListener("keydown",function(o){if(e){if("Escape"===o.key)return o.preventDefault(),void n();if("Tab"===o.key){var i=t(e.dialog),r=i[0],c=i[i.length-1];o.shiftKey&&e.dialog.ownerDocument.activeElement===r?(o.preventDefault(),null==c||c.focus()):o.shiftKey||e.dialog.ownerDocument.activeElement!==c||(o.preventDefault(),null==r||r.focus())}}})})}();
Save File
Cancel