-if (self.Clazz) {\r
-\r
-Clazz.declarePackage ("swingjs.jquery");\r
-c$ = Clazz.declareType (swingjs.jquery, "JQuery_UI_Core2");\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-});\r
-\r
-}\r
-\r
-// menu button autocomplete\r
-\r
-if (!jQuery.ui.menu)\r
-try{\r
-\r
-/*!\r
- * jQuery UI Menu 1.10.4\r
- * http://jqueryui.com\r
- *\r
- * Copyright 2014 jQuery Foundation and other contributors\r
- * Released under the MIT license.\r
- * http://jquery.org/license\r
- *\r
- * http://api.jqueryui.com/menu/\r
- *\r
- * Depends:\r
- * jquery.ui.core.js\r
- * jquery.ui.widget.js\r
- * jquery.ui.position.js\r
- */\r
-(function( $, undefined ) {\r
-\r
-$.widget( "ui.menu", {\r
- version: "1.10.4",\r
- defaultElement: "<ul>",\r
- delay: 300,\r
- options: {\r
- icons: {\r
- submenu: "ui-icon-carat-1-e"\r
- },\r
- menus: "ul",\r
- position: {\r
- my: "left top",\r
- at: "right top"\r
- },\r
- role: "menu",\r
-\r
- // callbacks\r
- blur: null,\r
- focus: null,\r
- select: null\r
- },\r
-\r
- _create: function() {\r
- this.activeMenu = this.element;\r
- // flag used to prevent firing of the click handler\r
- // as the event bubbles up through nested menus\r
- this.mouseHandled = false;\r
- this.element\r
- .uniqueId()\r
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )\r
- .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )\r
- .attr({\r
- role: this.options.role,\r
- tabIndex: 0\r
- })\r
- // need to catch all clicks on disabled menu\r
- // not possible through _on\r
- .bind( "click" + this.eventNamespace, $.proxy(function( event ) {\r
- if ( this.options.disabled ) {\r
- event.preventDefault();\r
- }\r
- }, this ));\r
-\r
- if ( this.options.disabled ) {\r
- this.element\r
- .addClass( "ui-state-disabled" )\r
- .attr( "aria-disabled", "true" );\r
- }\r
-\r
- this._on({\r
- // Prevent focus from sticking to links inside menu after clicking\r
- // them (focus should always stay on UL during navigation).\r
- "mousedown .ui-menu-item > a": function( event ) {\r
- event.preventDefault();\r
- },\r
- "click .ui-state-disabled > a": function( event ) {\r
- event.preventDefault();\r
- },\r
- "click .ui-menu-item:has(a)": function( event ) {\r
- var target = $( event.target ).closest( ".ui-menu-item" );\r
- if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {\r
- this.select( event );\r
-\r
- // Only set the mouseHandled flag if the event will bubble, see #9469.\r
- if ( !event.isPropagationStopped() ) {\r
- this.mouseHandled = true;\r
- }\r
-\r
- // Open submenu on click\r
- if ( target.has( ".ui-menu" ).length ) {\r
- this.expand( event );\r
- } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {\r
-\r
- // Redirect focus to the menu\r
- this.element.trigger( "focus", [ true ] );\r
-\r
- // If the active item is on the top level, let it stay active.\r
- // Otherwise, blur the active item since it is no longer visible.\r
- if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {\r
- clearTimeout( this.timer );\r
- }\r
- }\r
- }\r
- },\r
- "mouseenter .ui-menu-item": function( event ) {\r
- var target = $( event.currentTarget );\r
- // Remove ui-state-active class from siblings of the newly focused menu item\r
- // to avoid a jump caused by adjacent elements both having a class with a border\r
- target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );\r
- this.focus( event, target );\r
- },\r
- mouseleave: "collapseAll",\r
- "mouseleave .ui-menu": "collapseAll",\r
- focus: function( event, keepActiveItem ) {\r
- // If there's already an active item, keep it active\r
- // If not, activate the first item\r
- var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );\r
-\r
- if ( !keepActiveItem ) {\r
- this.focus( event, item );\r
- }\r
- },\r
- blur: function( event ) {\r
- this._delay(function() {\r
- if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {\r
- this.collapseAll( event );\r
- }\r
- });\r
- },\r
- keydown: "_keydown"\r
- });\r
-\r
- this.refresh();\r
-\r
- // Clicks outside of a menu collapse any open menus\r
- this._on( this.document, {\r
- click: function( event ) {\r
- if ( !$( event.target ).closest( ".ui-menu" ).length ) {\r
- this.collapseAll( event );\r
- }\r
-\r
- // Reset the mouseHandled flag\r
- this.mouseHandled = false;\r
- }\r
- });\r
- },\r
-\r
- _destroy: function() {\r
- // Destroy (sub)menus\r
- this.element\r
- .removeAttr( "aria-activedescendant" )\r
- .find( ".ui-menu" ).addBack()\r
- .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )\r
- .removeAttr( "role" )\r
- .removeAttr( "tabIndex" )\r
- .removeAttr( "aria-labelledby" )\r
- .removeAttr( "aria-expanded" )\r
- .removeAttr( "aria-hidden" )\r
- .removeAttr( "aria-disabled" )\r
- .removeUniqueId()\r
- .show();\r
-\r
- // Destroy menu items\r
- this.element.find( ".ui-menu-item" )\r
- .removeClass( "ui-menu-item" )\r
- .removeAttr( "role" )\r
- .removeAttr( "aria-disabled" )\r
- .children( "a" )\r
- .removeUniqueId()\r
- .removeClass( "ui-corner-all ui-state-hover" )\r
- .removeAttr( "tabIndex" )\r
- .removeAttr( "role" )\r
- .removeAttr( "aria-haspopup" )\r
- .children().each( function() {\r
- var elem = $( this );\r
- if ( elem.data( "ui-menu-submenu-carat" ) ) {\r
- elem.remove();\r
- }\r
- });\r
-\r
- // Destroy menu dividers\r
- this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );\r
- },\r
-\r
- _keydown: function( event ) {\r
- var match, prev, character, skip, regex,\r
- preventDefault = true;\r
-\r
- function escape( value ) {\r
- return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );\r
- }\r
-\r
- switch ( event.keyCode ) {\r
- case $.ui.keyCode.PAGE_UP:\r
- this.previousPage( event );\r
- break;\r
- case $.ui.keyCode.PAGE_DOWN:\r
- this.nextPage( event );\r
- break;\r
- case $.ui.keyCode.HOME:\r
- this._move( "first", "first", event );\r
- break;\r
- case $.ui.keyCode.END:\r
- this._move( "last", "last", event );\r
- break;\r
- case $.ui.keyCode.UP:\r
- this.previous( event );\r
- break;\r
- case $.ui.keyCode.DOWN:\r
- this.next( event );\r
- break;\r
- case $.ui.keyCode.LEFT:\r
- this.collapse( event );\r
- break;\r
- case $.ui.keyCode.RIGHT:\r
- if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {\r
- this.expand( event );\r
- }\r
- break;\r
- case $.ui.keyCode.ENTER:\r
- case $.ui.keyCode.SPACE:\r
- this._activate( event );\r
- break;\r
- case $.ui.keyCode.ESCAPE:\r
- this.collapse( event );\r
- break;\r
- default:\r
- preventDefault = false;\r
- prev = this.previousFilter || "";\r
- character = String.fromCharCode( event.keyCode );\r
- skip = false;\r
-\r
- clearTimeout( this.filterTimer );\r
-\r
- if ( character === prev ) {\r
- skip = true;\r
- } else {\r
- character = prev + character;\r
- }\r
-\r
- regex = new RegExp( "^" + escape( character ), "i" );\r
- match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {\r
- return regex.test( $( this ).children( "a" ).text() );\r
- });\r
- match = skip && match.index( this.active.next() ) !== -1 ?\r
- this.active.nextAll( ".ui-menu-item" ) :\r
- match;\r
-\r
- // If no matches on the current filter, reset to the last character pressed\r
- // to move down the menu to the first item that starts with that character\r
- if ( !match.length ) {\r
- character = String.fromCharCode( event.keyCode );\r
- regex = new RegExp( "^" + escape( character ), "i" );\r
- match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {\r
- return regex.test( $( this ).children( "a" ).text() );\r
- });\r
- }\r
-\r
- if ( match.length ) {\r
- this.focus( event, match );\r
- if ( match.length > 1 ) {\r
- this.previousFilter = character;\r
- this.filterTimer = this._delay(function() {\r
- delete this.previousFilter;\r
- }, 1000 );\r
- } else {\r
- delete this.previousFilter;\r
- }\r
- } else {\r
- delete this.previousFilter;\r
- }\r
- }\r
-\r
- if ( preventDefault ) {\r
- event.preventDefault();\r
- }\r
- },\r
-\r
- _activate: function( event ) {\r
- if ( !this.active.is( ".ui-state-disabled" ) ) {\r
- if ( this.active.children( "a[aria-haspopup='true']" ).length ) {\r
- this.expand( event );\r
- } else {\r
- this.select( event );\r
- }\r
- }\r
- },\r
-\r
- refresh: function() {\r
- var menus,\r
- icon = this.options.icons.submenu,\r
- submenus = this.element.find( this.options.menus );\r
-\r
- this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );\r
-\r
- // Initialize nested menus\r
- submenus.filter( ":not(.ui-menu)" )\r
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )\r
- .hide()\r
- .attr({\r
- role: this.options.role,\r
- "aria-hidden": "true",\r
- "aria-expanded": "false"\r
- })\r
- .each(function() {\r
- var menu = $( this ),\r
- item = menu.prev( "a" ),\r
- submenuCarat = $( "<span>" )\r
- .addClass( "ui-menu-icon ui-icon " + icon )\r
- .data( "ui-menu-submenu-carat", true );\r
-\r
- item\r
- .attr( "aria-haspopup", "true" )\r
- .prepend( submenuCarat );\r
- menu.attr( "aria-labelledby", item.attr( "id" ) );\r
- });\r
-\r
- menus = submenus.add( this.element );\r
-\r
- // Don't refresh list items that are already adapted\r
- menus.children( ":not(.ui-menu-item):has(a)" )\r
- .addClass( "ui-menu-item" )\r
- .attr( "role", "presentation" )\r
- .children( "a" )\r
- .uniqueId()\r
- .addClass( "ui-corner-all" )\r
- .attr({\r
- tabIndex: -1,\r
- role: this._itemRole()\r
- });\r
-\r
- // Initialize unlinked menu-items containing spaces and/or dashes only as dividers\r
- menus.children( ":not(.ui-menu-item)" ).each(function() {\r
- var item = $( this );\r
- // hyphen, em dash, en dash\r
- if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {\r
- item.addClass( "ui-widget-content ui-menu-divider" );\r
- }\r
- });\r
-\r
- // Add aria-disabled attribute to any disabled menu item\r
- menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );\r
-\r
- // If the active item has been removed, blur the menu\r
- if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {\r
- this.blur();\r
- }\r
- },\r
-\r
- _itemRole: function() {\r
- return {\r
- menu: "menuitem",\r
- listbox: "option"\r
- }[ this.options.role ];\r
- },\r
-\r
- _setOption: function( key, value ) {\r
- if ( key === "icons" ) {\r
- this.element.find( ".ui-menu-icon" )\r
- .removeClass( this.options.icons.submenu )\r
- .addClass( value.submenu );\r
- }\r
- this._super( key, value );\r
- },\r
-\r
- focus: function( event, item ) {\r
- var nested, focused;\r
- this.blur( event, event && event.type === "focus" );\r
-\r
- this._scrollIntoView( item );\r
-\r
- this.active = item.first();\r
- focused = this.active.children( "a" ).addClass( "ui-state-focus" );\r
- // Only update aria-activedescendant if there's a role\r
- // otherwise we assume focus is managed elsewhere\r
- if ( this.options.role ) {\r
- this.element.attr( "aria-activedescendant", focused.attr( "id" ) );\r
- }\r
-\r
- // Highlight active parent menu item, if any\r
- this.active\r
- .parent()\r
- .closest( ".ui-menu-item" )\r
- .children( "a:first" )\r
- .addClass( "ui-state-active" );\r
-\r
- if ( event && event.type === "keydown" ) {\r
- this._close();\r
- } else {\r
- this.timer = this._delay(function() {\r
- this._close();\r
- }, this.delay );\r
- }\r
-\r
- nested = item.children( ".ui-menu" );\r
- if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {\r
- this._startOpening(nested);\r
- }\r
- this.activeMenu = item.parent();\r
-\r
- this._trigger( "focus", event, { item: item } );\r
- },\r
-\r
- _scrollIntoView: function( item ) {\r
- var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;\r
- if ( this._hasScroll() ) {\r
- borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;\r
- paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;\r
- offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;\r
- scroll = this.activeMenu.scrollTop();\r
- elementHeight = this.activeMenu.height();\r
- itemHeight = item.height();\r
-\r
- if ( offset < 0 ) {\r
- this.activeMenu.scrollTop( scroll + offset );\r
- } else if ( offset + itemHeight > elementHeight ) {\r
- this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );\r
- }\r
- }\r
- },\r
-\r
- blur: function( event, fromFocus ) {\r
- if ( !fromFocus ) {\r
- clearTimeout( this.timer );\r
- }\r
-\r
- if ( !this.active ) {\r
- return;\r
- }\r
-\r
- this.active.children( "a" ).removeClass( "ui-state-focus" );\r
- this.active = null;\r
-\r
- this._trigger( "blur", event, { item: this.active } );\r
- },\r
-\r
- _startOpening: function( submenu ) {\r
- clearTimeout( this.timer );\r
-\r
- // Don't open if already open fixes a Firefox bug that caused a .5 pixel\r
- // shift in the submenu position when mousing over the carat icon\r
- if ( submenu.attr( "aria-hidden" ) !== "true" ) {\r
- return;\r
- }\r
-\r
- this.timer = this._delay(function() {\r
- this._close();\r
- this._open( submenu );\r
- }, this.delay );\r
- },\r
-\r
- _open: function( submenu ) {\r
- var position = $.extend({\r
- of: this.active\r
- }, this.options.position );\r
-\r
- clearTimeout( this.timer );\r
- this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )\r
- .hide()\r
- .attr( "aria-hidden", "true" );\r
-\r
- submenu\r
- .show()\r
- .removeAttr( "aria-hidden" )\r
- .attr( "aria-expanded", "true" )\r
- .position( position );\r
- },\r
-\r
- collapseAll: function( event, all ) {\r
- clearTimeout( this.timer );\r
- this.timer = this._delay(function() {\r
- // If we were passed an event, look for the submenu that contains the event\r
- var currentMenu = all ? this.element :\r
- $( event && event.target ).closest( this.element.find( ".ui-menu" ) );\r
-\r
- // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway\r
- if ( !currentMenu.length ) {\r
- currentMenu = this.element;\r
- }\r
-\r
- this._close( currentMenu );\r
-\r
- this.blur( event );\r
- this.activeMenu = currentMenu;\r
- }, this.delay );\r
- },\r
-\r
- // With no arguments, closes the currently active menu - if nothing is active\r
- // it closes all menus. If passed an argument, it will search for menus BELOW\r
- _close: function( startMenu ) {\r
- if ( !startMenu ) {\r
- startMenu = this.active ? this.active.parent() : this.element;\r
- }\r
-\r
- startMenu\r
- .find( ".ui-menu" )\r
- .hide()\r
- .attr( "aria-hidden", "true" )\r
- .attr( "aria-expanded", "false" )\r
- .end()\r
- .find( "a.ui-state-active" )\r
- .removeClass( "ui-state-active" );\r
- },\r
-\r
- collapse: function( event ) {\r
- var newItem = this.active &&\r
- this.active.parent().closest( ".ui-menu-item", this.element );\r
- if ( newItem && newItem.length ) {\r
- this._close();\r
- this.focus( event, newItem );\r
- }\r
- },\r
-\r
- expand: function( event ) {\r
- var newItem = this.active &&\r
- this.active\r
- .children( ".ui-menu " )\r
- .children( ".ui-menu-item" )\r
- .first();\r
-\r
- if ( newItem && newItem.length ) {\r
- this._open( newItem.parent() );\r
-\r
- // Delay so Firefox will not hide activedescendant change in expanding submenu from AT\r
- this._delay(function() {\r
- this.focus( event, newItem );\r
- });\r
- }\r
- },\r
-\r
- next: function( event ) {\r
- this._move( "next", "first", event );\r
- },\r
-\r
- previous: function( event ) {\r
- this._move( "prev", "last", event );\r
- },\r
-\r
- isFirstItem: function() {\r
- return this.active && !this.active.prevAll( ".ui-menu-item" ).length;\r
- },\r
-\r
- isLastItem: function() {\r
- return this.active && !this.active.nextAll( ".ui-menu-item" ).length;\r
- },\r
-\r
- _move: function( direction, filter, event ) {\r
- var next;\r
- if ( this.active ) {\r
- if ( direction === "first" || direction === "last" ) {\r
- next = this.active\r
- [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )\r
- .eq( -1 );\r
- } else {\r
- next = this.active\r
- [ direction + "All" ]( ".ui-menu-item" )\r
- .eq( 0 );\r
- }\r
- }\r
- if ( !next || !next.length || !this.active ) {\r
- next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();\r
- }\r
-\r
- this.focus( event, next );\r
- },\r
-\r
- nextPage: function( event ) {\r
- var item, base, height;\r
-\r
- if ( !this.active ) {\r
- this.next( event );\r
- return;\r
- }\r
- if ( this.isLastItem() ) {\r
- return;\r
- }\r
- if ( this._hasScroll() ) {\r
- base = this.active.offset().top;\r
- height = this.element.height();\r
- this.active.nextAll( ".ui-menu-item" ).each(function() {\r
- item = $( this );\r
- return item.offset().top - base - height < 0;\r
- });\r
-\r
- this.focus( event, item );\r
- } else {\r
- this.focus( event, this.activeMenu.children( ".ui-menu-item" )\r
- [ !this.active ? "first" : "last" ]() );\r
- }\r
- },\r
-\r
- previousPage: function( event ) {\r
- var item, base, height;\r
- if ( !this.active ) {\r
- this.next( event );\r
- return;\r
- }\r
- if ( this.isFirstItem() ) {\r
- return;\r
- }\r
- if ( this._hasScroll() ) {\r
- base = this.active.offset().top;\r
- height = this.element.height();\r
- this.active.prevAll( ".ui-menu-item" ).each(function() {\r
- item = $( this );\r
- return item.offset().top - base + height > 0;\r
- });\r
-\r
- this.focus( event, item );\r
- } else {\r
- this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );\r
- }\r
- },\r
-\r
- _hasScroll: function() {\r
- return this.element.outerHeight() < this.element.prop( "scrollHeight" );\r
- },\r
-\r
- select: function( event ) {\r
- // TODO: It should never be possible to not have an active item at this\r
- // point, but the tests don't trigger mouseenter before click.\r
- this.active = this.active || $( event.target ).closest( ".ui-menu-item" );\r
- var ui = { item: this.active };\r
- if ( !this.active.has( ".ui-menu" ).length ) {\r
- this.collapseAll( event, true );\r
- }\r
- this._trigger( "select", event, ui );\r
- }\r
-});\r
-\r
-}( jQuery ));\r
-\r
-\r
-}catch (e) {\r
-System.out.println("coremenu failed to load jQuery.ui.menu -- jQuery version conflict?");\r
-}\r
-\r
-if (!jQuery.ui.button)\r
-try{\r
-\r
-/*!\r
- * jQuery UI Button 1.10.4\r
- * http://jqueryui.com\r
- *\r
- * Copyright 2014 jQuery Foundation and other contributors\r
- * Released under the MIT license.\r
- * http://jquery.org/license\r
- *\r
- * http://api.jqueryui.com/button/\r
- *\r
- * Depends:\r
- * jquery.ui.core.js\r
- * jquery.ui.widget.js\r
- */\r
-(function( $, undefined ) {\r
-\r
-var lastActive,\r
- baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",\r
- typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",\r
- formResetHandler = function() {\r
- var form = $( this );\r
- setTimeout(function() {\r
- form.find( ":ui-button" ).button( "refresh" );\r
- }, 1 );\r
- },\r
- radioGroup = function( radio ) {\r
- var name = radio.name,\r
- form = radio.form,\r
- radios = $( [] );\r
- if ( name ) {\r
- name = name.replace( /'/g, "\\'" );\r
- if ( form ) {\r
- radios = $( form ).find( "[name='" + name + "']" );\r
- } else {\r
- radios = $( "[name='" + name + "']", radio.ownerDocument )\r
- .filter(function() {\r
- return !this.form;\r
- });\r
- }\r
- }\r
- return radios;\r
- };\r
-\r
-$.widget( "ui.button", {\r
- version: "1.10.4",\r
- defaultElement: "<button>",\r
- options: {\r
- disabled: null,\r
- text: true,\r
- label: null,\r
- icons: {\r
- primary: null,\r
- secondary: null\r
- }\r
- },\r
- _create: function() {\r
- this.element.closest( "form" )\r
- .unbind( "reset" + this.eventNamespace )\r
- .bind( "reset" + this.eventNamespace, formResetHandler );\r
-\r
- if ( typeof this.options.disabled !== "boolean" ) {\r
- this.options.disabled = !!this.element.prop( "disabled" );\r
- } else {\r
- this.element.prop( "disabled", this.options.disabled );\r
- }\r
-\r
- this._determineButtonType();\r
- this.hasTitle = !!this.buttonElement.attr( "title" );\r
-\r
- var that = this,\r
- options = this.options,\r
- toggleButton = this.type === "checkbox" || this.type === "radio",\r
- activeClass = !toggleButton ? "ui-state-active" : "";\r
-\r
- if ( options.label === null ) {\r
- options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());\r
- }\r
-\r
- this._hoverable( this.buttonElement );\r
-\r
- this.buttonElement\r
- .addClass( baseClasses )\r
- .attr( "role", "button" )\r
- .bind( "mouseenter" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return;\r
- }\r
- if ( this === lastActive ) {\r
- $( this ).addClass( "ui-state-active" );\r
- }\r
- })\r
- .bind( "mouseleave" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return;\r
- }\r
- $( this ).removeClass( activeClass );\r
- })\r
- .bind( "click" + this.eventNamespace, function( event ) {\r
- if ( options.disabled ) {\r
- event.preventDefault();\r
- event.stopImmediatePropagation();\r
- }\r
- });\r
-\r
- // Can't use _focusable() because the element that receives focus\r
- // and the element that gets the ui-state-focus class are different\r
- this._on({\r
- focus: function() {\r
- this.buttonElement.addClass( "ui-state-focus" );\r
- },\r
- blur: function() {\r
- this.buttonElement.removeClass( "ui-state-focus" );\r
- }\r
- });\r
-\r
- if ( toggleButton ) {\r
- this.element.bind( "change" + this.eventNamespace, function() {\r
- that.refresh();\r
- });\r
- }\r
-\r
- if ( this.type === "checkbox" ) {\r
- this.buttonElement.bind( "click" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return false;\r
- }\r
- });\r
- } else if ( this.type === "radio" ) {\r
- this.buttonElement.bind( "click" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return false;\r
- }\r
- $( this ).addClass( "ui-state-active" );\r
- that.buttonElement.attr( "aria-pressed", "true" );\r
-\r
- var radio = that.element[ 0 ];\r
- radioGroup( radio )\r
- .not( radio )\r
- .map(function() {\r
- return $( this ).button( "widget" )[ 0 ];\r
- })\r
- .removeClass( "ui-state-active" )\r
- .attr( "aria-pressed", "false" );\r
- });\r
- } else {\r
- this.buttonElement\r
- .bind( "mousedown" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return false;\r
- }\r
- $( this ).addClass( "ui-state-active" );\r
- lastActive = this;\r
- that.document.one( "mouseup", function() {\r
- lastActive = null;\r
- });\r
- })\r
- .bind( "mouseup" + this.eventNamespace, function() {\r
- if ( options.disabled ) {\r
- return false;\r
- }\r
- $( this ).removeClass( "ui-state-active" );\r
- })\r
- .bind( "keydown" + this.eventNamespace, function(event) {\r
- if ( options.disabled ) {\r
- return false;\r
- }\r
- if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {\r
- $( this ).addClass( "ui-state-active" );\r
- }\r
- })\r
- // see #8559, we bind to blur here in case the button element loses\r
- // focus between keydown and keyup, it would be left in an "active" state\r
- .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {\r
- $( this ).removeClass( "ui-state-active" );\r
- });\r
-\r
- if ( this.buttonElement.is("a") ) {\r
- this.buttonElement.keyup(function(event) {\r
- if ( event.keyCode === $.ui.keyCode.SPACE ) {\r
- // TODO pass through original event correctly (just as 2nd argument doesn't work)\r
- $( this ).click();\r
- }\r
- });\r
- }\r
- }\r
-\r
- // TODO: pull out $.Widget's handling for the disabled option into\r
- // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can\r
- // be overridden by individual plugins\r
- this._setOption( "disabled", options.disabled );\r
- this._resetButton();\r
- },\r
-\r
- _determineButtonType: function() {\r
- var ancestor, labelSelector, checked;\r
-\r
- if ( this.element.is("[type=checkbox]") ) {\r
- this.type = "checkbox";\r
- } else if ( this.element.is("[type=radio]") ) {\r
- this.type = "radio";\r
- } else if ( this.element.is("input") ) {\r
- this.type = "input";\r
- } else {\r
- this.type = "button";\r
- }\r
-\r
- if ( this.type === "checkbox" || this.type === "radio" ) {\r
- // we don't search against the document in case the element\r
- // is disconnected from the DOM\r
- ancestor = this.element.parents().last();\r
- labelSelector = "label[for='" + this.element.attr("id") + "']";\r
- this.buttonElement = ancestor.find( labelSelector );\r
- if ( !this.buttonElement.length ) {\r
- ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();\r
- this.buttonElement = ancestor.filter( labelSelector );\r
- if ( !this.buttonElement.length ) {\r
- this.buttonElement = ancestor.find( labelSelector );\r
- }\r
- }\r
- this.element.addClass( "ui-helper-hidden-accessible" );\r
-\r
- checked = this.element.is( ":checked" );\r
- if ( checked ) {\r
- this.buttonElement.addClass( "ui-state-active" );\r
- }\r
- this.buttonElement.prop( "aria-pressed", checked );\r
- } else {\r
- this.buttonElement = this.element;\r
- }\r
- },\r
-\r
- widget: function() {\r
- return this.buttonElement;\r
- },\r
-\r
- _destroy: function() {\r
- this.element\r
- .removeClass( "ui-helper-hidden-accessible" );\r
- this.buttonElement\r
- .removeClass( baseClasses + " ui-state-active " + typeClasses )\r
- .removeAttr( "role" )\r
- .removeAttr( "aria-pressed" )\r
- .html( this.buttonElement.find(".ui-button-text").html() );\r
-\r
- if ( !this.hasTitle ) {\r
- this.buttonElement.removeAttr( "title" );\r
- }\r
- },\r
-\r
- _setOption: function( key, value ) {\r
- this._super( key, value );\r
- if ( key === "disabled" ) {\r
- this.element.prop( "disabled", !!value );\r
- if ( value ) {\r
- this.buttonElement.removeClass( "ui-state-focus" );\r
- }\r
- return;\r
- }\r
- this._resetButton();\r
- },\r
-\r
- refresh: function() {\r
- //See #8237 & #8828\r
- var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );\r
-\r
- if ( isDisabled !== this.options.disabled ) {\r
- this._setOption( "disabled", isDisabled );\r
- }\r
- if ( this.type === "radio" ) {\r
- radioGroup( this.element[0] ).each(function() {\r
- if ( $( this ).is( ":checked" ) ) {\r
- $( this ).button( "widget" )\r
- .addClass( "ui-state-active" )\r
- .attr( "aria-pressed", "true" );\r
- } else {\r
- $( this ).button( "widget" )\r
- .removeClass( "ui-state-active" )\r
- .attr( "aria-pressed", "false" );\r
- }\r
- });\r
- } else if ( this.type === "checkbox" ) {\r
- if ( this.element.is( ":checked" ) ) {\r
- this.buttonElement\r
- .addClass( "ui-state-active" )\r
- .attr( "aria-pressed", "true" );\r
- } else {\r
- this.buttonElement\r
- .removeClass( "ui-state-active" )\r
- .attr( "aria-pressed", "false" );\r
- }\r
- }\r
- },\r
-\r
- _resetButton: function() {\r
- if ( this.type === "input" ) {\r
- if ( this.options.label ) {\r
- this.element.val( this.options.label );\r
- }\r
- return;\r
- }\r
- var buttonElement = this.buttonElement.removeClass( typeClasses ),\r
- buttonText = $( "<span></span>", this.document[0] )\r
- .addClass( "ui-button-text" )\r
- .html( this.options.label )\r
- .appendTo( buttonElement.empty() )\r
- .text(),\r
- icons = this.options.icons,\r
- multipleIcons = icons.primary && icons.secondary,\r
- buttonClasses = [];\r
-\r
- if ( icons.primary || icons.secondary ) {\r
- if ( this.options.text ) {\r
- buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );\r
- }\r
-\r
- if ( icons.primary ) {\r
- buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );\r
- }\r
-\r
- if ( icons.secondary ) {\r
- buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );\r
- }\r
-\r
- if ( !this.options.text ) {\r
- buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );\r
-\r
- if ( !this.hasTitle ) {\r
- buttonElement.attr( "title", $.trim( buttonText ) );\r
- }\r
- }\r
- } else {\r
- buttonClasses.push( "ui-button-text-only" );\r
- }\r
- buttonElement.addClass( buttonClasses.join( " " ) );\r
- }\r
-});\r
-\r
-$.widget( "ui.buttonset", {\r
- version: "1.10.4",\r
- options: {\r
- items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"\r
- },\r
-\r
- _create: function() {\r
- this.element.addClass( "ui-buttonset" );\r
- },\r
-\r
- _init: function() {\r
- this.refresh();\r
- },\r
-\r
- _setOption: function( key, value ) {\r
- if ( key === "disabled" ) {\r
- this.buttons.button( "option", key, value );\r
- }\r
-\r
- this._super( key, value );\r
- },\r
-\r
- refresh: function() {\r
- var rtl = this.element.css( "direction" ) === "rtl";\r
-\r
- this.buttons = this.element.find( this.options.items )\r
- .filter( ":ui-button" )\r
- .button( "refresh" )\r
- .end()\r
- .not( ":ui-button" )\r
- .button()\r
- .end()\r
- .map(function() {\r
- return $( this ).button( "widget" )[ 0 ];\r
- })\r
- .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )\r
- .filter( ":first" )\r
- .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )\r
- .end()\r
- .filter( ":last" )\r
- .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )\r
- .end()\r
- .end();\r
- },\r
-\r
- _destroy: function() {\r
- this.element.removeClass( "ui-buttonset" );\r
- this.buttons\r
- .map(function() {\r
- return $( this ).button( "widget" )[ 0 ];\r
- })\r
- .removeClass( "ui-corner-left ui-corner-right" )\r
- .end()\r
- .button( "destroy" );\r
- }\r
-});\r
-\r
-}( jQuery ) );\r
-\r
-}catch (e) {\r
-System.out.println("coremenu failed to load jQuery.ui.button -- jQuery version conflict?");\r
-}\r
-\r
-if (!jQuery.ui.autocomplete)\r
-try{\r
-\r
-/*!\r
- * jQuery UI Autocomplete 1.10.4\r
- * http://jqueryui.com\r
- *\r
- * Copyright 2014 jQuery Foundation and other contributors\r
- * Released under the MIT license.\r
- * http://jquery.org/license\r
- *\r
- * http://api.jqueryui.com/autocomplete/\r
- *\r
- * Depends:\r
- * jquery.ui.core.js\r
- * jquery.ui.widget.js\r
- * jquery.ui.position.js\r
- * jquery.ui.menu.js\r
- */\r
-(function( $, undefined ) {\r
-\r
-$.widget( "ui.autocomplete", {\r
- version: "1.10.4",\r
- defaultElement: "<input>",\r
- options: {\r
- appendTo: null,\r
- autoFocus: false,\r
- delay: 300,\r
- minLength: 1,\r
- position: {\r
- my: "left top",\r
- at: "left bottom",\r
- collision: "none"\r
- },\r
- source: null,\r
-\r
- // callbacks\r
- change: null,\r
- close: null,\r
- focus: null,\r
- open: null,\r
- response: null,\r
- search: null,\r
- select: null\r
- },\r
-\r
- requestIndex: 0,\r
- pending: 0,\r
-\r
- _create: function() {\r
- // Some browsers only repeat keydown events, not keypress events,\r
- // so we use the suppressKeyPress flag to determine if we've already\r
- // handled the keydown event. #7269\r
- // Unfortunately the code for & in keypress is the same as the up arrow,\r
- // so we use the suppressKeyPressRepeat flag to avoid handling keypress\r
- // events when we know the keydown event was used to modify the\r
- // search term. #7799\r
- var suppressKeyPress, suppressKeyPressRepeat, suppressInput,\r
- nodeName = this.element[0].nodeName.toLowerCase(),\r
- isTextarea = nodeName === "textarea",\r
- isInput = nodeName === "input";\r
-\r
- this.isMultiLine =\r
- // Textareas are always multi-line\r
- isTextarea ? true :\r
- // Inputs are always single-line, even if inside a contentEditable element\r
- // IE also treats inputs as contentEditable\r
- isInput ? false :\r
- // All other element types are determined by whether or not they're contentEditable\r
- this.element.prop( "isContentEditable" );\r
-\r
- this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];\r
- this.isNewMenu = true;\r
-\r
- this.element\r
- .addClass( "ui-autocomplete-input" )\r
- .attr( "autocomplete", "off" );\r
-\r
- this._on( this.element, {\r
- keydown: function( event ) {\r
- if ( this.element.prop( "readOnly" ) ) {\r
- suppressKeyPress = true;\r
- suppressInput = true;\r
- suppressKeyPressRepeat = true;\r
- return;\r
- }\r
-\r
- suppressKeyPress = false;\r
- suppressInput = false;\r
- suppressKeyPressRepeat = false;\r
- var keyCode = $.ui.keyCode;\r
- switch( event.keyCode ) {\r
- case keyCode.PAGE_UP:\r
- suppressKeyPress = true;\r
- this._move( "previousPage", event );\r
- break;\r
- case keyCode.PAGE_DOWN:\r
- suppressKeyPress = true;\r
- this._move( "nextPage", event );\r
- break;\r
- case keyCode.UP:\r
- suppressKeyPress = true;\r
- this._keyEvent( "previous", event );\r
- break;\r
- case keyCode.DOWN:\r
- suppressKeyPress = true;\r
- this._keyEvent( "next", event );\r
- break;\r
- case keyCode.ENTER:\r
- case keyCode.NUMPAD_ENTER:\r
- // when menu is open and has focus\r
- if ( this.menu.active ) {\r
- // #6055 - Opera still allows the keypress to occur\r
- // which causes forms to submit\r
- suppressKeyPress = true;\r
- event.preventDefault();\r
- this.menu.select( event );\r
- }\r
- break;\r
- case keyCode.TAB:\r
- if ( this.menu.active ) {\r
- this.menu.select( event );\r
- }\r
- break;\r
- case keyCode.ESCAPE:\r
- if ( this.menu.element.is( ":visible" ) ) {\r
- this._value( this.term );\r
- this.close( event );\r
- // Different browsers have different default behavior for escape\r
- // Single press can mean undo or clear\r
- // Double press in IE means clear the whole form\r
- event.preventDefault();\r
- }\r
- break;\r
- default:\r
- suppressKeyPressRepeat = true;\r
- // search timeout should be triggered before the input value is changed\r
- this._searchTimeout( event );\r
- break;\r
- }\r
- },\r
- keypress: function( event ) {\r
- if ( suppressKeyPress ) {\r
- suppressKeyPress = false;\r
- if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {\r
- event.preventDefault();\r
- }\r
- return;\r
- }\r
- if ( suppressKeyPressRepeat ) {\r
- return;\r
- }\r
-\r
- // replicate some key handlers to allow them to repeat in Firefox and Opera\r
- var keyCode = $.ui.keyCode;\r
- switch( event.keyCode ) {\r
- case keyCode.PAGE_UP:\r
- this._move( "previousPage", event );\r
- break;\r
- case keyCode.PAGE_DOWN:\r
- this._move( "nextPage", event );\r
- break;\r
- case keyCode.UP:\r
- this._keyEvent( "previous", event );\r
- break;\r
- case keyCode.DOWN:\r
- this._keyEvent( "next", event );\r
- break;\r
- }\r
- },\r
- input: function( event ) {\r
- if ( suppressInput ) {\r
- suppressInput = false;\r
- event.preventDefault();\r
- return;\r
- }\r
- this._searchTimeout( event );\r
- },\r
- focus: function() {\r
- this.selectedItem = null;\r
- this.previous = this._value();\r
- },\r
- blur: function( event ) {\r
- if ( this.cancelBlur ) {\r
- delete this.cancelBlur;\r
- return;\r
- }\r
-\r
- clearTimeout( this.searching );\r
- this.close( event );\r
- this._change( event );\r
- }\r
- });\r
-\r
- this._initSource();\r
- this.menu = $( "<ul>" )\r
- .addClass( "ui-autocomplete ui-front" )\r
- .appendTo( this._appendTo() )\r
- .menu({\r
- // disable ARIA support, the live region takes care of that\r
- role: null\r
- })\r
- .hide()\r
- .data( "ui-menu" );\r
-\r
- this._on( this.menu.element, {\r
- mousedown: function( event ) {\r
- // prevent moving focus out of the text field\r
- event.preventDefault();\r
-\r
- // IE doesn't prevent moving focus even with event.preventDefault()\r
- // so we set a flag to know when we should ignore the blur event\r
- this.cancelBlur = true;\r
- this._delay(function() {\r
- delete this.cancelBlur;\r
- });\r
-\r
- // clicking on the scrollbar causes focus to shift to the body\r
- // but we can't detect a mouseup or a click immediately afterward\r
- // so we have to track the next mousedown and close the menu if\r
- // the user clicks somewhere outside of the autocomplete\r
- var menuElement = this.menu.element[ 0 ];\r
- if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {\r
- this._delay(function() {\r
- var that = this;\r
- this.document.one( "mousedown", function( event ) {\r
- if ( event.target !== that.element[ 0 ] &&\r
- event.target !== menuElement &&\r
- !$.contains( menuElement, event.target ) ) {\r
- that.close();\r
- }\r
- });\r
- });\r
- }\r
- },\r
- menufocus: function( event, ui ) {\r
- // support: Firefox\r
- // Prevent accidental activation of menu items in Firefox (#7024 #9118)\r
- if ( this.isNewMenu ) {\r
- this.isNewMenu = false;\r
- if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {\r
- this.menu.blur();\r
-\r
- this.document.one( "mousemove", function() {\r
- $( event.target ).trigger( event.originalEvent );\r
- });\r
-\r
- return;\r
- }\r
- }\r
-\r
- var item = ui.item.data( "ui-autocomplete-item" );\r
- if ( false !== this._trigger( "focus", event, { item: item } ) ) {\r
- // use value to match what will end up in the input, if it was a key event\r
- if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {\r
- this._value( item.value );\r
- }\r
- } else {\r
- // Normally the input is populated with the item's value as the\r
- // menu is navigated, causing screen readers to notice a change and\r
- // announce the item. Since the focus event was canceled, this doesn't\r
- // happen, so we update the live region so that screen readers can\r
- // still notice the change and announce it.\r
- this.liveRegion.text( item.value );\r
- }\r
- },\r
- menuselect: function( event, ui ) {\r
- var item = ui.item.data( "ui-autocomplete-item" ),\r
- previous = this.previous;\r
-\r
- // only trigger when focus was lost (click on menu)\r
- if ( this.element[0] !== this.document[0].activeElement ) {\r
- this.element.focus();\r
- this.previous = previous;\r
- // #6109 - IE triggers two focus events and the second\r
- // is asynchronous, so we need to reset the previous\r
- // term synchronously and asynchronously :-(\r
- this._delay(function() {\r
- this.previous = previous;\r
- this.selectedItem = item;\r
- });\r
- }\r
-\r
- if ( false !== this._trigger( "select", event, { item: item } ) ) {\r
- this._value( item.value );\r
- }\r
- // reset the term after the select event\r
- // this allows custom select handling to work properly\r
- this.term = this._value();\r
-\r
- this.close( event );\r
- this.selectedItem = item;\r
- }\r
- });\r
-\r
- this.liveRegion = $( "<span>", {\r
- role: "status",\r
- "aria-live": "polite"\r
- })\r
- .addClass( "ui-helper-hidden-accessible" )\r
- .insertBefore( this.element );\r
-\r
- // turning off autocomplete prevents the browser from remembering the\r
- // value when navigating through history, so we re-enable autocomplete\r
- // if the page is unloaded before the widget is destroyed. #7790\r
- this._on( this.window, {\r
- beforeunload: function() {\r
- this.element.removeAttr( "autocomplete" );\r
- }\r
- });\r
- },\r
-\r
- _destroy: function() {\r
- clearTimeout( this.searching );\r
- this.element\r
- .removeClass( "ui-autocomplete-input" )\r
- .removeAttr( "autocomplete" );\r
- this.menu.element.remove();\r
- this.liveRegion.remove();\r
- },\r
-\r
- _setOption: function( key, value ) {\r
- this._super( key, value );\r
- if ( key === "source" ) {\r
- this._initSource();\r
- }\r
- if ( key === "appendTo" ) {\r
- this.menu.element.appendTo( this._appendTo() );\r
- }\r
- if ( key === "disabled" && value && this.xhr ) {\r
- this.xhr.abort();\r
- }\r
- },\r
-\r
- _appendTo: function() {\r
- var element = this.options.appendTo;\r
-\r
- if ( element ) {\r
- element = element.jquery || element.nodeType ?\r
- $( element ) :\r
- this.document.find( element ).eq( 0 );\r
- }\r
-\r
- if ( !element ) {\r
- element = this.element.closest( ".ui-front" );\r
- }\r
-\r
- if ( !element.length ) {\r
- element = this.document[0].body;\r
- }\r
-\r
- return element;\r
- },\r
-\r
- _initSource: function() {\r
- var array, url,\r
- that = this;\r
- if ( $.isArray(this.options.source) ) {\r
- array = this.options.source;\r
- this.source = function( request, response ) {\r
- response( $.ui.autocomplete.filter( array, request.term ) );\r
- };\r
- } else if ( typeof this.options.source === "string" ) {\r
- url = this.options.source;\r
- this.source = function( request, response ) {\r
- if ( that.xhr ) {\r
- that.xhr.abort();\r
- }\r
- that.xhr = $.ajax({\r
- url: url,\r
- data: request,\r
- dataType: "json",\r
- success: function( data ) {\r
- response( data );\r
- },\r
- error: function() {\r
- response( [] );\r
- }\r
- });\r
- };\r
- } else {\r
- this.source = this.options.source;\r
- }\r
- },\r
-\r
- _searchTimeout: function( event ) {\r
- clearTimeout( this.searching );\r
- this.searching = this._delay(function() {\r
- // only search if the value has changed\r
- if ( this.term !== this._value() ) {\r
- this.selectedItem = null;\r
- this.search( null, event );\r
- }\r
- }, this.options.delay );\r
- },\r
-\r
- search: function( value, event ) {\r
- value = value != null ? value : this._value();\r
-\r
- // always save the actual value, not the one passed as an argument\r
- this.term = this._value();\r
-\r
- if ( value.length < this.options.minLength ) {\r
- return this.close( event );\r
- }\r
-\r
- if ( this._trigger( "search", event ) === false ) {\r
- return;\r
- }\r
-\r
- return this._search( value );\r
- },\r
-\r
- _search: function( value ) {\r
- this.pending++;\r
- this.element.addClass( "ui-autocomplete-loading" );\r
- this.cancelSearch = false;\r
-\r
- this.source( { term: value }, this._response() );\r
- },\r
-\r
- _response: function() {\r
- var index = ++this.requestIndex;\r
-\r
- return $.proxy(function( content ) {\r
- if ( index === this.requestIndex ) {\r
- this.__response( content );\r
- }\r
-\r
- this.pending--;\r
- if ( !this.pending ) {\r
- this.element.removeClass( "ui-autocomplete-loading" );\r
- }\r
- }, this );\r
- },\r
-\r
- __response: function( content ) {\r
- if ( content ) {\r
- content = this._normalize( content );\r
- }\r
- this._trigger( "response", null, { content: content } );\r
- if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {\r
- this._suggest( content );\r
- this._trigger( "open" );\r
- } else {\r
- // use ._close() instead of .close() so we don't cancel future searches\r
- this._close();\r
- }\r
- },\r
-\r
- close: function( event ) {\r
- this.cancelSearch = true;\r
- this._close( event );\r
- },\r
-\r
- _close: function( event ) {\r
- if ( this.menu.element.is( ":visible" ) ) {\r
- this.menu.element.hide();\r
- this.menu.blur();\r
- this.isNewMenu = true;\r
- this._trigger( "close", event );\r
- }\r
- },\r
-\r
- _change: function( event ) {\r
- if ( this.previous !== this._value() ) {\r
- this._trigger( "change", event, { item: this.selectedItem } );\r
- }\r
- },\r
-\r
- _normalize: function( items ) {\r
- // assume all items have the right format when the first item is complete\r
- if ( items.length && items[0].label && items[0].value ) {\r
- return items;\r
- }\r
- return $.map( items, function( item ) {\r
- if ( typeof item === "string" ) {\r
- return {\r
- label: item,\r
- value: item\r
- };\r
- }\r
- return $.extend({\r
- label: item.label || item.value,\r
- value: item.value || item.label\r
- }, item );\r
- });\r
- },\r
-\r
- _suggest: function( items ) {\r
- var ul = this.menu.element.empty();\r
- this._renderMenu( ul, items );\r
- this.isNewMenu = true;\r
- this.menu.refresh();\r
-\r
- // size and position menu\r
- ul.show();\r
- this._resizeMenu();\r
- ul.position( $.extend({\r
- of: this.element\r
- }, this.options.position ));\r
-\r
- if ( this.options.autoFocus ) {\r
- this.menu.next();\r
- }\r
- },\r
-\r
- _resizeMenu: function() {\r
- var ul = this.menu.element;\r
- ul.outerWidth( Math.max(\r
- // Firefox wraps long text (possibly a rounding bug)\r
- // so we add 1px to avoid the wrapping (#7513)\r
- ul.width( "" ).outerWidth() + 1,\r
- this.element.outerWidth()\r
- ) );\r
- },\r
-\r
- _renderMenu: function( ul, items ) {\r
- var that = this;\r
- $.each( items, function( index, item ) {\r
- that._renderItemData( ul, item );\r
- });\r
- },\r
-\r
- _renderItemData: function( ul, item ) {\r
- return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );\r
- },\r
-\r
- _renderItem: function( ul, item ) {\r
- return $( "<li>" )\r
- .append( $( "<a>" ).text( item.label ) )\r
- .appendTo( ul );\r
- },\r
-\r
- _move: function( direction, event ) {\r
- if ( !this.menu.element.is( ":visible" ) ) {\r
- this.search( null, event );\r
- return;\r
- }\r
- if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||\r
- this.menu.isLastItem() && /^next/.test( direction ) ) {\r
- this._value( this.term );\r
- this.menu.blur();\r
- return;\r
- }\r
- this.menu[ direction ]( event );\r
- },\r
-\r
- widget: function() {\r
- return this.menu.element;\r
- },\r
-\r
- _value: function() {\r
- return this.valueMethod.apply( this.element, arguments );\r
- },\r
-\r
- _keyEvent: function( keyEvent, event ) {\r
- if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {\r
- this._move( keyEvent, event );\r
-\r
- // prevents moving cursor to beginning/end of the text field in some browsers\r
- event.preventDefault();\r
- }\r
- }\r
-});\r
-\r
-$.extend( $.ui.autocomplete, {\r
- escapeRegex: function( value ) {\r
- return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");\r
- },\r
- filter: function(array, term) {\r
- var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );\r
- return $.grep( array, function(value) {\r
- return matcher.test( value.label || value.value || value );\r
- });\r
- }\r
-});\r
-\r
-\r
-// live region extension, adding a `messages` option\r
-// NOTE: This is an experimental API. We are still investigating\r
-// a full solution for string manipulation and internationalization.\r
-$.widget( "ui.autocomplete", $.ui.autocomplete, {\r
- options: {\r
- messages: {\r
- noResults: "No search results.",\r
- results: function( amount ) {\r
- return amount + ( amount > 1 ? " results are" : " result is" ) +\r
- " available, use up and down arrow keys to navigate.";\r
- }\r
- }\r
- },\r
-\r
- __response: function( content ) {\r
- var message;\r
- this._superApply( arguments );\r
- if ( this.options.disabled || this.cancelSearch ) {\r
- return;\r
- }\r
- if ( content && content.length ) {\r
- message = this.options.messages.results( content.length );\r
- } else {\r
- message = this.options.messages.noResults;\r
- }\r
- this.liveRegion.text( message );\r
- }\r
-});\r
-\r
-}( jQuery ));\r
-\r
-}catch (e) {\r
-System.out.println("coremenu failed to load jQuery.ui.autocomplete -- jQuery version conflict?");\r
-}\r
-\r
+if (self.Clazz) {
+
+Clazz.declarePackage ("swingjs.jquery");
+c$ = Clazz.declareType (swingjs.jquery, "JQuery_UI_Core2");
+Clazz.makeConstructor (c$,
+function () {
+});
+
+}
+
+// menu button autocomplete
+
+if (!jQuery.ui.menu)
+try{
+
+/*!
+ * jQuery UI Menu 1.10.4
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/menu/
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ */
+(function( $, undefined ) {
+
+$.widget( "ui.menu", {
+ version: "1.10.4",
+ defaultElement: "<ul>",
+ delay: 300,
+ options: {
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
+ menus: "ul",
+ position: {
+ my: "left top",
+ at: "right top"
+ },
+ role: "menu",
+
+ // callbacks
+ blur: null,
+ focus: null,
+ select: null
+ },
+
+ _create: function() {
+ this.activeMenu = this.element;
+ // flag used to prevent firing of the click handler
+ // as the event bubbles up through nested menus
+ this.mouseHandled = false;
+ this.element
+ .uniqueId()
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+ .attr({
+ role: this.options.role,
+ tabIndex: 0
+ })
+ // need to catch all clicks on disabled menu
+ // not possible through _on
+ .bind( "click" + this.eventNamespace, $.proxy(function( event ) {
+ if ( this.options.disabled ) {
+ event.preventDefault();
+ }
+ }, this ));
+
+ if ( this.options.disabled ) {
+ this.element
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
+ }
+
+ this._on({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-state-disabled > a": function( event ) {
+ event.preventDefault();
+ },
+ "click .ui-menu-item:has(a)": function( event ) {
+ var target = $( event.target ).closest( ".ui-menu-item" );
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ this.select( event );
+
+ // Only set the mouseHandled flag if the event will bubble, see #9469.
+ if ( !event.isPropagationStopped() ) {
+ this.mouseHandled = true;
+ }
+
+ // Open submenu on click
+ if ( target.has( ".ui-menu" ).length ) {
+ this.expand( event );
+ } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
+
+ // Redirect focus to the menu
+ this.element.trigger( "focus", [ true ] );
+
+ // If the active item is on the top level, let it stay active.
+ // Otherwise, blur the active item since it is no longer visible.
+ if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+ clearTimeout( this.timer );
+ }
+ }
+ }
+ },
+ "mouseenter .ui-menu-item": function( event ) {
+ var target = $( event.currentTarget );
+ // Remove ui-state-active class from siblings of the newly focused menu item
+ // to avoid a jump caused by adjacent elements both having a class with a border
+ target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
+ this.focus( event, target );
+ },
+ mouseleave: "collapseAll",
+ "mouseleave .ui-menu": "collapseAll",
+ focus: function( event, keepActiveItem ) {
+ // If there's already an active item, keep it active
+ // If not, activate the first item
+ var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
+
+ if ( !keepActiveItem ) {
+ this.focus( event, item );
+ }
+ },
+ blur: function( event ) {
+ this._delay(function() {
+ if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+ this.collapseAll( event );
+ }
+ });
+ },
+ keydown: "_keydown"
+ });
+
+ this.refresh();
+
+ // Clicks outside of a menu collapse any open menus
+ this._on( this.document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.collapseAll( event );
+ }
+
+ // Reset the mouseHandled flag
+ this.mouseHandled = false;
+ }
+ });
+ },
+
+ _destroy: function() {
+ // Destroy (sub)menus
+ this.element
+ .removeAttr( "aria-activedescendant" )
+ .find( ".ui-menu" ).addBack()
+ .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
+ .removeAttr( "role" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "aria-labelledby" )
+ .removeAttr( "aria-expanded" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
+ .show();
+
+ // Destroy menu items
+ this.element.find( ".ui-menu-item" )
+ .removeClass( "ui-menu-item" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
+ .children( "a" )
+ .removeUniqueId()
+ .removeClass( "ui-corner-all ui-state-hover" )
+ .removeAttr( "tabIndex" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-haspopup" )
+ .children().each( function() {
+ var elem = $( this );
+ if ( elem.data( "ui-menu-submenu-carat" ) ) {
+ elem.remove();
+ }
+ });
+
+ // Destroy menu dividers
+ this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+ },
+
+ _keydown: function( event ) {
+ var match, prev, character, skip, regex,
+ preventDefault = true;
+
+ function escape( value ) {
+ return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+ }
+
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.PAGE_UP:
+ this.previousPage( event );
+ break;
+ case $.ui.keyCode.PAGE_DOWN:
+ this.nextPage( event );
+ break;
+ case $.ui.keyCode.HOME:
+ this._move( "first", "first", event );
+ break;
+ case $.ui.keyCode.END:
+ this._move( "last", "last", event );
+ break;
+ case $.ui.keyCode.UP:
+ this.previous( event );
+ break;
+ case $.ui.keyCode.DOWN:
+ this.next( event );
+ break;
+ case $.ui.keyCode.LEFT:
+ this.collapse( event );
+ break;
+ case $.ui.keyCode.RIGHT:
+ if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+ this.expand( event );
+ }
+ break;
+ case $.ui.keyCode.ENTER:
+ case $.ui.keyCode.SPACE:
+ this._activate( event );
+ break;
+ case $.ui.keyCode.ESCAPE:
+ this.collapse( event );
+ break;
+ default:
+ preventDefault = false;
+ prev = this.previousFilter || "";
+ character = String.fromCharCode( event.keyCode );
+ skip = false;
+
+ clearTimeout( this.filterTimer );
+
+ if ( character === prev ) {
+ skip = true;
+ } else {
+ character = prev + character;
+ }
+
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ match = skip && match.index( this.active.next() ) !== -1 ?
+ this.active.nextAll( ".ui-menu-item" ) :
+ match;
+
+ // If no matches on the current filter, reset to the last character pressed
+ // to move down the menu to the first item that starts with that character
+ if ( !match.length ) {
+ character = String.fromCharCode( event.keyCode );
+ regex = new RegExp( "^" + escape( character ), "i" );
+ match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+ return regex.test( $( this ).children( "a" ).text() );
+ });
+ }
+
+ if ( match.length ) {
+ this.focus( event, match );
+ if ( match.length > 1 ) {
+ this.previousFilter = character;
+ this.filterTimer = this._delay(function() {
+ delete this.previousFilter;
+ }, 1000 );
+ } else {
+ delete this.previousFilter;
+ }
+ } else {
+ delete this.previousFilter;
+ }
+ }
+
+ if ( preventDefault ) {
+ event.preventDefault();
+ }
+ },
+
+ _activate: function( event ) {
+ if ( !this.active.is( ".ui-state-disabled" ) ) {
+ if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
+ this.expand( event );
+ } else {
+ this.select( event );
+ }
+ }
+ },
+
+ refresh: function() {
+ var menus,
+ icon = this.options.icons.submenu,
+ submenus = this.element.find( this.options.menus );
+
+ this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.prev( "a" ),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
+
+ menus = submenus.add( this.element );
+
+ // Don't refresh list items that are already adapted
+ menus.children( ":not(.ui-menu-item):has(a)" )
+ .addClass( "ui-menu-item" )
+ .attr( "role", "presentation" )
+ .children( "a" )
+ .uniqueId()
+ .addClass( "ui-corner-all" )
+ .attr({
+ tabIndex: -1,
+ role: this._itemRole()
+ });
+
+ // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
+ menus.children( ":not(.ui-menu-item)" ).each(function() {
+ var item = $( this );
+ // hyphen, em dash, en dash
+ if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
+ item.addClass( "ui-widget-content ui-menu-divider" );
+ }
+ });
+
+ // Add aria-disabled attribute to any disabled menu item
+ menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+ // If the active item has been removed, blur the menu
+ if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+ this.blur();
+ }
+ },
+
+ _itemRole: function() {
+ return {
+ menu: "menuitem",
+ listbox: "option"
+ }[ this.options.role ];
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "icons" ) {
+ this.element.find( ".ui-menu-icon" )
+ .removeClass( this.options.icons.submenu )
+ .addClass( value.submenu );
+ }
+ this._super( key, value );
+ },
+
+ focus: function( event, item ) {
+ var nested, focused;
+ this.blur( event, event && event.type === "focus" );
+
+ this._scrollIntoView( item );
+
+ this.active = item.first();
+ focused = this.active.children( "a" ).addClass( "ui-state-focus" );
+ // Only update aria-activedescendant if there's a role
+ // otherwise we assume focus is managed elsewhere
+ if ( this.options.role ) {
+ this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+ }
+
+ // Highlight active parent menu item, if any
+ this.active
+ .parent()
+ .closest( ".ui-menu-item" )
+ .children( "a:first" )
+ .addClass( "ui-state-active" );
+
+ if ( event && event.type === "keydown" ) {
+ this._close();
+ } else {
+ this.timer = this._delay(function() {
+ this._close();
+ }, this.delay );
+ }
+
+ nested = item.children( ".ui-menu" );
+ if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
+ this._startOpening(nested);
+ }
+ this.activeMenu = item.parent();
+
+ this._trigger( "focus", event, { item: item } );
+ },
+
+ _scrollIntoView: function( item ) {
+ var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+ if ( this._hasScroll() ) {
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.height();
+
+ if ( offset < 0 ) {
+ this.activeMenu.scrollTop( scroll + offset );
+ } else if ( offset + itemHeight > elementHeight ) {
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+ }
+ }
+ },
+
+ blur: function( event, fromFocus ) {
+ if ( !fromFocus ) {
+ clearTimeout( this.timer );
+ }
+
+ if ( !this.active ) {
+ return;
+ }
+
+ this.active.children( "a" ).removeClass( "ui-state-focus" );
+ this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
+ },
+
+ _startOpening: function( submenu ) {
+ clearTimeout( this.timer );
+
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+ // shift in the submenu position when mousing over the carat icon
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+ return;
+ }
+
+ this.timer = this._delay(function() {
+ this._close();
+ this._open( submenu );
+ }, this.delay );
+ },
+
+ _open: function( submenu ) {
+ var position = $.extend({
+ of: this.active
+ }, this.options.position );
+
+ clearTimeout( this.timer );
+ this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+ .hide()
+ .attr( "aria-hidden", "true" );
+
+ submenu
+ .show()
+ .removeAttr( "aria-hidden" )
+ .attr( "aria-expanded", "true" )
+ .position( position );
+ },
+
+ collapseAll: function( event, all ) {
+ clearTimeout( this.timer );
+ this.timer = this._delay(function() {
+ // If we were passed an event, look for the submenu that contains the event
+ var currentMenu = all ? this.element :
+ $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+ // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ if ( !currentMenu.length ) {
+ currentMenu = this.element;
+ }
+
+ this._close( currentMenu );
+
+ this.blur( event );
+ this.activeMenu = currentMenu;
+ }, this.delay );
+ },
+
+ // With no arguments, closes the currently active menu - if nothing is active
+ // it closes all menus. If passed an argument, it will search for menus BELOW
+ _close: function( startMenu ) {
+ if ( !startMenu ) {
+ startMenu = this.active ? this.active.parent() : this.element;
+ }
+
+ startMenu
+ .find( ".ui-menu" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" )
+ .end()
+ .find( "a.ui-state-active" )
+ .removeClass( "ui-state-active" );
+ },
+
+ collapse: function( event ) {
+ var newItem = this.active &&
+ this.active.parent().closest( ".ui-menu-item", this.element );
+ if ( newItem && newItem.length ) {
+ this._close();
+ this.focus( event, newItem );
+ }
+ },
+
+ expand: function( event ) {
+ var newItem = this.active &&
+ this.active
+ .children( ".ui-menu " )
+ .children( ".ui-menu-item" )
+ .first();
+
+ if ( newItem && newItem.length ) {
+ this._open( newItem.parent() );
+
+ // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+ this._delay(function() {
+ this.focus( event, newItem );
+ });
+ }
+ },
+
+ next: function( event ) {
+ this._move( "next", "first", event );
+ },
+
+ previous: function( event ) {
+ this._move( "prev", "last", event );
+ },
+
+ isFirstItem: function() {
+ return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+ },
+
+ isLastItem: function() {
+ return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+ },
+
+ _move: function( direction, filter, event ) {
+ var next;
+ if ( this.active ) {
+ if ( direction === "first" || direction === "last" ) {
+ next = this.active
+ [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+ .eq( -1 );
+ } else {
+ next = this.active
+ [ direction + "All" ]( ".ui-menu-item" )
+ .eq( 0 );
+ }
+ }
+ if ( !next || !next.length || !this.active ) {
+ next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
+ }
+
+ this.focus( event, next );
+ },
+
+ nextPage: function( event ) {
+ var item, base, height;
+
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isLastItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.nextAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base - height < 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )
+ [ !this.active ? "first" : "last" ]() );
+ }
+ },
+
+ previousPage: function( event ) {
+ var item, base, height;
+ if ( !this.active ) {
+ this.next( event );
+ return;
+ }
+ if ( this.isFirstItem() ) {
+ return;
+ }
+ if ( this._hasScroll() ) {
+ base = this.active.offset().top;
+ height = this.element.height();
+ this.active.prevAll( ".ui-menu-item" ).each(function() {
+ item = $( this );
+ return item.offset().top - base + height > 0;
+ });
+
+ this.focus( event, item );
+ } else {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
+ }
+ },
+
+ _hasScroll: function() {
+ return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+ },
+
+ select: function( event ) {
+ // TODO: It should never be possible to not have an active item at this
+ // point, but the tests don't trigger mouseenter before click.
+ this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+ var ui = { item: this.active };
+ if ( !this.active.has( ".ui-menu" ).length ) {
+ this.collapseAll( event, true );
+ }
+ this._trigger( "select", event, ui );
+ }
+});
+
+}( jQuery ));
+
+
+}catch (e) {
+System.out.println("coremenu failed to load jQuery.ui.menu -- jQuery version conflict?");
+}
+
+if (!jQuery.ui.button)
+try{
+
+/*!
+ * jQuery UI Button 1.10.4
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/button/
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+var lastActive,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+ formResetHandler = function() {
+ var form = $( this );
+ setTimeout(function() {
+ form.find( ":ui-button" ).button( "refresh" );
+ }, 1 );
+ },
+ radioGroup = function( radio ) {
+ var name = radio.name,
+ form = radio.form,
+ radios = $( [] );
+ if ( name ) {
+ name = name.replace( /'/g, "\\'" );
+ if ( form ) {
+ radios = $( form ).find( "[name='" + name + "']" );
+ } else {
+ radios = $( "[name='" + name + "']", radio.ownerDocument )
+ .filter(function() {
+ return !this.form;
+ });
+ }
+ }
+ return radios;
+ };
+
+$.widget( "ui.button", {
+ version: "1.10.4",
+ defaultElement: "<button>",
+ options: {
+ disabled: null,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+ },
+ _create: function() {
+ this.element.closest( "form" )
+ .unbind( "reset" + this.eventNamespace )
+ .bind( "reset" + this.eventNamespace, formResetHandler );
+
+ if ( typeof this.options.disabled !== "boolean" ) {
+ this.options.disabled = !!this.element.prop( "disabled" );
+ } else {
+ this.element.prop( "disabled", this.options.disabled );
+ }
+
+ this._determineButtonType();
+ this.hasTitle = !!this.buttonElement.attr( "title" );
+
+ var that = this,
+ options = this.options,
+ toggleButton = this.type === "checkbox" || this.type === "radio",
+ activeClass = !toggleButton ? "ui-state-active" : "";
+
+ if ( options.label === null ) {
+ options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+ }
+
+ this._hoverable( this.buttonElement );
+
+ this.buttonElement
+ .addClass( baseClasses )
+ .attr( "role", "button" )
+ .bind( "mouseenter" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( this === lastActive ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "mouseleave" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return;
+ }
+ $( this ).removeClass( activeClass );
+ })
+ .bind( "click" + this.eventNamespace, function( event ) {
+ if ( options.disabled ) {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+ });
+
+ // Can't use _focusable() because the element that receives focus
+ // and the element that gets the ui-state-focus class are different
+ this._on({
+ focus: function() {
+ this.buttonElement.addClass( "ui-state-focus" );
+ },
+ blur: function() {
+ this.buttonElement.removeClass( "ui-state-focus" );
+ }
+ });
+
+ if ( toggleButton ) {
+ this.element.bind( "change" + this.eventNamespace, function() {
+ that.refresh();
+ });
+ }
+
+ if ( this.type === "checkbox" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ });
+ } else if ( this.type === "radio" ) {
+ this.buttonElement.bind( "click" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ that.buttonElement.attr( "aria-pressed", "true" );
+
+ var radio = that.element[ 0 ];
+ radioGroup( radio )
+ .not( radio )
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ });
+ } else {
+ this.buttonElement
+ .bind( "mousedown" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).addClass( "ui-state-active" );
+ lastActive = this;
+ that.document.one( "mouseup", function() {
+ lastActive = null;
+ });
+ })
+ .bind( "mouseup" + this.eventNamespace, function() {
+ if ( options.disabled ) {
+ return false;
+ }
+ $( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown" + this.eventNamespace, function(event) {
+ if ( options.disabled ) {
+ return false;
+ }
+ if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ // see #8559, we bind to blur here in case the button element loses
+ // focus between keydown and keyup, it would be left in an "active" state
+ .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
+ $( this ).removeClass( "ui-state-active" );
+ });
+
+ if ( this.buttonElement.is("a") ) {
+ this.buttonElement.keyup(function(event) {
+ if ( event.keyCode === $.ui.keyCode.SPACE ) {
+ // TODO pass through original event correctly (just as 2nd argument doesn't work)
+ $( this ).click();
+ }
+ });
+ }
+ }
+
+ // TODO: pull out $.Widget's handling for the disabled option into
+ // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+ // be overridden by individual plugins
+ this._setOption( "disabled", options.disabled );
+ this._resetButton();
+ },
+
+ _determineButtonType: function() {
+ var ancestor, labelSelector, checked;
+
+ if ( this.element.is("[type=checkbox]") ) {
+ this.type = "checkbox";
+ } else if ( this.element.is("[type=radio]") ) {
+ this.type = "radio";
+ } else if ( this.element.is("input") ) {
+ this.type = "input";
+ } else {
+ this.type = "button";
+ }
+
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ ancestor = this.element.parents().last();
+ labelSelector = "label[for='" + this.element.attr("id") + "']";
+ this.buttonElement = ancestor.find( labelSelector );
+ if ( !this.buttonElement.length ) {
+ ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+ this.buttonElement = ancestor.filter( labelSelector );
+ if ( !this.buttonElement.length ) {
+ this.buttonElement = ancestor.find( labelSelector );
+ }
+ }
+ this.element.addClass( "ui-helper-hidden-accessible" );
+
+ checked = this.element.is( ":checked" );
+ if ( checked ) {
+ this.buttonElement.addClass( "ui-state-active" );
+ }
+ this.buttonElement.prop( "aria-pressed", checked );
+ } else {
+ this.buttonElement = this.element;
+ }
+ },
+
+ widget: function() {
+ return this.buttonElement;
+ },
+
+ _destroy: function() {
+ this.element
+ .removeClass( "ui-helper-hidden-accessible" );
+ this.buttonElement
+ .removeClass( baseClasses + " ui-state-active " + typeClasses )
+ .removeAttr( "role" )
+ .removeAttr( "aria-pressed" )
+ .html( this.buttonElement.find(".ui-button-text").html() );
+
+ if ( !this.hasTitle ) {
+ this.buttonElement.removeAttr( "title" );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "disabled" ) {
+ this.element.prop( "disabled", !!value );
+ if ( value ) {
+ this.buttonElement.removeClass( "ui-state-focus" );
+ }
+ return;
+ }
+ this._resetButton();
+ },
+
+ refresh: function() {
+ //See #8237 & #8828
+ var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+ if ( isDisabled !== this.options.disabled ) {
+ this._setOption( "disabled", isDisabled );
+ }
+ if ( this.type === "radio" ) {
+ radioGroup( this.element[0] ).each(function() {
+ if ( $( this ).is( ":checked" ) ) {
+ $( this ).button( "widget" )
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ $( this ).button( "widget" )
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ });
+ } else if ( this.type === "checkbox" ) {
+ if ( this.element.is( ":checked" ) ) {
+ this.buttonElement
+ .addClass( "ui-state-active" )
+ .attr( "aria-pressed", "true" );
+ } else {
+ this.buttonElement
+ .removeClass( "ui-state-active" )
+ .attr( "aria-pressed", "false" );
+ }
+ }
+ },
+
+ _resetButton: function() {
+ if ( this.type === "input" ) {
+ if ( this.options.label ) {
+ this.element.val( this.options.label );
+ }
+ return;
+ }
+ var buttonElement = this.buttonElement.removeClass( typeClasses ),
+ buttonText = $( "<span></span>", this.document[0] )
+ .addClass( "ui-button-text" )
+ .html( this.options.label )
+ .appendTo( buttonElement.empty() )
+ .text(),
+ icons = this.options.icons,
+ multipleIcons = icons.primary && icons.secondary,
+ buttonClasses = [];
+
+ if ( icons.primary || icons.secondary ) {
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
+
+ if ( icons.primary ) {
+ buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+ }
+
+ if ( icons.secondary ) {
+ buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+ }
+
+ if ( !this.options.text ) {
+ buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+ if ( !this.hasTitle ) {
+ buttonElement.attr( "title", $.trim( buttonText ) );
+ }
+ }
+ } else {
+ buttonClasses.push( "ui-button-text-only" );
+ }
+ buttonElement.addClass( buttonClasses.join( " " ) );
+ }
+});
+
+$.widget( "ui.buttonset", {
+ version: "1.10.4",
+ options: {
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
+ },
+
+ _create: function() {
+ this.element.addClass( "ui-buttonset" );
+ },
+
+ _init: function() {
+ this.refresh();
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "disabled" ) {
+ this.buttons.button( "option", key, value );
+ }
+
+ this._super( key, value );
+ },
+
+ refresh: function() {
+ var rtl = this.element.css( "direction" ) === "rtl";
+
+ this.buttons = this.element.find( this.options.items )
+ .filter( ":ui-button" )
+ .button( "refresh" )
+ .end()
+ .not( ":ui-button" )
+ .button()
+ .end()
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+ .filter( ":first" )
+ .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+ .end()
+ .filter( ":last" )
+ .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+ .end()
+ .end();
+ },
+
+ _destroy: function() {
+ this.element.removeClass( "ui-buttonset" );
+ this.buttons
+ .map(function() {
+ return $( this ).button( "widget" )[ 0 ];
+ })
+ .removeClass( "ui-corner-left ui-corner-right" )
+ .end()
+ .button( "destroy" );
+ }
+});
+
+}( jQuery ) );
+
+}catch (e) {
+System.out.println("coremenu failed to load jQuery.ui.button -- jQuery version conflict?");
+}
+
+if (!jQuery.ui.autocomplete)
+try{
+
+/*!
+ * jQuery UI Autocomplete 1.10.4
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/autocomplete/
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ * jquery.ui.menu.js
+ */
+(function( $, undefined ) {
+
+$.widget( "ui.autocomplete", {
+ version: "1.10.4",
+ defaultElement: "<input>",
+ options: {
+ appendTo: null,
+ autoFocus: false,
+ delay: 300,
+ minLength: 1,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ source: null,
+
+ // callbacks
+ change: null,
+ close: null,
+ focus: null,
+ open: null,
+ response: null,
+ search: null,
+ select: null
+ },
+
+ requestIndex: 0,
+ pending: 0,
+
+ _create: function() {
+ // Some browsers only repeat keydown events, not keypress events,
+ // so we use the suppressKeyPress flag to determine if we've already
+ // handled the keydown event. #7269
+ // Unfortunately the code for & in keypress is the same as the up arrow,
+ // so we use the suppressKeyPressRepeat flag to avoid handling keypress
+ // events when we know the keydown event was used to modify the
+ // search term. #7799
+ var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
+ nodeName = this.element[0].nodeName.toLowerCase(),
+ isTextarea = nodeName === "textarea",
+ isInput = nodeName === "input";
+
+ this.isMultiLine =
+ // Textareas are always multi-line
+ isTextarea ? true :
+ // Inputs are always single-line, even if inside a contentEditable element
+ // IE also treats inputs as contentEditable
+ isInput ? false :
+ // All other element types are determined by whether or not they're contentEditable
+ this.element.prop( "isContentEditable" );
+
+ this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
+ this.isNewMenu = true;
+
+ this.element
+ .addClass( "ui-autocomplete-input" )
+ .attr( "autocomplete", "off" );
+
+ this._on( this.element, {
+ keydown: function( event ) {
+ if ( this.element.prop( "readOnly" ) ) {
+ suppressKeyPress = true;
+ suppressInput = true;
+ suppressKeyPressRepeat = true;
+ return;
+ }
+
+ suppressKeyPress = false;
+ suppressInput = false;
+ suppressKeyPressRepeat = false;
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ suppressKeyPress = true;
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ suppressKeyPress = true;
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ suppressKeyPress = true;
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ suppressKeyPress = true;
+ this._keyEvent( "next", event );
+ break;
+ case keyCode.ENTER:
+ case keyCode.NUMPAD_ENTER:
+ // when menu is open and has focus
+ if ( this.menu.active ) {
+ // #6055 - Opera still allows the keypress to occur
+ // which causes forms to submit
+ suppressKeyPress = true;
+ event.preventDefault();
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.TAB:
+ if ( this.menu.active ) {
+ this.menu.select( event );
+ }
+ break;
+ case keyCode.ESCAPE:
+ if ( this.menu.element.is( ":visible" ) ) {
+ this._value( this.term );
+ this.close( event );
+ // Different browsers have different default behavior for escape
+ // Single press can mean undo or clear
+ // Double press in IE means clear the whole form
+ event.preventDefault();
+ }
+ break;
+ default:
+ suppressKeyPressRepeat = true;
+ // search timeout should be triggered before the input value is changed
+ this._searchTimeout( event );
+ break;
+ }
+ },
+ keypress: function( event ) {
+ if ( suppressKeyPress ) {
+ suppressKeyPress = false;
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ event.preventDefault();
+ }
+ return;
+ }
+ if ( suppressKeyPressRepeat ) {
+ return;
+ }
+
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ this._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ this._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ this._keyEvent( "previous", event );
+ break;
+ case keyCode.DOWN:
+ this._keyEvent( "next", event );
+ break;
+ }
+ },
+ input: function( event ) {
+ if ( suppressInput ) {
+ suppressInput = false;
+ event.preventDefault();
+ return;
+ }
+ this._searchTimeout( event );
+ },
+ focus: function() {
+ this.selectedItem = null;
+ this.previous = this._value();
+ },
+ blur: function( event ) {
+ if ( this.cancelBlur ) {
+ delete this.cancelBlur;
+ return;
+ }
+
+ clearTimeout( this.searching );
+ this.close( event );
+ this._change( event );
+ }
+ });
+
+ this._initSource();
+ this.menu = $( "<ul>" )
+ .addClass( "ui-autocomplete ui-front" )
+ .appendTo( this._appendTo() )
+ .menu({
+ // disable ARIA support, the live region takes care of that
+ role: null
+ })
+ .hide()
+ .data( "ui-menu" );
+
+ this._on( this.menu.element, {
+ mousedown: function( event ) {
+ // prevent moving focus out of the text field
+ event.preventDefault();
+
+ // IE doesn't prevent moving focus even with event.preventDefault()
+ // so we set a flag to know when we should ignore the blur event
+ this.cancelBlur = true;
+ this._delay(function() {
+ delete this.cancelBlur;
+ });
+
+ // clicking on the scrollbar causes focus to shift to the body
+ // but we can't detect a mouseup or a click immediately afterward
+ // so we have to track the next mousedown and close the menu if
+ // the user clicks somewhere outside of the autocomplete
+ var menuElement = this.menu.element[ 0 ];
+ if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+ this._delay(function() {
+ var that = this;
+ this.document.one( "mousedown", function( event ) {
+ if ( event.target !== that.element[ 0 ] &&
+ event.target !== menuElement &&
+ !$.contains( menuElement, event.target ) ) {
+ that.close();
+ }
+ });
+ });
+ }
+ },
+ menufocus: function( event, ui ) {
+ // support: Firefox
+ // Prevent accidental activation of menu items in Firefox (#7024 #9118)
+ if ( this.isNewMenu ) {
+ this.isNewMenu = false;
+ if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+ this.menu.blur();
+
+ this.document.one( "mousemove", function() {
+ $( event.target ).trigger( event.originalEvent );
+ });
+
+ return;
+ }
+ }
+
+ var item = ui.item.data( "ui-autocomplete-item" );
+ if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+ // use value to match what will end up in the input, if it was a key event
+ if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+ this._value( item.value );
+ }
+ } else {
+ // Normally the input is populated with the item's value as the
+ // menu is navigated, causing screen readers to notice a change and
+ // announce the item. Since the focus event was canceled, this doesn't
+ // happen, so we update the live region so that screen readers can
+ // still notice the change and announce it.
+ this.liveRegion.text( item.value );
+ }
+ },
+ menuselect: function( event, ui ) {
+ var item = ui.item.data( "ui-autocomplete-item" ),
+ previous = this.previous;
+
+ // only trigger when focus was lost (click on menu)
+ if ( this.element[0] !== this.document[0].activeElement ) {
+ this.element.focus();
+ this.previous = previous;
+ // #6109 - IE triggers two focus events and the second
+ // is asynchronous, so we need to reset the previous
+ // term synchronously and asynchronously :-(
+ this._delay(function() {
+ this.previous = previous;
+ this.selectedItem = item;
+ });
+ }
+
+ if ( false !== this._trigger( "select", event, { item: item } ) ) {
+ this._value( item.value );
+ }
+ // reset the term after the select event
+ // this allows custom select handling to work properly
+ this.term = this._value();
+
+ this.close( event );
+ this.selectedItem = item;
+ }
+ });
+
+ this.liveRegion = $( "<span>", {
+ role: "status",
+ "aria-live": "polite"
+ })
+ .addClass( "ui-helper-hidden-accessible" )
+ .insertBefore( this.element );
+
+ // turning off autocomplete prevents the browser from remembering the
+ // value when navigating through history, so we re-enable autocomplete
+ // if the page is unloaded before the widget is destroyed. #7790
+ this._on( this.window, {
+ beforeunload: function() {
+ this.element.removeAttr( "autocomplete" );
+ }
+ });
+ },
+
+ _destroy: function() {
+ clearTimeout( this.searching );
+ this.element
+ .removeClass( "ui-autocomplete-input" )
+ .removeAttr( "autocomplete" );
+ this.menu.element.remove();
+ this.liveRegion.remove();
+ },
+
+ _setOption: function( key, value ) {
+ this._super( key, value );
+ if ( key === "source" ) {
+ this._initSource();
+ }
+ if ( key === "appendTo" ) {
+ this.menu.element.appendTo( this._appendTo() );
+ }
+ if ( key === "disabled" && value && this.xhr ) {
+ this.xhr.abort();
+ }
+ },
+
+ _appendTo: function() {
+ var element = this.options.appendTo;
+
+ if ( element ) {
+ element = element.jquery || element.nodeType ?
+ $( element ) :
+ this.document.find( element ).eq( 0 );
+ }
+
+ if ( !element ) {
+ element = this.element.closest( ".ui-front" );
+ }
+
+ if ( !element.length ) {
+ element = this.document[0].body;
+ }
+
+ return element;
+ },
+
+ _initSource: function() {
+ var array, url,
+ that = this;
+ if ( $.isArray(this.options.source) ) {
+ array = this.options.source;
+ this.source = function( request, response ) {
+ response( $.ui.autocomplete.filter( array, request.term ) );
+ };
+ } else if ( typeof this.options.source === "string" ) {
+ url = this.options.source;
+ this.source = function( request, response ) {
+ if ( that.xhr ) {
+ that.xhr.abort();
+ }
+ that.xhr = $.ajax({
+ url: url,
+ data: request,
+ dataType: "json",
+ success: function( data ) {
+ response( data );
+ },
+ error: function() {
+ response( [] );
+ }
+ });
+ };
+ } else {
+ this.source = this.options.source;
+ }
+ },
+
+ _searchTimeout: function( event ) {
+ clearTimeout( this.searching );
+ this.searching = this._delay(function() {
+ // only search if the value has changed
+ if ( this.term !== this._value() ) {
+ this.selectedItem = null;
+ this.search( null, event );
+ }
+ }, this.options.delay );
+ },
+
+ search: function( value, event ) {
+ value = value != null ? value : this._value();
+
+ // always save the actual value, not the one passed as an argument
+ this.term = this._value();
+
+ if ( value.length < this.options.minLength ) {
+ return this.close( event );
+ }
+
+ if ( this._trigger( "search", event ) === false ) {
+ return;
+ }
+
+ return this._search( value );
+ },
+
+ _search: function( value ) {
+ this.pending++;
+ this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
+
+ this.source( { term: value }, this._response() );
+ },
+
+ _response: function() {
+ var index = ++this.requestIndex;
+
+ return $.proxy(function( content ) {
+ if ( index === this.requestIndex ) {
+ this.__response( content );
+ }
+
+ this.pending--;
+ if ( !this.pending ) {
+ this.element.removeClass( "ui-autocomplete-loading" );
+ }
+ }, this );
+ },
+
+ __response: function( content ) {
+ if ( content ) {
+ content = this._normalize( content );
+ }
+ this._trigger( "response", null, { content: content } );
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+ this._suggest( content );
+ this._trigger( "open" );
+ } else {
+ // use ._close() instead of .close() so we don't cancel future searches
+ this._close();
+ }
+ },
+
+ close: function( event ) {
+ this.cancelSearch = true;
+ this._close( event );
+ },
+
+ _close: function( event ) {
+ if ( this.menu.element.is( ":visible" ) ) {
+ this.menu.element.hide();
+ this.menu.blur();
+ this.isNewMenu = true;
+ this._trigger( "close", event );
+ }
+ },
+
+ _change: function( event ) {
+ if ( this.previous !== this._value() ) {
+ this._trigger( "change", event, { item: this.selectedItem } );
+ }
+ },
+
+ _normalize: function( items ) {
+ // assume all items have the right format when the first item is complete
+ if ( items.length && items[0].label && items[0].value ) {
+ return items;
+ }
+ return $.map( items, function( item ) {
+ if ( typeof item === "string" ) {
+ return {
+ label: item,
+ value: item
+ };
+ }
+ return $.extend({
+ label: item.label || item.value,
+ value: item.value || item.label
+ }, item );
+ });
+ },
+
+ _suggest: function( items ) {
+ var ul = this.menu.element.empty();
+ this._renderMenu( ul, items );
+ this.isNewMenu = true;
+ this.menu.refresh();
+
+ // size and position menu
+ ul.show();
+ this._resizeMenu();
+ ul.position( $.extend({
+ of: this.element
+ }, this.options.position ));
+
+ if ( this.options.autoFocus ) {
+ this.menu.next();
+ }
+ },
+
+ _resizeMenu: function() {
+ var ul = this.menu.element;
+ ul.outerWidth( Math.max(
+ // Firefox wraps long text (possibly a rounding bug)
+ // so we add 1px to avoid the wrapping (#7513)
+ ul.width( "" ).outerWidth() + 1,
+ this.element.outerWidth()
+ ) );
+ },
+
+ _renderMenu: function( ul, items ) {
+ var that = this;
+ $.each( items, function( index, item ) {
+ that._renderItemData( ul, item );
+ });
+ },
+
+ _renderItemData: function( ul, item ) {
+ return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+ },
+
+ _renderItem: function( ul, item ) {
+ return $( "<li>" )
+ .append( $( "<a>" ).text( item.label ) )
+ .appendTo( ul );
+ },
+
+ _move: function( direction, event ) {
+ if ( !this.menu.element.is( ":visible" ) ) {
+ this.search( null, event );
+ return;
+ }
+ if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+ this.menu.isLastItem() && /^next/.test( direction ) ) {
+ this._value( this.term );
+ this.menu.blur();
+ return;
+ }
+ this.menu[ direction ]( event );
+ },
+
+ widget: function() {
+ return this.menu.element;
+ },
+
+ _value: function() {
+ return this.valueMethod.apply( this.element, arguments );
+ },
+
+ _keyEvent: function( keyEvent, event ) {
+ if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+ this._move( keyEvent, event );
+
+ // prevents moving cursor to beginning/end of the text field in some browsers
+ event.preventDefault();
+ }
+ }
+});
+
+$.extend( $.ui.autocomplete, {
+ escapeRegex: function( value ) {
+ return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+ },
+ filter: function(array, term) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( value.label || value.value || value );
+ });
+ }
+});
+
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+ options: {
+ messages: {
+ noResults: "No search results.",
+ results: function( amount ) {
+ return amount + ( amount > 1 ? " results are" : " result is" ) +
+ " available, use up and down arrow keys to navigate.";
+ }
+ }
+ },
+
+ __response: function( content ) {
+ var message;
+ this._superApply( arguments );
+ if ( this.options.disabled || this.cancelSearch ) {
+ return;
+ }
+ if ( content && content.length ) {
+ message = this.options.messages.results( content.length );
+ } else {
+ message = this.options.messages.noResults;
+ }
+ this.liveRegion.text( message );
+ }
+});
+
+}( jQuery ));
+
+}catch (e) {
+System.out.println("coremenu failed to load jQuery.ui.autocomplete -- jQuery version conflict?");
+}
+