diff --git a/dev/App/Abstract.js b/dev/App/Abstract.js index 8cababa6e..879df4eae 100644 --- a/dev/App/Abstract.js +++ b/dev/App/Abstract.js @@ -1,5 +1,4 @@ import window from 'window'; -import $ from '$'; import _ from '_'; import ko from 'ko'; import key from 'key'; @@ -10,7 +9,6 @@ import { $htmlCL, leftPanelDisabled, leftPanelType, - sUserAgent, bMobileDevice, bAnimationSupported } from 'Common/Globals'; @@ -37,11 +35,8 @@ class AbstractApp extends AbstractBoot { super(); this.isLocalAutocomplete = true; - this.iframe = null; this.lastErrorTime = 0; - this.iframe = $('').appendTo('body'); - window.addEventListener('resize', () => { Events.pub('window.resize'); }); @@ -71,21 +66,23 @@ class AbstractApp extends AbstractBoot { // } // }); - const $doc = $(window.document); - $doc - .on('keydown', (event) => { - if (event && event.ctrlKey) { - $htmlCL.add('rl-ctrl-key-pressed'); - } - }) - .on('keyup', (event) => { - if (event && !event.ctrlKey) { - $htmlCL.remove('rl-ctrl-key-pressed'); - } - }) - .on('mousemove keypress click', _.debounce(() => { - Events.pub('rl.auto-logout-refresh'); - }, Magics.Time5s)); + const $doc = window.document; + $doc.addEventListener('keydown', (event) => { + if (event && event.ctrlKey) { + $htmlCL.add('rl-ctrl-key-pressed'); + } + }); + $doc.addEventListener('keyup', (event) => { + if (event && !event.ctrlKey) { + $htmlCL.remove('rl-ctrl-key-pressed'); + } + }); + const fn = _.debounce(() => { + Events.pub('rl.auto-logout-refresh'); + }, Magics.Time5s); + $doc.addEventListener('mousemove', fn); + $doc.addEventListener('keypress', fn); + $doc.addEventListener('click', fn); key('esc, enter', KeyState.All, () => { detectDropdownVisibility(); @@ -109,28 +106,16 @@ class AbstractApp extends AbstractBoot { * @returns {boolean} */ download(link) { - if (sUserAgent && (-1 < sUserAgent.indexOf('chrome') || -1 < sUserAgent.indexOf('chrome'))) { - const oLink = window.document.createElement('a'); - oLink.href = link; - - if (window.document && window.document.createEvent) { - const oE = window.document.createEvent.MouseEvents; - if (oE && oE.initEvent && oLink.dispatchEvent) { - oE.initEvent('click', true, true); - oLink.dispatchEvent(oE); - return true; - } - } - } - if (bMobileDevice) { window.open(link, '_self'); window.focus(); } else { - this.iframe.attr('src', link); - // window.document.location.href = link; + const oLink = window.document.createElement('a'); + oLink.href = link; + window.document.body.appendChild(oLink).click(); + oLink.remove(); +// window.open(link, '_self'); } - return true; } @@ -143,7 +128,6 @@ class AbstractApp extends AbstractBoot { title += (title ? ' - ' : '') + Settings.settingsGet('Title'); } - window.document.title = title + ' ...'; window.document.title = title; } diff --git a/dev/App/User.js b/dev/App/User.js index c66a624f8..d706df677 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -1,6 +1,5 @@ import window from 'window'; import _ from '_'; -import $ from '$'; import progressJs from 'progressJs'; import { @@ -18,7 +17,6 @@ import { pString, delegateRunOnDestroy, mailToHelper, - windowResize, jassl } from 'Common/Utils'; @@ -34,7 +32,7 @@ import { Magics } from 'Common/Enums'; -import { $htmlCL, leftPanelWidth, leftPanelDisabled, bMobileDevice } from 'Common/Globals'; +import { $htmlCL, leftPanelDisabled, bMobileDevice } from 'Common/Globals'; import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { runHook } from 'Common/Plugins'; @@ -124,21 +122,23 @@ class AppUser extends AbstractApp { Magics.Time5m ); - $.wakeUp( - () => { + // wakeUp + const interval = Magics.Time60m; + var lastTime = (new Date()).getTime(); + setInterval(() => { + const currentTime = (new Date()).getTime(); + if (currentTime > (lastTime + interval + 1000)) { if (checkTimestamp()) { this.reload(); } - Remote.jsVersion((sResult, oData) => { if (StorageResultType.Success === sResult && oData && !oData.Result) { this.reload(); } }, Settings.appSettingsGet('version')); - }, - {}, - Magics.Time60m - ); + } + lastTime = currentTime; + }, interval); if (checkTimestamp()) { this.reload(); @@ -881,84 +881,49 @@ class AppUser extends AbstractApp { Local.set(ClientSideKeyName.ExpandedFolders, aExpandedList); } - initHorizontalLayoutResizer(sClientSideKeyName) { + initHorizontalLayoutResizer() { let top = null, - bottom = null; + bottom = null, + observer = null; - const minHeight = 200, - maxHeight = 500, - fSetHeight = (height) => { - if (height) { - if (top) { - top.attr('style', 'height:' + height + 'px'); - } - - if (bottom) { - bottom.attr('style', 'top:' + (55 /* top toolbar */ + height) + 'px'); - } - } - }, - fResizeCreateFunction = (event) => { - if (event && event.target) { - $(event.target) - .find('.ui-resizable-handle') - .on('mousedown', () => { - $htmlCL.add('rl-resizer'); - }) - .on('mouseup', () => { - $htmlCL.remove('rl-resizer'); - }); - } - }, - fResizeStartFunction = () => { - $htmlCL.add('rl-resizer'); - }, - fResizeResizeFunction = _.debounce( - () => { - $htmlCL.add('rl-resizer'); - }, - 500, - true - ), - fResizeStopFunction = (oEvent, oObject) => { - $htmlCL.remove('rl-resizer'); - if (oObject && oObject.size && oObject.size.height) { - Local.set(sClientSideKeyName, oObject.size.height); - - fSetHeight(oObject.size.height); - - windowResize(); - } - }, - oOptions = { - helper: 'ui-resizable-helper-h', - minHeight: minHeight, - maxHeight: maxHeight, - handles: 's', - create: fResizeCreateFunction, - resize: fResizeResizeFunction, - start: fResizeStartFunction, - stop: fResizeStopFunction - }, + const fDisable = (bDisable) => { if (bDisable) { - if (top && top.hasClass('ui-resizable')) { - top.resizable('destroy').removeAttr('style'); - } - - if (bottom) { - bottom.removeAttr('style'); + if (observer) { + observer.disconnect(); + top.removeAttribute('style'); + top.classList.remove('resizable'); + bottom.removeAttribute('style'); } } else if ($htmlCL.contains('rl-bottom-preview-pane')) { - top = $('.b-message-list-wrapper'); - bottom = $('.b-message-view-wrapper'); - - if (!top.hasClass('ui-resizable')) { - top.resizable(oOptions); + top = window.document.querySelector('.b-message-list-wrapper'); + bottom = window.document.querySelector('.b-message-view-wrapper'); + if (top && bottom) { + top.classList.add('resizable'); + if (window.ResizeObserver) { + if (!observer) { + observer = new window.ResizeObserver(entries => { + entries.forEach(entry => { + if (entry.target === top) { + bottom.style.top = (56 + entry.borderBoxSize.blockSize) + 'px'; + } + }); + }); + } + observer.observe(top); + } else { + if (!observer) { + observer = new window.MutationObserver(mutations => { + mutations.forEach(mutation => { + if (mutation.target === top && 'style' == mutation.attributeName) { + bottom.style.top = (56 + top.offsetHeight) + 'px'; + } + }); + }); + } + observer.observe(top, { attributes: true }); + } } - - const iHeight = pInt(Local.get(sClientSideKeyName)) || 300; - fSetHeight(iHeight > minHeight ? iHeight : minHeight); } }; @@ -969,93 +934,51 @@ class AppUser extends AbstractApp { }); } - initVerticalLayoutResizer(sClientSideKeyName) { - const disabledWidth = 60, - minWidth = 155, - lLeft = $('#rl-left'), - right = $('#rl-right'), - mLeftWidth = Local.get(sClientSideKeyName) || null, - fSetWidth = (iWidth) => { - if (iWidth) { - leftPanelWidth(iWidth); + initVerticalLayoutResizer() { + let rlLeft = null, + rlRight = null, + observer = null; - $htmlCL.remove('rl-resizer'); - - lLeft.css({ - width: '' + iWidth + 'px' - }); - - right.css({ - left: '' + iWidth + 'px' - }); - } - }, + const fDisable = (bDisable) => { if (bDisable) { - lLeft.resizable('disable'); - fSetWidth(disabledWidth); + if (observer) { + observer.disconnect(); + } + rlLeft.classList.remove('resizable'); + rlLeft.removeAttribute('style'); + rlRight.removeAttribute('style'); } else { - lLeft.resizable('enable'); - const width = pInt(Local.get(sClientSideKeyName)) || minWidth; - fSetWidth(width > minWidth ? width : minWidth); - } - }, - fResizeCreateFunction = (event) => { - if (event && event.target) { - $(event.target) - .find('.ui-resizable-handle') - .on('mousedown', () => { - $htmlCL.add('rl-resizer'); - }) - .on('mouseup', () => { - $htmlCL.remove('rl-resizer'); - }); - } - }, - fResizeResizeFunction = _.debounce( - () => { - $htmlCL.add('rl-resizer'); - }, - 500, - true - ), - fResizeStartFunction = () => { - $htmlCL.add('rl-resizer'); - }, - fResizeStopFunction = (event, obj) => { - $htmlCL.remove('rl-resizer'); - if (obj && obj.size && obj.size.width) { - Local.set(sClientSideKeyName, obj.size.width); - - leftPanelWidth(obj.size.width); - - right.css({ - left: '' + obj.size.width + 'px' - }); - - lLeft.css({ - position: '', - top: '', - left: '', - height: '' - }); + rlLeft = window.document.getElementById('rl-left'); + rlRight = window.document.getElementById('rl-right'); + if (rlLeft && rlRight) { + rlLeft.classList.add('resizable'); + rlLeft.removeAttribute('style'); + rlRight.removeAttribute('style'); + if (window.ResizeObserver) { + let observer = new window.ResizeObserver(entries => { + entries.forEach(entry => { + if (entry.target === rlLeft) { + rlRight.style.left = entry.borderBoxSize.inlineSize + 'px'; + } + }); + }); + observer.observe(rlLeft); + } else { + let observer = new window.MutationObserver(mutations => { + mutations.forEach(mutation => { + if (mutation.target === rlLeft && 'style' == mutation.attributeName) { + rlRight.style.left = rlLeft.offsetWidth + 'px'; + } + }); + }); + observer.observe(rlLeft, { attributes: true }); + } + } } }; - if (null !== mLeftWidth) { - fSetWidth(mLeftWidth > minWidth ? mLeftWidth : minWidth); - } - - lLeft.resizable({ - helper: 'ui-resizable-helper-w', - minWidth: minWidth, - maxWidth: Magics.Size350px, - handles: 'e', - create: fResizeCreateFunction, - resize: fResizeResizeFunction, - start: fResizeStartFunction, - stop: fResizeStopFunction - }); + fDisable(false); Events.sub('left-panel.off', () => { fDisable(true); diff --git a/dev/Styles/Layout.less b/dev/Styles/Layout.less index 355c5bd1a..c99270b97 100644 --- a/dev/Styles/Layout.less +++ b/dev/Styles/Layout.less @@ -53,6 +53,19 @@ html.rl-mobile { min-width: 60px; } +html:not(.rl-left-panel-disabled) #rl-left.resizable { + resize: horizontal; + overflow: hidden; + min-width: 155px; + max-width: 350px; +} +.b-message-list-wrapper.resizable { + resize: vertical; + overflow: hidden; + min-height: 200px; + max-height: 500px; +} + #rl-right { .g-ui-absolute-reset; @@ -271,21 +284,6 @@ html.rl-left-panel-none { } } -.ui-resizable-helper-w { - border-right: 5px solid #777; - border-right-color: rgba(255,255,255,0.7); -} - -.ui-resizable-helper-h { - border-bottom: 5px solid #ccc; - border-bottom-color: rgba(0,0,0,0.3); -} - -.ui-resizable-handle:hover { - background: #aaa; - background: rgba(255,255,255,0.5); -} - html.rl-no-preview-pane { #rl-sub-left { @@ -300,10 +298,6 @@ html.rl-no-preview-pane { #rl-sub-right { left: 0 !important; } - - #rl-right .ui-resizable-handle { - display: none !important; - } } html.rl-side-preview-pane #rl-right .ui-resizable-handle { diff --git a/dev/Styles/Ui.less b/dev/Styles/Ui.less index f3b3b23b9..9d003f0b9 100644 --- a/dev/Styles/Ui.less +++ b/dev/Styles/Ui.less @@ -103,11 +103,6 @@ height: 100%; } -.g-ui-resizable-delimiter-highlight { - border: none; - border-right: 6px solid #aaa; -} - .e-pagenator { .e-page { @@ -131,10 +126,6 @@ } } -html.rgba .g-ui-resizable-delimiter-highlight { - border-right-color: rgba(0, 0, 0, 0.2); -} - .settings-saved-trigger { display: inline-block; diff --git a/dev/Styles/_End.less b/dev/Styles/_End.less index 17e765216..df632e069 100644 --- a/dev/Styles/_End.less +++ b/dev/Styles/_End.less @@ -12,11 +12,6 @@ min-width: 300px; } -.ui-resizable-e { - right: -1px; - width: 5px; -} - .pswp__error-msg { color: #ccc; a, a:hover { diff --git a/tasks/config.js b/tasks/config.js index eb2716d54..b3277935f 100644 --- a/tasks/config.js +++ b/tasks/config.js @@ -75,7 +75,6 @@ config.paths.js = { src: [ 'node_modules/jquery/dist/jquery.min.js', 'vendors/jquery-ui/js/jquery-ui-1.12.1.custom.min.js', // custom - 'vendors/jquery-wakeup/jquery.wakeup.js', // no-npm 'vendors/jquery-letterfx/jquery-letterfx.min.js', // no-npm 'vendors/inputosaurus/inputosaurus.js', // custom (modified) 'vendors/routes/signals.min.js', // fixed diff --git a/vendors/jquery-ui/js/jquery-ui-1.12.1.custom.js b/vendors/jquery-ui/js/jquery-ui-1.12.1.custom.js index a08fce66d..1f2b9af1a 100644 --- a/vendors/jquery-ui/js/jquery-ui-1.12.1.custom.js +++ b/vendors/jquery-ui/js/jquery-ui-1.12.1.custom.js @@ -1,6 +1,6 @@ /*! jQuery UI - v1.12.1 - 2016-09-14 * http://jqueryui.com -* Includes: widget.js, position.js, data.js, keycode.js, scroll-parent.js, widgets/autocomplete.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js +* Includes: widget.js, position.js, data.js, keycode.js, scroll-parent.js, widgets/autocomplete.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/selectable.js, widgets/sortable.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ (function( factory ) { @@ -2966,12 +2966,6 @@ $.widget( "ui.draggable", $.ui.mouse, { _mouseCapture: function( event ) { var o = this.options; - // Among others, prevent a drag on a resizable-handle - if ( this.helper || o.disabled || - $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { - return false; - } - //Quit if we're not on a valid handle this.handle = this._getHandle( event ); if ( !this.handle ) { @@ -4092,1178 +4086,6 @@ $.ui.plugin.add( "draggable", "zIndex", { } ); -/*! - * jQuery UI Resizable 1.12.1 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -//>>label: Resizable -//>>group: Interactions -//>>description: Enables resize functionality for any element. -//>>docs: http://api.jqueryui.com/resizable/ -//>>demos: http://jqueryui.com/resizable/ -//>>css.structure: ../../themes/base/core.css -//>>css.structure: ../../themes/base/resizable.css -//>>css.theme: ../../themes/base/theme.css - - - -$.widget( "ui.resizable", $.ui.mouse, { - version: "1.12.1", - widgetEventPrefix: "resize", - options: { - alsoResize: false, - animate: false, - animateDuration: "slow", - animateEasing: "swing", - aspectRatio: false, - autoHide: false, - classes: { - "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" - }, - containment: false, - ghost: false, - grid: false, - handles: "e,s,se", - helper: false, - maxHeight: null, - maxWidth: null, - minHeight: 10, - minWidth: 10, - - // See #7960 - zIndex: 90, - - // Callbacks - resize: null, - start: null, - stop: null - }, - - _num: function( value ) { - return parseFloat( value ) || 0; - }, - - _isNumber: function( value ) { - return !isNaN( parseFloat( value ) ); - }, - - _hasScroll: function( el, a ) { - - if ( $( el ).css( "overflow" ) === "hidden" ) { - return false; - } - - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", - has = false; - - if ( el[ scroll ] > 0 ) { - return true; - } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; - return has; - }, - - _create: function() { - - var margins, - o = this.options, - that = this; - this._addClass( "ui-resizable" ); - - $.extend( this, { - _aspectRatio: !!( o.aspectRatio ), - aspectRatio: o.aspectRatio, - originalElement: this.element, - _proportionallyResizeElements: [], - _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null - } ); - - // Wrap the element if it cannot hold child nodes - if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { - - this.element.wrap( - $( "
" ).css( { - position: this.element.css( "position" ), - width: this.element.outerWidth(), - height: this.element.outerHeight(), - top: this.element.css( "top" ), - left: this.element.css( "left" ) - } ) - ); - - this.element = this.element.parent().data( - "ui-resizable", this.element.resizable( "instance" ) - ); - - this.elementIsWrapper = true; - - margins = { - marginTop: this.originalElement.css( "marginTop" ), - marginRight: this.originalElement.css( "marginRight" ), - marginBottom: this.originalElement.css( "marginBottom" ), - marginLeft: this.originalElement.css( "marginLeft" ) - }; - - this.element.css( margins ); - this.originalElement.css( "margin", 0 ); - - // support: Safari - // Prevent Safari textarea resize - this.originalResizeStyle = this.originalElement.css( "resize" ); - this.originalElement.css( "resize", "none" ); - - this._proportionallyResizeElements.push( this.originalElement.css( { - position: "static", - zoom: 1, - display: "block" - } ) ); - - // Support: IE9 - // avoid IE jump (hard set the margin) - this.originalElement.css( margins ); - - this._proportionallyResize(); - } - - this._setupHandles(); - - if ( o.autoHide ) { - $( this.element ) - .on( "mouseenter", function() { - if ( o.disabled ) { - return; - } - that._removeClass( "ui-resizable-autohide" ); - that._handles.show(); - } ) - .on( "mouseleave", function() { - if ( o.disabled ) { - return; - } - if ( !that.resizing ) { - that._addClass( "ui-resizable-autohide" ); - that._handles.hide(); - } - } ); - } - - this._mouseInit(); - }, - - _destroy: function() { - - this._mouseDestroy(); - - var wrapper, - _destroy = function( exp ) { - $( exp ) - .removeData( "resizable" ) - .removeData( "ui-resizable" ) - .off( ".resizable" ) - .find( ".ui-resizable-handle" ) - .remove(); - }; - - // TODO: Unwrap at same DOM position - if ( this.elementIsWrapper ) { - _destroy( this.element ); - wrapper = this.element; - this.originalElement.css( { - position: wrapper.css( "position" ), - width: wrapper.outerWidth(), - height: wrapper.outerHeight(), - top: wrapper.css( "top" ), - left: wrapper.css( "left" ) - } ).insertAfter( wrapper ); - wrapper.remove(); - } - - this.originalElement.css( "resize", this.originalResizeStyle ); - _destroy( this.originalElement ); - - return this; - }, - - _setOption: function( key, value ) { - this._super( key, value ); - - switch ( key ) { - case "handles": - this._removeHandles(); - this._setupHandles(); - break; - default: - break; - } - }, - - _setupHandles: function() { - var o = this.options, handle, i, n, hname, axis, that = this; - this.handles = o.handles || - ( !$( ".ui-resizable-handle", this.element ).length ? - "e,s,se" : { - n: ".ui-resizable-n", - e: ".ui-resizable-e", - s: ".ui-resizable-s", - w: ".ui-resizable-w", - se: ".ui-resizable-se", - sw: ".ui-resizable-sw", - ne: ".ui-resizable-ne", - nw: ".ui-resizable-nw" - } ); - - this._handles = $(); - if ( this.handles.constructor === String ) { - - if ( this.handles === "all" ) { - this.handles = "n,e,s,w,se,sw,ne,nw"; - } - - n = this.handles.split( "," ); - this.handles = {}; - - for ( i = 0; i < n.length; i++ ) { - - handle = $.trim( n[ i ] ); - hname = "ui-resizable-" + handle; - axis = $( "0&&((i=t.top-e.collisionPosition.marginTop+u+d+f-a)>0||s(i)
",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]))&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").show(),e.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,r=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:r=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&e.keyCode<=105?(e.keyCode-96).toString():String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),(i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i).length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}r&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),i=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("").data("ui-menu-submenu-caret",!0);o._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(i,"ui-menu","ui-widget ui-widget-content ui-front"),(e=h.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var e=t(this);o._isDivider(e)&&o._addClass(e,"ui-menu-divider","ui-widget-content")}),n=(s=e.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").attr({tabIndex:-1,role:this._itemRole()}),this._addClass(s,"ui-menu-item")._addClass(n,"ui-menu-item-wrapper"),e.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,r,h;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),r=this.activeMenu.height(),h=e.outerHeight(),n<0?this.activeMenu.scrollTop(o+n):n+h>r&&this.activeMenu.scrollTop(o+n-r+h))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},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(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;this.active?this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return(i=t(this)).offset().top-s-n<0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())):this.next(e)},previousPage:function(e){var i,s,n;this.active?this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return(i=t(this)).offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())):this.next(e)},_hasScroll:function(){return this.element.outerHeight()").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)});n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),(s=i.item.attr("aria-label")||n.value)&&t.trim(s).length&&(this.liveRegion.children().hide(),t("
",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){i&&!s.forcePlaceholderSize||(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,r,h,a,l,c,p,u=null,d=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(u&&t.contains(this.containers[i].element[0],u.element[0]))continue;u=this.containers[i],d=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(u)if(1===this.containers.length)this.containers[d].containerCache.over||(this.containers[d]._trigger("over",e,this._uiHash(this)),this.containers[d].containerCache.over=1);else{for(n=1e4,o=null,r=(c=u.floating||this._isFloating(this.currentItem))?"left":"top",h=c?"width":"height",p=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[d].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(a=this.items[s].item.offset()[r],l=!1,e[p]-a>this.items[s][h]/2&&(l=!0),Math.abs(e[p]-a)