(function ($) { $.jqx.jqxWidget("jqxMenu", "", {}); $.extend($.jqx._jqxMenu.prototype, { defineInstance: function () { var settings = { //Type: Array //Gets the menu's items. items: new Array(), //Type: String. //Default: 'horizontal'. //Gets or sets the menu's display mode. //Possible Values: 'horizontal', 'vertical', 'popup', 'simple' mode: 'horizontal', //Type: Number. //Default: null. //Sets the width. width: null, //Type: Number. //Default: null. //Sets the height. height: null, //Type: Number. //Default: 'auto'. //Sets the height. minimizeWidth: 'auto', //Type: String. //Default: easeInOutSine. //Gets or sets the animation's easing to one of the JQuery's supported easings. easing: 'easeInOutSine', //Type: Number. //Default: 500. //Gets or sets the duration of the show animation. animationShowDuration: 200, //Type: Number. //Default: 'fast'. //Gets or sets the duration of the hide animation. animationHideDuration: 200, // Type: Number // Default: 0 // Gets or sets whether the menu is automatically closed after a period of time. autoCloseInterval: 0, //Type: Number. //Default: 500. //Gets or sets the delay before the start of the hide animation. animationHideDelay: 100, //Type: Number. //Default: 200. //Gets or sets the delay before the start of the show animation. animationShowDelay: 100, //Type: Array. menuElements: new Array(), //Type: Boolean. //Default: true. //Auto-Sizes the Menu's main items when the menu's mode is 'horizontal'. autoSizeMainItems: false, //Type: Boolean. //Default: true. //Automatically closes the opened popups after a click. autoCloseOnClick: true, //Type: Boolean. //Default: true. //Automatically closes the opened popups after mouse leave. autoCloseOnMouseLeave: true, //Type: Boolean. //Default: true. //Enables or disables the rounded corners. enableRoundedCorners: true, //Type: Boolean. //Default: true. //Enables or disables the Menu. disabled: false, //Type: Boolean. //Default: true. //Opens the Context Menu when the right-mouse button is pressed. //When this property is set to false, the Open and Close functions can be used to open and close //the Context Menu. autoOpenPopup: true, // Type: Boolean // Default: true // enables or disables the hover state. enableHover: true, // Type: Boolean // Default: true // opens the top level menu items when the user hovers them. autoOpen: true, // Type: Boolean // Default: false // When this property is true, the menu is auto generated using all of ul and li tags inside the host. autoGenerate: true, // Type: Boolean // Default: false // opens an item after a click by the user. clickToOpen: false, // Type: Boolean // Default: false // shows the top-level item arrows in the default horizontal menu mode. showTopLevelArrows: false, // Sets whether the menu is on touch device. touchMode: 'auto', // Sets menu's source. source: null, popupZIndex: 1000, rtl: false, keyboardNavigation: false, lockFocus: false, title: "", // Menu events. events: [ 'shown', 'closed', 'itemclick', 'initialized', 'open', 'close' ] }; if (this === $.jqx._jqxMenu.prototype) { return settings; } $.extend(true, this, settings); return settings; }, createInstance: function (args) { var self = this; this.host.attr('role', 'menubar'); $.jqx.utilities.resize(this.host, function () { self.refresh(); }, false, this.mode != "popup"); if (this.minimizeWidth != "auto" && this.minimizeWidth != null && this.width && this.width.toString().indexOf('%') == -1) { $(window).resize(function () { self.refresh(); }); } this.host.css('outline', 'none'); if (this.source) { if (this.source != null) { var html = this.loadItems(this.source); this.element.innerHTML = html; } } this._tmpHTML = this.element.innerHTML; if (this.element.innerHTML.indexOf('UL')) { var innerElement = this.host.find('ul:first'); if (innerElement.length > 0) { this._createMenu(innerElement[0]); } } this.host.data('autoclose', {}); this._render(); this._setSize(); if ($.jqx.browser.msie && $.jqx.browser.version < 8) { this.host.attr('hideFocus', true); } }, focus: function () { try { if (this.mode === "popup" && this.keyboardNavigation) { var $popupElementparent = this.host.closest('div.jqx-menu-wrapper'); $popupElementparent.focus(); } if (this.keyboardNavigation) { this.host.focus(); var that = this; var setActiveItem = function () { if (!$.jqx.isHidden($(that.items[0].element))) { $(that.items[0].element).addClass(that.toThemeProperty('jqx-fill-state-focus')); that.activeItem = that.items[0]; } else { var item = that._nextVisibleItem(that.items[0], 0); if (item) { $(item.element).addClass(that.toThemeProperty('jqx-fill-state-focus')); that.activeItem = item; } } } if (!this.activeItem) { setActiveItem(); } else { if (!$.jqx.isHidden($(this.activeItem.element))) { $(this.activeItem.element).addClass(this.toThemeProperty('jqx-fill-state-focus')); } else { $(this.activeItem.element).removeClass(this.toThemeProperty('jqx-fill-state-focus')); setActiveItem(); } } } } catch (error) { } }, loadItems: function (items, subMenuWidth) { if (items == null) { return; } if (items.length == 0) return ""; var self = this; this.items = new Array(); var html = '