forked from adgsm/multi-level-push-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.multilevelpushmenu.min.js
1 lines (1 loc) · 27.2 KB
/
jquery.multilevelpushmenu.min.js
1
!function(t){t.fn.multilevelpushmenu=function(e){"use strict";var i=arguments,n=null;return this.each(function(){function s(t){t.stopPropagation&&t.preventDefault?(t.stopPropagation(),t.preventDefault()):(t.cancelBubble=!0,t.returnValue=!1)}function a(e,i){if(void 0==e||void 0==i)return!1;e.on(i,function(n,s){e.hide();try{if(!n.pageX||!n.pageY)return!1;s=s||{pageX:n.pageX,pageY:n.pageY};var a=document.elementFromPoint(s.pageX,s.pageY);a=3==a.nodeType?a.parentNode:a,t(a).trigger(i,s)}catch(e){t.error("Error while propagating event: "+e.message)}finally{e.show()}})}function r(){var e=t("<nav />").prop({id:B.settings.menuID,className:B.settings.wrapperClass}).appendTo(B.settings.container);l(B.settings.menu,e)}function l(e,i){void 0==e.level&&(e.level=0),t.each(e,function(){var n=t("<div />").attr({class:"levelHolderClass"+("rtl"==B.settings.direction?" rtl":" ltr"),"data-level":e.level,style:("rtl"==B.settings.direction?"margin-right: ":"margin-left: ")+(0!=e.level||B.settings.collapsed?"-200%":0)}).appendTo(i);x(B.settings.menuWidth)||k(B.settings.menuWidth)&&B.settings.menuWidth;n.bind(N,function(t){m(t,n)}),void 0!=this.id&&n.attr({id:this.id});var s=t("<h2 />").attr({style:"text-align: "+("rtl"==B.settings.direction?"right":"left")}).text(this.title).appendTo(n);t("<img />").prop({class:("rtl"==B.settings.direction?"floatLeft":"floatRight")+" cursorPointer",src:this.image}).prependTo(s);t("<i />").prop({class:("rtl"==B.settings.direction?"floatLeft":"floatRight")+" cursorPointer "+this.icon}).prependTo(s).bind(_,function(t){c(t,n,e)}),e.level>0&&g(n);t("<ul />").appendTo(n);t.each(this.items,function(){v(this,n,-1)})})}function o(){var t=B.settings.container.find("nav").length>0?B.settings.container.find("nav"):B.settings.menu;if(0==t.length)return!1;t.prop({id:B.settings.menuID,className:B.settings.wrapperClass}),d(t)}function d(e){void 0==e.level&&(e.level=0),t.each(e,function(){var i=t("<div />").attr({class:"levelHolderClass"+("rtl"==B.settings.direction?" rtl":" ltr"),"data-level":e.level,style:("rtl"==B.settings.direction?"margin-right: ":"margin-left: ")+(0!=e.level||B.settings.collapsed?"-200%":0)}).appendTo(e);x(B.settings.menuWidth)||k(B.settings.menuWidth)&&B.settings.menuWidth;i.bind(N,function(t){m(t,i)});var n=e.children("h2");n.attr({style:"text-align: "+("rtl"==B.settings.direction?"right":"left")}),n.appendTo(i);var s=n.children("i");s.addClass(("rtl"==B.settings.direction?"floatLeft":"floatRight")+" cursorPointer"),s.bind(_,function(t){c(t,i,e)}),e.level>0&&g(i);var a=e.children("ul");a.appendTo(i),t.each(a.children("li"),function(){var n=t(this);n.attr({style:"text-align: "+("rtl"==B.settings.direction?"right":"left")});var s=n.children("a");s.children("i").addClass("rtl"==B.settings.direction?"floatLeft":"floatRight"),n.children("ul").length>0?(s.bind(_,function(t){u(t,i,n)}),h(s),n.level=e.level+1,d(n)):s.bind(_,function(t){f(t,i,n)})})})}function c(e,i,n){if(t(B).find("div.levelHolderClass").is(":animated"))return!1;B.settings.onTitleItemClick.apply(this,Array.prototype.slice.call([e,i,B.settings])),s(e);var a="rtl"==B.settings.direction?parseInt(i.css("margin-right"))<0:parseInt(i.css("margin-left"))<0;if(0==n.level&&a)S();else{var r=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?t(this).attr("data-level")>i.attr("data-level")&&parseInt(t(this).css("margin-right"))>=0:t(this).attr("data-level")>i.attr("data-level")&&parseInt(t(this).css("margin-left"))>=0}),l=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?t(this).attr("data-level")<=i.attr("data-level")&&parseInt(t(this).css("margin-right"))>=0:t(this).attr("data-level")<=i.attr("data-level")&&parseInt(t(this).css("margin-left"))>=0});0==r.length&&1==l.length?T():T(parseInt(i.attr("data-level")))}i.css("visibility","visible"),i.find("."+B.settings.backItemClass).css("visibility","visible"),i.find("ul").css("visibility","visible"),i.removeClass(B.settings.menuInactiveClass)}function g(e){var i=t("<div />").attr({class:B.settings.backItemClass}).appendTo(e),n=t("<a />").prop({href:"#"}).text(B.settings.backText).appendTo(i);t("<i />").prop({class:("rtl"==B.settings.direction?"floatLeft ":"floatRight ")+B.settings.backItemIcon}).prependTo(n);n.bind(_,function(t){p(t,e)})}function p(e,i){if(t(B).find("div.levelHolderClass").is(":animated"))return!1;B.settings.onBackItemClick.apply(this,Array.prototype.slice.call([e,i,B.settings])),s(e),T(parseInt(i.attr("data-level")-1))}function u(e,i,n){if(t(B).find("div.levelHolderClass").is(":animated"))return!1;B.settings.onGroupItemClick.apply(this,Array.prototype.slice.call([e,i,n,B.settings])),S(n.find("div:first")),B.settings.preventGroupItemClick&&s(e)}function h(e){t("<i />").attr({class:("rtl"==B.settings.direction?" floatRight iconSpacing_rtl ":" floatLeft iconSpacing_ltr ")+B.settings.groupIcon}).prependTo(e)}function v(){var e=arguments[0],i=arguments[1],n=arguments[2],s=i.find("ul:first"),a=t("<li />");n<s.children("li").length&&n>=0?a.insertBefore(s.children("li").eq(n)):a.appendTo(s),a.attr({style:"text-align: "+("rtl"==B.settings.direction?"right":"left")}),void 0!=e.id&&a.attr({id:e.id});var r=t("<a />").prop({href:e.link}).text(e.name).appendTo(a);t("<img />").prop({class:"rtl"==B.settings.direction?"floatLeft":"floatRight",src:e.image}).prependTo(r),t("<i />").prop({class:("rtl"==B.settings.direction?"floatLeft ":"floatRight ")+e.icon}).prependTo(r);e.items?(r.bind(_,function(t){u(t,i,a)}),h(r),e.items.level=parseInt(i.attr("data-level"),10)+1,l(e.items,a)):r.bind(_,function(t){f(t,i,a)})}function f(t,e,i){B.settings.onItemClick.apply(this,Array.prototype.slice.call([t,e,i,B.settings])),B.settings.preventItemClick&&s(t)}function m(e,i){if(0==B.settings.onMenuSwipe.apply(this,Array.prototype.slice.call([e,i,B.settings])))return!1;if(t(B).find("div.levelHolderClass").is(":animated"))return!1;var n=i.attr("data-level")>0?i.attr("data-level")-1:void 0;if("touchmove"!=e.type||"touchscreen"!==B.settings.swipe&&"both"!==B.settings.swipe){if("mousedown"==e.type&&("desktop"===B.settings.swipe||"both"===B.settings.swipe)){s(e);var a=0;i.unbind("mousemove"),i.bind("mousemove",function(t){if(a=t.clientX-e.clientX,Math.abs(a)>.3*B.settings.overlapWidth)return i.unbind("mousemove"),"rtl"==B.settings.direction&&(a*=-1),a>0?S(void 0==n?n:i):T(n),!0}),B.settings.container.unbind("mouseup"),B.settings.container.bind("mouseup",function(t){s(t),i.unbind("mousemove"),B.settings.container.unbind("mouseup")})}}else{if(s(e),!(e=e.touches?e:e.originalEvent).touches||e.touches.length<=0)return!1;var r=e.touches[0];if(B.settings.container.unbind("touchend"),B.settings.container.bind("touchend",function(t){s(t),i.significance=0,i.swipeStart=0,B.settings.container.unbind("touchend")}),void 0==i.swipeStart||0==i.swipeStart)return i.significance=0,i.swipeStart=r.pageX,!0;i.significance=r.pageX-i.swipeStart,Math.abs(i.significance)>.3*B.settings.overlapWidth&&("rtl"==B.settings.direction&&(i.significance*=-1),i.significance>0?S(void 0==n?n:i):T(n),i.significance=0,i.swipeStart=0)}}function y(){var e=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?parseInt(t(this).css("margin-right"))>=0&&t(this).position().left<B.settings.container.width()-B.settings.overlapWidth:parseInt(t(this).css("margin-left"))>=0&&t(this).position().left>=0});return e.length<1&&(e=!1),e}function w(){var e=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?t(this).position().left>B.settings.container.width()||parseInt(t(this).css("margin-right"))<0:t(this).position().left<0||parseInt(t(this).css("margin-left"))<0});return e.length<1&&(e=!1),e}function b(){if(!B.redraw){B.redraw=!0;var e,i=arguments[0],n=arguments[1],s=arguments[2],a=t("#"+B.settings.menuID+" div.levelHolderClass").first().css("filter").match(/DXImageTransform\.Microsoft\.Shadow/)?t("#"+B.settings.menuID+" div.levelHolderClass").first().get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength:0,r=void 0==i?Math.max.apply(null,t("#"+B.settings.menuID+" div.levelHolderClass").map(function(){return t(this).width()}).get())-a:i-a,l=Math.max.apply(null,t("#"+B.settings.menuID+" div.levelHolderClass").map(function(){return t(this).attr("data-level")}).get()),o=x(B.settings.menuWidth)||k(B.settings.menuWidth)&&B.settings.menuWidth>0,d=x(B.settings.menuHeight)||k(B.settings.menuHeight)&&B.settings.menuHeight>0,c=void 0==s?t("#"+B.settings.menuID+" div.levelHolderClass"):s;o||void 0==B.menuWidth||(r=B.menuWidth),o&&void 0==i?c.width(B.settings.menuWidth):c.width(r),o&&((0==c.width()||x(B.settings.menuWidth)&&-1!=B.settings.menuWidth.indexOf("%"))&&void 0==i&&(c.css("min-width",""),c.width(parseInt(B.settings.container.parent().width()*parseInt(B.settings.menuWidth)/100))),r=c.width()-a,c.css("min-width",c.width()-a+"px"));var g=o&&void 0==i?c.width()-a+l*(B.settings.overlapWidth+a):r+l*(B.settings.overlapWidth+a),p=void 0==n?Math.max.apply(null,t("#"+B.settings.menuID+" div.levelHolderClass").map(function(){return t(this).height()}).get()):n;B.settings.container.css("min-height",""),B.settings.container.children("nav:first").css("min-height",""),d?(B.settings.container.height(B.settings.menuHeight),B.settings.container.css("min-height",B.settings.menuHeight),B.settings.container.children("nav:first").css("min-height",B.settings.menuHeight),t("#"+B.settings.menuID).height(B.settings.menuHeight),p=B.settings.container.height()):t("#"+B.settings.menuID).height(p),B.settings.container.css("min-height",p+"px"),B.settings.container.children("nav:first").css("min-height",p+"px"),B.settings.container.width(g),B.settings.container.height(p);var u=t("#"+B.settings.menuID+" div.levelHolderClass:first"),h=y(),v=w(),f=O(),m=1==f.length?f.attr("data-level"):0;h&&h.each(function(){"overlap"==B.settings.mode&&t(this).width(t(this).width()+(parseInt(m,10)-parseInt(t(this).attr("data-level"),10))*(B.settings.overlapWidth+a))}),v&&v.each(function(){"rtl"==B.settings.direction?t(this).css("margin-right",t(this).attr("data-level")!=u.attr("data-level")||B.settings.fullCollapse?-2*t(this).width():-1*t(this).width()+B.settings.overlapWidth):t(this).css("margin-left",t(this).attr("data-level")!=u.attr("data-level")||B.settings.fullCollapse?-2*t(this).width():-1*t(this).width()+B.settings.overlapWidth)}),e=u.width()+parseInt(u.css("rtl"==B.settings.direction?"margin-right":"margin-left"),10),I(B.settings.container,e),B.menuWidth=r,B.menuHeight=p,B.redraw=!1}}function I(t,e){if(void 0==t||void 0==e)return!1;t.css("min-width",""),t.css("min-width",e+"px"),t.children("nav:first").css("min-width",""),t.children("nav:first").css("min-width",e+"px"),t.width(e)}function C(){var e=t("#"+B.settings.menuID+" div.levelHolderClass:first");B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?(t(this).position().left>B.settings.container.width()||parseInt(t(this).css("margin-right"))<0)&&t(this).attr("data-level")>e.attr("data-level"):(t(this).position().left<0||parseInt(t(this).css("margin-left"))<0)&&t(this).attr("data-level")>e.attr("data-level")}).each(function(){"rtl"==B.settings.direction?t(this).css("margin-right",t(this).attr("data-level")!=e.attr("data-level")||B.settings.collapsed?-2*t(this).width():0):t(this).css("margin-left",t(this).attr("data-level")!=e.attr("data-level")||B.settings.collapsed?-2*t(this).width():0)}),"rtl"==B.settings.direction?e.css("margin-right",B.settings.collapsed?-2*e.width():0):e.css("margin-left",B.settings.collapsed?-2*e.width():0)}function k(t){return"number"==typeof t&&parseFloat(t)==parseInt(t,10)&&!isNaN(t)}function x(t){return"string"==typeof t&&(-1!=t.indexOf("%")||-1!=t.indexOf("px")||-1!=t.indexOf("em"))}function W(){e&&void 0!=e.menu?r():o();return a(B.settings.container,_),b(),C(),D(B.settings.collapsed),B.settings.onMenuReady.apply(this,Array.prototype.slice.call([B.settings])),G}function D(e){if(e){var i=t("#"+B.settings.menuID+" div.levelHolderClass:first");i.find("ul").hide(),i.addClass(B.settings.menuInactiveClass),"rtl"==B.settings.direction?i.stop().animate({marginRight:-1*i.width()+(B.settings.fullCollapse?0:B.settings.overlapWidth)},B.settings.durationSlideOut):i.stop().animate({marginLeft:-1*i.width()+(B.settings.fullCollapse?0:B.settings.overlapWidth)},B.settings.durationSlideOut)}}function H(e){if(null==B.settings.containersToPush)return!1;t.each(B.settings.containersToPush,function(){var i=parseInt(t(this).css("margin-left")),n=k(i)?i:0,s=parseInt(t(this).css("margin-right")),a=k(s)?s:0;t(this).stop().animate({marginLeft:n+("rtl"==B.settings.direction?-1:1)*e,marginRight:a+("rtl"==B.settings.direction?1:-1)*e},B.settings.durationSlideOut)})}function T(){if(t(B).find("div.levelHolderClass").is(":animated"))return!1;B.settings.onCollapseMenuStart.apply(this,Array.prototype.slice.call([B.settings]));var e,i,n,s,a=arguments[0],r=arguments[1],l={},o=t("#"+B.settings.menuID+" div.levelHolderClass:first"),d=void 0==a;if(l.collapsingEnded=!1,"object"==typeof a)a=a.attr("data-level");else if("string"==typeof a){var c=M(a);a=c&&1==c.length?c.attr("data-level"):o.attr("data-level")}else(void 0==a||!k(a)||a<0)&&(a=o.attr("data-level"));void 0==r&&"object"!=typeof r?r=[{method:B.settings.onCollapseMenuEnd,args:[B.settings]}]:t.merge(r,[{method:B.settings.onCollapseMenuEnd,args:[B.settings]}]);var g=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?t(this).attr("data-level")>a&&parseInt(t(this).css("margin-right"))>=0&&t(this).position().left<B.settings.container.width()-B.settings.overlapWidth:t(this).attr("data-level")>a&&parseInt(t(this).css("margin-left"))>=0&&t(this).position().left>=0}),p=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?t(this).attr("data-level")<=a&&parseInt(t(this).css("margin-right"))>=0&&t(this).position().left<B.settings.container.width()-B.settings.overlapWidth:t(this).attr("data-level")<=a&&parseInt(t(this).css("margin-left"))>=0&&t(this).position().left>=0});return p.length>0&&(l.prevAnimEnded=!1,g.each(function(n,s){e=t(s).css("filter").match(/DXImageTransform\.Microsoft\.Shadow/)?t(s).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength:0,i="overlap"==B.settings.mode?t(s).width()-(g.length+p.length-t(s).attr("data-level")-1)*(B.settings.overlapWidth+e)-e:t(s).width()-e,"rtl"==B.settings.direction?t(s).stop().animate({marginRight:-1*i,width:i},B.settings.durationTransition):t(s).stop().animate({marginLeft:-1*i,width:i},B.settings.durationTransition)}),l.nextAnimEnded=!(g.length>0),g.last().queue(function(){l.nextAnimEnded=!0,z(l,r)}),p.each(function(r,l){e=t(l).css("filter").match(/DXImageTransform\.Microsoft\.Shadow/)?t(l).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength:0;var c=p.filter(function(){return t(this).attr("data-level")==a});c.css("visibility","visible"),c.find("."+B.settings.backItemClass).css("visibility","visible"),c.find("ul").css("visibility","visible"),c.removeClass(B.settings.menuInactiveClass),i="overlap"==B.settings.mode?t(l).width()-g.length*(B.settings.overlapWidth+e)-e:t(l).width()-e,"rtl"==B.settings.direction?t(l).stop().animate({width:i,marginRight:t(l).attr("data-level")==o.attr("data-level")&&d?B.settings.fullCollapse?-1*t(l).width():-1*t(l).width()+("overlap"==B.settings.mode?g.length+1:1)*B.settings.overlapWidth:0},B.settings.durationSlideOut,function(){t(l).attr("data-level")==o.attr("data-level")&&d&&o.children("ul").first().hide(B.settings.durationSlideDown,function(){o.addClass(B.settings.menuInactiveClass)}),s=o.width()+parseInt(o.css("margin-right"),10),I(B.settings.container,s)}):t(l).stop().animate({width:i,marginLeft:t(l).attr("data-level")==o.attr("data-level")&&d?B.settings.fullCollapse?-1*t(l).width():-1*t(l).width()+("overlap"==B.settings.mode?g.length+1:1)*B.settings.overlapWidth:0},B.settings.durationSlideOut,function(){t(l).attr("data-level")==o.attr("data-level")&&d&&o.children("ul").first().hide(B.settings.durationSlideDown,function(){o.addClass(B.settings.menuInactiveClass)}),s=o.width()+parseInt(o.css("margin-left"),10),I(B.settings.container,s)}),n="overlap"==B.settings.mode?g.length*(B.settings.overlapWidth+e)*-1:0,H(t(l).attr("data-level")==o.attr("data-level")&&d?B.settings.fullCollapse?-1*(o.width()-e):-1*(o.width()-e)+B.settings.overlapWidth:n)}),p.last().queue(function(){l.prevAnimEnded=!0,z(l,r)})),l.collapsingEnded=!0,z(l,r),G}function A(){if(t(B).find("div.levelHolderClass").is(":animated"))return!1;B.settings.onExpandMenuStart.apply(this,Array.prototype.slice.call([B.settings]));var e,i,n,s,a=arguments[0],r=arguments[1],l={},o=t("#"+B.settings.menuID+" div.levelHolderClass:first"),d=void 0==a,c="rtl"==B.settings.direction?parseInt(o.css("margin-right"),10)<0||o.position().left>=B.settings.container.width()-B.settings.overlapWidth:parseInt(o.css("margin-left"),10)<0||o.position().left<0;if(l.expandingEnded=!1,void 0==r&&"object"!=typeof r?r=[{method:B.settings.onExpandMenuEnd,args:[B.settings]}]:t.merge(r,[{method:B.settings.onExpandMenuEnd,args:[B.settings]}]),d){l.baseAnimEnded=!1,o.removeClass(B.settings.menuInactiveClass),s=o.width(),I(B.settings.container,s),"rtl"==B.settings.direction?o.stop().animate({marginRight:0},B.settings.durationSlideOut,function(){o.children("ul").first().show(B.settings.durationSlideDown,function(){l.baseAnimEnded=!0,z(l,r)})}):o.stop().animate({marginLeft:0},B.settings.durationSlideOut,function(){o.children("ul").first().show(B.settings.durationSlideDown,function(){l.baseAnimEnded=!0,z(l,r)})}),n=B.settings.fullCollapse?o.width():o.width()-B.settings.overlapWidth;X(o)||H(n)}else{var g;if("object"==typeof a?g=a:"string"==typeof a?g=M(a):(g=null,t.error("Provided menu selector is not valid")),g&&1==g.length){var p=O(),u=1==p.length?p.attr("data-level"):0,h=g.width(),v=j(g);if(l.setToOpenAnimEnded=!1,v){var f=t(v).length-1;o.find("ul").each(function(){t(this).show(0)}),t(v).find("ul").css("visibility","hidden"),t(v).find("div").css("visibility","visible"),t(v).find("."+B.settings.backItemClass).css("visibility","hidden"),t(v).each(function(n,s){e=t(s).css("filter").match(/DXImageTransform\.Microsoft\.Shadow/)?t(s).get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength:0,i=h-e+(f-t(s).attr("data-level"))*(B.settings.overlapWidth+e),B.settings.container.width()<i&&"overlap"==B.settings.mode&&I(B.settings.container,i),"rtl"==B.settings.direction?t(s).stop().animate({marginRight:0,width:"overlap"==B.settings.mode?i:h-e},B.settings.durationTransition,function(){t(s).addClass(B.settings.menuInactiveClass)}):t(s).stop().animate({marginLeft:0,width:"overlap"==B.settings.mode?i:h-e},B.settings.durationTransition,function(){t(s).addClass(B.settings.menuInactiveClass)})}),t(v).last().queue(function(){t(this).removeClass(B.settings.menuInactiveClass),l.setToOpenAnimEnded=!0,z(l,r)}),c&&H(n=B.settings.fullCollapse?o.width():o.width()-B.settings.overlapWidth),"overlap"==B.settings.mode&&H(c?h+(f-(B.settings.fullCollapse?0:1))*(B.settings.overlapWidth+e):(f-u)*(B.settings.overlapWidth+e)),g.css("visibility","visible"),g.find("."+B.settings.backItemClass).css("visibility","visible"),g.find("ul").css("visibility","visible"),g.removeClass(B.settings.menuInactiveClass)}else t.error("Invalid menu object provided")}else t.error("No or too many menus named "+a)}l.expandingEnded=!0,z(l,r)}function S(){var e,i,n,s,a=arguments[0],r=O();return"object"==typeof a?e=a:"string"==typeof a?(s=M(a))?e=s.eq(0):t.error(a+" menu level does not exist!"):e=t("#"+B.settings.menuID+" div.levelHolderClass:first"),i=R(e,r,!0),n=i.length>0?Math.max.apply(null,i.map(function(){return t(this).attr("data-level")}).get()):0,n<r.attr("data-level")?T(n,[{method:A,args:arguments}]):A.apply(this,Array.prototype.slice.call(arguments)),G}function M(){var e=arguments[0],i=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){var i=t(this).children("h2").text();return"[object RegExp]"===Object.prototype.toString.call(e)?i.match(e):i===e.toString()});return n=i.length>0&&i}function E(){var e=arguments[0],i=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass li").filter(function(){var i=t(this).children("a").text();return"[object RegExp]"===Object.prototype.toString.call(e)?i.match(e):i===e.toString()});return n=i.length>0&&i}function j(){var e,i,s=arguments[0];return void 0==s||1!=s.length?n=!1:(e=s.parents("div.levelHolderClass"),i=t.merge(e.get().reverse(),s.get()),n=i)}function R(){var e,i,s,a,r,l,o,d=arguments[0],c=arguments[1],g=void 0!=arguments[2]&&arguments[2];return void 0==d||void 0==c?n=!1:(e=1==d.length?d.parents("div.levelHolderClass"):null,i=1==c.length?c.parents("div.levelHolderClass"):null,s=null!=e?t.merge(e.get().reverse(),d.get()):[],a=null!=i?t.merge(i.get().reverse(),c.get()):[],r=s.length>=a.length?s:a,l=r===s?a:s,o=t(r).filter(function(){return g?-1!=t.inArray(this,l):-1==t.inArray(this,l)}),n=o)}function O(){var e=B.settings.container.find("#"+B.settings.menuID+" div.levelHolderClass").filter(function(){return"rtl"==B.settings.direction?parseInt(t(this).css("margin-right"))>=0&&t(this).position().left<B.settings.container.width()-B.settings.overlapWidth:parseInt(t(this).css("margin-left"))>=0&&t(this).position().left>=0}),i=Math.max.apply(null,e.map(function(){return t(this).attr("data-level")}).get()),s=e.filter(function(){return t(this).attr("data-level")==i});return n=s}function X(){var t=arguments[0];return void 0!=t&&("rtl"==B.settings.direction?parseInt(t.css("margin-right"))>=0&&t.position().left<B.settings.container.width()-B.settings.overlapWidth:parseInt(t.css("margin-left"))>=0&&t.position().left>=0)}function L(){var e=arguments[0],i=arguments[1],n=arguments[2];if(void 0==i||"object"!=typeof e||!i)return!1;void 0==e.level&&(e.level=parseInt(i.attr("data-level"),10)),void 0==n&&(n=0);i.find("ul:first");return t.each(e,function(){void 0!=this.name&&v(this,i,n)}),b(B.menuWidth),G}function q(){var e=arguments[0];if(void 0==e||"object"!=typeof e||0==e.length)return!1;e.remove();var i=O();if(1==i.length){i.css("visibility","visible"),i.find("."+B.settings.backItemClass).css("visibility","visible"),i.find("ul").css("visibility","visible"),i.removeClass(B.settings.menuInactiveClass);var n=i.width()-B.menuWidth;if(0!=n){var s=y();s&&s.each(function(){t(this).width(t(this).width()-n)})}}return b(B.menuWidth),G}function z(e,i){var n=!0;t.each(e,function(t,e){n=n&&e}),n&&window.setTimeout(function(){t.each(i,function(t,e){e.method.apply(this,Array.prototype.slice.call(e.args))})},1)}function P(){var e=!1;return void 0!=B.settings[arguments[0]]?(void 0!=arguments[1]&&(B.settings[arguments[0]]=arguments[1]),e=B.settings[arguments[0]]):t.error("No option "+arguments[0]+" found in jQuery.multilevelpushmenu"),e}var _,N,B=this,G=t(this),Y=void 0!=G.context?G:t("body"),Q=e&&void 0!=e.menu?e.menu:G.find("nav"),F=t.extend({container:Y,containersToPush:null,menuID:(void 0!=Y.prop("id")&&""!=Y.prop("id")?Y.prop("id"):this.nodeName.toLowerCase())+"_multilevelpushmenu",wrapperClass:"multilevelpushmenu_wrapper",menuInactiveClass:"multilevelpushmenu_inactive",menu:Q,menuWidth:0,menuHeight:0,collapsed:!1,fullCollapse:!1,direction:"ltr",backText:"Back",backItemClass:"backItemClass",backItemIcon:"fa fa-angle-right",groupIcon:"fa fa-angle-left",mode:"overlap",overlapWidth:40,preventItemClick:!0,preventGroupItemClick:!0,swipe:"both",durationSlideOut:400,durationSlideDown:500,durationTransition:400,onCollapseMenuStart:function(){},onCollapseMenuEnd:function(){},onExpandMenuStart:function(){},onExpandMenuEnd:function(){},onGroupItemClick:function(){},onItemClick:function(){},onTitleItemClick:function(){},onBackItemClick:function(){},onMenuReady:function(){},onMenuSwipe:function(){}},e);t.data(B,"plugin_multilevelpushmenu")||(t.data(B,"plugin_multilevelpushmenu",F),B.settings=t.data(B,"plugin_multilevelpushmenu"));var V={init:function(){return W.apply(this,Array.prototype.slice.call(arguments))},collapse:function(){return T.apply(this,Array.prototype.slice.call(arguments))},expand:function(){return S.apply(this,Array.prototype.slice.call(arguments))},menuexpanded:function(){return X.apply(this,Array.prototype.slice.call(arguments))},activemenu:function(){return O.apply(this,Array.prototype.slice.call(arguments))},findmenusbytitle:function(){return M.apply(this,Array.prototype.slice.call(arguments))},finditemsbyname:function(){return E.apply(this,Array.prototype.slice.call(arguments))},pathtoroot:function(){return j.apply(this,Array.prototype.slice.call(arguments))},comparepaths:function(){return R.apply(this,Array.prototype.slice.call(arguments))},option:function(){return P.apply(this,Array.prototype.slice.call(arguments))},additems:function(){return L.apply(this,Array.prototype.slice.call(arguments))},removeitems:function(){return q.apply(this,Array.prototype.slice.call(arguments))},redraw:function(){return b.apply(this,Array.prototype.slice.call(arguments))},visiblemenus:function(){return y.apply(this,Array.prototype.slice.call(arguments))},hiddenmenus:function(){return w.apply(this,Array.prototype.slice.call(arguments))},propagateevent:function(){return a.apply(this,Array.prototype.slice.call(arguments))}};return!function(){var t=!1;return function(e){(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)}(navigator.userAgent||navigator.vendor||window.opera),t}()?(_="click",N="mousedown"):(_="touchend",N="touchmove"),V[e]?n=V[e].apply(this,Array.prototype.slice.call(i,1)):"object"!=typeof e&&e?(t.error("No "+e+" method found in jQuery.multilevelpushmenu"),void(n||(n=this))):n=V.init.apply(this,arguments)}),n}}(jQuery);