CoreFiles by mySites.guru
metismenujs.min.js24 lines, 5,458 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
9e199c6e2f6b1cfe43a1cf9744453c86
sha1
4620e558ea114e009a1c3778fad06167b06b1789
sha256
d3ffcd840b1d9a763c516f58663b4a12656f7cf571e6cd5c6f3341ad54a447d0
/*!
* metismenujs - v1.2.0
* MetisMenu 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. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */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",v="mm-collapsing",e="metismenu",p="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,t=e,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){if(!this.disposed){var e=null==t?void 0:t.currentTarget;e&&"A"===e.tagName&&t.preventDefault();var i=y(e,this.config.parentTrigger),n=null==i?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=this,n=t,s=g,r=f,o=m,l=v,a=p;if(!this.isTransitioning&&!n.classList.contains(l)){var c=function(){n.classList.remove(l),n.style.height="",n.removeEventListener("transitionend",c),i.setTransitioning(!1),i.emit("shown.metisMenu",{shownElement:n})},u=y(n,this.config.parentTrigger);null!=u&&u.classList.add(s);var h=null==u?void 0:u.querySelector(this.config.triggerElement);null!=h&&h.setAttribute("aria-expanded","true"),null!=h&&h.classList.remove(o),n.style.height="0px",n.classList.remove(r),n.classList.remove(a),n.classList.add(l);var d=[].slice.call(null===(e=null==u?void 0:u.parentNode)||void 0===e?void 0:e.children).filter(function(t){return t!==u});this.config.toggle&&0<d.length&&d.forEach(function(t){var e=t.querySelector(i.config.subMenu);e&&i.hide(e)}),this.setTransitioning(!0),n.classList.add(r),n.classList.add(a),n.style.height=n.scrollHeight+"px",this.emit("show.metisMenu",{showElement:n}),n.addEventListener("transitionend",c)}},s.prototype.hide=function(t){var e=this,i=g,n=f,s=m,r=v,o=p,l=t;if(!this.isTransitioning&&l.classList.contains(o)){this.emit("hide.metisMenu",{hideElement:l});var a=y(l,this.config.parentTrigger);null!=a&&a.classList.remove(i);var c=function(){l.classList.remove(r),l.classList.add(n),l.style.height="",l.removeEventListener("transitionend",c),e.setTransitioning(!1),e.emit("hidden.metisMenu",{hiddenElement:l})};l.style.height=l.getBoundingClientRect().height+"px",l.style.height=l.offsetHeight+"px",l.classList.add(r),l.classList.remove(n),l.classList.remove(o),this.setTransitioning(!0),l.addEventListener("transitionend",c),l.style.height="0px";var u=null==a?void 0:a.querySelector(this.config.triggerElement);null!=u&&u.setAttribute("aria-expanded","false"),null!=u&&u.classList.add(s)}},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 3 releases, Joomla 4.0.0-beta to 4.0.0-beta3. See them all, or every version of this file.