PageSourceSearch

https://www.enercoop.fr/vite/assets/modal-DOJ-DYgf.js

js enercoop.fr collected 2026-09-24 09:11:20 UTC 7,716 bytes, 3 lines download raw bytes

1import{o as C}from"./on_load_async-Dd9lPJDF.js";C(()=>{document.querySelectorAll(".js-navigation-burger-menu").forEach(n=>{n.addEventListener("click",t=>{t.preventDefault(),document.querySelector(".js-navigation-mobile-menu").classList.add("active"),document.body.style.overflow="hidden"})}),document.querySelectorAll(".js-navigation-close-menu").forEach(n=>{n.addEventListener("click",()=>{document.querySelectorAll("nav.navigation-mobile").forEach(t=>{t.classList.remove("active")}),document.body.style.overflow="visible"})})});function N(n,t){for(var i=0;i<t.length;i++){var e=t[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function f(n){return function(t){if(Array.isArray(t))return h(t)}(n)||function(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}(n)||function(t,i){if(t){if(typeof t=="string")return h(t,i);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return h(t,i)}}(n)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function h(n,t){(t==null||t>n.length)&&(t=n.length);for(var i=0,e=new Array(t);i<t;i++)e[i]=n[i];return e}var L,m,s,g,S,v=(L=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],m=function(){function n(e){var o=e.targetModal,a=e.triggers,r=a===void 0?[]:a,c=e.onShow,l=c===void 0?function(){}:c,d=e.onClose,u=d===void 0?function(){}:d,b=e.openTrigger,T=b===void 0?"data-micromodal-trigger":b,y=e.closeTrigger,F=y===void 0?"data-micromodal-close":y,p=e.openClass,j=p===void 0?"is-open":p,w=e.disableScroll,O=w!==void 0&&w,E=e.disableFocus,q=E!==void 0&&E,k=e.awaitCloseAnimation,I=k!==void 0&&k,A=e.awaitOpenAnimation,B=A!==void 0&&A,M=e.debugMode,x=M!==void 0&&M;(function(D,K){if(!(D instanceof K))throw new TypeError("Cannot call a class as a function")})(this,n),this.modal=document.getElementById(o),this.config={debugMode:x,disableScroll:O,openTrigger:T,closeTrigger:F,openClass:j,onShow:l,onClose:u,awaitCloseAnimation:I,awaitOpenAnimation:B,disableFocus:q},r.length>0&&this.registerTriggers.apply(this,f(r)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var t,i;return t=n,(i=[{key:"registerTriggers",value:function(){for(var e=this,o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];a.filter(Boolean).forEach(function(c){c.addEventListener("click",function(l){return e.showModal(l)})})}},{key:"showModal",value:function(){var e=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var a=function r(){e.modal.removeEventListener("animationend",r,!1),e.setFocusToFirstNode()};this.modal.addEventListener("animationend",a,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,o)}},{key:"closeModal",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,o=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var a=this.config.openClass;this.modal.addEventListener("animationend",function r(){o.classList.remove(a),o.removeEventListener("animationend",r,!1)},!1)}else o.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var o=document.querySelector("body");switch(e){case"enable":Object.assign(o.style,{overflow:""});break;case"disable":Object.assign(o.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){(e.target.hasAttribute(this.config.closeTrigger)||e.target.parentNode.hasAttribute(this.config.closeTrigger))&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){e.keyCode===27&&this.closeModal(e),e.keyCode===9&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(L);return Array.apply(void 0,f(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var o=this.getFocusableNodes();if(o.length!==0){var a=o.filter(function(r){return!r.hasAttribute(e.config.closeTrigger)});a.length>0&&a[0].focus(),a.length===0&&o[0].focus()}}}},{key:"retainFocus",value:function(e){var o=this.getFocusableNodes();if(o.length!==0)if(o=o.filter(function(r){return r.offsetParent!==null}),this.modal.contains(document.activeElement)){var a=o.indexOf(document.activeElement);e.shiftKey&&a===0&&(o[o.length-1].focus(),e.preventDefault()),!e.shiftKey&&o.length>0&&a===o.length-1&&(o[0].focus(),e.preventDefault())}else o[0].focus()}}
2])&&N(t.prototype,i),n}(),s=null,g=function(n){if(!document.getElementById(n))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(n,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'.concat(n,'"></div>')),!1},S=function(n,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'))}(n),!t)return!0;for(var i in t)g(i);return!0},{init:function(n){var t=Object.assign({},{openTrigger:"data-micromodal-trigger"},n),i=f(document.querySelectorAll("[".concat(t.openTrigger,"]"))),e=function(r,c){var l=[];return r.forEach(function(d){var u=d.attributes[c].value;l[u]===void 0&&(l[u]=[]),l[u].push(d)}),l}(i,t.openTrigger);if(t.debugMode!==!0||S(i,e)!==!1)for(var o in e){var a=e[o];t.targetModal=o,t.triggers=f(a),s=new m(t)}},show:function(n,t){var i=t||{};i.targetModal=n,i.debugMode===!0&&g(n)===!1||(s&&s.removeEventListeners(),(s=new m(i)).showModal())},close:function(n){n?s.closeModalById(n):s.closeModal()}});typeof window<"u"&&(window.MicroModal=v);C(()=>{v.init({onShow:n=>{const t=n;t.scrollTop=0;const i=n.querySelector(".modal-container");i.scrollTop=0},disableScroll:!0}),document.querySelectorAll(".js-modal-open-at-page-load").forEach(n=>{const t=n.id;v.show(t)}),document.querySelectorAll(".modal-checkbox").forEach(n=>{n.addEventListener("click",t=>{t.preventDefault()})})});
3//# sourceMappingURL=modal-DOJ-DYgf.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.