/*! * SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 * http://www.smartmenus.org/ * * Copyright Vasil Dinkov, Vadikom Web Ltd. * http://vadikom.com * * Licensed MIT */ !function(t) { "function" == typeof define && define.amd ? define(["jquery"], t) : "object" == typeof module && "object" == typeof module.exports ? module.exports = t(require("jquery")) : t(jQuery) }(function($) { var menuTrees = [] , mouse = !1 , touchEvents = "ontouchstart"in window , mouseDetectionEnabled = !1 , requestAnimationFrame = window.requestAnimationFrame || function(t) { return setTimeout(t, 1e3 / 60) } , cancelAnimationFrame = window.cancelAnimationFrame || function(t) { clearTimeout(t) } , canAnimate = !!$.fn.animate; function initMouseDetection(t) { var i = ".smartmenus_mouse"; if (mouseDetectionEnabled || t) mouseDetectionEnabled && t && ($(document).off(i), mouseDetectionEnabled = !1); else { var s = !0 , e = null , o = { mousemove: function(t) { var i = { x: t.pageX, y: t.pageY, timeStamp: new Date().getTime() }; if (e) { var o = Math.abs(e.x - i.x) , a = Math.abs(e.y - i.y); if ((o > 0 || a > 0) && o <= 2 && a <= 2 && i.timeStamp - e.timeStamp <= 300 && (mouse = !0, s)) { var r = $(t.target).closest("a"); r.is("a") && $.each(menuTrees, function() { if ($.contains(this.$root[0], r[0])) return this.itemEnter({ currentTarget: r[0] }), !1 }), s = !1 } } e = i } }; o[touchEvents ? "touchstart" : "pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"] = function(t) { isTouchEvent(t.originalEvent) && (mouse = !1) } , $(document).on(getEventsNS(o, i)), mouseDetectionEnabled = !0 } } function isTouchEvent(t) { return !/^(4|mouse)$/.test(t.pointerType) } function getEventsNS(t, i) { i || (i = ""); var s = {}; for (var e in t) s[e.split(" ").join(i + " ") + i] = t[e]; return s } return $.SmartMenus = function(t, i) { this.$root = $(t), this.opts = i, this.rootId = "", this.accessIdPrefix = "", this.$subArrow = null, this.activatedItems = [], this.visibleSubMenus = [], this.showTimeout = 0, this.hideTimeout = 0, this.scrollTimeout = 0, this.clickActivated = !1, this.focusActivated = !1, this.zIndexInc = 0, this.idInc = 0, this.$firstLink = null, this.$firstSub = null, this.disabled = !1, this.$disableOverlay = null, this.$touchScrollingSub = null, this.cssTransforms3d = "perspective"in t.style || "webkitPerspective"in t.style, this.wasCollapsible = !1, this.init() } , $.extend($.SmartMenus, { hideAll: function() { $.each(menuTrees, function() { this.menuHideAll() }) }, destroy: function() { for (; menuTrees.length; ) menuTrees[0].destroy(); initMouseDetection(!0) }, prototype: { init: function(t) { var i = this; if (!t) { menuTrees.push(this), this.rootId = (new Date().getTime() + Math.random() + "").replace(/\D/g, ""), this.accessIdPrefix = "sm-" + this.rootId + "-", this.$root.hasClass("sm-rtl") && (this.opts.rightToLeftSubMenus = !0); var s = ".smartmenus"; this.$root.data("smartmenus", this).attr("data-smartmenus-id", this.rootId).dataSM("level", 1).on(getEventsNS({ "mouseover focusin": $.proxy(this.rootOver, this), "mouseout focusout": $.proxy(this.rootOut, this), keydown: $.proxy(this.rootKeyDown, this) }, s)).on(getEventsNS({ mouseenter: $.proxy(this.itemEnter, this), mouseleave: $.proxy(this.itemLeave, this), mousedown: $.proxy(this.itemDown, this), focus: $.proxy(this.itemFocus, this), blur: $.proxy(this.itemBlur, this), click: $.proxy(this.itemClick, this) }, s), "a"), s += this.rootId, this.opts.hideOnClick && $(document).on(getEventsNS({ touchstart: $.proxy(this.docTouchStart, this), touchmove: $.proxy(this.docTouchMove, this), touchend: $.proxy(this.docTouchEnd, this), click: $.proxy(this.docClick, this) }, s)), $(window).on(getEventsNS({ "resize orientationchange": $.proxy(this.winResize, this) }, s)), this.opts.subIndicators && (this.$subArrow = $("").addClass("sub-arrow"), this.opts.subIndicatorsText && this.$subArrow.html(this.opts.subIndicatorsText)), initMouseDetection() } if (this.$firstSub = this.$root.find("ul.submenu, ul.sub-menu").each(function() { i.menuInit($(this)) }).eq(0), this.$firstLink = this.$root.find("a").eq(0), this.opts.markCurrentItem) { var e = /(index|default)\.[^#\?\/]*/i , o = /#.*/ , a = window.location.href.replace(e, "") , r = a.replace(o, ""); this.$root.find("a").each(function() { var t = this.href.replace(e, "") , s = $(this); (t == a || t == r) && (s.addClass("current"), i.opts.markCurrentTree && s.parentsUntil("[data-smartmenus-id]", "ul").each(function() { $(this).dataSM("parent-a").addClass("current") })) }) } this.wasCollapsible = this.isCollapsible() }, destroy: function(t) { if (!t) { var i = ".smartmenus"; this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(i), i += this.rootId, $(document).off(i), $(window).off(i), this.opts.subIndicators && (this.$subArrow = null) } this.menuHideAll(); var s = this; this.$root.find("ul").each(function() { var t = $(this); t.dataSM("scroll-arrows") && t.dataSM("scroll-arrows").remove(), t.dataSM("shown-before") && ((s.opts.subMenusMinWidth || s.opts.subMenusMaxWidth) && t.css({ width: "", minWidth: "", maxWidth: "" }).removeClass("sm-nowrap"), t.dataSM("scroll-arrows") && t.dataSM("scroll-arrows").remove(), t.css({ zIndex: "", top: "", left: "", marginLeft: "", marginTop: "", display: "" })), 0 == (t.attr("id") || "").indexOf(s.accessIdPrefix) && t.removeAttr("id") }).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"), this.$root.find("a.has-submenu").each(function() { var t = $(this); 0 == t.attr("id").indexOf(s.accessIdPrefix) && t.removeAttr("id") }).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"), this.opts.subIndicators && this.$root.find("span.sub-arrow").remove(), this.opts.markCurrentItem && this.$root.find("a.current").removeClass("current"), t || (this.$root = null, this.$firstLink = null, this.$firstSub = null, this.$disableOverlay && (this.$disableOverlay.remove(), this.$disableOverlay = null), menuTrees.splice($.inArray(this, menuTrees), 1)) }, disable: function(t) { if (!this.disabled) { if (this.menuHideAll(), !t && !this.opts.isPopup && this.$root.is(":visible")) { var i = this.$root.offset(); this.$disableOverlay = $('
').css({ position: "absolute", top: i.top, left: i.left, width: this.$root.outerWidth(), height: this.$root.outerHeight(), zIndex: this.getStartZIndex(!0), opacity: 0 }).appendTo(document.body) } this.disabled = !0 } }, docClick: function(t) { if (this.$touchScrollingSub) { this.$touchScrollingSub = null; return } (this.visibleSubMenus.length && !$.contains(this.$root[0], t.target) || $(t.target).closest("a").length) && this.menuHideAll() }, docTouchEnd: function(t) { if (this.lastTouch) { if (this.visibleSubMenus.length && (void 0 === this.lastTouch.x2 || this.lastTouch.x1 == this.lastTouch.x2) && (void 0 === this.lastTouch.y2 || this.lastTouch.y1 == this.lastTouch.y2) && (!this.lastTouch.target || !$.contains(this.$root[0], this.lastTouch.target))) { this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = 0); var i = this; this.hideTimeout = setTimeout(function() { i.menuHideAll() }, 350) } this.lastTouch = null } }, docTouchMove: function(t) { if (this.lastTouch) { var i = t.originalEvent.touches[0]; this.lastTouch.x2 = i.pageX, this.lastTouch.y2 = i.pageY } }, docTouchStart: function(t) { var i = t.originalEvent.touches[0]; this.lastTouch = { x1: i.pageX, y1: i.pageY, target: i.target } }, enable: function() { this.disabled && (this.$disableOverlay && (this.$disableOverlay.remove(), this.$disableOverlay = null), this.disabled = !1) }, getClosestMenu: function(t) { for (var i = $(t).closest("ul"); i.dataSM("in-mega"); ) i = i.parent().closest("ul"); return i[0] || null }, getHeight: function(t) { return this.getOffset(t, !0) }, getOffset: function(t, i) { "none" == t.css("display") && (s = { position: t[0].style.position, visibility: t[0].style.visibility }, t.css({ position: "absolute", visibility: "hidden" }).show()); var s, e = t[0].getBoundingClientRect && t[0].getBoundingClientRect(), o = e && (i ? e.height || e.bottom - e.top : e.width || e.right - e.left); return o || 0 === o || (o = i ? t[0].offsetHeight : t[0].offsetWidth), s && t.hide().css(s), o }, getStartZIndex: function(t) { var i = parseInt(this[t ? "$root" : "$firstSub"].css("z-index")); return !t && isNaN(i) && (i = parseInt(this.$root.css("z-index"))), isNaN(i) ? 1 : i }, getTouchPoint: function(t) { return t.touches && t.touches[0] || t.changedTouches && t.changedTouches[0] || t }, getViewport: function(t) { var i = t ? "Height" : "Width" , s = document.documentElement["client" + i] , e = window["inner" + i]; return e && (s = Math.min(s, e)), s }, getViewportHeight: function() { return this.getViewport(!0) }, getViewportWidth: function() { return this.getViewport() }, getWidth: function(t) { return this.getOffset(t) }, handleEvents: function() { return !this.disabled && this.isCSSOn() }, handleItemEvents: function(t) { return this.handleEvents() && !this.isLinkInMegaMenu(t) }, isCollapsible: function() { return "static" == this.$firstSub.css("position") }, isCSSOn: function() { return "inline" != this.$firstLink.css("display") }, isFixed: function() { var t = "fixed" == this.$root.css("position"); return t || this.$root.parentsUntil("body").each(function() { if ("fixed" == $(this).css("position")) return t = !0, !1 }), t }, isLinkInMegaMenu: function(t) { return $(this.getClosestMenu(t[0])).hasClass("mega-menu") }, isTouchMode: function() { return !mouse || this.opts.noMouseOver || this.isCollapsible() }, itemActivate: function(t, i) { var s = t.closest("ul") , e = s.dataSM("level"); if (e > 1 && (!this.activatedItems[e - 2] || this.activatedItems[e - 2][0] != s.dataSM("parent-a")[0])) { var o = this; $(s.parentsUntil("[data-smartmenus-id]", "ul").get().reverse()).add(s).each(function() { o.itemActivate($(this).dataSM("parent-a")) }) } if ($(s).parents(".raven-megamenu-wrapper").length > 0 && (e += $(s).parents(".raven-megamenu-wrapper").length), (!this.isCollapsible() || i) && this.menuHideSubMenus(this.activatedItems[e - 1] && this.activatedItems[e - 1][0] == t[0] ? e : e - 1), this.activatedItems[e - 1] = t, !1 !== this.$root.triggerHandler("activate.smapi", t[0])) { var a = t.dataSM("sub"); a && (this.isTouchMode() || !this.opts.showOnClick || this.clickActivated) && this.menuShow(a) } }, itemBlur: function(t) { var i = $(t.currentTarget); this.handleItemEvents(i) && this.$root.triggerHandler("blur.smapi", i[0]) }, itemClick: function(t) { var i = $(t.currentTarget); if (this.handleItemEvents(i)) { if (this.$touchScrollingSub && this.$touchScrollingSub[0] == i.closest("ul")[0]) return this.$touchScrollingSub = null, t.stopPropagation(), !1; if (!1 === this.$root.triggerHandler("click.smapi", i[0])) return !1; var s = $(t.target).is(".sub-arrow") , e = i.dataSM("sub") , o = !!e && 2 == e.dataSM("level") , a = this.isCollapsible() , r = /toggle$/.test(this.opts.collapsibleBehavior) , n = /link$/.test(this.opts.collapsibleBehavior) , h = /^accordion/.test(this.opts.collapsibleBehavior); if (e && !e.is(":visible")) { if ((!n || !a || s) && (this.opts.showOnClick && o && (this.clickActivated = !0), this.itemActivate(i, h), e.is(":visible"))) return this.focusActivated = !0, !1 } else if (a && (r || s)) return this.itemActivate(i, h), this.menuHide(e), r && (this.focusActivated = !1), !1; if (this.opts.showOnClick && o || i.hasClass("disabled") || !1 === this.$root.triggerHandler("select.smapi", i[0])) return !1 } }, itemDown: function(t) { var i = $(t.currentTarget); this.handleItemEvents(i) && i.dataSM("mousedown", !0) }, itemEnter: function(t) { var i = $(t.currentTarget); if (this.handleItemEvents(i) && !this.opts.showOnClick) { if (!this.isTouchMode()) { this.showTimeout && (clearTimeout(this.showTimeout), this.showTimeout = 0); var s = this; this.showTimeout = setTimeout(function() { s.itemActivate(i) }, this.opts.showOnClick && 1 == i.closest("ul").dataSM("level") ? 1 : this.opts.showTimeout) } this.$root.triggerHandler("mouseenter.smapi", i[0]) } }, itemFocus: function(t) { var i = $(t.currentTarget); this.handleItemEvents(i) && (!this.focusActivated || this.isTouchMode() && i.dataSM("mousedown") || this.activatedItems.length && this.activatedItems[this.activatedItems.length - 1][0] == i[0] || this.itemActivate(i, !0), this.$root.triggerHandler("focus.smapi", i[0])) }, itemLeave: function(t) { var i = $(t.currentTarget); this.handleItemEvents(i) && (!this.isTouchMode() && (i[0].blur(), this.showTimeout && (clearTimeout(this.showTimeout), this.showTimeout = 0)), i.removeDataSM("mousedown"), this.$root.triggerHandler("mouseleave.smapi", i[0])) }, menuHide: function(t) { if (!1 !== this.$root.triggerHandler("beforehide.smapi", t[0]) && (canAnimate && t.stop(!0, !0), "none" != t.css("display"))) { var i = function() { t.css("z-index", "") }; this.isCollapsible() ? canAnimate && this.opts.collapsibleHideFunction ? this.opts.collapsibleHideFunction.call(this, t, i) : t.hide(this.opts.collapsibleHideDuration, i) : canAnimate && this.opts.hideFunction ? this.opts.hideFunction.call(this, t, i) : t.hide(this.opts.hideDuration, i), t.dataSM("scroll") && (this.menuScrollStop(t), t.css({ "touch-action": "", "-ms-touch-action": "", "-webkit-transform": "", transform: "" }).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()), t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded", "false"), t.attr({ "aria-expanded": "false", "aria-hidden": "true" }); var s = t.dataSM("level"); this.activatedItems.splice(s - 1, 1), this.visibleSubMenus.splice($.inArray(t, this.visibleSubMenus), 1), this.$root.triggerHandler("hide.smapi", t[0]) } }, menuHideAll: function() { this.showTimeout && (clearTimeout(this.showTimeout), this.showTimeout = 0); for (var t = this.opts.isPopup ? 1 : 0, i = this.visibleSubMenus.length - 1; i >= t; i--) this.menuHide(this.visibleSubMenus[i]); this.opts.isPopup && (canAnimate && this.$root.stop(!0, !0), this.$root.is(":visible") && (canAnimate && this.opts.hideFunction ? this.opts.hideFunction.call(this, this.$root) : this.$root.hide(this.opts.hideDuration))), this.activatedItems = [], this.visibleSubMenus = [], this.clickActivated = !1, this.focusActivated = !1, this.zIndexInc = 0, this.$root.triggerHandler("hideAll.smapi") }, menuHideSubMenus: function(t) { for (var i = this.activatedItems.length - 1; i >= t; i--) { var s = this.activatedItems[i].dataSM("sub"); s && this.menuHide(s) } }, menuInit: function(t) { if (!t.dataSM("in-mega")) { t.hasClass("mega-menu") && t.find("ul").dataSM("in-mega", !0); for (var i = 2, s = t[0]; (s = s.parentNode.parentNode) != this.$root[0]; ) i++; var e = t.prevAll("a").eq(-1); e.length || (e = t.prevAll().find("a").eq(-1)), e.addClass("has-submenu").dataSM("sub", t), t.dataSM("parent-a", e).dataSM("level", i).parent().dataSM("sub", t); var o = e.attr("id") || this.accessIdPrefix + ++this.idInc , a = t.attr("id") || this.accessIdPrefix + ++this.idInc; e.attr({ id: o, "aria-haspopup": "true", "aria-controls": a, "aria-expanded": "false" }), t.attr({ id: a, role: "group", "aria-hidden": "true", "aria-labelledby": o, "aria-expanded": "false" }), this.opts.subIndicators && e[this.opts.subIndicatorsPos](this.$subArrow.clone()) } }, menuPosition: function(t) { var i, s, e = t.dataSM("parent-a"), o = e.closest("li"), a = o.parent(), r = t.dataSM("level"), n = this.getWidth(t), h = this.getHeight(t), u = e.offset(), l = u.left, c = u.top, d = this.getWidth(e), m = this.getHeight(e), p = $(window), f = p.scrollLeft(), v = p.scrollTop(), b = this.getViewportWidth(), S = this.getViewportHeight(), g = a.parent().is("[data-sm-horizontal-sub]") || 2 == r && !a.hasClass("sm-vertical"), M = this.opts.rightToLeftSubMenus && !o.is("[data-sm-reverse]") || !this.opts.rightToLeftSubMenus && o.is("[data-sm-reverse]"), w = 2 == r ? this.opts.mainMenuSubOffsetX : this.opts.subMenusSubOffsetX, T = 2 == r ? this.opts.mainMenuSubOffsetY : this.opts.subMenusSubOffsetY; if (g ? (i = M ? d - n - w : w, s = this.opts.bottomToTopSubMenus ? -h - T : m + T) : (i = M ? w - n : d - w, s = this.opts.bottomToTopSubMenus ? m - T - h : T), this.opts.keepInViewport) { var y = l + i , x = c + s; if (M && y < f ? i = g ? f - y + i : d - w : !M && y + n > f + b && (i = g ? f + b - n - y + i : w - n), !g && (h < S && x + h > v + S ? s += v + S - h - x : (h >= S || x < v) && (s += v - x)), g && (x + h > v + S + .49 || x < v) || !g && h > S + .49) { var I = this; t.dataSM("scroll-arrows") || t.dataSM("scroll-arrows", $([$('')[0], $('')[0]]).on({ mouseenter: function() { t.dataSM("scroll").up = $(this).hasClass("scroll-up"), I.menuScroll(t) }, mouseleave: function(i) { I.menuScrollStop(t), I.menuScrollOut(t, i) }, "mousewheel DOMMouseScroll": function(t) { t.preventDefault() } }).insertAfter(t)); var _ = ".smartmenus_scroll"; if (t.dataSM("scroll", { y: this.cssTransforms3d ? 0 : s - m, step: 1, itemH: m, subH: h, arrowDownH: this.getHeight(t.dataSM("scroll-arrows").eq(1)) }).on(getEventsNS({ mouseover: function(i) { I.menuScrollOver(t, i) }, mouseout: function(i) { I.menuScrollOut(t, i) }, "mousewheel DOMMouseScroll": function(i) { I.menuScrollMousewheel(t, i) } }, _)).dataSM("scroll-arrows").css({ top: "auto", left: "0", marginLeft: i + (parseInt(t.css("border-left-width")) || 0), width: n - (parseInt(t.css("border-left-width")) || 0) - (parseInt(t.css("border-right-width")) || 0), zIndex: t.css("z-index") }).eq(g && this.opts.bottomToTopSubMenus ? 0 : 1).show(), this.isFixed()) { var C = {}; C[touchEvents ? "touchstart touchmove touchend" : "pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"] = function(i) { I.menuScrollTouch(t, i) } , t.css({ "touch-action": "none", "-ms-touch-action": "none" }).on(getEventsNS(C, _)) } } } t.css({ top: "auto", left: "0", marginLeft: i, marginTop: s - m }) }, menuScroll: function(t, i, s) { var e, o = t.dataSM("scroll"), a = t.dataSM("scroll-arrows"), r = o.up ? o.upEnd : o.downEnd; if (!i && o.momentum) { if (o.momentum *= .92, (e = o.momentum) < .5) { this.menuScrollStop(t); return } } else e = s || (i || !this.opts.scrollAccelerate ? this.opts.scrollStep : Math.floor(o.step)); var n = t.dataSM("level"); if (this.activatedItems[n - 1] && this.activatedItems[n - 1].dataSM("sub") && this.activatedItems[n - 1].dataSM("sub").is(":visible") && this.menuHideSubMenus(n - 1), o.y = o.up && r <= o.y || !o.up && r >= o.y ? o.y : Math.abs(r - o.y) > e ? o.y + (o.up ? e : -e) : r, t.css(this.cssTransforms3d ? { "-webkit-transform": "translate3d(0, " + o.y + "px, 0)", transform: "translate3d(0, " + o.y + "px, 0)" } : { marginTop: o.y }), mouse && (o.up && o.y > o.downEnd || !o.up && o.y < o.upEnd) && a.eq(o.up ? 1 : 0).show(), o.y == r) mouse && a.eq(o.up ? 0 : 1).hide(), this.menuScrollStop(t); else if (!i) { this.opts.scrollAccelerate && o.step < this.opts.scrollStep && (o.step += .2); var h = this; this.scrollTimeout = requestAnimationFrame(function() { h.menuScroll(t) }) } }, menuScrollMousewheel: function(t, i) { if (this.getClosestMenu(i.target) == t[0]) { var s = ((i = i.originalEvent).wheelDelta || -i.detail) > 0; t.dataSM("scroll-arrows").eq(s ? 0 : 1).is(":visible") && (t.dataSM("scroll").up = s, this.menuScroll(t, !0)) } i.preventDefault() }, menuScrollOut: function(t, i) { !mouse || /^scroll-(up|down)/.test((i.relatedTarget || "").className) || (t[0] == i.relatedTarget || $.contains(t[0], i.relatedTarget)) && this.getClosestMenu(i.relatedTarget) == t[0] || t.dataSM("scroll-arrows").css("visibility", "hidden") }, menuScrollOver: function(t, i) { if (mouse && !/^scroll-(up|down)/.test(i.target.className) && this.getClosestMenu(i.target) == t[0]) { this.menuScrollRefreshData(t); var s = t.dataSM("scroll") , e = $(window).scrollTop() - t.dataSM("parent-a").offset().top - s.itemH; t.dataSM("scroll-arrows").eq(0).css("margin-top", e).end().eq(1).css("margin-top", e + this.getViewportHeight() - s.arrowDownH).end().css("visibility", "visible") } }, menuScrollRefreshData: function(t) { var i = t.dataSM("scroll") , s = $(window).scrollTop() - t.dataSM("parent-a").offset().top - i.itemH; this.cssTransforms3d && (s = -(parseFloat(t.css("margin-top")) - s)), $.extend(i, { upEnd: s, downEnd: s + this.getViewportHeight() - i.subH }) }, menuScrollStop: function(t) { if (this.scrollTimeout) return cancelAnimationFrame(this.scrollTimeout), this.scrollTimeout = 0, t.dataSM("scroll").step = 1, !0 }, menuScrollTouch: function(t, i) { if (isTouchEvent(i = i.originalEvent)) { var s = this.getTouchPoint(i); if (this.getClosestMenu(s.target) == t[0]) { var e = t.dataSM("scroll"); if (/(start|down)$/i.test(i.type)) this.menuScrollStop(t) ? (i.preventDefault(), this.$touchScrollingSub = t) : this.$touchScrollingSub = null, this.menuScrollRefreshData(t), $.extend(e, { touchStartY: s.pageY, touchStartTime: i.timeStamp }); else if (/move$/i.test(i.type)) { var o = void 0 !== e.touchY ? e.touchY : e.touchStartY; if (void 0 !== o && o != s.pageY) { this.$touchScrollingSub = t; var a = o < s.pageY; void 0 !== e.up && e.up != a && $.extend(e, { touchStartY: s.pageY, touchStartTime: i.timeStamp }), $.extend(e, { up: a, touchY: s.pageY }), this.menuScroll(t, !0, Math.abs(s.pageY - o)) } i.preventDefault() } else void 0 !== e.touchY && ((e.momentum = 15 * Math.pow(Math.abs(s.pageY - e.touchStartY) / (i.timeStamp - e.touchStartTime), 2)) && (this.menuScrollStop(t), this.menuScroll(t), i.preventDefault()), delete e.touchY) } } }, menuShow: function(t) { if ((t.dataSM("beforefirstshowfired") || (t.dataSM("beforefirstshowfired", !0), !1 !== this.$root.triggerHandler("beforefirstshow.smapi", t[0]))) && !1 !== this.$root.triggerHandler("beforeshow.smapi", t[0]) && (t.dataSM("shown-before", !0), canAnimate && t.stop(!0, !0), !t.is(":visible"))) { var i = t.dataSM("parent-a") , s = this.isCollapsible(); if ((this.opts.keepHighlighted || s) && i.addClass("highlighted"), s) t.removeClass("sm-nowrap").css({ zIndex: "", width: "auto", minWidth: "", maxWidth: "", top: "", left: "", marginLeft: "", marginTop: "" }); else { if (t.css("z-index", this.zIndexInc = (this.zIndexInc || this.getStartZIndex()) + 1), (this.opts.subMenusMinWidth || this.opts.subMenusMaxWidth) && (t.css({ width: "auto", minWidth: "", maxWidth: "" }).addClass("sm-nowrap"), this.opts.subMenusMinWidth && t.css("min-width", this.opts.subMenusMinWidth), this.opts.subMenusMaxWidth)) { var e = this.getWidth(t); t.css("max-width", this.opts.subMenusMaxWidth), e > this.getWidth(t) && t.removeClass("sm-nowrap").css("width", this.opts.subMenusMaxWidth) } this.menuPosition(t) } var o = function() { t.css("overflow", "") }; s ? canAnimate && this.opts.collapsibleShowFunction ? this.opts.collapsibleShowFunction.call(this, t, o) : t.show(this.opts.collapsibleShowDuration, o) : canAnimate && this.opts.showFunction ? this.opts.showFunction.call(this, t, o) : t.show(this.opts.showDuration, o), i.attr("aria-expanded", "true"), t.attr({ "aria-expanded": "true", "aria-hidden": "false" }), this.visibleSubMenus.push(t), this.$root.triggerHandler("show.smapi", t[0]) } }, popupHide: function(t) { this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = 0); var i = this; this.hideTimeout = setTimeout(function() { i.menuHideAll() }, t ? 1 : this.opts.hideTimeout) }, popupShow: function(t, i) { if (!this.opts.isPopup) { alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'); return } if (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = 0), this.$root.dataSM("shown-before", !0), canAnimate && this.$root.stop(!0, !0), !this.$root.is(":visible")) { this.$root.css({ left: t, top: i }); var s = this , e = function() { s.$root.css("overflow", "") }; canAnimate && this.opts.showFunction ? this.opts.showFunction.call(this, this.$root, e) : this.$root.show(this.opts.showDuration, e), this.visibleSubMenus[0] = this.$root } }, refresh: function() { this.destroy(!0), this.init(!0) }, rootKeyDown: function(t) { if (this.handleEvents()) switch (t.keyCode) { case 27: var i = this.activatedItems[0]; if (i) { this.menuHideAll(), i[0].focus(); var s = i.dataSM("sub"); s && this.menuHide(s) } break; case 32: var e = $(t.target); if (e.is("a") && this.handleItemEvents(e)) { var s = e.dataSM("sub"); s && !s.is(":visible") && (this.itemClick({ currentTarget: t.target }), t.preventDefault()) } } }, rootOut: function(t) { if (!(!this.handleEvents() || this.isTouchMode()) && t.target != this.$root[0] && (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = 0), !this.opts.showOnClick || !this.opts.hideOnClick)) { var i = this; this.hideTimeout = setTimeout(function() { i.menuHideAll() }, this.opts.hideTimeout) } }, rootOver: function(t) { !(!this.handleEvents() || this.isTouchMode()) && t.target != this.$root[0] && this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = 0) }, winResize: function(t) { if (!this.handleEvents()) { if (this.$disableOverlay) { var i = this.$root.offset(); this.$disableOverlay.css({ top: i.top, left: i.left, width: this.$root.outerWidth(), height: this.$root.outerHeight() }) } return } if (!("onorientationchange"in window) || "orientationchange" == t.type) { var s = this.isCollapsible(); this.wasCollapsible && s || (this.activatedItems.length && this.activatedItems[this.activatedItems.length - 1][0].blur(), this.menuHideAll()), this.wasCollapsible = s } } } }), $.fn.dataSM = function(t, i) { return i ? this.data(t + "_smartmenus", i) : this.data(t + "_smartmenus") } , $.fn.removeDataSM = function(t) { return this.removeData(t + "_smartmenus") } , $.fn.smartmenus = function(options) { if ("string" == typeof options) { var args = arguments , method = options; return Array.prototype.shift.call(args), this.each(function() { var t = $(this).data("smartmenus"); t && t[method] && t[method].apply(t, args) }) } return this.each(function() { var dataOpts = $(this).data("sm-options") || null; if (dataOpts) try { dataOpts = eval("(" + dataOpts + ")") } catch (e) { dataOpts = null, alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.') } new $.SmartMenus(this,$.extend({}, $.fn.smartmenus.defaults, options, dataOpts)) }) } , $.fn.smartmenus.defaults = { isPopup: !1, mainMenuSubOffsetX: 0, mainMenuSubOffsetY: 0, subMenusSubOffsetX: 0, subMenusSubOffsetY: 0, subMenusMinWidth: "10em", subMenusMaxWidth: "20em", subIndicators: !0, subIndicatorsPos: "append", subIndicatorsText: "", scrollStep: 30, scrollAccelerate: !0, showTimeout: 250, hideTimeout: 500, showDuration: 0, showFunction: null, hideDuration: 0, hideFunction: function(t, i) { t.fadeOut(200, i) }, collapsibleShowDuration: 0, collapsibleShowFunction: function(t, i) { t.slideDown(200, i) }, collapsibleHideDuration: 0, collapsibleHideFunction: function(t, i) { t.slideUp(200, i) }, showOnClick: !1, hideOnClick: !0, noMouseOver: !1, keepInViewport: !0, keepHighlighted: !0, markCurrentItem: !1, markCurrentTree: !0, rightToLeftSubMenus: !1, bottomToTopSubMenus: !1, collapsibleBehavior: "default" }, $ });