CoreFiles by mySites.guru
metismenujs.min.js24 lines, 5,459 bytes, from Joomla_4.0.5-rc4-Release_Candidate-Full_Package.zip
Raw History Compare with 4.0.5-rc3
md5
1a12622fd21fdc39b0f1a68082935fc0
sha1
b5aef3f86520723b6d96c7d405cec8181545384d
sha256
f91c31136a4a2652eadaa74f5f70da2f0ac7abf06e5e5c967ab8437cc70901f7
/*!
* metismenujs - v1.2.1
* MetisMenu: Collapsible menu plugin with Vanilla-JS
* https://github.com/onokumus/metismenujs#readme
*
* Made by Osman Nuri Okumus <[email protected]> (https://github.com/onokumus)
* Under MIT License
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MetisMenu=e()}(this,function(){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */var i=function(){return(i=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},n={parentTrigger:"li",subMenu:"ul",toggle:!0,triggerElement:"a"},g="mm-active",f="mm-collapse",m="mm-collapsed",p="mm-collapsing",t="metismenu",v="mm-show";function y(t,e){if(t.closest)return t.closest(e);for(var i,n,s=t;s;){if(n=e,((i=s).matches||i.webkitMatchesSelector||i.msMatchesSelector).call(i,n))return s;s=s.parentElement}return null}function s(t,e){this.element=s.isElement(t)?t:document.querySelector(t),this.config=i(i({},n),e),this.disposed=!1,this.triggerArr=[],this.init()}return s.attach=function(t,e){return new s(t,e)},s.prototype.init=function(){var n=this,s=g,r=f;this.element.classList.add(t),[].slice.call(this.element.querySelectorAll(this.config.subMenu)).forEach(function(t){t.classList.add(r);var e=y(t,n.config.parentTrigger);null!=e&&e.classList.contains(s)?n.show(t):n.hide(t);var i=null==e?void 0:e.querySelector(n.config.triggerElement);"true"!==(null==i?void 0:i.getAttribute("aria-disabled"))&&(null!=i&&i.setAttribute("aria-expanded","false"),null!=i&&i.addEventListener("click",n.clickEvent.bind(n)),n.triggerArr.push(i))})},s.prototype.clickEvent=function(t){var e,i,n;this.disposed||((e=null==t?void 0:t.currentTarget)&&"A"===e.tagName&&t.preventDefault(),n=null==(i=y(e,this.config.parentTrigger))?void 0:i.querySelector(this.config.subMenu),this.toggle(n))},s.prototype.update=function(){this.disposed=!1,this.init()},s.prototype.dispose=function(){var e=this;this.triggerArr.forEach(function(t){t.removeEventListener("click",e.clickEvent.bind(e))}),this.disposed=!0},s.prototype.on=function(t,e,i){return this.element.addEventListener(t,e,i),this},s.prototype.off=function(t,e,i){return this.element.removeEventListener(t,e,i),this},s.prototype.emit=function(t,e,i){var n;return void 0===i&&(i=!1),"function"==typeof CustomEvent?n=new CustomEvent(t,{bubbles:i,detail:e}):(n=document.createEvent("CustomEvent")).initCustomEvent(t,i,!1,e),this.element.dispatchEvent(n),this},s.prototype.toggle=function(t){var e=y(t,this.config.parentTrigger);null!=e&&e.classList.contains(g)?this.hide(t):this.show(t)},s.prototype.show=function(t){var e,i,n,s,r,o=this,l=t,a=g,c=f,u=m,h=p,d=v;this.isTransitioning||l.classList.contains(h)||(i=function(){l.classList.remove(h),l.style.height="",l.removeEventListener("transitionend",i),o.setTransitioning(!1),o.emit("shown.metisMenu",{shownElement:l})},null!=(n=y(l,this.config.parentTrigger))&&n.classList.add(a),null!=(s=null==n?void 0:n.querySelector(this.config.triggerElement))&&s.setAttribute("aria-expanded","true"),null!=s&&s.classList.remove(u),l.style.height="0px",l.classList.remove(c),l.classList.remove(d),l.classList.add(h),r=[].slice.call(null===(e=null==n?void 0:n.parentNode)||void 0===e?void 0:e.children).filter(function(t){return t!==n}),this.config.toggle&&0<r.length&&r.forEach(function(t){var e=t.querySelector(o.config.subMenu);e&&o.hide(e)}),this.setTransitioning(!0),l.classList.add(c),l.classList.add(d),l.style.height=l.scrollHeight+"px",this.emit("show.metisMenu",{showElement:l}),l.addEventListener("transitionend",i))},s.prototype.hide=function(t){var e,i,n,s=this,r=g,o=f,l=m,a=p,c=v,u=t;!this.isTransitioning&&u.classList.contains(c)&&(this.emit("hide.metisMenu",{hideElement:u}),null!=(e=y(u,this.config.parentTrigger))&&e.classList.remove(r),i=function(){u.classList.remove(a),u.classList.add(o),u.style.height="",u.removeEventListener("transitionend",i),s.setTransitioning(!1),s.emit("hidden.metisMenu",{hiddenElement:u})},u.style.height=u.getBoundingClientRect().height+"px",u.style.height=u.offsetHeight+"px",u.classList.add(a),u.classList.remove(o),u.classList.remove(c),this.setTransitioning(!0),u.addEventListener("transitionend",i),u.style.height="0px",null!=(n=null==e?void 0:e.querySelector(this.config.triggerElement))&&n.setAttribute("aria-expanded","false"),null!=n&&n.classList.add(l))},s.prototype.setTransitioning=function(t){this.isTransitioning=t},s.isElement=function(t){return Boolean(t.classList)},s});
//# sourceMappingURL=metismenujs.min.js.map

The same content is in 27 releases, Joomla 4.0.0-beta4 to 4.1.0-beta2. See them all, or every version of this file.