mirror of
https://github.com/moexe/FFFGateway-Monitoring.git
synced 2024-11-23 22:23:41 +01:00
e030b64b85
und aufgeräumt
2 lines
9.3 KiB
JavaScript
2 lines
9.3 KiB
JavaScript
/*! jQuery Responsive Menu 2015-06-14 version: 0.2.1 */
|
|
!function(a,b,c,d,e){"use strict";var f="rMenu",g=function(c,d){var e=this;e.optionsInit={minWidth:"769px",transitionSpeed:400,jqueryEasing:"swing",css3Easing:"ease",toggleBtnBool:!0,toggleSel:".rm-toggle",menuSel:"ul",menuItemsSel:"li",animateBool:!0,accelerateBool:!1,setupCallback:!1,tabindexStart:1,developmentMode:!1},e.options=a.extend({},e.optionsInit,d),e.tButton=a(e.options.toggleSel),e.tButtonClass="rm-button",e.tButtonShowClass="rm-show",e.tButtonActiveClass="rm-active",e.el=a(c),e.navElementClass="rm-nav",e.container=e.el.parent(),e.containerClass="rm-container",e.expandedClass="rm-layout-expanded",e.contractedClass="rm-layout-contracted",e.noJSClass="rm-nojs",e.menus=e.el.find(e.options.menuSel),e.menuClass="rm-menu",e.topMenu=e.el.children(e.options.menuSel),e.topMenuClass="rm-top-menu",e.menuExpandedClass="rm-menu-expanded",e.menuHiddenClass="accessibly-hidden",e.menuCalcClass="rm-calculate",e.menuItemClass="rm-menu-item",e.itemFocused=!1,e.parentClass="rm-parent",e.itemHoverClass="rm-hover",e.itemFirst="rm-first",e.itemLast="rm-last",e.item2ndLast="rm-2nd-last",e.animateClass="rm-css-animate",e.animateBool=e.options.animateBool,e.accelerateClass="rm-accelerate",e.accelerateBool=e.options.accelerateBool,e.touchMoveBool=!1,e.timer=!1,e.windowWidth=a(b).width(),e.init=function(){return e.setup(),a(b).on({resize:function(){a(b).width()!==e.windowWidth&&(e.windowWidth=a(b).width(),clearTimeout(e.timer),e.timer=setTimeout(e.adjust,500))}}),"function"==typeof e.options.setupCallback&&e.options.setupCallback(),this},e.setup=function(){return e.container.addClass(e.containerClass),e.options.toggleBtnBool?e.tButton.addClass(e.tButtonClass):e.tButton.removeClass(e.tButtonClass),e.tButton.removeClass(e.noJSClass).off("mousedown.rm focusin.rm click.rm").on("mousedown.rm focusin.rm",f).on("click.rm",g).attr("tabindex",0),e.menus.addClass(e.menuClass).attr("aria-hidden","false").hide(),e.topMenu.addClass(e.topMenuClass),e.animateBool?"undefined"!=typeof Modernizr?Modernizr.csstransitions?Modernizr.csstransforms3d||(e.accelerateBool=!1):(e.animateBool=!1,e.accelerateBool=!1):i()?h()||(e.accelerateBool=!1):(e.animateBool=!1,e.accelerateBool=!1):e.accelerateBool=!1,e.animateBool&&(e.menus.addClass(e.animateClass),e.accelerateBool&&e.menus.addClass(e.accelerateClass)),e.el.removeClass(e.noJSClass).addClass(e.navElementClass).off("focusin.rm focusout.rm click.rm touchend.rm touchmove.rm").on("focusin.rm",e.options.menuItemsSel,l).on("focusout.rm",e.topMenu,n).on("click.rm touchend.rm",e.options.menuItemsSel,k).on("touchmove.rm",e.options.menuItemsSel,m).find(e.options.menuItemsSel).each(function(){var b=a(this);b.addClass(e.menuItemClass).children("a").attr("tabindex",0),b.is(":first-child")&&b.addClass(e.itemFirst),b.is(":last-child")&&b.addClass(e.itemLast).prev().addClass(e.item2ndLast)}).addBack().removeClass(e.parentClass).has(e.options.menuSel).addClass(e.parentClass),e.adjust(),this},e.adjust=function(c){c="undefined"!=typeof c?c:e.options.minWidth,"undefined"!=typeof Modernizr&&Modernizr.mq("only all")?(e.options.developmentMode&&console.log("Modernizr: MQ supported"),Modernizr.mq("( min-width: "+c+" )")?e.layoutExpanded():e.layoutContracted()):(e.options.developmentMode&&console.log("unable to detect MQ support"),a(b).outerWidth()<parseInt(c)?e.layoutContracted():e.layoutExpanded())},e.layoutContracted=function(){return e.container.hasClass(e.contractedClass)||(n({type:"layoutContracted"}),e.container.removeClass(e.expandedClass).addClass(e.contractedClass).find("."+e.itemHoverClass).removeClass(e.itemHoverClass),e.animateBool&&e.calculateHeights(),e.el.off("mouseenter.le mouseleave.le"),e.tButton.addClass(e.tButtonShowClass),e.tButton.hasClass(e.tButtonActiveClass)?(e.topMenu.removeClass(e.menuHiddenClass).show().addClass(e.menuExpandedClass),e.animateBool&&e.topMenu.css({"max-height":"none"})):e.topMenu.addClass(e.menuHiddenClass).show().removeClass(e.menuExpandedClass)),e.options.developmentMode&&console.log("responsive-menu: contracted layout"),this},e.layoutExpanded=function(){return e.container.hasClass(e.expandedClass)||(n({type:"layoutExpanded"}),e.container.removeClass(e.contractedClass).addClass(e.expandedClass).find("."+e.itemHoverClass).removeClass(e.itemHoverClass),e.animateBool&&e.calculateHeights(),e.el.off("mouseenter.le mouseleave.le").on("mouseenter.le",e.options.menuItemsSel,l).on("mouseleave.le",e.options.menuItemsSel,o).on("mouseleave.le",e.topMenu,n),e.tButton.removeClass(e.tButtonShowClass),e.topMenu.removeClass(e.menuHiddenClass).show().addClass(e.menuExpandedClass),e.animateBool&&e.topMenu.css({"max-height":"none",overflow:"visible"})),e.options.developmentMode&&console.log("responsive-menu: expanded layout"),this},e.calculateHeights=function(){return e.menus.addClass(e.menuCalcClass).removeClass(e.menuExpandedClass).attr("style","").show(0),e.menus.each(function(){var b=a(this);b.data("height",b.height())}).css({"max-height":"0"}).removeClass(e.menuCalcClass),this},e.toggleMenu=function(b){r(e.topMenu),e.topMenu.hasClass(e.menuHiddenClass)?(a(b).addClass(e.tButtonActiveClass),e.topMenu.removeClass(e.menuHiddenClass),e.animateBool?e.topMenu.css("max-height","0"):e.topMenu.hide(0),s(e.el)):(a(b).removeClass(e.tButtonActiveClass),r(e.container))};var f=function(b){b.stopPropagation();a(b.target);clearTimeout(e.timer),e.timer=setTimeout(function(){e.toggleMenu(b.target)},100)},g=function(a){a.preventDefault(),a.stopPropagation()},k=function(b){var c=a(b.currentTarget);b.stopPropagation(),!c.hasClass(e.itemHoverClass)&&c.hasClass(e.parentClass)||e.touchMoveBool?"touchend"!==b.type&&b.preventDefault():(location.href=c.children("a").attr("href"),n(b)),e.touchMoveBool=!1},l=function(b){var c=a(b.currentTarget);b.stopPropagation(),"focusin"!==b.type&&c.children("a").not(":focus").focus(),e.itemFocused=c,clearTimeout(e.timer),e.timer=setTimeout(function(){e.tButton.hasClass(e.tButtonShowClass)&&!e.tButton.hasClass(e.tButtonActiveClass)&&e.toggleMenu(e.tButton.get(0)),c.hasClass(e.parentClass)?c.hasClass(e.itemHoverClass)||(r(c.parent()),s(c)):r(c.parent())},100)},m=function(){e.touchMoveBool=!0},n=function(a){a=a||{type:"callback"},clearTimeout(e.timer),e.timer=setTimeout(function(){e.itemFocused&&(e.itemFocused.children("a").blur(),e.itemFocused=!1),r(e.topMenu)},100)},o=function(b){var c=a(b.currentTarget);clearTimeout(e.timer),e.timer=setTimeout(function(){c.parent().parent().children("a").focus()},100)},p=function(b){if("max-height"===b.originalEvent.propertyName){var c=a(b.currentTarget);b.stopPropagation(),c.css({transition:"","max-height":"0",overflow:"hidden"}).removeClass(e.menuExpandedClass).off("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd").parent().find("."+e.itemHoverClass).addBack().removeClass(e.itemHoverClass),c.hasClass(e.topMenuClass)&&c.addClass(e.menuHiddenClass).show(0),j(e.itemFocused)}},q=function(b){if("max-height"===b.originalEvent.propertyName){var c=a(b.currentTarget);b.stopPropagation(),c.removeClass(e.menuHiddenClass).css({transition:"","max-height":"none",overflow:"visible"}).addClass(e.menuExpandedClass).off("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),c.parent("."+e.parentClass).addClass(e.itemHoverClass),j(e.itemFocused)}},r=function(b){var c=b.find(e.options.menuSel);e.animateBool?(c.each(function(){var b=a(this);0!==b.height()?b.css({"max-height":b.height(),transition:"max-height "+String(e.options.transitionSpeed/1e3)+"s "+e.options.css3Easing,overflow:"hidden"}).on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",p):c.not(b)}),c.hide(0).show(0),c.css({"max-height":"0"}).removeClass(e.menuExpandedClass)):c.each(function(){var b=a(this);0!==b.height()&&b.slideUp(e.options.transitionSpeed,e.options.jqueryEasing,function(){b.css("overflow","visible").removeClass(e.menuExpandedClass).parent("."+e.parentClass).removeClass(e.itemHoverClass),b.hasClass(e.topMenuClass)&&e.topMenu.addClass(e.menuHiddenClass),j(e.itemFocused)})})},s=function(a){var b=a.children(e.options.menuSel);a.siblings("."+e.itemHoverClass).removeClass(e.itemHoverClass),e.animateBool?b.css({transition:"max-height "+String(e.options.transitionSpeed/1e3)+"s "+e.options.css3Easing,"max-height":b.data("height")}).on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",q):b.slideDown(e.options.transitionSpeed,e.options.jqueryEasing,function(){a.addClass(e.itemHoverClass),b.addClass(e.menuExpandedClass).css("overflow","visible"),console.log("jquery expand"),j(e.itemFocused)})};return e.init(c),this};a.fn[f]=function(b){return this.each(function(){var c=a(this);c.data(f)||c.data(f,new g(this,b))})};var h=function(){var a,d=c.createElement("p"),f={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};c.body.insertBefore(d,null);for(var g in f)d.style[g]!==e&&(d.style[g]="translate3d(1px,1px,1px)",a=b.getComputedStyle(d).getPropertyValue(f[g]));return c.body.removeChild(d),a!==e&&a.length>0&&"none"!==a},i=function(){var a=c.body||c.documentElement,b=a.style,d="transition";if("string"==typeof b[d])return!0;var e=["Moz","webkit","Webkit","Khtml","O","ms"];d=d.charAt(0).toUpperCase()+d.substr(1);for(var f=0;f<e.length;f++)if("string"==typeof b[e[f]+d])return!0;return!1},j=function(c){if(c.length){var d=a(b).scrollTop(),e=d+a(b).height(),f=c.offset().top,g=f+c.outerHeight();(g>e||d>f)&&a("html, body").animate({scrollTop:f},"slow")}}}(jQuery,window,document,Math); |