kollapsminoriteten/wp-content/plugins/the-events-calendar/common/build/js/tec-a11y-dialog.js

1 line
7.2 KiB
JavaScript
Raw Permalink Normal View History

2025-06-09 09:58:01 +02:00
(()=>{var t={9462:(t,e,i)=>{var o;!function(){"use strict";const i=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];let n;const s=function(){const t=/(android)/i.test(navigator.userAgent),e=!!window.chrome,i="undefined"!=typeof InstallTrigger,o=document.documentMode,n=!o&&!!window.StyleMedia,s=!!navigator.userAgent.match(/(iPod|iPhone|iPad)/i),r=!!navigator.userAgent.match(/(iPod|iPhone)/i),d=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0;return{android:t,chrome:e,edge:n,firefox:i,ie:o,ios:s,iosMobile:r,opera:d,safari:Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||!e&&!d&&"undefined"!==window.webkitAudioContext,os:navigator.platform}}();let r=0;const d=s.ie||s.firefox||s.chrome&&!s.edge?document.documentElement:document.body;function a(t){var e,i,o;this.options=(e={appendTarget:"",bodyLock:!0,closeButtonAriaLabel:"Close this dialog window",closeButtonClasses:"a11y-dialog__close-button",contentClasses:"a11y-dialog__content",effect:"none",effectSpeed:300,effectEasing:"ease-in-out",overlayClasses:"a11y-dialog__overlay",overlayClickCloses:!0,trigger:null,wrapperClasses:"a11y-dialog",ariaDescribedBy:"",ariaLabel:"",ariaLabelledBy:""},i=t,Object.keys(i).forEach((function(t){e[t]=i[t]})),e),this._rendered=!1,this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.trigger=(o=this.options.trigger,"[object String]"===Object.prototype.toString.call(o)?h(this.options.trigger,!0,document,!0):this.options.trigger),this.node=null,this.trigger?(this._listeners={},this.create()):console.warn("Lookup for a11y target node failed.")}function c(t){const e=[];let i=t.length;for(;i--;e.unshift(t[i]));return e}function h(t,e,i,o){i||(i=document);const n=o?t:'[data-js="'+t+'"]';let s=i.querySelectorAll(n);return e&&(s=c(s)),s}function l(t){const e=u(t);e.length&&e[0].focus()}function u(t){return(e=i.join(","),o=t,c((o||document).querySelectorAll(e))).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}));var e,o}a.prototype.create=function(){return this.shown=!1,this.trigger.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._fire("create"),this},a.prototype.render=function(t){const e=h(this.trigger[0].dataset.content)[0];if(!e)return this;const i=this.options.ariaDescribedBy?'aria-describedby="'+this.options.ariaDescribedBy+'" ':"",o=this.options.ariaLabel?'aria-label="'+this.options.ariaLabel+'"':"",n=this.options.ariaLabelledBy?'aria-labelledby="'+this.options.ariaLabelledBy+'"':"",s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.classList.add(this.options.wrapperClasses),s.innerHTML='<div data-js="a11y-overlay" tabindex="-1" class="'+this.options.overlayClasses+'"></div>\n <div class="'+this.options.contentClasses+'" role="dialog" aria-modal="true" '+n+i+o+'>\n <div role="document">\n <button data-js="a11y-close-button" class="'+this.options.closeButtonClasses+'" type="button" aria-label="'+this.options.closeButtonAriaLabel+'" ></button>\n '+e.innerHTML+" </div>\n </div>";let r=this.trigger;var d,a;return this.options.appendTarget.length&&(r=document.querySelectorAll(this.options.appendTarget)[0]||this.trigger),d=s,(a=r).parentNode.insertBefore(d,a.nextElementSibling),this.node=s,this.overlay=h("a11y-overlay",!1,this.node)[0],this.closeButton=h("a11y-close-button",!1,this.node)[0],this.options.overlayClickCloses&&this.overlay.addEventListener("click",this._hide),this.closeButton.addEventListener("click",this._hide),this._rendered=!0,this._fire("render",t),this},a.prototype.show=function(t){return this.shown?this:(this._rendered||this.render(t),this._rendered?(this.shown=!0,this._applyOpenEffect(),this.node.setAttribute("aria-hidden","false"),this.options.bodyLock&&(r=d.scrollTop,document.bo