From cb2828e072b180bd0976da2e427f6e556cd16421 Mon Sep 17 00:00:00 2001 From: FrDH Date: Wed, 29 Oct 2014 20:17:27 +0100 Subject: [PATCH] bugfix vertical submenus --- src/js/umd/jquery.mmenu.umd.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/js/umd/jquery.mmenu.umd.js diff --git a/src/js/umd/jquery.mmenu.umd.js b/src/js/umd/jquery.mmenu.umd.js new file mode 100644 index 00000000..111a7d39 --- /dev/null +++ b/src/js/umd/jquery.mmenu.umd.js @@ -0,0 +1,40 @@ +(function ( factory ) { + if ( typeof define === 'function' && define.amd ) + { + // AMD. Register as an anonymous module. + define( [ 'jquery' ], factory ); + } + else if ( typeof exports === 'object' ) + { + // Node/CommonJS + factory( require( 'jquery' ) ); + } + else + { + // Browser globals + factory( jQuery ); + } +}( function ( jQuery ) { + + +/* + * jQuery mmenu v4.6.2 + * @requires jQuery 1.7.0 or later + * + * mmenu.frebsite.nl + * + * Copyright (c) Fred Heusschen + * www.frebsite.nl + * + * Licensed under the MIT license: + * http://en.wikipedia.org/wiki/MIT_License + */ +!function(e){function n(){l=!0,d.$wndw=e(window),d.$html=e("html"),d.$body=e("body"),e.each([i,a,o],function(e,n){n.add=function(e){e=e.split(" ");for(var t in e)n[e[t]]=n.mm(e[t])}}),i.mm=function(e){return"mm-"+e},i.add("wrapper menu inline panel nopanel list nolist subtitle selected label spacer current highest hidden opened subopened subopen fullsubopen subclose"),i.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},a.mm=function(e){return"mm-"+e},a.add("parent"),o.mm=function(e){return e+".mm"},o.add("toggle open close setSelected transitionend webkitTransitionEnd mousedown mouseup touchstart touchmove touchend scroll resize click keydown keyup"),e[t]._c=i,e[t]._d=a,e[t]._e=o,e[t].glbl=d}var t="mmenu",s="4.6.2";if(!e[t]){var i={},a={},o={},l=!1,d={$wndw:null,$html:null,$body:null};e[t]=function(e,n,t){return this.$menu=e,this.opts=n,this.conf=t,this.vars={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initMenu(),this._initAnchors(),this._initEvents(),this._init(this.$menu.children(this.conf.panelNodetype)),"function"==typeof this.___debug&&this.___debug(),this},e[t].version=s,e[t].addons=[],e[t].uniqueId=0,e[t].defaults={classes:"",slidingSubmenus:!0,onClick:{setSelected:!0}},e[t].configuration={panelNodetype:"ul, ol, div",transitionDuration:400,openingInterval:25,classNames:{panel:"Panel",selected:"Selected",label:"Label",spacer:"Spacer"}},e[t].prototype={_init:function(n){n=n.not("."+i.nopanel),n=this._initPanels(n);for(var s=0;s li");this.__refactorClass(s,this.conf.classNames.selected,"selected"),this.__refactorClass(s,this.conf.classNames.label,"label"),this.__refactorClass(s,this.conf.classNames.spacer,"spacer"),s.off(o.setSelected).on(o.setSelected,function(n,t){n.stopPropagation(),s.removeClass(i.selected),"boolean"!=typeof t&&(t=!0),t&&e(this).addClass(i.selected)}),this.__refactorClass(this.__findAddBack(n,"."+this.conf.classNames.panel),this.conf.classNames.panel,"panel"),n.add(this.__findAddBack(n,"."+i.list).children().children().filter(this.conf.panelNodetype).not("."+i.nopanel)).addClass(i.panel);var l=this.__findAddBack(n,"."+i.panel),d=e("."+i.panel,this.$menu);if(l.each(function(){var n=e(this),s=n.attr("id")||t.__getUniqueId();n.attr("id",s)}),l.each(function(){var n=e(this),s=n.is("ul, ol")?n:n.find("ul ,ol").first(),o=n.parent(),l=o.find("> a, > span"),d=o.closest("."+i.panel);if(o.parent().is("."+i.list)){n.data(a.parent,o);var r=e('').insertBefore(l);l.is("a")||r.addClass(i.fullsubopen),t.opts.slidingSubmenus&&s.prepend('
  • '+l.text()+"
  • ")}}),this.opts.slidingSubmenus){var r=this.__findAddBack(n,"."+i.list).find("> li."+i.selected);r.parents("li").removeClass(i.selected).end().add(r.parents("li")).each(function(){var n=e(this),t=n.find("> ."+i.panel);t.length&&(n.parents("."+i.panel).addClass(i.subopened),t.addClass(i.opened))}).closest("."+i.panel).addClass(i.opened).parents("."+i.panel).addClass(i.subopened)}else{var r=e("li."+i.selected,d);r.parents("li").removeClass(i.selected).end().add(r.parents("li")).addClass(i.opened)}var u=d.filter("."+i.opened);return u.length||(u=l.first()),u.addClass(i.opened).last().addClass(i.current),this.opts.slidingSubmenus&&l.not(u.last()).addClass(i.hidden).end().appendTo(this.$menu),l},_initAnchors:function(){var n=this;d.$body.on(o.click,"."+i.menu+" a",function(t){var s=e(this),a=s.attr("href")||"",l=e(a);if(l.is("."+i.panel))t.preventDefault(),l.trigger(n.opts.slidingSubmenus?o.open:o.toggle);else if(s.is("."+i.list+" > li > a")&&!s.is('[rel="external"]')&&!s.is('[target="_blank"]')){n.__valueOrFn(n.opts.onClick.setSelected,s)&&s.parent().trigger(o.setSelected);var r=n.__valueOrFn(n.opts.onClick.preventDefault,s,"#"==a.slice(0,1));r&&t.preventDefault(),n.__valueOrFn(n.opts.onClick.blockUI,s,!r)&&d.$html.addClass(i.blocking),n.__valueOrFn(n.opts.onClick.close,s,r)&&n.$menu.trigger(o.close)}})},_initEvents:function(){var n=this;this.$menu.on(o.toggle+" "+o.open+" "+o.close,"."+i.panel,function(e){e.stopPropagation()}),this.opts.slidingSubmenus?this.$menu.on(o.open,"."+i.panel,function(){return n._openSubmenuHorizontal(e(this))}):this.$menu.on(o.toggle,"."+i.panel,function(){var n=e(this);n.trigger(n.parent().hasClass(i.opened)?o.close:o.open)}).on(o.open,"."+i.panel,function(){e(this).parent().addClass(i.opened)}).on(o.close,"."+i.panel,function(){e(this).parent().removeClass(i.opened)})},_openSubmenuHorizontal:function(n){if(n.hasClass(i.current))return!1;var t=e("."+i.panel,this.$menu),s=t.filter("."+i.current);return t.removeClass(i.highest).removeClass(i.current).not(n).not(s).addClass(i.hidden),n.hasClass(i.opened)?s.addClass(i.highest).removeClass(i.opened).removeClass(i.subopened):(n.addClass(i.highest),s.addClass(i.subopened)),n.removeClass(i.hidden).addClass(i.current),setTimeout(function(){n.removeClass(i.subopened).addClass(i.opened)},this.conf.openingInterval),"open"},_update:function(e){if(this.updates||(this.updates=[]),"function"==typeof e)this.updates.push(e);else for(var n=0,t=this.updates.length;t>n;n++)this.updates[n].call(this,e)},__valueOrFn:function(e,n,t){return"function"==typeof e?e.call(n[0]):"undefined"==typeof e&&"undefined"!=typeof t?t:e},__refactorClass:function(e,n,t){e.filter("."+n).removeClass(n).addClass(i[t])},__findAddBack:function(e,n){return e.find(n).add(e.filter(n))},__transitionend:function(e,n,t){var s=!1,i=function(){s||n.call(e[0]),s=!0};e.one(o.transitionend,i),e.one(o.webkitTransitionEnd,i),setTimeout(i,1.1*t)},__getUniqueId:function(){return i.mm(e[t].uniqueId++)}},e.fn[t]=function(s,i){return l||n(),s=e.extend(!0,{},e[t].defaults,s),i=e.extend(!0,{},e[t].configuration,i),this.each(function(){var n=e(this);n.data(t)||n.data(t,new e[t](n,s,i))})},e[t].support={touch:"ontouchstart"in window.document}}}(jQuery); +/* + * jQuery mmenu offCanvas addon + * mmenu.frebsite.nl + * + * Copyright (c) Fred Heusschen + */ +!function(e){function t(e){return e}function o(e){return"string"!=typeof e.pageSelector&&(e.pageSelector="> "+e.pageNodetype),e}function n(){c=!0,a=e[s]._c,p=e[s]._d,r=e[s]._e,a.add("offcanvas modal background opening blocker page"),p.add("style"),r.add("opening opened closing closed setPage"),l=e[s].glbl,l.$allMenus=(l.$allMenus||e()).add(this.$menu),l.$wndw.on(r.keydown,function(e){return l.$html.hasClass(a.opened)&&9==e.keyCode?(e.preventDefault(),!1):void 0});var t=0;l.$wndw.on(r.resize,function(e,o){if(o||l.$html.hasClass(a.opened)){var n=l.$wndw.height();(o||n!=t)&&(t=n,l.$page.css("minHeight",n))}})}var s="mmenu",i="offCanvas";e[s].prototype["_init_"+i]=function(){if(this.opts[i]&&!this.vars[i+"_added"]){this.vars[i+"_added"]=!0,c||n(),this.opts[i]=t(this.opts[i]),this.conf[i]=o(this.conf[i]);var e=this.opts[i],s=this.conf[i],p=[a.offcanvas];"boolean"!=typeof this.vars.opened&&(this.vars.opened=!1),"left"!=e.position&&p.push(a.mm(e.position)),"back"!=e.zposition&&p.push(a.mm(e.zposition)),this.$menu.addClass(p.join(" ")).parent().removeClass(a.wrapper),this[i+"_initPage"](l.$page),this[i+"_initBlocker"](),this[i+"_initAnchors"](),this[i+"_initEvents"](),this.$menu[s.menuInjectMethod+"To"](s.menuWrapperSelector)}},e[s].addons.push(i),e[s].defaults[i]={position:"left",zposition:"back",modal:!1,moveBackground:!0},e[s].configuration[i]={pageNodetype:"div",pageSelector:null,menuWrapperSelector:"body",menuInjectMethod:"prepend"},e[s].prototype.open=function(){if(this.vars.opened)return!1;var e=this;return this._openSetup(),setTimeout(function(){e._openFinish()},this.conf.openingInterval),"open"},e[s].prototype._openSetup=function(){var e=this;l.$allMenus.not(this.$menu).trigger(r.close),l.$page.data(p.style,l.$page.attr("style")||""),l.$wndw.trigger(r.resize,[!0]);var t=[a.opened];this.opts[i].modal&&t.push(a.modal),this.opts[i].moveBackground&&t.push(a.background),"left"!=this.opts[i].position&&t.push(a.mm(this.opts[i].position)),"back"!=this.opts[i].zposition&&t.push(a.mm(this.opts[i].zposition)),this.opts.classes&&t.push(this.opts.classes),l.$html.addClass(t.join(" ")),setTimeout(function(){e.vars.opened=!0},this.conf.openingInterval),this.$menu.addClass(a.current+" "+a.opened)},e[s].prototype._openFinish=function(){var e=this;this.__transitionend(l.$page,function(){e.$menu.trigger(r.opened)},this.conf.transitionDuration),l.$html.addClass(a.opening),this.$menu.trigger(r.opening)},e[s].prototype.close=function(){if(!this.vars.opened)return!1;var e=this;return this.__transitionend(l.$page,function(){e.$menu.removeClass(a.current).removeClass(a.opened),l.$html.removeClass(a.opened).removeClass(a.modal).removeClass(a.background).removeClass(a.mm(e.opts[i].position)).removeClass(a.mm(e.opts[i].zposition)),e.opts.classes&&l.$html.removeClass(e.opts.classes),l.$page.attr("style",l.$page.data(p.style)),e.vars.opened=!1,e.$menu.trigger(r.closed)},this.conf.transitionDuration),l.$html.removeClass(a.opening),this.$menu.trigger(r.closing),"close"},e[s].prototype[i+"_initBlocker"]=function(){var t=this;l.$blck||(l.$blck=e('
    ').appendTo(l.$body)),l.$blck.off(r.touchstart).on(r.touchstart,function(e){e.preventDefault(),e.stopPropagation(),l.$blck.trigger(r.mousedown)}).on(r.mousedown,function(e){e.preventDefault(),l.$html.hasClass(a.modal)||t.close()})},e[s].prototype[i+"_initPage"]=function(t){t||(t=e(this.conf[i].pageSelector,l.$body),t.length>1&&(t=t.wrapAll("<"+this.conf[i].pageNodetype+" />").parent())),t.addClass(a.page),l.$page=t},e[s].prototype[i+"_initAnchors"]=function(){var t=this;l.$body.on(r.click,"a",function(o){var n=e(this),s=t.$menu.attr("id");s&&s.length&&(t.conf.clone&&(s=a.umm(s)),n.is('[href="#'+s+'"]')&&(o.preventDefault(),t.open()));var s=l.$page.attr("id");s&&s.length&&n.is('[href="#'+s+'"]')&&(o.preventDefault(),t.close())})},e[s].prototype[i+"_initEvents"]=function(){var e=this,t=r.open+" "+r.opening+" "+r.opened+" "+r.close+" "+r.closing+" "+r.closed+" "+r.setPage;this.$menu.on(t,function(e){e.stopPropagation()}),this.$menu.on(r.open,function(){e.open()}).on(r.close,function(){e.close()}).on(r.setPage,function(t,o){e[i+"_initPage"](o),e[i+"_initOpenClose"]()})};var a,p,r,l,c=!1}(jQuery); +})); \ No newline at end of file