CoreFiles by mySites.guru
metismenujs.min.js24 lines, 5,180 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
a14e58e09e0cbe4e12ddc50922da1009
sha1
f19c1d5b3d6ab3412aa7b02a75085ac25572bdb5
sha256
82dacfa7f349e974a9967470d07f5c9ee350ccb9f307f3bf66eb06a5d837a4a6
/*!
* metismenujs - v1.1.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,s=arguments.length;i<s;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},s={parentTrigger:"li",subMenu:"ul",toggle:!0,triggerElement:"a"},h="mm-active",c="mm-collapse",d="mm-collapsed",u="mm-collapsing",l="metismenu",f="mm-show";function t(t,e){this.element="string"==typeof t?document.querySelector(t):t,this.cacheEl=this.element,this.config=i({},s,e),this.cacheConfig=this.config,this.disposed=!1,this.ulArr=[],this.listenerOb=[],this.init()}return t.prototype.update=function(){this.disposed=!1,this.element=this.cacheEl,this.config=this.cacheConfig,this.init()},t.prototype.dispose=function(){for(var t=0,e=this.listenerOb;t<e.length;t++){var i=e[t];for(var s in i)if(i.hasOwnProperty(s)){var n=i[s];n[1].removeEventListener(n[0],n[2])}}this.ulArr=[],this.listenerOb=[],this.config=null,this.element=null,this.disposed=!0},t.prototype.on=function(t,e){return this.element.addEventListener(t,e,!1),this},t.prototype.off=function(t,e){return this.element.removeEventListener(t,e),this},t.prototype.emit=function(t,e,i){var s;return void 0===i&&(i=!1),"function"==typeof CustomEvent?s=new CustomEvent(t,{bubbles:i,detail:e}):(s=document.createEvent("CustomEvent")).initCustomEvent(t,i,!1,e),this.element.dispatchEvent(s),this},t.prototype.init=function(){this.element.classList.add(l),this.ulArr=[].slice.call(this.element.querySelectorAll(this.config.subMenu));for(var t=0,e=this.ulArr;t<e.length;t++){var i=e[t],s=i.parentNode;i.classList.add(c),s.classList.contains(h)?this.show(i):this.hide(i);var n=s.querySelector(this.config.triggerElement);if("true"===n.getAttribute("aria-disabled"))return;n.setAttribute("aria-expanded","false");var r={aClick:["click",n,this.clickEvent.bind(this)]};for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];a[1].addEventListener(a[0],a[2])}this.listenerOb.push(r)}},t.prototype.clickEvent=function(t){if(!this.disposed){"A"===t.currentTarget.tagName&&t.preventDefault();var e=t.currentTarget.parentNode.querySelector(this.config.subMenu);this.toggle(e)}},t.prototype.toggle=function(t){t.parentNode.classList.contains(h)?this.hide(t):this.show(t)},t.prototype.show=function(t){var e=this;if(!this.isTransitioning&&!t.classList.contains(u)){var i=function(){t.classList.remove(u),t.style.height="",t.removeEventListener("transitionend",i),e.setTransitioning(!1),e.emit("shown.metisMenu",{shownElement:t})},s=t.parentNode;s.classList.add(h);var n=s.querySelector(this.config.triggerElement);n.setAttribute("aria-expanded","true"),n.classList.remove(d),t.style.height="0px",t.classList.remove(c),t.classList.remove(f),t.classList.add(u);var r=[].slice.call(s.parentNode.children).filter(function(t){return t!==s});if(this.config.toggle&&0<r.length)for(var o=0,a=r;o<a.length;o++){var l=a[o].querySelector(this.config.subMenu);null!==l&&this.hide(l)}this.setTransitioning(!0),t.classList.add(c),t.classList.add(f),t.style.height=t.scrollHeight+"px",this.emit("show.metisMenu",{showElement:t}),t.addEventListener("transitionend",i)}},t.prototype.hide=function(t){var e=this;if(!this.isTransitioning&&t.classList.contains(f)){this.emit("hide.metisMenu",{hideElement:t});var i=t.parentNode;i.classList.remove(h);var s=function(){t.classList.remove(u),t.classList.add(c),t.style.height="",t.removeEventListener("transitionend",s),e.setTransitioning(!1),e.emit("hidden.metisMenu",{hiddenElement:t})};t.style.height=t.getBoundingClientRect().height+"px",t.style.height=t.offsetHeight+"px",t.classList.add(u),t.classList.remove(c),t.classList.remove(f),this.setTransitioning(!0),t.addEventListener("transitionend",s),t.style.height="0px";var n=i.querySelector(this.config.triggerElement);n.setAttribute("aria-expanded","false"),n.classList.add(d)}},t.prototype.setTransitioning=function(t){this.isTransitioning=t},t});
//# sourceMappingURL=metismenujs.min.js.map

No other release has this exact content. See every version of this file.