/* jQuery.flexMenu 1.3 https://github.com/352Media/flexMenu Description: If a list is too long for all items to fit on one line, display a popup menu instead. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function i(){e(o).each(function(){e(this).flexMenu({undo:!0}).flexMenu(this.options)})}function n(i){var n,l;n=e("li.flexMenu-viewMore.active"),l=n.not(i),l.removeClass("active").find("> ul").hide()}var l,o=[];e(window).resize(function(){clearTimeout(l),l=setTimeout(function(){i()},200)}),e.fn.flexMenu=function(i){var l,t=e.extend({threshold:2,cutoff:2,linkText:"More",linkTitle:"View More",linkTextAll:"Menu",linkTitleAll:"Open/Close Menu",showOnHover:!0,popupAbsolute:!0,popupClass:"",undo:!1},i);return this.options=t,l=e.inArray(this,o),l>=0?o.splice(l,1):o.push(this),this.each(function(){function i(e){var i=Math.ceil(e.offset().top)>=v+x?!0:!1;return i}var l,o,f,u,s,r,a,p=e(this),d=p.find("> li"),c=d.first(),h=d.last(),M=p.find("li").length,v=Math.floor(c.offset().top),x=Math.floor(c.outerHeight(!0)),T=!1;if(i(h)&&M>t.threshold&&!t.undo&&p.is(":visible")){var w=e('
');c.offset().top;for(w.addClass(t.popupClass),a=M;a>1;a--){if(l=p.find("> li:last-child"),o=i(l),l.appendTo(w),a-1<=t.cutoff){e(p.children().get().reverse()).appendTo(w),T=!0;break}if(!o)break}T?p.append('