PageSourceSearch

https://uw.org/wp-content/plugins/bricksextras/components/assets/js/micromodal.min.js

js uw.org collected 2026-09-24 09:28:38 UTC 9,216 bytes, 7 lines download raw bytes

1/*!
2 * MicroModal.js v0.7.3
3 * https://micromodal.vercel.app/
4 * Copyright (c) 2017 Indrashish Ghosh
5 * Licensed under MIT (https://github.com/Ghosh/micromodal/blob/master/LICENSE.md)
6 */
vendor: 9,028 bytes, line 7
7!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).MicroModal=t()}(this,(function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function t(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function o(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,o){if(t){if("string"==typeof t)return e(t,o);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,o):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}var i=function(){var e=["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^="-"])'],n={openTrigger:"data-micromodal-trigger",identifier:"data-micromodal-id"},i={},r=[],a=0;n.generateId=function(){return"micromodal-".concat(++a)};var l=function(){function n(e){var t=e.targetModal,o=e.triggers,i=void 0===o?[]:o,r=e.onShow,a=void 0===r?function(){}:r,l=e.onClose,s=void 0===l?function(){}:l,d=e.openTrigger,c=void 0===d?"data-micromodal-trigger":d,f=e.closeTrigger,h=void 0===f?"data-micromodal-close":f,g=e.openClass,m=void 0===g?"is-open":g,v=e.disableScroll,y=void 0!==v&&v,b=e.disableFocus,p=void 0!==b&&b,w=e.awaitCloseAnimation,k=void 0!==w&&w,E=e.awaitOpenAnimation,M=void 0!==E&&E,T=e.debugMode,A=void 0!==T&&T;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.modal="string"==typeof t?document.getElementById(t):t,this.modalId=null,null!==this.modal?(this.config={debugMode:A,disableScroll:y,openTrigger:c,closeTrigger:h,openClass:m,onShow:a,onClose:s,awaitCloseAnimation:k,awaitOpenAnimation:M,disableFocus:p},this.showModal=this.showModal.bind(this),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this),this.setFocusToFirstNode=this.setFocusToFirstNode.bind(this),this.triggers=i,this.registerTriggers()):!0===A&&u(t,A,!1)}var i,a,l;return i=n,a=[{key:"registerTriggers",value:function(){var e=this;this.triggers.filter(Boolean).forEach((function(t){t.addEventListener("click",e.showModal)}))}},{key:"unregisterTriggers",value:function(){var e=this;this.triggers.filter(Boolean).forEach((function(t){t.removeEventListener("click",e.showModal)}))}},{key:"destroy",value:function(){this.closeModal(),this.unregisterTriggers()}},{key:"showModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.modal.classList.contains(this.config.openClass)||(this.removeEventListeners(),this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.toggleScrolling(!1),this.addEventListeners(),this.modalId&&-1===r.indexOf(this.modalId)&&r.push(this.modalId),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",this.setFocusToFirstNode,{once:!0}):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,e))}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal,o=this.config.openClass;if(t.classList.contains(o)){var n=r.indexOf(this.modalId);n>-1&&r.splice(n,1),this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.toggleScrolling(!0),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",(function(){t.classList.remove(o)}),{once:!0}):t.classList.remove(o)}}},{key:"toggleScrolling",value:function(e){if(this.config.disableScroll){var t=!e||r.length>0;document.body.style.overflow=t?"hidden":"",document.body.style.touchAction=t?"none":""}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("click",this.onClick),this.modal.addEventListener("keydown",this.onKeydown),this.modalId?0===r.length&&document.addEventListener("keydown",d):document.removeEventListener("keydown",d)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("click",this.onClick),this.modal.removeEventListener("keydown",this.onKeydown),0===r.length&&document.removeEventListener("keydown",d)}},{key:"onClick",value:function(e){var t=c(e.target,this.modal),o=e.target.closest("[".concat(this.config.closeTrigger,"]"));(e.target.hasAttribute(this.config.closeTrigger)&&t||null!==o&&!c(o,this.modal)&&!t)&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){"Escape"!==e.key&&27!==e.keyCode||null!==this.modal.querySelector('[role="alertdialog"]')||this.closeModal(e),"Tab"!==e.key&&9!==e.keyCode||this.retainFocus(e,"inside")}},{key:"getFocusableNodes",value:function(){return o(this.modal.querySelectorAll(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var o=t.filter((function(t){return!t.hasAttribute(e.config.closeTrigger)}));o.length>0&&o[0].focus(),0===o.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e,t){var o=this.getFocusableNodes();if(0!==o.length)if(o=o.filter((function(e){return null!==e.offsetParent})),"outside"===t)o[0].focus(),e.preventDefault();else{var n=o.indexOf(document.activeElement);e.shiftKey&&0===n&&(o[o.length-1].focus(),e.preventDefault()),!e.shiftKey&&o.length>0&&n===o.length-1&&(o[0].focus(),e.preventDefault())}}}],a&&t(i.prototype,a),l&&t(i,l),Object.defineProperty(i,"prototype",{writable:!1}),n}(),s=function(e){if("string"==typeof e)return e;if(e instanceof HTMLElement){var t=e.getAttribute(n.identifier);return t||(e.id?e.id:(t=n.generateId(),e.setAttribute(n.identifier,t),t))}return null},d=function(e){var t=i[r[r.length-1]];t.modal.contains(document.activeElement)||("Escape"!==e.key&&27!==e.keyCode||null!==t.modal.querySelector('[role="alertdialog"]')||g(),"Tab"!==e.key&&9!==e.keyCode||t.retainFocus(e,"outside"))},c=function(e,t){return e===t||e.parentNode===t},u=function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!!(o?void 0!==i[e]:"string"==typeof e?null!==document.getElementById(e):e instanceof HTMLElement)||(t&&console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e,"'%c ID somewhere in your code. Try the example below to resolve it.\n\n")+'%cExample:%c <div class="modal" id="'.concat(e,'"></div>'),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),!1)},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=Object.assign({},n,{targetModal:e},t),r=s(e);u(o.targetModal,o.debugMode,!1)&&(i[r]||(i[r]=new l(o),i[r].modal.setAttribute(n.identifier,r),i[r].modalId=r))},h=function(e,t){var o=s(e);u(o,n.debugMode)&&Object.assign(i[o].config,t)},g=function(e){if(0!==r.length)if(e){var t=s(e);r.indexOf(t)>-1&&i[t].closeModal()}else i[r[r.length-1]].closeModal()};return{init:function(e){Object.assign(n,e);var t=o(document.querySelectorAll("[".concat(n.openTrigger,"]"))),i=function(e,t){var o=[];return e.forEach((function(e){var n=e.getAttribute(t);o[n]||(o[n]=[]),o[n].push(e)})),o}(t,n.openTrigger);!0===n.debugMode&&!1===function(e){return!(e.length<=0&&(console.warn('MicroModal: ❗Please specify at least one %c\'micromodal-trigger\'%c data attribute.\n\n%cExample:%c <a href="#" data-micromodal-trigger="my-modal">Open modal</a>',"background-color: #f8f9fa;color: #50596c;font-weight: bold;","","background-color: #f8f9fa;color: #50596c;font-weight: bold;",""),1))}(t)||Object.keys(i).forEach((function(e){var t=i[e];f(e,{targetModal:e,triggers:t})}))},initModal:f,config:h,show:function(e,t){var o=s(e);i[o]?t&&h(e,t):f(o,t),i[o]&&i[o].showModal()},close:g,closeAll:function(){for(var e=r.length-1;e>=0;e--)i[r[e]].closeModal()},removeModal:function(e){var t=s(e),o=i[t];o&&(o.destroy(),delete i[t])}}}();return"undefined"!=typeof window&&(window.MicroModal=i),i}));

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.