laipower/wp-content/upgrade-temp-backup/plugins/gp-premium/menu-plus/functions/js/offside.min.js

1 line
6.6 KiB
JavaScript
Raw Normal View History

2024-06-27 12:11:15 +00:00
!function(a,c,u){"use strict";var e={getInstance:function(e,t){return a.offside.factory||(a.offside.factory=n(t)),a.offside.factory.getOffsideInstance(e,t)}};function n(e){var t,p=function(e){0<k.length&&(isNaN(e)?k.forEach(function(e){x[e].close()}):x[e].close())},b=function(){h(C,i)},h=function(e,t){e.classList?e.classList.add(t):e.className=(e.className+" "+t).trim()},S=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")},L=function(e,t,n){e.addEventListener(t,n)},A=function(e,t,n){e.removeEventListener(t,n)},E=function(e){return e instanceof HTMLElement?[e]:Array.isArray(e)?e:"string"==typeof e&&Array.apply(null,c.querySelectorAll(e))},O=function(e,t){e=e.indexOf(t);return-1<e&&e},n={slidingElementsSelector:".offside-sliding-element",disableCss3dTransforms:!1,debug:!1};for(t in e)n.hasOwnProperty(t)&&(n[t]=e[t]);var q="offside-js",o=q+"--init",i=q+"--interact",x=[],w=!0,s=!n.disableCss3dTransforms&&function(){if(!a.getComputedStyle)return!1;var e,t,n=c.createElement("p"),o={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(t in c.body.insertBefore(n,null),o)n.style[t]!==u&&(n.style[t]="translate3d(1px,1px,1px)",e=a.getComputedStyle(n).getPropertyValue(o[t]));return c.body.removeChild(n),e!==u&&0<e.length&&"none"!==e}(),k=[],C=c.body,r=E(n.slidingElementsSelector),T=n.debug;function l(e,t,n){var o,i={buttonsSelector:"",slidingSide:"left",init:function(){},beforeOpen:function(){},afterOpen:function(){},beforeClose:function(){},afterClose:function(){},beforeDestroy:function(){},afterDestroy:function(){}};for(o in t)i.hasOwnProperty(o)&&(i[o]=t[o]);var s=e,r=E(i.buttonsSelector),e=i.slidingSide,l="offside",a=l+"--"+e,c="is-open",u=q+"--is-open",d=q+"--is-"+e,f=n||0,m=function(){(!1===O(k,f)?g:y)()},g=function(){i.beforeOpen(),w&&(w=!1,b()),p(),h(C,u),h(C,d),h(s,c),k.push(f),i.afterOpen()},y=function(){var e=O(k,f);!1!==e&&(i.beforeClose(),S(C,u),S(C,d),S(s,c),k.splice(e,1),i.afterClose())},v=function(e){e.preventDefault(),m()},e=function(){s||console.error('Offside alert: "offside" selector could not match any element'),r.length||console.error('Offside alert: "buttonsSelector" selector could not match any element')};this.toggle=function(){m()},this.open=function(){g()},this.close=function(){y()},this.closeAll=function(){p()},this.destroy=function(){i.beforeDestroy(),y(),r.forEach(function(e){A(e,"click",v)}),S(s,l),S(s,a),delete x[f],i.afterDestroy()},T&&e(),h(s,l),h(s,a),r.forEach(function(e){L(e,"click",v)}),i.init()}return r.forEach(function(e){h(e,"offside-sliding-element")}),s||h(c.documentElement,"no-csstransforms3d"),h(C,o),{closeOpenOffside:function(){p()},getOffsideInstance:function(e,t){var n,o=x.length||0,e=(t=t,n=o,!1!==(e=E((e=e)!==u?e:".offside"))?new l(e[0],t,n):null);if(null!==e)return x[o]=e}}}"undefined"!=typeof module&&module.exports?module.exports=e.getInstance:a.offside=e.getInstance}(window,document);for(var generateOffside=offside(".slideout-navigation",{slidingElementsSelector:"#slideout-container",buttonsSelector:".slideout-mobile .main-navigation .menu-toggle, .slideout-both .main-navigation .menu-toggle, .slideout-both .slideout-toggle, .slideout-desktop .slideout-toggle",slidingSide:offSide.side,beforeOpen:function(){document.querySelector(".slideout-navigation").classList.add("slideout-transition")},afterOpen:function(){if(setTimeout(function(){document.querySelector(".slideout-navigation").classList.remove("slideout-transition")},10),document.documentElement.classList.add("slide-opened"),document.body.classList.add("slide-opened"),document.body.classList.contains("dropdown-hover"))for(var e=document.querySelector(".slideout-navigation").querySelectorAll("li.menu-item-has-children"),t=0;t<e.length;t++){var n=e[t].querySelector("span.dropdown-menu-toggle");n&&(n.setAttribute("tabindex",0),n.setAttribute("role","button"),n.setAttribute("aria-expanded",!0))}var o=document.querySelector(".slideout-navigation"