Update Jquery UI 13.2

Update to  Jquery UI 13.2
This commit is contained in:
g7sim 2022-08-23 19:08:24 +02:00
parent 7b1188d85e
commit 4122ca03f7
78 changed files with 8547 additions and 9245 deletions

View file

@ -1,44 +1,66 @@
/*!
* jQuery UI Accordion 1.11.4
* jQuery UI Accordion @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/accordion/
*/
(function( factory ) {
//>>label: Accordion
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/accordion/
//>>demos: http://jqueryui.com/accordion/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/accordion.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget"
"../version",
"../keycode",
"../unique-id",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.accordion", {
version: "1.11.4",
version: "@VERSION",
options: {
active: 0,
animate: {},
classes: {
"ui-accordion-header": "ui-corner-top",
"ui-accordion-header-collapsed": "ui-corner-all",
"ui-accordion-content": "ui-corner-bottom"
},
collapsible: false,
event: "click",
header: "> li > :first-child,> :not(li):even",
header: function( elem ) {
return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
},
heightStyle: "auto",
icons: {
activeHeader: "ui-icon-triangle-1-s",
header: "ui-icon-triangle-1-e"
},
// callbacks
// Callbacks
activate: null,
beforeActivate: null
},
@ -61,17 +83,18 @@ return $.widget( "ui.accordion", {
_create: function() {
var options = this.options;
this.prevShow = this.prevHide = $();
this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
// ARIA
.attr( "role", "tablist" );
// don't allow collapsible: false and active: false / null
if ( !options.collapsible && (options.active === false || options.active == null) ) {
this.prevShow = this.prevHide = $();
this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
this.element.attr( "role", "tablist" );
// Don't allow collapsible: false and active: false / null
if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
options.active = 0;
}
this._processPanels();
// handle negative values
if ( options.active < 0 ) {
options.active += this.headers.length;
@ -87,54 +110,42 @@ return $.widget( "ui.accordion", {
},
_createIcons: function() {
var icons = this.options.icons;
var icon, children,
icons = this.options.icons;
if ( icons ) {
$( "<span>" )
.addClass( "ui-accordion-header-icon ui-icon " + icons.header )
.prependTo( this.headers );
this.active.children( ".ui-accordion-header-icon" )
.removeClass( icons.header )
.addClass( icons.activeHeader );
this.headers.addClass( "ui-accordion-icons" );
icon = $( "<span>" );
this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
icon.prependTo( this.headers );
children = this.active.children( ".ui-accordion-header-icon" );
this._removeClass( children, icons.header )
._addClass( children, null, icons.activeHeader )
._addClass( this.headers, "ui-accordion-icons" );
}
},
_destroyIcons: function() {
this.headers
.removeClass( "ui-accordion-icons" )
.children( ".ui-accordion-header-icon" )
.remove();
this._removeClass( this.headers, "ui-accordion-icons" );
this.headers.children( ".ui-accordion-header-icon" ).remove();
},
_destroy: function() {
var contents;
// clean up main element
this.element
.removeClass( "ui-accordion ui-widget ui-helper-reset" )
.removeAttr( "role" );
// Clean up main element
this.element.removeAttr( "role" );
// clean up headers
// Clean up headers
this.headers
.removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
.removeAttr( "role" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-controls" )
.removeAttr( "tabIndex" )
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
.removeUniqueId();
this._destroyIcons();
// clean up content panels
// Clean up content panels
contents = this.headers.next()
.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
.css( "display", "" )
.removeAttr( "role" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-labelledby" )
.removeAttr( "role aria-hidden aria-labelledby" )
.removeUniqueId();
if ( this.options.heightStyle !== "content" ) {
@ -144,6 +155,7 @@ return $.widget( "ui.accordion", {
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
@ -158,7 +170,7 @@ return $.widget( "ui.accordion", {
this._super( key, value );
// setting collapsible: false while collapsed; open first panel
// Setting collapsible: false while collapsed; open first panel
if ( key === "collapsible" && !value && this.options.active === false ) {
this._activate( 0 );
}
@ -169,16 +181,19 @@ return $.widget( "ui.accordion", {
this._createIcons();
}
}
},
// #5332 - opacity doesn't cascade to positioned elements in IE
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", value );
// Support: IE8 Only
// #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
// so we need to add the disabled class to the headers and panels
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
this.headers.add( this.headers.next() )
.toggleClass( "ui-state-disabled", !!value );
}
this._toggleClass( null, "ui-state-disabled", !!value );
this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
!!value );
},
_keydown: function( event ) {
@ -192,37 +207,37 @@ return $.widget( "ui.accordion", {
toFocus = false;
switch ( event.keyCode ) {
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
break;
case keyCode.HOME:
toFocus = this.headers[ 0 ];
break;
case keyCode.END:
toFocus = this.headers[ length - 1 ];
break;
case keyCode.RIGHT:
case keyCode.DOWN:
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
break;
case keyCode.LEFT:
case keyCode.UP:
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
break;
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
break;
case keyCode.HOME:
toFocus = this.headers[ 0 ];
break;
case keyCode.END:
toFocus = this.headers[ length - 1 ];
break;
}
if ( toFocus ) {
$( event.target ).attr( "tabIndex", -1 );
$( toFocus ).attr( "tabIndex", 0 );
toFocus.focus();
$( toFocus ).trigger( "focus" );
event.preventDefault();
}
},
_panelKeyDown: function( event ) {
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
$( event.currentTarget ).prev().focus();
$( event.currentTarget ).prev().trigger( "focus" );
}
},
@ -230,25 +245,32 @@ return $.widget( "ui.accordion", {
var options = this.options;
this._processPanels();
// was collapsed or no panel
if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
// Was collapsed or no panel
if ( ( options.active === false && options.collapsible === true ) ||
!this.headers.length ) {
options.active = false;
this.active = $();
// active false only when collapsible is true
} else if ( options.active === false ) {
this._activate( 0 );
// was active, but active panel is gone
} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
// all remaining panel are disabled
if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
options.active = false;
this.active = $();
// activate previous panel
} else {
this._activate( Math.max( 0, options.active - 1 ) );
}
// was active, active panel still exists
} else {
// make sure active index is correct
options.active = this.headers.index( this.active );
}
@ -262,13 +284,16 @@ return $.widget( "ui.accordion", {
var prevHeaders = this.headers,
prevPanels = this.panels;
this.headers = this.element.find( this.options.header )
.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
if ( typeof this.options.header === "function" ) {
this.headers = this.options.header( this.element );
} else {
this.headers = this.element.find( this.options.header );
}
this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
"ui-state-default" );
this.panels = this.headers.next()
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.filter( ":not(.ui-accordion-content-active)" )
.hide();
this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
// Avoid memory leaks (#10056)
if ( prevPanels ) {
@ -283,52 +308,51 @@ return $.widget( "ui.accordion", {
heightStyle = options.heightStyle,
parent = this.element.parent();
this.active = this._findActive( options.active )
.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
.removeClass( "ui-corner-all" );
this.active.next()
.addClass( "ui-accordion-content-active" )
.show();
this.active = this._findActive( options.active );
this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
._removeClass( this.active, "ui-accordion-header-collapsed" );
this._addClass( this.active.next(), "ui-accordion-content-active" );
this.active.next().show();
this.headers
.attr( "role", "tab" )
.each(function() {
.each( function() {
var header = $( this ),
headerId = header.uniqueId().attr( "id" ),
panel = header.next(),
panelId = panel.uniqueId().attr( "id" );
header.attr( "aria-controls", panelId );
panel.attr( "aria-labelledby", headerId );
})
} )
.next()
.attr( "role", "tabpanel" );
this.headers
.not( this.active )
.attr({
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
})
.next()
.attr({
"aria-hidden": "true"
})
.hide();
.attr( {
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
} )
.next()
.attr( {
"aria-hidden": "true"
} )
.hide();
// make sure at least one header is in the tab order
// Make sure at least one header is in the tab order
if ( !this.active.length ) {
this.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active.attr({
this.active.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
})
.next()
.attr({
"aria-hidden": "false"
});
} )
.next()
.attr( {
"aria-hidden": "false"
} );
}
this._createIcons();
@ -337,7 +361,7 @@ return $.widget( "ui.accordion", {
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
this.element.siblings( ":visible" ).each(function() {
this.element.siblings( ":visible" ).each( function() {
var elem = $( this ),
position = elem.css( "position" );
@ -345,24 +369,31 @@ return $.widget( "ui.accordion", {
return;
}
maxHeight -= elem.outerHeight( true );
});
} );
this.headers.each(function() {
this.headers.each( function() {
maxHeight -= $( this ).outerHeight( true );
});
} );
this.headers.next()
.each(function() {
.each( function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
})
} )
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.headers.next()
.each(function() {
.each( function() {
var isVisible = $( this ).is( ":visible" );
if ( !isVisible ) {
$( this ).show();
}
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
})
if ( !isVisible ) {
$( this ).hide();
}
} )
.height( maxHeight );
}
},
@ -370,19 +401,19 @@ return $.widget( "ui.accordion", {
_activate: function( index ) {
var active = this._findActive( index )[ 0 ];
// trying to activate the already active panel
// Trying to activate the already active panel
if ( active === this.active[ 0 ] ) {
return;
}
// trying to collapse, simulate a click on the currently active header
// Trying to collapse, simulate a click on the currently active header
active = active || this.active[ 0 ];
this._eventHandler({
this._eventHandler( {
target: active,
currentTarget: active,
preventDefault: $.noop
});
} );
},
_findActive: function( selector ) {
@ -396,18 +427,19 @@ return $.widget( "ui.accordion", {
if ( event ) {
$.each( event.split( " " ), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
} );
}
this._off( this.headers.add( this.headers.next() ) );
this._on( this.headers, events );
this._on( this.headers.next(), { keydown: "_panelKeyDown" });
this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
this._hoverable( this.headers );
this._focusable( this.headers );
},
_eventHandler: function( event ) {
var options = this.options,
var activeChildren, clickedChildren,
options = this.options,
active = this.active,
clicked = $( event.currentTarget ),
clickedIsActive = clicked[ 0 ] === active[ 0 ],
@ -424,8 +456,10 @@ return $.widget( "ui.accordion", {
event.preventDefault();
if (
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
@ -433,33 +467,30 @@ return $.widget( "ui.accordion", {
options.active = collapsing ? false : this.headers.index( clicked );
// when the call to ._toggle() comes after the class changes
// When the call to ._toggle() comes after the class changes
// it causes a very odd bug in IE 8 (see #6720)
this.active = clickedIsActive ? $() : clicked;
this._toggle( eventData );
// switch classes
// Switch classes
// corner classes on the previously active header stay after the animation
active.removeClass( "ui-accordion-header-active ui-state-active" );
this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
if ( options.icons ) {
active.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.activeHeader )
.addClass( options.icons.header );
activeChildren = active.children( ".ui-accordion-header-icon" );
this._removeClass( activeChildren, null, options.icons.activeHeader )
._addClass( activeChildren, null, options.icons.header );
}
if ( !clickedIsActive ) {
clicked
.removeClass( "ui-corner-all" )
.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
this._removeClass( clicked, "ui-accordion-header-collapsed" )
._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
if ( options.icons ) {
clicked.children( ".ui-accordion-header-icon" )
.removeClass( options.icons.header )
.addClass( options.icons.activeHeader );
clickedChildren = clicked.children( ".ui-accordion-header-icon" );
this._removeClass( clickedChildren, null, options.icons.header )
._addClass( clickedChildren, null, options.icons.activeHeader );
}
clicked
.next()
.addClass( "ui-accordion-content-active" );
this._addClass( clicked.next(), "ui-accordion-content-active" );
}
},
@ -467,7 +498,7 @@ return $.widget( "ui.accordion", {
var toShow = data.newPanel,
toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
// handle activating a panel during the animation for another activation
// Handle activating a panel during the animation for another activation
this.prevShow.add( this.prevHide ).stop( true, true );
this.prevShow = toShow;
this.prevHide = toHide;
@ -480,36 +511,37 @@ return $.widget( "ui.accordion", {
this._toggleComplete( data );
}
toHide.attr({
toHide.attr( {
"aria-hidden": "true"
});
toHide.prev().attr({
} );
toHide.prev().attr( {
"aria-selected": "false",
"aria-expanded": "false"
});
} );
// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
if ( toShow.length && toHide.length ) {
toHide.prev().attr({
toHide.prev().attr( {
"tabIndex": -1,
"aria-expanded": "false"
});
} );
} else if ( toShow.length ) {
this.headers.filter(function() {
this.headers.filter( function() {
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
})
.attr( "tabIndex", -1 );
} )
.attr( "tabIndex", -1 );
}
toShow
.attr( "aria-hidden", "false" )
.prev()
.attr({
.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
} );
},
_animate: function( toShow, toHide, data ) {
@ -531,6 +563,7 @@ return $.widget( "ui.accordion", {
if ( typeof options === "string" ) {
easing = options;
}
// fall back from options to animation in case of partial down settings
easing = easing || options.easing || animate.easing;
duration = duration || options.duration || animate.duration;
@ -549,7 +582,7 @@ return $.widget( "ui.accordion", {
step: function( now, fx ) {
fx.now = Math.round( now );
}
});
} );
toShow
.hide()
.animate( this.showProps, {
@ -567,17 +600,16 @@ return $.widget( "ui.accordion", {
adjust = 0;
}
}
});
} );
},
_toggleComplete: function( data ) {
var toHide = data.oldPanel;
var toHide = data.oldPanel,
prev = toHide.prev();
toHide
.removeClass( "ui-accordion-content-active" )
.prev()
.removeClass( "ui-corner-top" )
.addClass( "ui-corner-all" );
this._removeClass( toHide, "ui-accordion-content-active" );
this._removeClass( prev, "ui-accordion-header-active" )
._addClass( prev, "ui-accordion-header-collapsed" );
// Work around for rendering bug in IE (#5421)
if ( toHide.length ) {
@ -585,6 +617,6 @@ return $.widget( "ui.accordion", {
}
this._trigger( "activate", null, data );
}
});
} );
}));
} );

View file

@ -1,33 +1,46 @@
/*!
* jQuery UI Autocomplete 1.11.4
* jQuery UI Autocomplete @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/autocomplete/
*/
(function( factory ) {
//>>label: Autocomplete
//>>group: Widgets
//>>description: Lists suggested words as the user is typing.
//>>docs: http://api.jqueryui.com/autocomplete/
//>>demos: http://jqueryui.com/autocomplete/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/autocomplete.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./position",
"./menu"
"./menu",
"../keycode",
"../position",
"../safe-active-element",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
$.widget( "ui.autocomplete", {
version: "1.11.4",
version: "@VERSION",
defaultElement: "<input>",
options: {
appendTo: null,
@ -41,7 +54,7 @@ $.widget( "ui.autocomplete", {
},
source: null,
// callbacks
// Callbacks
change: null,
close: null,
focus: null,
@ -53,8 +66,10 @@ $.widget( "ui.autocomplete", {
requestIndex: 0,
pending: 0,
liveRegionTimer: null,
_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
@ -67,21 +82,17 @@ $.widget( "ui.autocomplete", {
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" );
// Textareas are always multi-line
// Inputs are always single-line, even if inside a contentEditable element
// IE also treats inputs as contentEditable
// All other element types are determined by whether or not they're contentEditable
this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true;
this.element
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" );
this._addClass( "ui-autocomplete-input" );
this.element.attr( "autocomplete", "off" );
this._on( this.element, {
keydown: function( event ) {
@ -114,8 +125,10 @@ $.widget( "ui.autocomplete", {
this._keyEvent( "next", event );
break;
case keyCode.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;
@ -134,6 +147,7 @@ $.widget( "ui.autocomplete", {
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
@ -142,6 +156,7 @@ $.widget( "ui.autocomplete", {
break;
default:
suppressKeyPressRepeat = true;
// search timeout should be triggered before the input value is changed
this._searchTimeout( event );
break;
@ -159,7 +174,7 @@ $.widget( "ui.autocomplete", {
return;
}
// replicate some key handlers to allow them to repeat in Firefox and Opera
// Replicate some key handlers to allow them to repeat in Firefox and Opera
var keyCode = $.ui.keyCode;
switch ( event.keyCode ) {
case keyCode.PAGE_UP:
@ -189,60 +204,43 @@ $.widget( "ui.autocomplete", {
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({
.menu( {
// disable ARIA support, the live region takes care of that
role: null
})
} )
.hide()
// Support: IE 11 only, Edge <= 14
// For other browsers, we preventDefault() on the mousedown event
// to keep the dropdown from taking focus from the input. This doesn't
// work for IE/Edge, causing problems with selection and scrolling (#9638)
// Happily, IE and Edge support an "unselectable" attribute that
// prevents an element from receiving focus, exactly what we want here.
.attr( {
"unselectable": "on"
} )
.menu( "instance" );
this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
this._on( this.menu.element, {
mousedown: function( event ) {
// prevent moving focus out of the text field
// 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 ) {
var label, item;
// support: Firefox
// Prevent accidental activation of menu items in Firefox (#7024 #9118)
if ( this.isNewMenu ) {
@ -252,7 +250,7 @@ $.widget( "ui.autocomplete", {
this.document.one( "mousemove", function() {
$( event.target ).trigger( event.originalEvent );
});
} );
return;
}
@ -260,6 +258,7 @@ $.widget( "ui.autocomplete", {
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 );
@ -268,31 +267,35 @@ $.widget( "ui.autocomplete", {
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && $.trim( label ).length ) {
this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion );
if ( label && String.prototype.trim.call( label ).length ) {
clearTimeout( this.liveRegionTimer );
this.liveRegionTimer = this._delay( function() {
this.liveRegion.html( $( "<div>" ).text( label ) );
}, 100 );
}
},
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();
// Only trigger when focus was lost (click on menu)
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
this.element.trigger( "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._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();
@ -300,31 +303,30 @@ $.widget( "ui.autocomplete", {
this.close( event );
this.selectedItem = item;
}
});
} );
this.liveRegion = $( "<span>", {
role: "status",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.addClass( "ui-helper-hidden-accessible" )
this.liveRegion = $( "<div>", {
role: "status",
"aria-live": "assertive",
"aria-relevant": "additions"
} )
.appendTo( this.document[ 0 ].body );
// turning off autocomplete prevents the browser from remembering the
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
// 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.element.removeAttr( "autocomplete" );
this.menu.element.remove();
this.liveRegion.remove();
},
@ -342,6 +344,20 @@ $.widget( "ui.autocomplete", {
}
},
_isEventTargetInWidget: function( event ) {
var menuElement = this.menu.element[ 0 ];
return event.target === this.element[ 0 ] ||
event.target === menuElement ||
$.contains( menuElement, event.target );
},
_closeOnClickOutside: function( event ) {
if ( !this._isEventTargetInWidget( event ) ) {
this.close();
}
},
_appendTo: function() {
var element = this.options.appendTo;
@ -352,7 +368,7 @@ $.widget( "ui.autocomplete", {
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front" );
element = this.element.closest( ".ui-front, dialog" );
}
if ( !element.length ) {
@ -365,7 +381,7 @@ $.widget( "ui.autocomplete", {
_initSource: function() {
var array, url,
that = this;
if ( $.isArray( this.options.source ) ) {
if ( Array.isArray( this.options.source ) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
@ -376,7 +392,7 @@ $.widget( "ui.autocomplete", {
if ( that.xhr ) {
that.xhr.abort();
}
that.xhr = $.ajax({
that.xhr = $.ajax( {
url: url,
data: request,
dataType: "json",
@ -384,9 +400,9 @@ $.widget( "ui.autocomplete", {
response( data );
},
error: function() {
response([]);
response( [] );
}
});
} );
};
} else {
this.source = this.options.source;
@ -395,7 +411,7 @@ $.widget( "ui.autocomplete", {
_searchTimeout: function( event ) {
clearTimeout( this.searching );
this.searching = this._delay(function() {
this.searching = this._delay( function() {
// Search if the value has changed, or if the user retypes the same value (see #7434)
var equalValues = this.term === this._value(),
@ -412,7 +428,7 @@ $.widget( "ui.autocomplete", {
search: function( value, event ) {
value = value != null ? value : this._value();
// always save the actual value, not the one passed as an argument
// Always save the actual value, not the one passed as an argument
this.term = this._value();
if ( value.length < this.options.minLength ) {
@ -428,7 +444,7 @@ $.widget( "ui.autocomplete", {
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
this._addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;
this.source( { term: value }, this._response() );
@ -437,16 +453,16 @@ $.widget( "ui.autocomplete", {
_response: function() {
var index = ++this.requestIndex;
return $.proxy(function( content ) {
return function( content ) {
if ( index === this.requestIndex ) {
this.__response( content );
}
this.pending--;
if ( !this.pending ) {
this.element.removeClass( "ui-autocomplete-loading" );
this._removeClass( "ui-autocomplete-loading" );
}
}, this );
}.bind( this );
},
__response: function( content ) {
@ -458,6 +474,7 @@ $.widget( "ui.autocomplete", {
this._suggest( content );
this._trigger( "open" );
} else {
// use ._close() instead of .close() so we don't cancel future searches
this._close();
}
@ -469,6 +486,10 @@ $.widget( "ui.autocomplete", {
},
_close: function( event ) {
// Remove the handler that closes the menu on outside clicks
this._off( this.document, "mousedown" );
if ( this.menu.element.is( ":visible" ) ) {
this.menu.element.hide();
this.menu.blur();
@ -484,6 +505,7 @@ $.widget( "ui.autocomplete", {
},
_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;
@ -498,8 +520,8 @@ $.widget( "ui.autocomplete", {
return $.extend( {}, item, {
label: item.label || item.value,
value: item.value || item.label
});
});
} );
} );
},
_suggest: function( items ) {
@ -508,21 +530,27 @@ $.widget( "ui.autocomplete", {
this.isNewMenu = true;
this.menu.refresh();
// size and position menu
// Size and position menu
ul.show();
this._resizeMenu();
ul.position( $.extend({
ul.position( $.extend( {
of: this.element
}, this.options.position ) );
if ( this.options.autoFocus ) {
this.menu.next();
}
// Listen for interactions outside of the widget (#6642)
this._on( this.document, {
mousedown: "_closeOnClickOutside"
} );
},
_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,
@ -534,7 +562,7 @@ $.widget( "ui.autocomplete", {
var that = this;
$.each( items, function( index, item ) {
that._renderItemData( ul, item );
});
} );
},
_renderItemData: function( ul, item ) {
@ -542,7 +570,9 @@ $.widget( "ui.autocomplete", {
},
_renderItem: function( ul, item ) {
return $( "<li>" ).text( item.label ).appendTo( ul );
return $( "<li>" )
.append( $( "<div>" ).text( item.label ) )
.appendTo( ul );
},
_move: function( direction, event ) {
@ -575,11 +605,29 @@ $.widget( "ui.autocomplete", {
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
// Prevents moving cursor to beginning/end of the text field in some browsers
event.preventDefault();
}
},
// Support: Chrome <=50
// We should be able to just use this.element.prop( "isContentEditable" )
// but hidden elements always report false in Chrome.
// https://code.google.com/p/chromium/issues/detail?id=313082
_isContentEditable: function( element ) {
if ( !element.length ) {
return false;
}
var editable = element.prop( "contentEditable" );
if ( editable === "inherit" ) {
return this._isContentEditable( element.parent() );
}
return editable === "true";
}
});
} );
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
@ -589,11 +637,11 @@ $.extend( $.ui.autocomplete, {
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
// 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, {
@ -618,11 +666,13 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, {
} else {
message = this.options.messages.noResults;
}
this.liveRegion.children().hide();
$( "<div>" ).text( message ).appendTo( this.liveRegion );
clearTimeout( this.liveRegionTimer );
this.liveRegionTimer = this._delay( function() {
this.liveRegion.html( $( "<div>" ).text( message ) );
}, 100 );
}
});
} );
return $.ui.autocomplete;
}));
} );

View file

@ -1,411 +1,449 @@
/*!
* jQuery UI Button 1.11.4
* jQuery UI Button @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/button/
*/
(function( factory ) {
//>>label: Button
//>>group: Widgets
//>>description: Enhances a form with themeable buttons.
//>>docs: http://api.jqueryui.com/button/
//>>demos: http://jqueryui.com/button/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget"
// These are only for backcompat
// TODO: Remove after 1.12
"./controlgroup",
"./checkboxradio",
"../keycode",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
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 + "'][type=radio]" );
} else {
radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
.filter(function() {
return !this.form;
});
}
}
return radios;
};
} )( function( $ ) {
"use strict";
$.widget( "ui.button", {
version: "1.11.4",
version: "@VERSION",
defaultElement: "<button>",
options: {
classes: {
"ui-button": "ui-corner-all"
},
disabled: null,
text: true,
icon: null,
iconPosition: "beginning",
label: null,
icons: {
primary: null,
secondary: null
}
showLabel: true
},
_getCreateOptions: function() {
var disabled,
// This is to support cases like in jQuery Mobile where the base widget does have
// an implementation of _getCreateOptions
options = this._super() || {};
this.isInput = this.element.is( "input" );
disabled = this.element[ 0 ].disabled;
if ( disabled != null ) {
options.disabled = disabled;
}
this.originalLabel = this.isInput ? this.element.val() : this.element.html();
if ( this.originalLabel ) {
options.label = this.originalLabel;
}
return options;
},
_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 );
if ( !this.option.showLabel & !this.options.icon ) {
this.options.showLabel = true;
}
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());
// We have to check the option again here even though we did in _getCreateOptions,
// because null may have been passed on init which would override what was set in
// _getCreateOptions
if ( this.options.disabled == null ) {
this.options.disabled = this.element[ 0 ].disabled || false;
}
this._hoverable( this.buttonElement );
this.hasTitle = !!this.element.attr( "title" );
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" );
// Check to see if the label needs to be set or if its already correct
if ( this.options.label && this.options.label !== this.originalLabel ) {
if ( this.isInput ) {
this.element.val( this.options.label );
} else {
this.element.html( this.options.label );
}
});
if ( toggleButton ) {
this.element.bind( "change" + this.eventNamespace, function() {
that.refresh();
});
}
this._addClass( "ui-button", "ui-widget" );
this._setOption( "disabled", this.options.disabled );
this._enhance();
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 ( this.element.is( "a" ) ) {
this._on( {
"keyup": function( event ) {
if ( event.keyCode === $.ui.keyCode.SPACE ) {
// TODO pass through original event correctly (just as 2nd argument doesn't work)
$( this ).click();
event.preventDefault();
// Support: PhantomJS <= 1.9, IE 8 Only
// If a native click is available use it so we actually cause navigation
// otherwise just trigger a click event
if ( this.element[ 0 ].click ) {
this.element[ 0 ].click();
} else {
this.element.trigger( "click" );
}
}
});
}
}
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;
_enhance: function() {
if ( !this.element.is( "button" ) ) {
this.element.attr( "role", "button" );
}
if ( this.options.icon ) {
this._updateIcon( "icon", this.options.icon );
this._updateTooltip();
}
},
_updateTooltip: function() {
this.title = this.element.attr( "title" );
if ( !this.options.showLabel && !this.title ) {
this.element.attr( "title", this.options.label );
}
},
_updateIcon: function( option, value ) {
var icon = option !== "iconPosition",
position = icon ? this.options.iconPosition : value,
displayBlock = position === "top" || position === "bottom";
// Create icon
if ( !this.icon ) {
this.icon = $( "<span>" );
this._addClass( this.icon, "ui-button-icon", "ui-icon" );
if ( !this.options.showLabel ) {
this._addClass( "ui-button-icon-only" );
}
} else if ( icon ) {
// If we are updating the icon remove the old icon class
this._removeClass( this.icon, null, this.options.icon );
}
// If we are updating the icon add the new icon class
if ( icon ) {
this._addClass( this.icon, null, value );
}
this._attachIcon( position );
// If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
// the iconSpace if there is one.
if ( displayBlock ) {
this._addClass( this.icon, null, "ui-widget-icon-block" );
if ( this.iconSpace ) {
this.iconSpace.remove();
}
} else {
// Position is beginning or end so remove the ui-widget-icon-block class and add the
// space if it does not exist
if ( !this.iconSpace ) {
this.iconSpace = $( "<span> </span>" );
this._addClass( this.iconSpace, "ui-button-icon-space" );
}
this._removeClass( this.icon, null, "ui-wiget-icon-block" );
this._attachIconSpace( position );
}
},
_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() );
this.element.removeAttr( "role" );
if ( !this.hasTitle ) {
this.buttonElement.removeAttr( "title" );
if ( this.icon ) {
this.icon.remove();
}
if ( this.iconSpace ) {
this.iconSpace.remove();
}
if ( !this.hasTitle ) {
this.element.removeAttr( "title" );
}
},
_attachIconSpace: function( iconPosition ) {
this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
},
_attachIcon: function( iconPosition ) {
this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
},
_setOptions: function( options ) {
var newShowLabel = options.showLabel === undefined ?
this.options.showLabel :
options.showLabel,
newIcon = options.icon === undefined ? this.options.icon : options.icon;
if ( !newShowLabel && !newIcon ) {
options.showLabel = true;
}
this._super( options );
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "disabled" ) {
this.widget().toggleClass( "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
if ( key === "icon" ) {
if ( value ) {
if ( this.type === "checkbox" || this.type === "radio" ) {
this.buttonElement.removeClass( "ui-state-focus" );
} else {
this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
this._updateIcon( key, value );
} else if ( this.icon ) {
this.icon.remove();
if ( this.iconSpace ) {
this.iconSpace.remove();
}
}
return;
}
this._resetButton();
if ( key === "iconPosition" ) {
this._updateIcon( key, value );
}
// Make sure we can't end up with a button that has neither text nor icon
if ( key === "showLabel" ) {
this._toggleClass( "ui-button-icon-only", null, !value );
this._updateTooltip();
}
if ( key === "label" ) {
if ( this.isInput ) {
this.element.val( value );
} else {
// If there is an icon, append it, else nothing then append the value
// this avoids removal of the icon when setting label text
this.element.html( value );
if ( this.icon ) {
this._attachIcon( this.options.iconPosition );
this._attachIconSpace( this.options.iconPosition );
}
}
}
this._super( key, value );
if ( key === "disabled" ) {
this._toggleClass( null, "ui-state-disabled", value );
this.element[ 0 ].disabled = value;
if ( value ) {
this.element.trigger( "blur" );
}
}
},
refresh: function() {
//See #8237 & #8828
var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
// Make sure to only check disabled if its an element that supports this otherwise
// check for the disabled class to determine state
var isDisabled = this.element.is( "input, button" ) ?
this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) {
this._setOption( "disabled", isDisabled );
this._setOptions( { 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" );
this._updateTooltip();
}
} );
// DEPRECATED
if ( $.uiBackCompat !== false ) {
// Text and Icons options
$.widget( "ui.button", $.ui.button, {
options: {
text: true,
icons: {
primary: null,
secondary: null
}
},
_create: function() {
if ( this.options.showLabel && !this.options.text ) {
this.options.showLabel = this.options.text;
}
if ( !this.options.showLabel && this.options.text ) {
this.options.text = this.options.showLabel;
}
if ( !this.options.icon && ( this.options.icons.primary ||
this.options.icons.secondary ) ) {
if ( this.options.icons.primary ) {
this.options.icon = this.options.icons.primary;
} else {
$( this ).button( "widget" )
.removeClass( "ui-state-active" )
.attr( "aria-pressed", "false" );
this.options.icon = this.options.icons.secondary;
this.options.iconPosition = "end";
}
} else if ( this.options.icon ) {
this.options.icons.primary = this.options.icon;
}
this._super();
},
_setOption: function( key, value ) {
if ( key === "text" ) {
this._super( "showLabel", value );
return;
}
if ( key === "showLabel" ) {
this.options.text = value;
}
if ( key === "icon" ) {
this.options.icons.primary = value;
}
if ( key === "icons" ) {
if ( value.primary ) {
this._super( "icon", value.primary );
this._super( "iconPosition", "beginning" );
} else if ( value.secondary ) {
this._super( "icon", value.secondary );
this._super( "iconPosition", "end" );
}
}
this._superApply( arguments );
}
} );
$.fn.button = ( function( orig ) {
return function( options ) {
var isMethodCall = typeof options === "string";
var args = Array.prototype.slice.call( arguments, 1 );
var returnValue = this;
if ( isMethodCall ) {
// If this is an empty collection, we need to have the instance method
// return undefined instead of the jQuery instance
if ( !this.length && options === "instance" ) {
returnValue = undefined;
} else {
this.each( function() {
var methodValue;
var type = $( this ).attr( "type" );
var name = type !== "checkbox" && type !== "radio" ?
"button" :
"checkboxradio";
var instance = $.data( this, "ui-" + name );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on button" +
" prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( typeof instance[ options ] !== "function" ||
options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for button" +
" widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return 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 ) );
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat( args ) );
}
this.each( function() {
var type = $( this ).attr( "type" );
var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
var instance = $.data( this, "ui-" + name );
if ( instance ) {
instance.option( options || {} );
if ( instance._init ) {
instance._init();
}
} else {
if ( name === "button" ) {
orig.call( $( this ), options );
return;
}
$( this ).checkboxradio( $.extend( { icon: false }, options ) );
}
} );
}
} else {
buttonClasses.push( "ui-button-text-only" );
return returnValue;
};
} )( $.fn.button );
$.fn.buttonset = function() {
if ( !$.ui.controlgroup ) {
$.error( "Controlgroup widget missing" );
}
buttonElement.addClass( buttonClasses.join( " " ) );
}
});
$.widget( "ui.buttonset", {
version: "1.11.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 );
if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
return this.controlgroup.apply( this,
[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
}
this._super( key, value );
},
refresh: function() {
var rtl = this.element.css( "direction" ) === "rtl",
allButtons = this.element.find( this.options.items ),
existingButtons = allButtons.filter( ":ui-button" );
// Initialize new buttons
allButtons.not( ":ui-button" ).button();
// Refresh existing buttons
existingButtons.button( "refresh" );
this.buttons = allButtons
.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" );
}
});
if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
}
if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
arguments[ 0 ].items = {
button: arguments[ 0 ].items
};
}
return this.controlgroup.apply( this, arguments );
};
}
return $.ui.button;
}));
} );

View file

@ -0,0 +1,290 @@
/*!
* jQuery UI Checkboxradio @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Checkboxradio
//>>group: Widgets
//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
//>>docs: http://api.jqueryui.com/checkboxradio/
//>>demos: http://jqueryui.com/checkboxradio/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.structure: ../../themes/base/checkboxradio.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [
"jquery",
"../form-reset-mixin",
"../labels",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
version: "@VERSION",
options: {
disabled: null,
label: null,
icon: true,
classes: {
"ui-checkboxradio-label": "ui-corner-all",
"ui-checkboxradio-icon": "ui-corner-all"
}
},
_getCreateOptions: function() {
var disabled, labels, labelContents;
var options = this._super() || {};
// We read the type here, because it makes more sense to throw a element type error first,
// rather then the error for lack of a label. Often if its the wrong type, it
// won't have a label (e.g. calling on a div, btn, etc)
this._readType();
labels = this.element.labels();
// If there are multiple labels, use the last one
this.label = $( labels[ labels.length - 1 ] );
if ( !this.label.length ) {
$.error( "No label found for checkboxradio widget" );
}
this.originalLabel = "";
// We need to get the label text but this may also need to make sure it does not contain the
// input itself.
// The label contents could be text, html, or a mix. We wrap all elements
// and read the wrapper's `innerHTML` to get a string representation of
// the label, without the input as part of it.
labelContents = this.label.contents().not( this.element[ 0 ] );
if ( labelContents.length ) {
this.originalLabel += labelContents
.clone()
.wrapAll( "<div></div>" )
.parent()
.html();
}
// Set the label option if we found label text
if ( this.originalLabel ) {
options.label = this.originalLabel;
}
disabled = this.element[ 0 ].disabled;
if ( disabled != null ) {
options.disabled = disabled;
}
return options;
},
_create: function() {
var checked = this.element[ 0 ].checked;
this._bindFormResetHandler();
if ( this.options.disabled == null ) {
this.options.disabled = this.element[ 0 ].disabled;
}
this._setOption( "disabled", this.options.disabled );
this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
if ( this.type === "radio" ) {
this._addClass( this.label, "ui-checkboxradio-radio-label" );
}
if ( this.options.label && this.options.label !== this.originalLabel ) {
this._updateLabel();
} else if ( this.originalLabel ) {
this.options.label = this.originalLabel;
}
this._enhance();
if ( checked ) {
this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
}
this._on( {
change: "_toggleClasses",
focus: function() {
this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
},
blur: function() {
this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
}
} );
},
_readType: function() {
var nodeName = this.element[ 0 ].nodeName.toLowerCase();
this.type = this.element[ 0 ].type;
if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
" and element.type=" + this.type );
}
},
// Support jQuery Mobile enhanced option
_enhance: function() {
this._updateIcon( this.element[ 0 ].checked );
},
widget: function() {
return this.label;
},
_getRadioGroup: function() {
var group;
var name = this.element[ 0 ].name;
var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
if ( !name ) {
return $( [] );
}
if ( this.form.length ) {
group = $( this.form[ 0 ].elements ).filter( nameSelector );
} else {
// Not inside a form, check all inputs that also are not inside a form
group = $( nameSelector ).filter( function() {
return $( this )._form().length === 0;
} );
}
return group.not( this.element );
},
_toggleClasses: function() {
var checked = this.element[ 0 ].checked;
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
if ( this.options.icon && this.type === "checkbox" ) {
this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
}
if ( this.type === "radio" ) {
this._getRadioGroup()
.each( function() {
var instance = $( this ).checkboxradio( "instance" );
if ( instance ) {
instance._removeClass( instance.label,
"ui-checkboxradio-checked", "ui-state-active" );
}
} );
}
},
_destroy: function() {
this._unbindFormResetHandler();
if ( this.icon ) {
this.icon.remove();
this.iconSpace.remove();
}
},
_setOption: function( key, value ) {
// We don't allow the value to be set to nothing
if ( key === "label" && !value ) {
return;
}
this._super( key, value );
if ( key === "disabled" ) {
this._toggleClass( this.label, null, "ui-state-disabled", value );
this.element[ 0 ].disabled = value;
// Don't refresh when setting disabled
return;
}
this.refresh();
},
_updateIcon: function( checked ) {
var toAdd = "ui-icon ui-icon-background ";
if ( this.options.icon ) {
if ( !this.icon ) {
this.icon = $( "<span>" );
this.iconSpace = $( "<span> </span>" );
this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
}
if ( this.type === "checkbox" ) {
toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
} else {
toAdd += "ui-icon-blank";
}
this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
if ( !checked ) {
this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
}
this.icon.prependTo( this.label ).after( this.iconSpace );
} else if ( this.icon !== undefined ) {
this.icon.remove();
this.iconSpace.remove();
delete this.icon;
}
},
_updateLabel: function() {
// Remove the contents of the label ( minus the icon, icon space, and input )
var contents = this.label.contents().not( this.element[ 0 ] );
if ( this.icon ) {
contents = contents.not( this.icon[ 0 ] );
}
if ( this.iconSpace ) {
contents = contents.not( this.iconSpace[ 0 ] );
}
contents.remove();
this.label.append( this.options.label );
},
refresh: function() {
var checked = this.element[ 0 ].checked,
isDisabled = this.element[ 0 ].disabled;
this._updateIcon( checked );
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
if ( this.options.label !== null ) {
this._updateLabel();
}
if ( isDisabled !== this.options.disabled ) {
this._setOptions( { "disabled": isDisabled } );
}
}
} ] );
return $.ui.checkboxradio;
} );

View file

@ -0,0 +1,302 @@
/*!
* jQuery UI Controlgroup @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Controlgroup
//>>group: Widgets
//>>description: Visually groups form control widgets
//>>docs: http://api.jqueryui.com/controlgroup/
//>>demos: http://jqueryui.com/controlgroup/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/controlgroup.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [
"jquery",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
return $.widget( "ui.controlgroup", {
version: "@VERSION",
defaultElement: "<div>",
options: {
direction: "horizontal",
disabled: null,
onlyVisible: true,
items: {
"button": "input[type=button], input[type=submit], input[type=reset], button, a",
"controlgroupLabel": ".ui-controlgroup-label",
"checkboxradio": "input[type='checkbox'], input[type='radio']",
"selectmenu": "select",
"spinner": ".ui-spinner-input"
}
},
_create: function() {
this._enhance();
},
// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
_enhance: function() {
this.element.attr( "role", "toolbar" );
this.refresh();
},
_destroy: function() {
this._callChildMethod( "destroy" );
this.childWidgets.removeData( "ui-controlgroup-data" );
this.element.removeAttr( "role" );
if ( this.options.items.controlgroupLabel ) {
this.element
.find( this.options.items.controlgroupLabel )
.find( ".ui-controlgroup-label-contents" )
.contents().unwrap();
}
},
_initWidgets: function() {
var that = this,
childWidgets = [];
// First we iterate over each of the items options
$.each( this.options.items, function( widget, selector ) {
var labels;
var options = {};
// Make sure the widget has a selector set
if ( !selector ) {
return;
}
if ( widget === "controlgroupLabel" ) {
labels = that.element.find( selector );
labels.each( function() {
var element = $( this );
if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
return;
}
element.contents()
.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
} );
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
childWidgets = childWidgets.concat( labels.get() );
return;
}
// Make sure the widget actually exists
if ( !$.fn[ widget ] ) {
return;
}
// We assume everything is in the middle to start because we can't determine
// first / last elements until all enhancments are done.
if ( that[ "_" + widget + "Options" ] ) {
options = that[ "_" + widget + "Options" ]( "middle" );
} else {
options = { classes: {} };
}
// Find instances of this widget inside controlgroup and init them
that.element
.find( selector )
.each( function() {
var element = $( this );
var instance = element[ widget ]( "instance" );
// We need to clone the default options for this type of widget to avoid
// polluting the variable options which has a wider scope than a single widget.
var instanceOptions = $.widget.extend( {}, options );
// If the button is the child of a spinner ignore it
// TODO: Find a more generic solution
if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
return;
}
// Create the widget if it doesn't exist
if ( !instance ) {
instance = element[ widget ]()[ widget ]( "instance" );
}
if ( instance ) {
instanceOptions.classes =
that._resolveClassesValues( instanceOptions.classes, instance );
}
element[ widget ]( instanceOptions );
// Store an instance of the controlgroup to be able to reference
// from the outermost element for changing options and refresh
var widgetElement = element[ widget ]( "widget" );
$.data( widgetElement[ 0 ], "ui-controlgroup-data",
instance ? instance : element[ widget ]( "instance" ) );
childWidgets.push( widgetElement[ 0 ] );
} );
} );
this.childWidgets = $( $.uniqueSort( childWidgets ) );
this._addClass( this.childWidgets, "ui-controlgroup-item" );
},
_callChildMethod: function( method ) {
this.childWidgets.each( function() {
var element = $( this ),
data = element.data( "ui-controlgroup-data" );
if ( data && data[ method ] ) {
data[ method ]();
}
} );
},
_updateCornerClass: function( element, position ) {
var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
var add = this._buildSimpleOptions( position, "label" ).classes.label;
this._removeClass( element, null, remove );
this._addClass( element, null, add );
},
_buildSimpleOptions: function( position, key ) {
var direction = this.options.direction === "vertical";
var result = {
classes: {}
};
result.classes[ key ] = {
"middle": "",
"first": "ui-corner-" + ( direction ? "top" : "left" ),
"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
"only": "ui-corner-all"
}[ position ];
return result;
},
_spinnerOptions: function( position ) {
var options = this._buildSimpleOptions( position, "ui-spinner" );
options.classes[ "ui-spinner-up" ] = "";
options.classes[ "ui-spinner-down" ] = "";
return options;
},
_buttonOptions: function( position ) {
return this._buildSimpleOptions( position, "ui-button" );
},
_checkboxradioOptions: function( position ) {
return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
},
_selectmenuOptions: function( position ) {
var direction = this.options.direction === "vertical";
return {
width: direction ? "auto" : false,
classes: {
middle: {
"ui-selectmenu-button-open": "",
"ui-selectmenu-button-closed": ""
},
first: {
"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
},
last: {
"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
},
only: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
}
}[ position ]
};
},
_resolveClassesValues: function( classes, instance ) {
var result = {};
$.each( classes, function( key ) {
var current = instance.options.classes[ key ] || "";
current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
} );
return result;
},
_setOption: function( key, value ) {
if ( key === "direction" ) {
this._removeClass( "ui-controlgroup-" + this.options.direction );
}
this._super( key, value );
if ( key === "disabled" ) {
this._callChildMethod( value ? "disable" : "enable" );
return;
}
this.refresh();
},
refresh: function() {
var children,
that = this;
this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
if ( this.options.direction === "horizontal" ) {
this._addClass( null, "ui-helper-clearfix" );
}
this._initWidgets();
children = this.childWidgets;
// We filter here because we need to track all childWidgets not just the visible ones
if ( this.options.onlyVisible ) {
children = children.filter( ":visible" );
}
if ( children.length ) {
// We do this last because we need to make sure all enhancment is done
// before determining first and last
$.each( [ "first", "last" ], function( index, value ) {
var instance = children[ value ]().data( "ui-controlgroup-data" );
if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
var options = that[ "_" + instance.widgetName + "Options" ](
children.length === 1 ? "only" : value
);
options.classes = that._resolveClassesValues( options.classes, instance );
instance.element[ instance.widgetName ]( options );
} else {
that._updateCornerClass( children[ value ](), value );
}
} );
// Finally call the refresh method on each of the child widgets.
this._callChildMethod( "refresh" );
}
}
} );
} );

View file

@ -1,304 +1,23 @@
/*!
* jQuery UI Core 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// This file is deprecated in 1.12.0 to be removed in 1.14
( function() {
"use strict";
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {};
$.extend( $.ui, {
version: "1.11.4",
keyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
}
});
// plugins
$.fn.extend({
scrollParent: function( includeHidden ) {
var position = this.css( "position" ),
excludeStaticParent = position === "absolute",
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
scrollParent = this.parents().filter( function() {
var parent = $( this );
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
return false;
}
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
}).eq( 0 );
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
},
uniqueId: (function() {
var uuid = 0;
return function() {
return this.each(function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
});
};
})(),
removeUniqueId: function() {
return this.each(function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
});
}
});
// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
return !!img && visible( img );
}
return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) &&
// the element and all of its ancestors must be visible
visible( element );
}
function visible( element ) {
return $.expr.filters.visible( element ) &&
!$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
}
$.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo(function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
}) :
// support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
},
focusable: function( element ) {
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
},
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
isTabIndexNaN = isNaN( tabIndex );
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
}
});
// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};
function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}
$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}
return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};
$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}
return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}
// support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
$.fn.removeData = (function( removeData ) {
return function( key ) {
if ( arguments.length ) {
return removeData.call( this, $.camelCase( key ) );
} else {
return removeData.call( this );
}
};
})( $.fn.removeData );
}
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
$.fn.extend({
focus: (function( orig ) {
return function( delay, fn ) {
return typeof delay === "number" ?
this.each(function() {
var elem = this;
setTimeout(function() {
$( elem ).focus();
if ( fn ) {
fn.call( elem );
}
}, delay );
}) :
orig.apply( this, arguments );
};
})( $.fn.focus ),
disableSelection: (function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.bind( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
});
};
})(),
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
},
zIndex: function( zIndex ) {
if ( zIndex !== undefined ) {
return this.css( "zIndex", zIndex );
}
if ( this.length ) {
var elem = $( this[ 0 ] ), position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
}
return 0;
}
});
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
add: function( module, option, set ) {
var i,
proto = $.ui[ module ].prototype;
for ( i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args, allowDisconnected ) {
var i,
set = instance.plugins[ name ];
if ( !set ) {
return;
}
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
return;
}
for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
}
}
};
}));
define( [
"jquery",
"./data",
"./disable-selection",
"./focusable",
"./form",
"./ie",
"./keycode",
"./labels",
"./jquery-patch.js",
"./plugin",
"./safe-active-element",
"./safe-blur",
"./scroll-parent",
"./tabbable",
"./unique-id",
"./version"
] );
} )();

43
include/thirdparty/jquery_ui/data.js vendored Normal file
View file

@ -0,0 +1,43 @@
/*!
* jQuery UI :data @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :data Selector
//>>group: Core
//>>description: Selects elements which have data stored under the specified key.
//>>docs: http://api.jqueryui.com/data-selector/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.extend( $.expr.pseudos, {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
} ) :
// Support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
}
} );
} );

File diff suppressed because it is too large Load diff

View file

@ -1,43 +1,63 @@
/*!
* jQuery UI Dialog 1.11.4
* jQuery UI Dialog @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/dialog/
*/
(function( factory ) {
//>>label: Dialog
//>>group: Widgets
//>>description: Displays customizable dialog windows.
//>>docs: http://api.jqueryui.com/dialog/
//>>demos: http://jqueryui.com/dialog/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/dialog.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./button",
"./draggable",
"./mouse",
"./position",
"./resizable"
"./resizable",
"../focusable",
"../keycode",
"../position",
"../safe-active-element",
"../safe-blur",
"../tabbable",
"../unique-id",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.dialog", {
version: "1.11.4",
$.widget( "ui.dialog", {
version: "@VERSION",
options: {
appendTo: "body",
autoOpen: true,
buttons: [],
classes: {
"ui-dialog": "ui-corner-all",
"ui-dialog-titlebar": "ui-corner-all"
},
closeOnEscape: true,
closeText: "Close",
dialogClass: "",
draggable: true,
hide: null,
height: "auto",
@ -51,6 +71,7 @@ return $.widget( "ui.dialog", {
at: "center",
of: window,
collision: "fit",
// Ensure the titlebar is always visible
using: function( pos ) {
var topOffset = $( this ).css( pos ).offset().top;
@ -64,7 +85,7 @@ return $.widget( "ui.dialog", {
title: null,
width: 300,
// callbacks
// Callbacks
beforeClose: null,
close: null,
drag: null,
@ -107,16 +128,24 @@ return $.widget( "ui.dialog", {
index: this.element.parent().children().index( this.element )
};
this.originalTitle = this.element.attr( "title" );
this.options.title = this.options.title || this.originalTitle;
if ( this.options.title == null && this.originalTitle != null ) {
this.options.title = this.originalTitle;
}
// Dialogs can't be disabled
if ( this.options.disabled ) {
this.options.disabled = false;
}
this._createWrapper();
this.element
.show()
.removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" )
.appendTo( this.uiDialog );
this._addClass( "ui-dialog-content", "ui-widget-content" );
this._createTitlebar();
this._createButtonPane();
@ -140,7 +169,7 @@ return $.widget( "ui.dialog", {
_appendTo: function() {
var element = this.options.appendTo;
if ( element && (element.jquery || element.nodeType) ) {
if ( element && ( element.jquery || element.nodeType ) ) {
return $( element );
}
return this.document.find( element || "body" ).eq( 0 );
@ -155,18 +184,19 @@ return $.widget( "ui.dialog", {
this.element
.removeUniqueId()
.removeClass( "ui-dialog-content ui-widget-content" )
.css( this.originalCss )
// Without detaching first, the following becomes really slow
.detach();
this.uiDialog.stop( true, true ).remove();
this.uiDialog.remove();
if ( this.originalTitle ) {
this.element.attr( "title", this.originalTitle );
}
next = originalPosition.parent.children().eq( originalPosition.index );
// Don't try to place the dialog next to itself (#8613)
if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
next.before( this.element );
@ -183,8 +213,7 @@ return $.widget( "ui.dialog", {
enable: $.noop,
close: function( event ) {
var activeElement,
that = this;
var that = this;
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
return;
@ -195,28 +224,17 @@ return $.widget( "ui.dialog", {
this._destroyOverlay();
this._untrackInstance();
if ( !this.opener.filter( ":focusable" ).focus().length ) {
if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
activeElement = this.document[ 0 ].activeElement;
// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #4520
if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
// Hiding a focused element doesn't trigger blur in WebKit
// so in case we have nothing to focus on, explicitly blur the active element
// https://bugs.webkit.org/show_bug.cgi?id=47182
$( activeElement ).blur();
}
} catch ( error ) {}
// Hiding a focused element doesn't trigger blur in WebKit
// so in case we have nothing to focus on, explicitly blur the active element
// https://bugs.webkit.org/show_bug.cgi?id=47182
$.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
}
this._hide( this.uiDialog, this.options.hide, function() {
that._trigger( "close", event );
});
} );
},
isOpen: function() {
@ -229,9 +247,9 @@ return $.widget( "ui.dialog", {
_moveToTop: function( event, silent ) {
var moved = false,
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
return +$( this ).css( "z-index" );
}).get(),
} ).get(),
zIndexMax = Math.max.apply( null, zIndices );
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
@ -255,7 +273,7 @@ return $.widget( "ui.dialog", {
}
this._isOpen = true;
this.opener = $( this.document[ 0 ].activeElement );
this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
this._size();
this._position();
@ -272,9 +290,9 @@ return $.widget( "ui.dialog", {
this._show( this.uiDialog, this.options.show, function() {
that._focusTabbable();
that._trigger( "focus" );
});
} );
// Track the dialog immediately upon openening in case a focus event
// Track the dialog immediately upon opening in case a focus event
// somehow occurs outside of the dialog before an element inside the
// dialog is focused (#10152)
this._makeFocusTarget();
@ -283,6 +301,7 @@ return $.widget( "ui.dialog", {
},
_focusTabbable: function() {
// Set focus to the first match:
// 1. An element that was focused previously
// 2. First element inside the dialog matching [autofocus]
@ -306,38 +325,40 @@ return $.widget( "ui.dialog", {
if ( !hasFocus.length ) {
hasFocus = this.uiDialog;
}
hasFocus.eq( 0 ).focus();
hasFocus.eq( 0 ).trigger( "focus" );
},
_restoreTabbableFocus: function() {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
isActive = this.uiDialog[ 0 ] === activeElement ||
$.contains( this.uiDialog[ 0 ], activeElement );
if ( !isActive ) {
this._focusTabbable();
}
},
_keepFocus: function( event ) {
function checkFocus() {
var activeElement = this.document[0].activeElement,
isActive = this.uiDialog[0] === activeElement ||
$.contains( this.uiDialog[0], activeElement );
if ( !isActive ) {
this._focusTabbable();
}
}
event.preventDefault();
checkFocus.call( this );
this._restoreTabbableFocus();
// support: IE
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
// so we check again later
this._delay( checkFocus );
this._delay( this._restoreTabbableFocus );
},
_createWrapper: function() {
this.uiDialog = $("<div>")
.addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
this.options.dialogClass )
this.uiDialog = $( "<div>" )
.hide()
.attr({
.attr( {
// Setting tabIndex makes the div focusable
tabIndex: -1,
role: "dialog"
})
} )
.appendTo( this._appendTo() );
this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
this._on( this.uiDialog, {
keydown: function( event ) {
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
@ -347,23 +368,25 @@ return $.widget( "ui.dialog", {
return;
}
// prevent tabbing out of dialogs
// Prevent tabbing out of dialogs
if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
return;
}
var tabbables = this.uiDialog.find( ":tabbable" ),
first = tabbables.filter( ":first" ),
last = tabbables.filter( ":last" );
first = tabbables.first(),
last = tabbables.last();
if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
this._delay(function() {
first.focus();
});
if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
!event.shiftKey ) {
this._delay( function() {
first.trigger( "focus" );
} );
event.preventDefault();
} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
this._delay(function() {
last.focus();
});
} else if ( ( event.target === first[ 0 ] ||
event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
this._delay( function() {
last.trigger( "focus" );
} );
event.preventDefault();
}
},
@ -372,81 +395,84 @@ return $.widget( "ui.dialog", {
this._focusTabbable();
}
}
});
} );
// We assume that any existing aria-describedby attribute means
// that the dialog content is marked up properly
// otherwise we brute force the content as the description
if ( !this.element.find( "[aria-describedby]" ).length ) {
this.uiDialog.attr({
this.uiDialog.attr( {
"aria-describedby": this.element.uniqueId().attr( "id" )
});
} );
}
},
_createTitlebar: function() {
var uiDialogTitle;
this.uiDialogTitlebar = $( "<div>" )
.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
.prependTo( this.uiDialog );
this.uiDialogTitlebar = $( "<div>" );
this._addClass( this.uiDialogTitlebar,
"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
this._on( this.uiDialogTitlebar, {
mousedown: function( event ) {
// Don't prevent click on close button (#8838)
// Focusing a dialog that is partially scrolled out of view
// causes the browser to scroll it into view, preventing the click event
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
// Dialog isn't getting focus when dragging (#8063)
this.uiDialog.focus();
this.uiDialog.trigger( "focus" );
}
}
});
} );
// support: IE
// Support: IE
// Use type="button" to prevent enter keypresses in textboxes from closing the
// dialog in IE (#9312)
this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
.button({
label: this.options.closeText,
icons: {
primary: "ui-icon-closethick"
},
text: false
})
.addClass( "ui-dialog-titlebar-close" )
.button( {
label: $( "<a>" ).text( this.options.closeText ).html(),
icon: "ui-icon-closethick",
showLabel: false
} )
.appendTo( this.uiDialogTitlebar );
this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
this._on( this.uiDialogTitlebarClose, {
click: function( event ) {
event.preventDefault();
this.close( event );
}
});
} );
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
.prependTo( this.uiDialogTitlebar );
uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
this._addClass( uiDialogTitle, "ui-dialog-title" );
this._title( uiDialogTitle );
this.uiDialog.attr({
this.uiDialogTitlebar.prependTo( this.uiDialog );
this.uiDialog.attr( {
"aria-labelledby": uiDialogTitle.attr( "id" )
});
} );
},
_title: function( title ) {
if ( !this.options.title ) {
if ( this.options.title ) {
title.text( this.options.title );
} else {
title.html( "&#160;" );
}
title.text( this.options.title );
},
_createButtonPane: function() {
this.uiDialogButtonPane = $( "<div>" )
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
this.uiDialogButtonPane = $( "<div>" );
this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
"ui-widget-content ui-helper-clearfix" );
this.uiButtonSet = $( "<div>" )
.addClass( "ui-dialog-buttonset" )
.appendTo( this.uiDialogButtonPane );
this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
this._createButtons();
},
@ -455,38 +481,55 @@ return $.widget( "ui.dialog", {
var that = this,
buttons = this.options.buttons;
// if we already have a button pane, remove it
// If we already have a button pane, remove it
this.uiDialogButtonPane.remove();
this.uiButtonSet.empty();
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
this.uiDialog.removeClass( "ui-dialog-buttons" );
if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) {
this._removeClass( this.uiDialog, "ui-dialog-buttons" );
return;
}
$.each( buttons, function( name, props ) {
var click, buttonOptions;
props = $.isFunction( props ) ?
props = typeof props === "function" ?
{ click: props, text: name } :
props;
// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
// Change the context for the click callback to be the main element
click = props.click;
props.click = function() {
click.apply( that.element[ 0 ], arguments );
};
buttonOptions = {
icon: props.icon,
iconPosition: props.iconPosition,
showLabel: props.showLabel,
// Deprecated options
icons: props.icons,
text: props.showText
text: props.text
};
delete props.click;
delete props.icon;
delete props.iconPosition;
delete props.showLabel;
// Deprecated options
delete props.icons;
delete props.showText;
if ( typeof props.text === "boolean" ) {
delete props.text;
}
$( "<button></button>", props )
.button( buttonOptions )
.appendTo( that.uiButtonSet );
});
this.uiDialog.addClass( "ui-dialog-buttons" );
.appendTo( that.uiButtonSet )
.on( "click", function() {
click.apply( that.element[ 0 ], arguments );
} );
} );
this._addClass( this.uiDialog, "ui-dialog-buttons" );
this.uiDialogButtonPane.appendTo( this.uiDialog );
},
@ -501,12 +544,12 @@ return $.widget( "ui.dialog", {
};
}
this.uiDialog.draggable({
this.uiDialog.draggable( {
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
handle: ".ui-dialog-titlebar",
containment: "document",
start: function( event, ui ) {
$( this ).addClass( "ui-dialog-dragging" );
that._addClass( $( this ), "ui-dialog-dragging" );
that._blockFrames();
that._trigger( "dragStart", event, filteredUi( ui ) );
},
@ -519,26 +562,27 @@ return $.widget( "ui.dialog", {
options.position = {
my: "left top",
at: "left" + (left >= 0 ? "+" : "") + left + " " +
"top" + (top >= 0 ? "+" : "") + top,
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
of: that.window
};
$( this ).removeClass( "ui-dialog-dragging" );
that._removeClass( $( this ), "ui-dialog-dragging" );
that._unblockFrames();
that._trigger( "dragStop", event, filteredUi( ui ) );
}
});
} );
},
_makeResizable: function() {
var that = this,
options = this.options,
handles = options.resizable,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css("position"),
position = this.uiDialog.css( "position" ),
resizeHandles = typeof handles === "string" ?
handles :
handles :
"n,e,s,w,se,sw,ne,nw";
function filteredUi( ui ) {
@ -550,7 +594,7 @@ return $.widget( "ui.dialog", {
};
}
this.uiDialog.resizable({
this.uiDialog.resizable( {
cancel: ".ui-dialog-content",
containment: "document",
alsoResize: this.element,
@ -560,7 +604,7 @@ return $.widget( "ui.dialog", {
minHeight: this._minHeight(),
handles: resizeHandles,
start: function( event, ui ) {
$( this ).addClass( "ui-dialog-resizing" );
that._addClass( $( this ), "ui-dialog-resizing" );
that._blockFrames();
that._trigger( "resizeStart", event, filteredUi( ui ) );
},
@ -576,16 +620,16 @@ return $.widget( "ui.dialog", {
options.width = that.uiDialog.width();
options.position = {
my: "left top",
at: "left" + (left >= 0 ? "+" : "") + left + " " +
"top" + (top >= 0 ? "+" : "") + top,
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
of: that.window
};
$( this ).removeClass( "ui-dialog-resizing" );
that._removeClass( $( this ), "ui-dialog-resizing" );
that._unblockFrames();
that._trigger( "resizeStop", event, filteredUi( ui ) );
}
})
.css( "position", position );
} )
.css( "position", position );
},
_trackFocus: function() {
@ -594,7 +638,7 @@ return $.widget( "ui.dialog", {
this._makeFocusTarget();
this._focusedElement = $( event.target );
}
});
} );
},
_makeFocusTarget: function() {
@ -628,6 +672,7 @@ return $.widget( "ui.dialog", {
},
_position: function() {
// Need to show the dialog to get the actual offset in the position plugin
var isVisible = this.uiDialog.is( ":visible" );
if ( !isVisible ) {
@ -653,7 +698,7 @@ return $.widget( "ui.dialog", {
if ( key in that.resizableRelatedOptions ) {
resizableOptions[ key ] = value;
}
});
} );
if ( resize ) {
this._size();
@ -668,12 +713,6 @@ return $.widget( "ui.dialog", {
var isDraggable, isResizable,
uiDialog = this.uiDialog;
if ( key === "dialogClass" ) {
uiDialog
.removeClass( this.options.dialogClass )
.addClass( value );
}
if ( key === "disabled" ) {
return;
}
@ -689,10 +728,11 @@ return $.widget( "ui.dialog", {
}
if ( key === "closeText" ) {
this.uiDialogTitlebarClose.button({
this.uiDialogTitlebarClose.button( {
// Ensure that we always pass a string
label: "" + value
});
label: $( "<a>" ).text( "" + this.options.closeText ).html()
} );
}
if ( key === "draggable" ) {
@ -711,18 +751,19 @@ return $.widget( "ui.dialog", {
}
if ( key === "resizable" ) {
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
// currently resizable, changing handles
// Currently resizable, changing handles
if ( isResizable && typeof value === "string" ) {
uiDialog.resizable( "option", "handles", value );
}
// currently non-resizable, becoming resizable
// Currently non-resizable, becoming resizable
if ( !isResizable && value !== false ) {
this._makeResizable();
}
@ -734,29 +775,30 @@ return $.widget( "ui.dialog", {
},
_size: function() {
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,
options = this.options;
// Reset content sizing
this.element.show().css({
this.element.show().css( {
width: "auto",
minHeight: 0,
maxHeight: "none",
height: 0
});
} );
if ( options.minWidth > options.width ) {
options.width = options.minWidth;
}
// reset wrapper sizing
// Reset wrapper sizing
// determine the height of all the non-content elements
nonContentHeight = this.uiDialog.css({
height: "auto",
width: options.width
})
nonContentHeight = this.uiDialog.css( {
height: "auto",
width: options.width
} )
.outerHeight();
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
maxContentHeight = typeof options.maxHeight === "number" ?
@ -764,11 +806,11 @@ return $.widget( "ui.dialog", {
"none";
if ( options.height === "auto" ) {
this.element.css({
this.element.css( {
minHeight: minContentHeight,
maxHeight: maxContentHeight,
height: "auto"
});
} );
} else {
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
}
@ -779,18 +821,18 @@ return $.widget( "ui.dialog", {
},
_blockFrames: function() {
this.iframeBlocks = this.document.find( "iframe" ).map(function() {
this.iframeBlocks = this.document.find( "iframe" ).map( function() {
var iframe = $( this );
return $( "<div>" )
.css({
.css( {
position: "absolute",
width: iframe.outerWidth(),
height: iframe.outerHeight()
})
} )
.appendTo( iframe.parent() )
.offset( iframe.offset() )[0];
});
.offset( iframe.offset() )[ 0 ];
} );
},
_unblockFrames: function() {
@ -815,40 +857,51 @@ return $.widget( "ui.dialog", {
return;
}
var jqMinor = $.fn.jquery.substring( 0, 4 );
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling (#2804)
var isOpening = true;
this._delay(function() {
this._delay( function() {
isOpening = false;
});
} );
if ( !this.document.data( "ui-dialog-overlays" ) ) {
// Prevent use of anchors and inputs
// Using _on() for an event handler shared across many instances is
// safe because the dialogs stack and must be closed in reverse order
this._on( this.document, {
focusin: function( event ) {
if ( isOpening ) {
return;
}
// This doesn't use `_on()` because it is a shared event handler
// across all open modal dialogs.
this.document.on( "focusin.ui-dialog", function( event ) {
if ( isOpening ) {
return;
}
if ( !this._allowInteraction( event ) ) {
event.preventDefault();
this._trackingInstances()[ 0 ]._focusTabbable();
var instance = this._trackingInstances()[ 0 ];
if ( !instance._allowInteraction( event ) ) {
event.preventDefault();
instance._focusTabbable();
// Support: jQuery >=3.4 <3.6 only
// Focus re-triggering in jQuery 3.4/3.5 makes the original element
// have its focus event propagated last, breaking the re-targeting.
// Trigger focus in a delay in addition if needed to avoid the issue
// See https://github.com/jquery/jquery/issues/4382
if ( jqMinor === "3.4." || jqMinor === "3.5." ) {
instance._delay( instance._restoreTabbableFocus );
}
}
});
}.bind( this ) );
}
this.overlay = $( "<div>" )
.addClass( "ui-widget-overlay ui-front" )
.appendTo( this._appendTo() );
this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
this._on( this.overlay, {
mousedown: "_keepFocus"
});
} );
this.document.data( "ui-dialog-overlays",
(this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
},
_destroyOverlay: function() {
@ -860,9 +913,8 @@ return $.widget( "ui.dialog", {
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
if ( !overlays ) {
this.document
.unbind( "focusin" )
.removeData( "ui-dialog-overlays" );
this.document.off( "focusin.ui-dialog" );
this.document.removeData( "ui-dialog-overlays" );
} else {
this.document.data( "ui-dialog-overlays", overlays );
}
@ -871,6 +923,32 @@ return $.widget( "ui.dialog", {
this.overlay = null;
}
}
});
} );
}));
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for dialogClass option
$.widget( "ui.dialog", $.ui.dialog, {
options: {
dialogClass: ""
},
_createWrapper: function() {
this._super();
this.uiDialog.addClass( this.options.dialogClass );
},
_setOption: function( key, value ) {
if ( key === "dialogClass" ) {
this.uiDialog
.removeClass( this.options.dialogClass )
.addClass( value );
}
this._superApply( arguments );
}
} );
}
return $.ui.dialog;
} );

View file

@ -0,0 +1,49 @@
/*!
* jQuery UI Disable Selection @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: disableSelection
//>>group: Core
//>>description: Disable selection of text content within the set of matched elements.
//>>docs: http://api.jqueryui.com/disableSelection/
// This file is deprecated
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.fn.extend( {
disableSelection: ( function() {
var eventType = "onselectstart" in document.createElement( "div" ) ?
"selectstart" :
"mousedown";
return function() {
return this.on( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
} );
};
} )(),
enableSelection: function() {
return this.off( ".ui-disableSelection" );
}
} );
} );

File diff suppressed because it is too large Load diff

View file

@ -1,44 +1,50 @@
/*!
* jQuery UI Droppable 1.11.4
* jQuery UI Droppable @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/droppable/
*/
(function( factory ) {
//>>label: Droppable
//>>group: Interactions
//>>description: Enables drop targets for draggable elements.
//>>docs: http://api.jqueryui.com/droppable/
//>>demos: http://jqueryui.com/droppable/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./draggable",
"./mouse",
"./draggable"
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
$.widget( "ui.droppable", {
version: "1.11.4",
version: "@VERSION",
widgetEventPrefix: "drop",
options: {
accept: "*",
activeClass: false,
addClasses: true,
greedy: false,
hoverClass: false,
scope: "default",
tolerance: "intersect",
// callbacks
// Callbacks
activate: null,
deactivate: null,
drop: null,
@ -54,15 +60,17 @@ $.widget( "ui.droppable", {
this.isover = false;
this.isout = true;
this.accept = $.isFunction( accept ) ? accept : function( d ) {
this.accept = typeof accept === "function" ? accept : function( d ) {
return d.is( accept );
};
this.proportions = function( /* valueToWrite */ ) {
if ( arguments.length ) {
// Store the droppable's proportions
proportions = arguments[ 0 ];
} else {
// Retrieve or derive the droppable's proportions
return proportions ?
proportions :
@ -75,11 +83,14 @@ $.widget( "ui.droppable", {
this._addToManager( o.scope );
o.addClasses && this.element.addClass( "ui-droppable" );
if ( o.addClasses ) {
this._addClass( "ui-droppable" );
}
},
_addToManager: function( scope ) {
// Add the reference and positions to the manager
$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
$.ui.ddmanager.droppables[ scope ].push( this );
@ -98,14 +109,12 @@ $.widget( "ui.droppable", {
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
this._splice( drop );
this.element.removeClass( "ui-droppable ui-droppable-disabled" );
},
_setOption: function( key, value ) {
if ( key === "accept" ) {
this.accept = $.isFunction( value ) ? value : function( d ) {
this.accept = typeof value === "function" ? value : function( d ) {
return d.is( value );
};
} else if ( key === "scope" ) {
@ -120,20 +129,18 @@ $.widget( "ui.droppable", {
_activate: function( event ) {
var draggable = $.ui.ddmanager.current;
if ( this.options.activeClass ) {
this.element.addClass( this.options.activeClass );
}
if ( draggable ){
this._addActiveClass();
if ( draggable ) {
this._trigger( "activate", event, this.ui( draggable ) );
}
},
_deactivate: function( event ) {
var draggable = $.ui.ddmanager.current;
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
if ( draggable ){
this._removeActiveClass();
if ( draggable ) {
this._trigger( "deactivate", event, this.ui( draggable ) );
}
},
@ -143,14 +150,14 @@ $.widget( "ui.droppable", {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.hoverClass ) {
this.element.addClass( this.options.hoverClass );
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._addHoverClass();
this._trigger( "over", event, this.ui( draggable ) );
}
@ -161,14 +168,14 @@ $.widget( "ui.droppable", {
var draggable = $.ui.ddmanager.current;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._removeHoverClass();
this._trigger( "out", event, this.ui( draggable ) );
}
@ -180,31 +187,42 @@ $.widget( "ui.droppable", {
childrenIntersection = false;
// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return false;
}
this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
$.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
) { childrenIntersection = true; return false; }
});
this.element
.find( ":data(ui-droppable)" )
.not( ".ui-draggable-dragging" )
.each( function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call(
inst.element[ 0 ], ( draggable.currentItem || draggable.element )
) &&
$.ui.intersect(
draggable,
$.extend( inst, { offset: inst.element.offset() } ),
inst.options.tolerance, event
)
) {
childrenIntersection = true;
return false;
}
} );
if ( childrenIntersection ) {
return false;
}
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
if ( this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this._removeActiveClass();
this._removeHoverClass();
this._trigger( "drop", event, this.ui( draggable ) );
return this.element;
}
@ -220,11 +238,28 @@ $.widget( "ui.droppable", {
position: c.position,
offset: c.positionAbs
};
},
// Extension points just to make backcompat sane and avoid duplicating logic
// TODO: Remove in 1.14 along with call to it below
_addHoverClass: function() {
this._addClass( "ui-droppable-hover" );
},
_removeHoverClass: function() {
this._removeClass( "ui-droppable-hover" );
},
_addActiveClass: function() {
this._addClass( "ui-droppable-active" );
},
_removeActiveClass: function() {
this._removeClass( "ui-droppable-active" );
}
} );
});
$.ui.intersect = (function() {
$.ui.intersect = ( function() {
function isOverAxis( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
}
@ -235,8 +270,10 @@ $.ui.intersect = (function() {
return false;
}
var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
var x1 = ( draggable.positionAbs ||
draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs ||
draggable.position.absolute ).top + draggable.margins.top,
x2 = x1 + draggable.helperProportions.width,
y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left,
@ -253,7 +290,8 @@ $.ui.intersect = (function() {
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
@ -268,7 +306,7 @@ $.ui.intersect = (function() {
return false;
}
};
})();
} )();
/*
This manager tracks offsets of draggables and droppables
@ -286,7 +324,8 @@ $.ui.ddmanager = {
droppablesLoop: for ( i = 0; i < m.length; i++ ) {
// No disabled and non-accepted
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
( t.currentItem || t.element ) ) ) ) {
continue;
}
@ -309,7 +348,10 @@ $.ui.ddmanager = {
}
m[ i ].offset = m[ i ].element.offset();
m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
m[ i ].proportions( {
width: m[ i ].element[ 0 ].offsetWidth,
height: m[ i ].element[ 0 ].offsetHeight
} );
}
@ -317,37 +359,43 @@ $.ui.ddmanager = {
drop: function( draggable, event ) {
var dropped = false;
// Create a copy of the droppables in case the list changes during the drop (#9116)
$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
if ( !this.options ) {
return;
}
if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
if ( !this.options.disabled && this.visible &&
$.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
dropped = this._drop.call( this, event ) || dropped;
}
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this.isout = true;
this.isover = false;
this._deactivate.call( this, event );
}
});
} );
return dropped;
},
dragStart: function( draggable, event ) {
// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
// Listen for scrolling so that if the dragging causes scrolling the position of the
// droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
});
} );
},
drag: function( draggable, event ) {
// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
// If you have a highly dynamic page, you might try this option. It renders positions
// every time you move the mouse.
if ( draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
@ -361,17 +409,20 @@ $.ui.ddmanager = {
var parentInstance, scope, parent,
intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
c = !intersects && this.isover ?
"isout" :
( intersects && !this.isover ? "isover" : null );
if ( !c ) {
return;
}
if ( this.options.greedy ) {
// find droppable parents with same scope
scope = this.options.scope;
parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
return $( this ).droppable( "instance" ).options.scope === scope;
});
} );
if ( parent.length ) {
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
@ -379,7 +430,7 @@ $.ui.ddmanager = {
}
}
// we just moved into a greedy child
// We just moved into a greedy child
if ( parentInstance && c === "isover" ) {
parentInstance.isover = false;
parentInstance.isout = true;
@ -387,27 +438,66 @@ $.ui.ddmanager = {
}
this[ c ] = true;
this[c === "isout" ? "isover" : "isout"] = false;
this[c === "isover" ? "_over" : "_out"].call( this, event );
this[ c === "isout" ? "isover" : "isout" ] = false;
this[ c === "isover" ? "_over" : "_out" ].call( this, event );
// we just moved out of a greedy child
// We just moved out of a greedy child
if ( parentInstance && c === "isout" ) {
parentInstance.isout = false;
parentInstance.isover = true;
parentInstance._over.call( parentInstance, event );
}
});
} );
},
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
// Call prepareOffsets one final time since IE does not fire return scroll events when
// overflow was caused by drag (see #5003)
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
}
};
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for activeClass and hoverClass options
$.widget( "ui.droppable", $.ui.droppable, {
options: {
hoverClass: false,
activeClass: false
},
_addActiveClass: function() {
this._super();
if ( this.options.activeClass ) {
this.element.addClass( this.options.activeClass );
}
},
_removeActiveClass: function() {
this._super();
if ( this.options.activeClass ) {
this.element.removeClass( this.options.activeClass );
}
},
_addHoverClass: function() {
this._super();
if ( this.options.hoverClass ) {
this.element.addClass( this.options.hoverClass );
}
},
_removeHoverClass: function() {
this._super();
if ( this.options.hoverClass ) {
this.element.removeClass( this.options.hoverClass );
}
}
} );
}
return $.ui.droppable;
}));
} );

View file

@ -1,90 +1,73 @@
/*!
* jQuery UI Effects Blind 1.11.4
* jQuery UI Effects Blind @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/blind-effect/
*/
(function( factory ) {
//>>label: Blind Effect
//>>group: Effects
//>>description: Blinds the element.
//>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.blind = function( o, done ) {
// Create element
var el = $( this ),
rvertical = /up|down|vertical/,
rpositivemotion = /up|left|vertical|horizontal/,
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
direction = o.direction || "up",
vertical = rvertical.test( direction ),
ref = vertical ? "height" : "width",
ref2 = vertical ? "top" : "left",
motion = rpositivemotion.test( direction ),
animation = {},
show = mode === "show",
wrapper, distance, margin;
return $.effects.define( "blind", "hide", function( options, done ) {
var map = {
up: [ "bottom", "top" ],
vertical: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
horizontal: [ "right", "left" ],
right: [ "left", "right" ]
},
element = $( this ),
direction = options.direction || "up",
start = element.cssClip(),
animate = { clip: $.extend( {}, start ) },
placeholder = $.effects.createPlaceholder( element );
// if already wrapped, the wrapper's properties are my property. #6245
if ( el.parent().is( ".ui-effects-wrapper" ) ) {
$.effects.save( el.parent(), props );
} else {
$.effects.save( el, props );
}
el.show();
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
distance = wrapper[ ref ]();
margin = parseFloat( wrapper.css( ref2 ) ) || 0;
animation[ ref ] = show ? distance : 0;
if ( !motion ) {
el
.css( vertical ? "bottom" : "right", 0 )
.css( vertical ? "top" : "left", "auto" )
.css({ position: "absolute" });
animation[ ref2 ] = show ? margin : distance + margin;
}
// start at 0 if we are showing
if ( show ) {
wrapper.css( ref, 0 );
if ( !motion ) {
wrapper.css( ref2, margin + distance );
if ( options.mode === "show" ) {
element.cssClip( animate.clip );
if ( placeholder ) {
placeholder.css( $.effects.clipToBox( animate ) );
}
animate.clip = start;
}
// Animate
wrapper.animate( animation, {
duration: o.duration,
easing: o.easing,
if ( placeholder ) {
placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
}
element.animate( animate, {
queue: false,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
}));
} );

View file

@ -1,94 +1,97 @@
/*!
* jQuery UI Effects Bounce 1.11.4
* jQuery UI Effects Bounce @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/bounce-effect/
*/
(function( factory ) {
//>>label: Bounce Effect
//>>group: Effects
//>>description: Bounces an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/bounce-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.bounce = function( o, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
return $.effects.define( "bounce", function( options, done ) {
var upAnim, downAnim, refValue,
element = $( this ),
// defaults:
mode = $.effects.setMode( el, o.mode || "effect" ),
// Defaults:
mode = options.mode,
hide = mode === "hide",
show = mode === "show",
direction = o.direction || "up",
distance = o.distance,
times = o.times || 5,
direction = options.direction || "up",
distance = options.distance,
times = options.times || 5,
// number of internal animations
// Number of internal animations
anims = times * 2 + ( show || hide ? 1 : 0 ),
speed = o.duration / anims,
easing = o.easing,
speed = options.duration / anims,
easing = options.easing,
// utility:
// Utility:
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ),
i,
upAnim,
downAnim,
i = 0,
// we will need to re-assemble the queue to stack our animations in place
queue = el.queue(),
queuelen = queue.length;
queuelen = element.queue().length;
// Avoid touching opacity to prevent clearType and PNG issues in IE
if ( show || hide ) {
props.push( "opacity" );
}
$.effects.createPlaceholder( element );
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el ); // Create Wrapper
refValue = element.css( ref );
// default distance for the BIGGEST bounce is the outer Distance / 3
// Default distance for the BIGGEST bounce is the outer Distance / 3
if ( !distance ) {
distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
}
if ( show ) {
downAnim = { opacity: 1 };
downAnim[ ref ] = 0;
downAnim[ ref ] = refValue;
// if we are showing, force opacity 0 and set the initial position
// If we are showing, force opacity 0 and set the initial position
// then do the "first" animation
el.css( "opacity", 0 )
element
.css( "opacity", 0 )
.css( ref, motion ? -distance * 2 : distance * 2 )
.animate( downAnim, speed, easing );
}
// start at the smallest distance if we are hiding
// Start at the smallest distance if we are hiding
if ( hide ) {
distance = distance / Math.pow( 2, times - 1 );
}
downAnim = {};
downAnim[ ref ] = 0;
downAnim[ ref ] = refValue;
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
for ( i = 0; i < times; i++ ) {
for ( ; i < times; i++ ) {
upAnim = {};
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
el.animate( upAnim, speed, easing )
element
.animate( upAnim, speed, easing )
.animate( downAnim, speed, easing );
distance = hide ? distance * 2 : distance / 2;
@ -99,25 +102,12 @@ return $.effects.effect.bounce = function( o, done ) {
upAnim = { opacity: 0 };
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
el.animate( upAnim, speed, easing );
element.animate( upAnim, speed, easing );
}
el.queue(function() {
if ( hide ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
element.queue( done );
// inject all the animations we just queued to be first in line (after "inprogress")
if ( queuelen > 1) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
el.dequeue();
$.effects.unshift( element, queuelen, anims + 1 );
} );
};
}));
} );

View file

@ -1,77 +1,68 @@
/*!
* jQuery UI Effects Clip 1.11.4
* jQuery UI Effects Clip @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/clip-effect/
*/
(function( factory ) {
//>>label: Clip Effect
//>>group: Effects
//>>description: Clips the element on and off like an old TV.
//>>docs: http://api.jqueryui.com/clip-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.clip = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
show = mode === "show",
direction = o.direction || "vertical",
vert = direction === "vertical",
size = vert ? "height" : "width",
position = vert ? "top" : "left",
animation = {},
wrapper, animate, distance;
return $.effects.define( "clip", "hide", function( options, done ) {
var start,
animate = {},
element = $( this ),
direction = options.direction || "vertical",
both = direction === "both",
horizontal = both || direction === "horizontal",
vertical = both || direction === "vertical";
// Save & Show
$.effects.save( el, props );
el.show();
start = element.cssClip();
animate.clip = {
top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
right: horizontal ? ( start.right - start.left ) / 2 : start.right,
bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
left: horizontal ? ( start.right - start.left ) / 2 : start.left
};
// Create Wrapper
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
distance = animate[ size ]();
$.effects.createPlaceholder( element );
// Shift
if ( show ) {
animate.css( size, 0 );
animate.css( position, distance / 2 );
if ( options.mode === "show" ) {
element.cssClip( animate.clip );
animate.clip = start;
}
// Create Animation Object:
animation[ size ] = show ? distance : 0;
animation[ position ] = show ? 0 : distance / 2;
// Animate
animate.animate( animation, {
element.animate( animate, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( !show ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
duration: options.duration,
easing: options.easing,
complete: done
} );
};
} );
}));
} );

View file

@ -1,75 +1,72 @@
/*!
* jQuery UI Effects Drop 1.11.4
* jQuery UI Effects Drop @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/drop-effect/
*/
(function( factory ) {
//>>label: Drop Effect
//>>group: Effects
//>>description: Moves an element in one direction and hides it at the same time.
//>>docs: http://api.jqueryui.com/drop-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.drop = function( o, done ) {
return $.effects.define( "drop", "hide", function( options, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
var distance,
element = $( this ),
mode = options.mode,
show = mode === "show",
direction = o.direction || "left",
direction = options.direction || "left",
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
animation = {
opacity: show ? 1 : 0
},
distance;
opacity: 0
};
// Adjust
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
$.effects.createPlaceholder( element );
distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
distance = options.distance ||
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
animation[ ref ] = motion + distance;
if ( show ) {
el
.css( "opacity", 0 )
.css( ref, motion === "pos" ? -distance : distance );
element.css( animation );
animation[ ref ] = oppositeMotion + distance;
animation.opacity = 1;
}
// Animation
animation[ ref ] = ( show ?
( motion === "pos" ? "+=" : "-=" ) :
( motion === "pos" ? "-=" : "+=" ) ) +
distance;
// Animate
el.animate( animation, {
element.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
}));
} );

View file

@ -1,48 +1,57 @@
/*!
* jQuery UI Effects Explode 1.11.4
* jQuery UI Effects Explode @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/explode-effect/
*/
(function( factory ) {
//>>label: Explode Effect
//>>group: Effects
/* eslint-disable max-len */
//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/explode-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.explode = function( o, done ) {
return $.effects.define( "explode", "hide", function( options, done ) {
var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
var i, j, left, top, mx, my,
rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
cells = rows,
el = $( this ),
mode = $.effects.setMode( el, o.mode || "hide" ),
element = $( this ),
mode = options.mode,
show = mode === "show",
// show and then visibility:hidden the element before calculating offset
offset = el.show().css( "visibility", "hidden" ).offset(),
// Show and then visibility:hidden the element before calculating offset
offset = element.show().css( "visibility", "hidden" ).offset(),
// width and height of a piece
width = Math.ceil( el.outerWidth() / cells ),
height = Math.ceil( el.outerHeight() / rows ),
pieces = [],
// Width and height of a piece
width = Math.ceil( element.outerWidth() / cells ),
height = Math.ceil( element.outerHeight() / rows ),
pieces = [];
// loop
i, j, left, top, mx, my;
// children animate complete:
// Children animate complete:
function childComplete() {
pieces.push( this );
if ( pieces.length === rows * cells ) {
@ -50,58 +59,56 @@ return $.effects.effect.explode = function( o, done ) {
}
}
// clone the element for each row and cell.
for ( i = 0; i < rows ; i++ ) { // ===>
// Clone the element for each row and cell.
for ( i = 0; i < rows; i++ ) { // ===>
top = offset.top + i * height;
my = i - ( rows - 1 ) / 2 ;
my = i - ( rows - 1 ) / 2;
for ( j = 0; j < cells ; j++ ) { // |||
for ( j = 0; j < cells; j++ ) { // |||
left = offset.left + j * width;
mx = j - ( cells - 1 ) / 2 ;
mx = j - ( cells - 1 ) / 2;
// Create a clone of the now hidden main element that will be absolute positioned
// within a wrapper div off the -left and -top equal to size of our pieces
el
element
.clone()
.appendTo( "body" )
.wrap( "<div></div>" )
.css({
.css( {
position: "absolute",
visibility: "visible",
left: -j * width,
top: -i * height
})
} )
// select the wrapper - make it overflow: hidden and absolute positioned based on
// where the original was located +left and +top equal to the size of pieces
// Select the wrapper - make it overflow: hidden and absolute positioned based on
// where the original was located +left and +top equal to the size of pieces
.parent()
.addClass( "ui-effects-explode" )
.css({
position: "absolute",
overflow: "hidden",
width: width,
height: height,
left: left + ( show ? mx * width : 0 ),
top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1
}).animate({
left: left + ( show ? 0 : mx * width ),
top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0
}, o.duration || 500, o.easing, childComplete );
.addClass( "ui-effects-explode" )
.css( {
position: "absolute",
overflow: "hidden",
width: width,
height: height,
left: left + ( show ? mx * width : 0 ),
top: top + ( show ? my * height : 0 ),
opacity: show ? 0 : 1
} )
.animate( {
left: left + ( show ? 0 : mx * width ),
top: top + ( show ? 0 : my * height ),
opacity: show ? 1 : 0
}, options.duration || 500, options.easing, childComplete );
}
}
function animComplete() {
el.css({
element.css( {
visibility: "visible"
});
} );
$( pieces ).remove();
if ( !show ) {
el.hide();
}
done();
}
};
} );
}));
} );

View file

@ -1,40 +1,50 @@
/*!
* jQuery UI Effects Fade 1.11.4
* jQuery UI Effects Fade @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/fade-effect/
*/
(function( factory ) {
//>>label: Fade Effect
//>>group: Effects
//>>description: Fades the element.
//>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.fade = function( o, done ) {
var el = $( this ),
mode = $.effects.setMode( el, o.mode || "toggle" );
return $.effects.define( "fade", "toggle", function( options, done ) {
var show = options.mode === "show";
el.animate({
opacity: mode
}, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: done
});
};
$( this )
.css( "opacity", show ? 0 : 1 )
.animate( {
opacity: show ? 1 : 0
}, {
queue: false,
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
}));
} );

View file

@ -1,86 +1,92 @@
/*!
* jQuery UI Effects Fold 1.11.4
* jQuery UI Effects Fold @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/fold-effect/
*/
(function( factory ) {
//>>label: Fold Effect
//>>group: Effects
//>>description: Folds an element first horizontally and then vertically.
//>>docs: http://api.jqueryui.com/fold-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.fold = function( o, done ) {
return $.effects.define( "fold", "hide", function( options, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
var element = $( this ),
mode = options.mode,
show = mode === "show",
hide = mode === "hide",
size = o.size || 15,
size = options.size || 15,
percent = /([0-9]+)%/.exec( size ),
horizFirst = !!o.horizFirst,
widthFirst = show !== horizFirst,
ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
duration = o.duration / 2,
wrapper, distance,
animation1 = {},
animation2 = {};
horizFirst = !!options.horizFirst,
ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
duration = options.duration / 2,
$.effects.save( el, props );
el.show();
placeholder = $.effects.createPlaceholder( element ),
// Create Wrapper
wrapper = $.effects.createWrapper( el ).css({
overflow: "hidden"
});
distance = widthFirst ?
[ wrapper.width(), wrapper.height() ] :
[ wrapper.height(), wrapper.width() ];
start = element.cssClip(),
animation1 = { clip: $.extend( {}, start ) },
animation2 = { clip: $.extend( {}, start ) },
distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
queuelen = element.queue().length;
if ( percent ) {
size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
}
animation1.clip[ ref[ 0 ] ] = size;
animation2.clip[ ref[ 0 ] ] = size;
animation2.clip[ ref[ 1 ] ] = 0;
if ( show ) {
wrapper.css( horizFirst ? {
height: 0,
width: size
} : {
height: size,
width: 0
});
element.cssClip( animation2.clip );
if ( placeholder ) {
placeholder.css( $.effects.clipToBox( animation2 ) );
}
animation2.clip = start;
}
// Animation
animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
// Animate
wrapper
.animate( animation1, duration, o.easing )
.animate( animation2, duration, o.easing, function() {
if ( hide ) {
el.hide();
element
.queue( function( next ) {
if ( placeholder ) {
placeholder
.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
};
next();
} )
.animate( animation1, duration, options.easing )
.animate( animation2, duration, options.easing )
.queue( done );
}));
$.effects.unshift( element, queuelen, 4 );
} );
} );

View file

@ -1,60 +1,60 @@
/*!
* jQuery UI Effects Highlight 1.11.4
* jQuery UI Effects Highlight @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/highlight-effect/
*/
(function( factory ) {
//>>label: Highlight Effect
//>>group: Effects
//>>description: Highlights the background of an element in a defined color for a custom duration.
//>>docs: http://api.jqueryui.com/highlight-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.highlight = function( o, done ) {
var elem = $( this ),
props = [ "backgroundImage", "backgroundColor", "opacity" ],
mode = $.effects.setMode( elem, o.mode || "show" ),
return $.effects.define( "highlight", "show", function( options, done ) {
var element = $( this ),
animation = {
backgroundColor: elem.css( "backgroundColor" )
backgroundColor: element.css( "backgroundColor" )
};
if (mode === "hide") {
if ( options.mode === "hide" ) {
animation.opacity = 0;
}
$.effects.save( elem, props );
$.effects.saveStyle( element );
elem
.show()
.css({
element
.css( {
backgroundImage: "none",
backgroundColor: o.color || "#ffff99"
})
backgroundColor: options.color || "#ffff99"
} )
.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
elem.hide();
}
$.effects.restore( elem, props );
done();
}
});
};
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
}));
} );

View file

@ -1,20 +1,28 @@
/*!
* jQuery UI Effects Puff 1.11.4
* jQuery UI Effects Puff @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/puff-effect/
*/
(function( factory ) {
//>>label: Puff Effect
//>>group: Effects
//>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
//>>docs: http://api.jqueryui.com/puff-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect",
"../version",
"../effect",
"./effect-scale"
], factory );
} else {
@ -22,39 +30,16 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.puff = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "hide" ),
hide = mode === "hide",
percent = parseInt( o.percent, 10 ) || 150,
factor = percent / 100,
original = {
height: elem.height(),
width: elem.width(),
outerHeight: elem.outerHeight(),
outerWidth: elem.outerWidth()
};
$.extend( o, {
effect: "scale",
queue: false,
return $.effects.define( "puff", "hide", function( options, done ) {
var newOptions = $.extend( true, {}, options, {
fade: true,
mode: mode,
complete: done,
percent: hide ? percent : 100,
from: hide ?
original :
{
height: original.height * factor,
width: original.width * factor,
outerHeight: original.outerHeight * factor,
outerWidth: original.outerWidth * factor
}
});
percent: parseInt( options.percent, 10 ) || 150
} );
elem.effect( o );
};
$.effects.effect.scale.call( this, newOptions, done );
} );
}));
} );

View file

@ -1,73 +1,67 @@
/*!
* jQuery UI Effects Pulsate 1.11.4
* jQuery UI Effects Pulsate @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/pulsate-effect/
*/
(function( factory ) {
//>>label: Pulsate Effect
//>>group: Effects
//>>description: Pulsates an element n times by changing the opacity to zero and back.
//>>docs: http://api.jqueryui.com/pulsate-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.pulsate = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "show" ),
return $.effects.define( "pulsate", "show", function( options, done ) {
var element = $( this ),
mode = options.mode,
show = mode === "show",
hide = mode === "hide",
showhide = ( show || mode === "hide" ),
showhide = show || hide,
// showing or hiding leaves of the "last" animation
anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = o.duration / anims,
// Showing or hiding leaves off the "last" animation
anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = options.duration / anims,
animateTo = 0,
queue = elem.queue(),
queuelen = queue.length,
i;
i = 1,
queuelen = element.queue().length;
if ( show || !elem.is(":visible")) {
elem.css( "opacity", 0 ).show();
if ( show || !element.is( ":visible" ) ) {
element.css( "opacity", 0 ).show();
animateTo = 1;
}
// anims - 1 opacity "toggles"
for ( i = 1; i < anims; i++ ) {
elem.animate({
opacity: animateTo
}, duration, o.easing );
// Anims - 1 opacity "toggles"
for ( ; i < anims; i++ ) {
element.animate( { opacity: animateTo }, duration, options.easing );
animateTo = 1 - animateTo;
}
elem.animate({
opacity: animateTo
}, duration, o.easing);
element.animate( { opacity: animateTo }, duration, options.easing );
elem.queue(function() {
if ( hide ) {
elem.hide();
}
done();
});
element.queue( done );
// We just queued up "anims" animations, we need to put them next in the queue
if ( queuelen > 1 ) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
elem.dequeue();
};
$.effects.unshift( element, queuelen, anims + 1 );
} );
}));
} );

View file

@ -1,20 +1,28 @@
/*!
* jQuery UI Effects Scale 1.11.4
* jQuery UI Effects Scale @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/scale-effect/
*/
(function( factory ) {
//>>label: Scale Effect
//>>group: Effects
//>>description: Grows or shrinks an element and its content.
//>>docs: http://api.jqueryui.com/scale-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect",
"../version",
"../effect",
"./effect-size"
], factory );
} else {
@ -22,68 +30,30 @@
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.scale = function( o, done ) {
return $.effects.define( "scale", function( options, done ) {
// Create element
var el = $( this ),
options = $.extend( true, {}, o ),
mode = $.effects.setMode( el, o.mode || "effect" ),
percent = parseInt( o.percent, 10 ) ||
( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
direction = o.direction || "both",
origin = o.origin,
original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
},
factor = {
y: direction !== "horizontal" ? (percent / 100) : 1,
x: direction !== "vertical" ? (percent / 100) : 1
};
mode = options.mode,
percent = parseInt( options.percent, 10 ) ||
( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
// We are going to pass this effect to the size effect:
options.effect = "size";
options.queue = false;
options.complete = done;
// Set default origin and restore for show/hide
if ( mode !== "effect" ) {
options.origin = origin || [ "middle", "center" ];
options.restore = true;
}
options.from = o.from || ( mode === "show" ? {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
} : original );
options.to = {
height: original.height * factor.y,
width: original.width * factor.x,
outerHeight: original.outerHeight * factor.y,
outerWidth: original.outerWidth * factor.x
};
newOptions = $.extend( true, {
from: $.effects.scaledDimensions( el ),
to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
origin: options.origin || [ "middle", "center" ]
}, options );
// Fade option to support puff
if ( options.fade ) {
if ( mode === "show" ) {
options.from.opacity = 0;
options.to.opacity = 1;
}
if ( mode === "hide" ) {
options.from.opacity = 1;
options.to.opacity = 0;
}
newOptions.from.opacity = 1;
newOptions.to.opacity = 0;
}
// Animate
el.effect( options );
$.effects.effect.size.call( this, newOptions, done );
} );
};
}));
} );

View file

@ -1,52 +1,55 @@
/*!
* jQuery UI Effects Shake 1.11.4
* jQuery UI Effects Shake @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/shake-effect/
*/
(function( factory ) {
//>>label: Shake Effect
//>>group: Effects
//>>description: Shakes an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/shake-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.shake = function( o, done ) {
return $.effects.define( "shake", function( options, done ) {
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "effect" ),
direction = o.direction || "left",
distance = o.distance || 20,
times = o.times || 3,
var i = 1,
element = $( this ),
direction = options.direction || "left",
distance = options.distance || 20,
times = options.times || 3,
anims = times * 2 + 1,
speed = Math.round( o.duration / anims ),
ref = (direction === "up" || direction === "down") ? "top" : "left",
positiveMotion = (direction === "up" || direction === "left"),
speed = Math.round( options.duration / anims ),
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
positiveMotion = ( direction === "up" || direction === "left" ),
animation = {},
animation1 = {},
animation2 = {},
i,
// we will need to re-assemble the queue to stack our animations in place
queue = el.queue(),
queuelen = queue.length;
queuelen = element.queue().length;
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
$.effects.createPlaceholder( element );
// Animation
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
@ -54,31 +57,21 @@ return $.effects.effect.shake = function( o, done ) {
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
// Animate
el.animate( animation, speed, o.easing );
element.animate( animation, speed, options.easing );
// Shakes
for ( i = 1; i < times; i++ ) {
el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
for ( ; i < times; i++ ) {
element
.animate( animation1, speed, options.easing )
.animate( animation2, speed, options.easing );
}
el
.animate( animation1, speed, o.easing )
.animate( animation, speed / 2, o.easing )
.queue(function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
});
// inject all the animations we just queued to be first in line (after "inprogress")
if ( queuelen > 1) {
queue.splice.apply( queue,
[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
el.dequeue();
element
.animate( animation1, speed, options.easing )
.animate( animation, speed / 2, options.easing )
.queue( done );
};
$.effects.unshift( element, queuelen, anims + 1 );
} );
}));
} );

View file

@ -1,85 +1,76 @@
/*!
* jQuery UI Effects Size 1.11.4
* jQuery UI Effects Size @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/size-effect/
*/
(function( factory ) {
//>>label: Size Effect
//>>group: Effects
//>>description: Resize an element to a specified width and height.
//>>docs: http://api.jqueryui.com/size-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.size = function( o, done ) {
return $.effects.define( "size", function( options, done ) {
// Create element
var original, baseline, factor,
el = $( this ),
props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
// Always restore
props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
var baseline, factor, temp,
element = $( this ),
// Copy for children
props2 = [ "width", "height", "overflow" ],
cProps = [ "fontSize" ],
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
// Set options
mode = $.effects.setMode( el, o.mode || "effect" ),
restore = o.restore || mode !== "effect",
scale = o.scale || "both",
origin = o.origin || [ "middle", "center" ],
position = el.css( "position" ),
props = restore ? props0 : props1,
zero = {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
};
mode = options.mode,
restore = mode !== "effect",
scale = options.scale || "both",
origin = options.origin || [ "middle", "center" ],
position = element.css( "position" ),
pos = element.position(),
original = $.effects.scaledDimensions( element ),
from = options.from || original,
to = options.to || $.effects.scaledDimensions( element, 0 );
$.effects.createPlaceholder( element );
if ( mode === "show" ) {
el.show();
}
original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
};
if ( o.mode === "toggle" && mode === "show" ) {
el.from = o.to || zero;
el.to = o.from || original;
} else {
el.from = o.from || ( mode === "show" ? zero : original );
el.to = o.to || ( mode === "hide" ? zero : original );
temp = from;
from = to;
to = temp;
}
// Set scaling factor
factor = {
from: {
y: el.from.height / original.height,
x: el.from.width / original.width
y: from.height / original.height,
x: from.width / original.width
},
to: {
y: el.to.height / original.height,
x: el.to.width / original.width
y: to.height / original.height,
x: to.width / original.width
}
};
@ -88,16 +79,14 @@ return $.effects.effect.size = function( o, done ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( vProps );
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
from = $.effects.setTransition( element, vProps, factor.from.y, from );
to = $.effects.setTransition( element, vProps, factor.to.y, to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
props = props.concat( hProps );
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
from = $.effects.setTransition( element, hProps, factor.from.x, from );
to = $.effects.setTransition( element, hProps, factor.to.x, to );
}
}
@ -106,128 +95,102 @@ return $.effects.effect.size = function( o, done ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( cProps ).concat( props2 );
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
from = $.effects.setTransition( element, cProps, factor.from.y, from );
to = $.effects.setTransition( element, cProps, factor.to.y, to );
}
}
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
el.css( "overflow", "hidden" ).css( el.from );
// Adjust
if (origin) { // Calculate baseline shifts
// Adjust the position properties based on the provided origin points
if ( origin ) {
baseline = $.effects.getBaseline( origin, original );
el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
}
el.css( el.from ); // set top & left
delete from.outerHeight;
delete from.outerWidth;
element.css( from );
// Animate
if ( scale === "content" || scale === "both" ) { // Scale the children
// Animate the children if desired
if ( scale === "content" || scale === "both" ) {
// Add margins/font-size
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
hProps = hProps.concat([ "marginLeft", "marginRight" ]);
props2 = props0.concat(vProps).concat(hProps);
vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
el.find( "*[width]" ).each( function() {
// Only animate children with width attributes specified
// TODO: is this right? should we include anything with css width specified as well
element.find( "*[width]" ).each( function() {
var child = $( this ),
c_original = {
height: child.height(),
width: child.width(),
outerHeight: child.outerHeight(),
outerWidth: child.outerWidth()
childOriginal = $.effects.scaledDimensions( child ),
childFrom = {
height: childOriginal.height * factor.from.y,
width: childOriginal.width * factor.from.x,
outerHeight: childOriginal.outerHeight * factor.from.y,
outerWidth: childOriginal.outerWidth * factor.from.x
},
childTo = {
height: childOriginal.height * factor.to.y,
width: childOriginal.width * factor.to.x,
outerHeight: childOriginal.height * factor.to.y,
outerWidth: childOriginal.width * factor.to.x
};
if (restore) {
$.effects.save(child, props2);
}
child.from = {
height: c_original.height * factor.from.y,
width: c_original.width * factor.from.x,
outerHeight: c_original.outerHeight * factor.from.y,
outerWidth: c_original.outerWidth * factor.from.x
};
child.to = {
height: c_original.height * factor.to.y,
width: c_original.width * factor.to.x,
outerHeight: c_original.height * factor.to.y,
outerWidth: c_original.width * factor.to.x
};
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
}
if ( restore ) {
$.effects.saveStyle( child );
}
// Animate children
child.css( child.from );
child.animate( child.to, o.duration, o.easing, function() {
child.css( childFrom );
child.animate( childTo, options.duration, options.easing, function() {
// Restore children
if ( restore ) {
$.effects.restore( child, props2 );
$.effects.restoreStyle( child );
}
});
});
} );
} );
}
// Animate
el.animate( el.to, {
element.animate( to, {
queue: false,
duration: o.duration,
easing: o.easing,
duration: options.duration,
easing: options.easing,
complete: function() {
if ( el.to.opacity === 0 ) {
el.css( "opacity", el.from.opacity );
var offset = element.offset();
if ( to.opacity === 0 ) {
element.css( "opacity", from.opacity );
}
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
if ( !restore ) {
element
.css( "position", position === "static" ? "relative" : position )
.offset( offset );
// we need to calculate our new positioning based on the scaling
if ( position === "static" ) {
el.css({
position: "relative",
top: el.to.top,
left: el.to.left
});
} else {
$.each([ "top", "left" ], function( idx, pos ) {
el.css( pos, function( _, str ) {
var val = parseInt( str, 10 ),
toRef = idx ? el.to.left : el.to.top;
// if original was "auto", recalculate the new value from wrapper
if ( str === "auto" ) {
return toRef + "px";
}
return val + toRef + "px";
});
});
}
// Need to save style here so that automatic style restoration
// doesn't restore to the original styles from before the animation.
$.effects.saveStyle( element );
}
$.effects.removeWrapper( el );
done();
}
});
} );
};
} );
}));
} );

View file

@ -1,74 +1,79 @@
/*!
* jQuery UI Effects Slide 1.11.4
* jQuery UI Effects Slide @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/slide-effect/
*/
(function( factory ) {
//>>label: Slide Effect
//>>group: Effects
//>>description: Slides an element in and out of the viewport.
//>>docs: http://api.jqueryui.com/slide-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.slide = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
mode = $.effects.setMode( el, o.mode || "show" ),
show = mode === "show",
direction = o.direction || "left",
ref = (direction === "up" || direction === "down") ? "top" : "left",
positiveMotion = (direction === "up" || direction === "left"),
distance,
return $.effects.define( "slide", "show", function( options, done ) {
var startClip, startRef,
element = $( this ),
map = {
up: [ "bottom", "top" ],
down: [ "top", "bottom" ],
left: [ "right", "left" ],
right: [ "left", "right" ]
},
mode = options.mode,
direction = options.direction || "left",
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
positiveMotion = ( direction === "up" || direction === "left" ),
distance = options.distance ||
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
animation = {};
// Adjust
$.effects.save( el, props );
el.show();
distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
$.effects.createPlaceholder( element );
$.effects.createWrapper( el ).css({
overflow: "hidden"
});
startClip = element.cssClip();
startRef = element.position()[ ref ];
if ( show ) {
el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
// Define hide animation
animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
animation.clip = element.cssClip();
animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
// Reverse the animation if we're showing
if ( mode === "show" ) {
element.cssClip( animation.clip );
element.css( ref, animation[ ref ] );
animation.clip = startClip;
animation[ ref ] = startRef;
}
// Animation
animation[ ref ] = ( show ?
( positiveMotion ? "+=" : "-=") :
( positiveMotion ? "-=" : "+=")) +
distance;
// Animate
el.animate( animation, {
// Actually animate
element.animate( animation, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
$.effects.removeWrapper( el );
done();
}
});
};
duration: options.duration,
easing: options.easing,
complete: done
} );
} );
}));
} );

View file

@ -1,57 +1,43 @@
/*!
* jQuery UI Effects Transfer 1.11.4
* jQuery UI Effects Transfer @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/transfer-effect/
*/
(function( factory ) {
//>>label: Transfer Effect
//>>group: Effects
//>>description: Displays a transfer effect from one element to another.
//>>docs: http://api.jqueryui.com/transfer-effect/
//>>demos: http://jqueryui.com/effect/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./effect"
"../version",
"../effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.effects.effect.transfer = function( o, done ) {
var elem = $( this ),
target = $( o.to ),
targetFixed = target.css( "position" ) === "fixed",
body = $("body"),
fixTop = targetFixed ? body.scrollTop() : 0,
fixLeft = targetFixed ? body.scrollLeft() : 0,
endPosition = target.offset(),
animation = {
top: endPosition.top - fixTop,
left: endPosition.left - fixLeft,
height: target.innerHeight(),
width: target.innerWidth()
},
startPosition = elem.offset(),
transfer = $( "<div class='ui-effects-transfer'></div>" )
.appendTo( document.body )
.addClass( o.className )
.css({
top: startPosition.top - fixTop,
left: startPosition.left - fixLeft,
height: elem.innerHeight(),
width: elem.innerWidth(),
position: targetFixed ? "fixed" : "absolute"
})
.animate( animation, o.duration, o.easing, function() {
transfer.remove();
done();
});
};
var effect;
if ( $.uiBackCompat !== false ) {
effect = $.effects.define( "transfer", function( options, done ) {
$( this ).transfer( options, done );
} );
}
return effect;
}));
} );

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
/*!
* jQuery UI Focusable @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :focusable Selector
//>>group: Core
//>>description: Selects elements which can be focused.
//>>docs: http://api.jqueryui.com/focusable-selector/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// Selectors
$.ui.focusable = function( element, hasTabindex ) {
var map, mapName, img, focusableIfVisible, fieldset,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap='#" + mapName + "']" );
return img.length > 0 && img.is( ":visible" );
}
if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
focusableIfVisible = !element.disabled;
if ( focusableIfVisible ) {
// Form controls within a disabled fieldset are disabled.
// However, controls within the fieldset's legend do not get disabled.
// Since controls generally aren't placed inside legends, we skip
// this portion of the check.
fieldset = $( element ).closest( "fieldset" )[ 0 ];
if ( fieldset ) {
focusableIfVisible = !fieldset.disabled;
}
}
} else if ( "a" === nodeName ) {
focusableIfVisible = element.href || hasTabindex;
} else {
focusableIfVisible = hasTabindex;
}
return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
};
// Support: IE 8 only
// IE 8 doesn't resolve inherit to visible/hidden for computed values
function visible( element ) {
var visibility = element.css( "visibility" );
while ( visibility === "inherit" ) {
element = element.parent();
visibility = element.css( "visibility" );
}
return visibility === "visible";
}
$.extend( $.expr.pseudos, {
focusable: function( element ) {
return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
}
} );
return $.ui.focusable;
} );

View file

@ -0,0 +1,80 @@
/*!
* jQuery UI Form Reset Mixin @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Form Reset Mixin
//>>group: Core
//>>description: Refresh input widgets when their form is reset
//>>docs: http://api.jqueryui.com/form-reset-mixin/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [
"jquery",
"./form",
"./version"
], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.ui.formResetMixin = {
_formResetHandler: function() {
var form = $( this );
// Wait for the form reset to actually happen before refreshing
setTimeout( function() {
var instances = form.data( "ui-form-reset-instances" );
$.each( instances, function() {
this.refresh();
} );
} );
},
_bindFormResetHandler: function() {
this.form = this.element._form();
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" ) || [];
if ( !instances.length ) {
// We don't use _on() here because we use a single event handler per form
this.form.on( "reset.ui-form-reset", this._formResetHandler );
}
instances.push( this );
this.form.data( "ui-form-reset-instances", instances );
},
_unbindFormResetHandler: function() {
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" );
instances.splice( $.inArray( this, instances ), 1 );
if ( instances.length ) {
this.form.data( "ui-form-reset-instances", instances );
} else {
this.form
.removeData( "ui-form-reset-instances" )
.off( "reset.ui-form-reset" );
}
}
};
} );

23
include/thirdparty/jquery_ui/form.js vendored Normal file
View file

@ -0,0 +1,23 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// Support: IE8 Only
// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
// with a string, so we need to find the proper form.
return $.fn._form = function() {
return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
};
} );

18
include/thirdparty/jquery_ui/ie.js vendored Normal file
View file

@ -0,0 +1,18 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// This file is deprecated
return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
} );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,89 @@
/*!
* jQuery UI Support for jQuery core 1.8.x and newer @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
*/
//>>label: jQuery 1.8+ Support
//>>group: Core
//>>description: Support version 1.8.x and newer of jQuery core
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// Support: jQuery 1.9.x or older
// $.expr[ ":" ] is deprecated.
if ( !$.expr.pseudos ) {
$.expr.pseudos = $.expr[ ":" ];
}
// Support: jQuery 1.11.x or older
// $.unique has been renamed to $.uniqueSort
if ( !$.uniqueSort ) {
$.uniqueSort = $.unique;
}
// Support: jQuery 2.2.x or older.
// This method has been defined in jQuery 3.0.0.
// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
if ( !$.escapeSelector ) {
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
var fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
};
$.escapeSelector = function( sel ) {
return ( sel + "" ).replace( rcssescape, fcssescape );
};
}
// Support: jQuery 3.4.x or older
// These methods have been defined in jQuery 3.5.0.
if ( !$.fn.even || !$.fn.odd ) {
$.fn.extend( {
even: function() {
return this.filter( function( i ) {
return i % 2 === 0;
} );
},
odd: function() {
return this.filter( function( i ) {
return i % 2 === 1;
} );
}
} );
}
} );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,22 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// Create a local jQuery because jQuery Color relies on it and the
// global may not exist with AMD and a custom build (#10199).
// This module is a noop if used as a regular AMD module.
// eslint-disable-next-line no-unused-vars
var jQuery = $;
} );

49
include/thirdparty/jquery_ui/keycode.js vendored Normal file
View file

@ -0,0 +1,49 @@
/*!
* jQuery UI Keycode @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Keycode
//>>group: Core
//>>description: Provide keycodes as keynames
//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.ui.keyCode = {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
};
} );

69
include/thirdparty/jquery_ui/labels.js vendored Normal file
View file

@ -0,0 +1,69 @@
/*!
* jQuery UI Labels @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: labels
//>>group: Core
//>>description: Find all the labels associated with a given input
//>>docs: http://api.jqueryui.com/labels/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.fn.labels = function() {
var ancestor, selector, id, labels, ancestors;
if ( !this.length ) {
return this.pushStack( [] );
}
// Check control.labels first
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
return this.pushStack( this[ 0 ].labels );
}
// Support: IE <= 11, FF <= 37, Android <= 2.3 only
// Above browsers do not support control.labels. Everything below is to support them
// as well as document fragments. control.labels does not work on document fragments
labels = this.eq( 0 ).parents( "label" );
// Look for the label based on the id
id = this.attr( "id" );
if ( id ) {
// We don't search against the document in case the element
// is disconnected from the DOM
ancestor = this.eq( 0 ).parents().last();
// Get a full set of top level ancestors
ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
// Create a selector for the label based on the id
selector = "label[for='" + $.escapeSelector( id ) + "']";
labels = labels.add( ancestors.find( selector ).addBack( selector ) );
}
// Return whatever we have found for labels
return this.pushStack( labels );
};
} );

View file

@ -1,47 +1,61 @@
/*!
* jQuery UI Menu 1.11.4
* jQuery UI Menu @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/menu/
*/
(function( factory ) {
//>>label: Menu
//>>group: Widgets
//>>description: Creates nestable menus.
//>>docs: http://api.jqueryui.com/menu/
//>>demos: http://jqueryui.com/menu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/menu.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./position"
"../keycode",
"../position",
"../safe-active-element",
"../unique-id",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.menu", {
version: "1.11.4",
version: "@VERSION",
defaultElement: "<ul>",
delay: 300,
options: {
icons: {
submenu: "ui-icon-carat-1-e"
submenu: "ui-icon-caret-1-e"
},
items: "> *",
menus: "ul",
position: {
my: "left-1 top",
my: "left top",
at: "right top"
},
role: "menu",
// callbacks
// Callbacks
blur: null,
focus: null,
select: null
@ -53,29 +67,27 @@ return $.widget( "ui.menu", {
// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
this.lastMousePosition = { x: null, y: null };
this.element
.uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content" )
.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
.attr({
.attr( {
role: this.options.role,
tabIndex: 0
});
} );
if ( this.options.disabled ) {
this.element
.addClass( "ui-state-disabled" )
.attr( "aria-disabled", "true" );
}
this._addClass( "ui-menu", "ui-widget ui-widget-content" );
this._on( {
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": function( event ) {
event.preventDefault();
this._activateItem( event );
},
"click .ui-menu-item": function( event ) {
var target = $( event.target );
var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
this.select( event );
@ -87,7 +99,8 @@ return $.widget( "ui.menu", {
// 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 ) {
} else if ( !this.element.is( ":focus" ) &&
active.closest( ".ui-menu" ).length ) {
// Redirect focus to the menu
this.element.trigger( "focus", [ true ] );
@ -100,39 +113,33 @@ return $.widget( "ui.menu", {
}
}
},
"mouseenter .ui-menu-item": function( event ) {
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if ( this.previousFilter ) {
return;
}
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( ".ui-state-active" ).removeClass( "ui-state-active" );
this.focus( event, target );
},
"mouseenter .ui-menu-item": "_activateItem",
"mousemove .ui-menu-item": "_activateItem",
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.find( this.options.items ).eq( 0 );
var item = this.active || this._menuItems().first();
if ( !keepActiveItem ) {
this.focus( event, item );
}
},
blur: function( event ) {
this._delay(function() {
if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
this._delay( function() {
var notContained = !$.contains(
this.element[ 0 ],
$.ui.safeActiveElement( this.document[ 0 ] )
);
if ( notContained ) {
this.collapseAll( event );
}
});
} );
},
keydown: "_keydown"
});
} );
this.refresh();
@ -140,49 +147,77 @@ return $.widget( "ui.menu", {
this._on( this.document, {
click: function( event ) {
if ( this._closeOnDocumentClick( event ) ) {
this.collapseAll( event );
this.collapseAll( event, true );
}
// Reset the mouseHandled flag
this.mouseHandled = false;
}
});
} );
},
_activateItem: function( event ) {
// Ignore mouse events while typeahead is active, see #10458.
// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
// is over an item in the menu
if ( this.previousFilter ) {
return;
}
// If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
if ( event.clientX === this.lastMousePosition.x &&
event.clientY === this.lastMousePosition.y ) {
return;
}
this.lastMousePosition = {
x: event.clientX,
y: event.clientY
};
var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
target = $( event.currentTarget );
// Ignore bubbled events on parent items, see #11641
if ( actualTarget[ 0 ] !== target[ 0 ] ) {
return;
}
// If the item is already active, there's nothing to do
if ( target.is( ".ui-state-active" ) ) {
return;
}
// 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
this._removeClass( target.siblings().children( ".ui-state-active" ),
null, "ui-state-active" );
this.focus( event, target );
},
_destroy: function() {
var items = this.element.find( ".ui-menu-item" )
.removeAttr( "role aria-disabled" ),
submenus = items.children( ".ui-menu-item-wrapper" )
.removeUniqueId()
.removeAttr( "tabIndex role aria-haspopup" );
// Destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
.find( ".ui-menu" ).addBack()
.removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-disabled" )
.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
"tabIndex" )
.removeUniqueId()
.show();
// Destroy menu items
this.element.find( ".ui-menu-item" )
.removeClass( "ui-menu-item" )
.removeAttr( "role" )
.removeAttr( "aria-disabled" )
.removeUniqueId()
.removeClass( "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" );
submenus.children().each( function() {
var elem = $( this );
if ( elem.data( "ui-menu-submenu-caret" ) ) {
elem.remove();
}
} );
},
_keydown: function( event ) {
@ -226,9 +261,12 @@ return $.widget( "ui.menu", {
default:
preventDefault = false;
prev = this.previousFilter || "";
character = String.fromCharCode( event.keyCode );
skip = false;
// Support number pad values
character = event.keyCode >= 96 && event.keyCode <= 105 ?
( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
clearTimeout( this.filterTimer );
if ( character === prev ) {
@ -252,7 +290,7 @@ return $.widget( "ui.menu", {
if ( match.length ) {
this.focus( event, match );
this.previousFilter = character;
this.filterTimer = this._delay(function() {
this.filterTimer = this._delay( function() {
delete this.previousFilter;
}, 1000 );
} else {
@ -266,8 +304,8 @@ return $.widget( "ui.menu", {
},
_activate: function( event ) {
if ( !this.active.is( ".ui-state-disabled" ) ) {
if ( this.active.is( "[aria-haspopup='true']" ) ) {
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
if ( this.active.children( "[aria-haspopup='true']" ).length ) {
this.expand( event );
} else {
this.select( event );
@ -276,54 +314,57 @@ return $.widget( "ui.menu", {
},
refresh: function() {
var menus, items,
var menus, items, newSubmenus, newItems, newWrappers,
that = this,
icon = this.options.icons.submenu,
submenus = this.element.find( this.options.menus );
this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
// Initialize nested menus
submenus.filter( ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-front" )
newSubmenus = submenus.filter( ":not(.ui-menu)" )
.hide()
.attr({
.attr( {
role: this.options.role,
"aria-hidden": "true",
"aria-expanded": "false"
})
.each(function() {
} )
.each( function() {
var menu = $( this ),
item = menu.parent(),
submenuCarat = $( "<span>" )
.addClass( "ui-menu-icon ui-icon " + icon )
.data( "ui-menu-submenu-carat", true );
item = menu.prev(),
submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
item
.attr( "aria-haspopup", "true" )
.prepend( submenuCarat );
.prepend( submenuCaret );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
} );
this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
menus = submenus.add( this.element );
items = menus.find( this.options.items );
// Initialize menu-items containing spaces and/or dashes only as dividers
items.not( ".ui-menu-item" ).each(function() {
items.not( ".ui-menu-item" ).each( function() {
var item = $( this );
if ( that._isDivider( item ) ) {
item.addClass( "ui-widget-content ui-menu-divider" );
that._addClass( item, "ui-menu-divider", "ui-widget-content" );
}
});
} );
// Don't refresh list items that are already adapted
items.not( ".ui-menu-item, .ui-menu-divider" )
.addClass( "ui-menu-item" )
.uniqueId()
.attr({
tabIndex: -1,
role: this._itemRole()
});
newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
newWrappers = newItems.children()
.not( ".ui-menu" )
.uniqueId()
.attr( {
tabIndex: -1,
role: this._itemRole()
} );
this._addClass( newItems, "ui-menu-item" )
._addClass( newWrappers, "ui-menu-item-wrapper" );
// Add aria-disabled attribute to any disabled menu item
items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
@ -343,26 +384,31 @@ return $.widget( "ui.menu", {
_setOption: function( key, value ) {
if ( key === "icons" ) {
this.element.find( ".ui-menu-icon" )
.removeClass( this.options.icons.submenu )
.addClass( value.submenu );
}
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
var icons = this.element.find( ".ui-menu-icon" );
this._removeClass( icons, null, this.options.icons.submenu )
._addClass( icons, null, value.submenu );
}
this._super( key, value );
},
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", String( value ) );
this._toggleClass( null, "ui-state-disabled", !!value );
},
focus: function( event, item ) {
var nested, focused;
var nested, focused, activeParent;
this.blur( event, event && event.type === "focus" );
this._scrollIntoView( item );
this.active = item.first();
focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
focused = this.active.children( ".ui-menu-item-wrapper" );
this._addClass( focused, null, "ui-state-active" );
// Only update aria-activedescendant if there's a role
// otherwise we assume focus is managed elsewhere
if ( this.options.role ) {
@ -370,22 +416,23 @@ return $.widget( "ui.menu", {
}
// Highlight active parent menu item, if any
this.active
activeParent = this.active
.parent()
.closest( ".ui-menu-item" )
.addClass( "ui-state-active" );
.closest( ".ui-menu-item" )
.children( ".ui-menu-item-wrapper" );
this._addClass( activeParent, null, "ui-state-active" );
if ( event && event.type === "keydown" ) {
this._close();
} else {
this.timer = this._delay(function() {
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._startOpening( nested );
}
this.activeMenu = item.parent();
@ -395,8 +442,8 @@ return $.widget( "ui.menu", {
_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;
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();
@ -419,29 +466,30 @@ return $.widget( "ui.menu", {
return;
}
this.active.removeClass( "ui-state-focus" );
this.active = null;
this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
null, "ui-state-active" );
this._trigger( "blur", event, { item: this.active } );
this.active = null;
},
_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
// shift in the submenu position when mousing over the caret icon
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
return;
}
this.timer = this._delay(function() {
this.timer = this._delay( function() {
this._close();
this._open( submenu );
}, this.delay );
},
_open: function( submenu ) {
var position = $.extend({
var position = $.extend( {
of: this.active
}, this.options.position );
@ -459,12 +507,14 @@ return $.widget( "ui.menu", {
collapseAll: function( event, all ) {
clearTimeout( this.timer );
this.timer = this._delay(function() {
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 we found no valid submenu ancestor, use the main menu to close all
// sub menus anyway
if ( !currentMenu.length ) {
currentMenu = this.element;
}
@ -472,8 +522,12 @@ return $.widget( "ui.menu", {
this._close( currentMenu );
this.blur( event );
// Work around active item staying active after menu is blurred
this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
this.activeMenu = currentMenu;
}, this.delay );
}, all ? 0 : this.delay );
},
// With no arguments, closes the currently active menu - if nothing is active
@ -483,14 +537,10 @@ return $.widget( "ui.menu", {
startMenu = this.active ? this.active.parent() : this.element;
}
startMenu
.find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" )
.end()
.find( ".ui-state-active" ).not( ".ui-state-focus" )
.removeClass( "ui-state-active" );
startMenu.find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" );
},
_closeOnDocumentClick: function( event ) {
@ -513,19 +563,15 @@ return $.widget( "ui.menu", {
},
expand: function( event ) {
var newItem = this.active &&
this.active
.children( ".ui-menu " )
.find( this.options.items )
.first();
var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).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._delay( function() {
this.focus( event, newItem );
});
} );
}
},
@ -545,21 +591,27 @@ return $.widget( "ui.menu", {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},
_menuItems: function( menu ) {
return ( menu || this.element )
.find( this.options.items )
.filter( ".ui-menu-item" );
},
_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 );
.last();
} else {
next = this.active
[ direction + "All" ]( ".ui-menu-item" )
.eq( 0 );
.first();
}
}
if ( !next || !next.length || !this.active ) {
next = this.activeMenu.find( this.options.items )[ filter ]();
next = this._menuItems( this.activeMenu )[ filter ]();
}
this.focus( event, next );
@ -577,15 +629,21 @@ return $.widget( "ui.menu", {
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.height();
this.active.nextAll( ".ui-menu-item" ).each(function() {
height = this.element.innerHeight();
// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
}
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.find( this.options.items )
this.focus( event, this._menuItems( this.activeMenu )
[ !this.active ? "first" : "last" ]() );
}
},
@ -601,15 +659,21 @@ return $.widget( "ui.menu", {
}
if ( this._hasScroll() ) {
base = this.active.offset().top;
height = this.element.height();
this.active.prevAll( ".ui-menu-item" ).each(function() {
height = this.element.innerHeight();
// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
}
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.find( this.options.items ).first() );
this.focus( event, this._menuItems( this.activeMenu ).first() );
}
},
@ -618,6 +682,7 @@ return $.widget( "ui.menu", {
},
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" );
@ -628,19 +693,21 @@ return $.widget( "ui.menu", {
this._trigger( "select", event, ui );
},
_filterMenuItems: function(character) {
_filterMenuItems: function( character ) {
var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
regex = new RegExp( "^" + escapedCharacter, "i" );
return this.activeMenu
.find( this.options.items )
// Only match on items, not dividers or other content (#10571)
.filter( ".ui-menu-item" )
.filter(function() {
return regex.test( $.trim( $( this ).text() ) );
});
// Only match on items, not dividers or other content (#10571)
.filter( ".ui-menu-item" )
.filter( function() {
return regex.test(
String.prototype.trim.call(
$( this ).children( ".ui-menu-item-wrapper" ).text() ) );
} );
}
});
} );
}));
} );

View file

@ -1,37 +1,46 @@
/*!
* jQuery UI Mouse 1.11.4
* jQuery UI Mouse @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/mouse/
*/
(function( factory ) {
//>>label: Mouse
//>>group: Widgets
//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
//>>docs: http://api.jqueryui.com/mouse/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./widget"
"../ie",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
var mouseHandled = false;
$( document ).mouseup( function() {
$( document ).on( "mouseup", function() {
mouseHandled = false;
});
} );
return $.widget("ui.mouse", {
version: "1.11.4",
return $.widget( "ui.mouse", {
version: "@VERSION",
options: {
cancel: "input,textarea,button,select,option",
cancel: "input, textarea, button, select, option",
distance: 1,
delay: 0
},
@ -39,16 +48,16 @@ return $.widget("ui.mouse", {
var that = this;
this.element
.bind("mousedown." + this.widgetName, function(event) {
return that._mouseDown(event);
})
.bind("click." + this.widgetName, function(event) {
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
$.removeData(event.target, that.widgetName + ".preventClickEvent");
.on( "mousedown." + this.widgetName, function( event ) {
return that._mouseDown( event );
} )
.on( "click." + this.widgetName, function( event ) {
if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, that.widgetName + ".preventClickEvent" );
event.stopImmediatePropagation();
return false;
}
});
} );
this.started = false;
},
@ -56,15 +65,16 @@ return $.widget("ui.mouse", {
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind("." + this.widgetName);
this.element.off( "." + this.widgetName );
if ( this._mouseMoveDelegate ) {
this.document
.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
}
},
_mouseDown: function(event) {
_mouseDown: function( event ) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
@ -72,51 +82,55 @@ return $.widget("ui.mouse", {
this._mouseMoved = false;
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
// We may have missed mouseup (out of window)
if ( this._mouseStarted ) {
this._mouseUp( event );
}
this._mouseDownEvent = event;
var that = this,
btnIsLeft = (event.which === 1),
btnIsLeft = ( event.which === 1 ),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
$( event.target ).closest( this.options.cancel ).length : false );
if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
return true;
}
this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
if ( !this.mouseDelayMet ) {
this._mouseDelayTimer = setTimeout( function() {
that.mouseDelayMet = true;
}, this.options.delay);
}, this.options.delay );
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted = (this._mouseStart(event) !== false);
if (!this._mouseStarted) {
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted = ( this._mouseStart( event ) !== false );
if ( !this._mouseStarted ) {
event.preventDefault();
return true;
}
}
// Click event may never have fired (Gecko & Opera)
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
$.removeData(event.target, this.widgetName + ".preventClickEvent");
if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
$.removeData( event.target, this.widgetName + ".preventClickEvent" );
}
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
return that._mouseMove(event);
// These delegates are required to keep context
this._mouseMoveDelegate = function( event ) {
return that._mouseMove( event );
};
this._mouseUpDelegate = function(event) {
return that._mouseUp(event);
this._mouseUpDelegate = function( event ) {
return that._mouseUp( event );
};
this.document
.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
@ -124,19 +138,31 @@ return $.widget("ui.mouse", {
return true;
},
_mouseMove: function(event) {
_mouseMove: function( event ) {
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if ( this._mouseMoved ) {
// IE mouseup check - mouseup happened when mouse was out of window
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event);
if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
!event.button ) {
return this._mouseUp( event );
// Iframe mouseup check - mouseup occurred in another document
} else if ( !event.which ) {
return this._mouseUp( event );
// Support: Safari <=8 - 9
// Safari sets which to 0 if you press any of the following keys
// during a drag (#14461)
if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
this.ignoreMissingWhich = true;
} else if ( !this.ignoreMissingWhich ) {
return this._mouseUp( event );
}
}
}
@ -144,56 +170,68 @@ return $.widget("ui.mouse", {
this._mouseMoved = true;
}
if (this._mouseStarted) {
this._mouseDrag(event);
if ( this._mouseStarted ) {
this._mouseDrag( event );
return event.preventDefault();
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event) !== false);
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
( this._mouseStart( this._mouseDownEvent, event ) !== false );
if ( this._mouseStarted ) {
this._mouseDrag( event );
} else {
this._mouseUp( event );
}
}
return !this._mouseStarted;
},
_mouseUp: function(event) {
_mouseUp: function( event ) {
this.document
.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
if (this._mouseStarted) {
if ( this._mouseStarted ) {
this._mouseStarted = false;
if (event.target === this._mouseDownEvent.target) {
$.data(event.target, this.widgetName + ".preventClickEvent", true);
if ( event.target === this._mouseDownEvent.target ) {
$.data( event.target, this.widgetName + ".preventClickEvent", true );
}
this._mouseStop(event);
this._mouseStop( event );
}
if ( this._mouseDelayTimer ) {
clearTimeout( this._mouseDelayTimer );
delete this._mouseDelayTimer;
}
this.ignoreMissingWhich = false;
mouseHandled = false;
return false;
event.preventDefault();
},
_mouseDistanceMet: function(event) {
return (Math.max(
Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math.abs(this._mouseDownEvent.pageY - event.pageY)
_mouseDistanceMet: function( event ) {
return ( Math.max(
Math.abs( this._mouseDownEvent.pageX - event.pageX ),
Math.abs( this._mouseDownEvent.pageY - event.pageY )
) >= this.options.distance
);
},
_mouseDelayMet: function(/* event */) {
_mouseDelayMet: function( /* event */ ) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart: function(/* event */) {},
_mouseDrag: function(/* event */) {},
_mouseStop: function(/* event */) {},
_mouseCapture: function(/* event */) { return true; }
});
_mouseStart: function( /* event */ ) {},
_mouseDrag: function( /* event */ ) {},
_mouseStop: function( /* event */ ) {},
_mouseCapture: function( /* event */ ) {
return true;
}
} );
}));
} );

47
include/thirdparty/jquery_ui/plugin.js vendored Normal file
View file

@ -0,0 +1,47 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
return $.ui.plugin = {
add: function( module, option, set ) {
var i,
proto = $.ui[ module ].prototype;
for ( i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args, allowDisconnected ) {
var i,
set = instance.plugins[ name ];
if ( !set ) {
return;
}
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
return;
}
for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
}
}
};
} );

View file

@ -1,32 +1,39 @@
/*!
* jQuery UI Position 1.11.4
* jQuery UI Position @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/position/
*/
(function( factory ) {
//>>label: Position
//>>group: Core
//>>description: Positions elements relative to other elements.
//>>docs: http://api.jqueryui.com/position/
//>>demos: http://jqueryui.com/position/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
(function() {
} )( function( $ ) {
"use strict";
$.ui = $.ui || {};
var cachedScrollbarWidth, supportsOffsetFractions,
( function() {
var cachedScrollbarWidth,
max = Math.max,
abs = Math.abs,
round = Math.round,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
@ -45,8 +52,12 @@ function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
function isWindow( obj ) {
return obj != null && obj === obj.window;
}
function getDimensions( elem ) {
var raw = elem[0];
var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
@ -54,7 +65,7 @@ function getDimensions( elem ) {
offset: { top: 0, left: 0 }
};
}
if ( $.isWindow( raw ) ) {
if ( isWindow( raw ) ) {
return {
width: elem.width(),
height: elem.height(),
@ -81,8 +92,10 @@ $.position = {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0];
div = $( "<div style=" +
"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
"<div style='height:300px;width:auto;'></div></div>" ),
innerDiv = div.children()[ 0 ];
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
@ -91,12 +104,12 @@ $.position = {
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
w2 = div[0].clientWidth;
w2 = div[ 0 ].clientWidth;
}
div.remove();
return (cachedScrollbarWidth = w1 - w2);
return ( cachedScrollbarWidth = w1 - w2 );
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow || within.isDocument ? "" :
@ -104,9 +117,9 @@ $.position = {
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
( overflowY === "auto" && within.height < within.element[0].scrollHeight );
( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
@ -114,20 +127,18 @@ $.position = {
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
isWindow = $.isWindow( withinElement[0] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
isElemWindow = isWindow( withinElement[ 0 ] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
hasOffset = !isElemWindow && !isDocument;
return {
element: withinElement,
isWindow: isWindow,
isWindow: isElemWindow,
isDocument: isDocument,
offset: withinElement.offset() || { left: 0, top: 0 },
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
scrollLeft: withinElement.scrollLeft(),
scrollTop: withinElement.scrollTop(),
// support: jQuery 1.6.x
// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
width: withinElement.outerWidth(),
height: withinElement.outerHeight()
};
}
};
@ -137,35 +148,42 @@ $.fn.position = function( options ) {
return _position.apply( this, arguments );
}
// make a copy, we don't want to modify arguments
// Make a copy, we don't want to modify arguments
options = $.extend( {}, options );
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target = $( options.of ),
// Make sure string options are treated as CSS selectors
target = typeof options.of === "string" ?
$( document ).find( options.of ) :
$( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
dimensions = getDimensions( target );
if ( target[0].preventDefault ) {
// force left top to allow flipping
if ( target[ 0 ].preventDefault ) {
// Force left top to allow flipping
options.at = "left top";
}
targetWidth = dimensions.width;
targetHeight = dimensions.height;
targetOffset = dimensions.offset;
// clone to reuse original targetOffset later
// Clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
// force my and at to have valid horizontal and vertical positions
// Force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each( [ "my", "at" ], function() {
var pos = ( options[ this ] || "" ).split( " " ),
horizontalOffset,
verticalOffset;
if ( pos.length === 1) {
if ( pos.length === 1 ) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
@ -175,7 +193,7 @@ $.fn.position = function( options ) {
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
// calculate offsets
// Calculate offsets
horizontalOffset = roffset.exec( pos[ 0 ] );
verticalOffset = roffset.exec( pos[ 1 ] );
offsets[ this ] = [
@ -183,14 +201,14 @@ $.fn.position = function( options ) {
verticalOffset ? verticalOffset[ 0 ] : 0
];
// reduce to just the positions without the offsets
// Reduce to just the positions without the offsets
options[ this ] = [
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
});
} );
// normalize collision option
// Normalize collision option
if ( collision.length === 1 ) {
collision[ 1 ] = collision[ 0 ];
}
@ -211,15 +229,17 @@ $.fn.position = function( options ) {
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
return this.each(function() {
return this.each( function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
elemHeight = elem.outerHeight(),
marginLeft = parseCss( this, "marginLeft" ),
marginTop = parseCss( this, "marginTop" ),
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
scrollInfo.width,
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
scrollInfo.height,
position = $.extend( {}, basePosition ),
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
@ -238,12 +258,6 @@ $.fn.position = function( options ) {
position.left += myOffset[ 0 ];
position.top += myOffset[ 1 ];
// if the browser doesn't support fractions, then round for consistent results
if ( !supportsOffsetFractions ) {
position.left = round( position.left );
position.top = round( position.top );
}
collisionPosition = {
marginLeft: marginLeft,
marginTop: marginTop
@ -264,12 +278,13 @@ $.fn.position = function( options ) {
at: options.at,
within: within,
elem: elem
});
} );
}
});
} );
if ( options.using ) {
// adds feedback as second argument to using callback, if present
// Adds feedback as second argument to using callback, if present
using = function( props ) {
var left = targetOffset.left - position.left,
right = left + targetWidth - elemWidth,
@ -309,7 +324,7 @@ $.fn.position = function( options ) {
}
elem.offset( $.extend( position, { using: using } ) );
});
} );
};
$.ui.position = {
@ -323,16 +338,20 @@ $.ui.position = {
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
newOverRight;
// element is wider than within
// Element is wider than within
if ( data.collisionWidth > outerWidth ) {
// element is initially over the left side of within
// Element is initially over the left side of within
if ( overLeft > 0 && overRight <= 0 ) {
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
withinOffset;
position.left += overLeft - newOverRight;
// element is initially over right side of within
// Element is initially over right side of within
} else if ( overRight > 0 && overLeft <= 0 ) {
position.left = withinOffset;
// element is initially over both left and right sides of within
// Element is initially over both left and right sides of within
} else {
if ( overLeft > overRight ) {
position.left = withinOffset + outerWidth - data.collisionWidth;
@ -340,13 +359,16 @@ $.ui.position = {
position.left = withinOffset;
}
}
// too far left -> align with left edge
// Too far left -> align with left edge
} else if ( overLeft > 0 ) {
position.left += overLeft;
// too far right -> align with right edge
// Too far right -> align with right edge
} else if ( overRight > 0 ) {
position.left -= overRight;
// adjust based on position and margin
// Adjust based on position and margin
} else {
position.left = max( position.left - collisionPosLeft, position.left );
}
@ -360,16 +382,20 @@ $.ui.position = {
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
newOverBottom;
// element is taller than within
// Element is taller than within
if ( data.collisionHeight > outerHeight ) {
// element is initially over the top of within
// Element is initially over the top of within
if ( overTop > 0 && overBottom <= 0 ) {
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
withinOffset;
position.top += overTop - newOverBottom;
// element is initially over bottom of within
// Element is initially over bottom of within
} else if ( overBottom > 0 && overTop <= 0 ) {
position.top = withinOffset;
// element is initially over both top and bottom of within
// Element is initially over both top and bottom of within
} else {
if ( overTop > overBottom ) {
position.top = withinOffset + outerHeight - data.collisionHeight;
@ -377,13 +403,16 @@ $.ui.position = {
position.top = withinOffset;
}
}
// too far up -> align with top
// Too far up -> align with top
} else if ( overTop > 0 ) {
position.top += overTop;
// too far down -> align with bottom edge
// Too far down -> align with bottom edge
} else if ( overBottom > 0 ) {
position.top -= overBottom;
// adjust based on position and margin
// Adjust based on position and margin
} else {
position.top = max( position.top - collisionPosTop, position.top );
}
@ -413,12 +442,14 @@ $.ui.position = {
newOverLeft;
if ( overLeft < 0 ) {
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
outerWidth - withinOffset;
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset;
}
} else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset;
}
@ -447,12 +478,14 @@ $.ui.position = {
newOverTop,
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
outerHeight - withinOffset;
if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
position.top += myOffset + atOffset + offset;
}
} else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
offset - offsetTop;
if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
position.top += myOffset + atOffset + offset;
}
@ -471,47 +504,8 @@ $.ui.position = {
}
};
// fraction support test
(function() {
var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" );
//Create a "fake body" for testing based on method used in jQuery.support
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
$.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || document.documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
div.style.cssText = "position: absolute; left: 10.7432222px;";
offsetLeft = $( div ).offset().left;
supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
})();
})();
} )();
return $.ui.position;
}));
} );

View file

@ -1,32 +1,50 @@
/*!
* jQuery UI Progressbar 1.11.4
* jQuery UI Progressbar @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/progressbar/
*/
(function( factory ) {
//>>label: Progressbar
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/progressbar/
//>>demos: http://jqueryui.com/progressbar/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/progressbar.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget"
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.progressbar", {
version: "1.11.4",
version: "@VERSION",
options: {
classes: {
"ui-progressbar": "ui-corner-all",
"ui-progressbar-value": "ui-corner-left",
"ui-progressbar-complete": "ui-corner-right"
},
max: 100,
value: 0,
@ -37,31 +55,26 @@ return $.widget( "ui.progressbar", {
min: 0,
_create: function() {
// Constrain initial value
this.oldValue = this.options.value = this._constrainedValue();
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
// Only set static values, aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role: "progressbar",
"aria-valuemin": this.min
});
this.element.attr( {
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
// Only set static values; aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role: "progressbar",
"aria-valuemin": this.min
} );
this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
this.valueDiv = $( "<div>" ).appendTo( this.element );
this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
this._refreshValue();
},
_destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
this.valueDiv.remove();
},
@ -82,7 +95,7 @@ return $.widget( "ui.progressbar", {
this.indeterminate = newValue === false;
// sanitize value
// Sanitize value
if ( typeof newValue !== "number" ) {
newValue = 0;
}
@ -92,6 +105,7 @@ return $.widget( "ui.progressbar", {
},
_setOptions: function( options ) {
// Ensure "value" option is set after other values (like max)
var value = options.value;
delete options.value;
@ -104,19 +118,24 @@ return $.widget( "ui.progressbar", {
_setOption: function( key, value ) {
if ( key === "max" ) {
// Don't allow a max less than min
value = Math.max( this.min, value );
}
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
}
this._super( key, value );
},
_setOptionDisabled: function( value ) {
this._super( value );
this.element.attr( "aria-disabled", value );
this._toggleClass( null, "ui-state-disabled", !!value );
},
_percentage: function() {
return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
return this.indeterminate ?
100 :
100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
},
_refreshValue: function() {
@ -125,21 +144,24 @@ return $.widget( "ui.progressbar", {
this.valueDiv
.toggle( this.indeterminate || value > this.min )
.toggleClass( "ui-corner-right", value === this.options.max )
.width( percentage.toFixed(0) + "%" );
.width( percentage.toFixed( 0 ) + "%" );
this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
this
._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
value === this.options.max )
._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuenow" );
if ( !this.overlayDiv ) {
this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
}
} else {
this.element.attr({
this.element.attr( {
"aria-valuemax": this.options.max,
"aria-valuenow": value
});
} );
if ( this.overlayDiv ) {
this.overlayDiv.remove();
this.overlayDiv = null;
@ -154,6 +176,6 @@ return $.widget( "ui.progressbar", {
this._trigger( "complete" );
}
}
});
} );
}));
} );

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.ui.safeActiveElement = function( document ) {
var activeElement;
// Support: IE 9 only
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
activeElement = document.activeElement;
} catch ( error ) {
activeElement = document.body;
}
// Support: IE 9 - 11 only
// IE may return null instead of an element
// Interestingly, this only seems to occur when NOT in an iframe
if ( !activeElement ) {
activeElement = document.body;
}
// Support: IE 11 only
// IE11 returns a seemingly empty object in some cases when accessing
// document.activeElement from an <iframe>
if ( !activeElement.nodeName ) {
activeElement = document.body;
}
return activeElement;
};
} );

View file

@ -0,0 +1,25 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.ui.safeBlur = function( element ) {
// Support: IE9 - 10 only
// If the <body> is blurred, IE will switch windows, see #9420
if ( element && element.nodeName.toLowerCase() !== "body" ) {
$( element ).trigger( "blur" );
}
};
} );

View file

@ -0,0 +1,48 @@
/*!
* jQuery UI Scroll Parent @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: scrollParent
//>>group: Core
//>>description: Get the closest ancestor element that is scrollable.
//>>docs: http://api.jqueryui.com/scrollParent/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.fn.scrollParent = function( includeHidden ) {
var position = this.css( "position" ),
excludeStaticParent = position === "absolute",
overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
scrollParent = this.parents().filter( function() {
var parent = $( this );
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
return false;
}
return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
parent.css( "overflow-x" ) );
} ).eq( 0 );
return position === "fixed" || !scrollParent.length ?
$( this[ 0 ].ownerDocument || document ) :
scrollParent;
};
} );

View file

@ -1,32 +1,41 @@
/*!
* jQuery UI Selectable 1.11.4
* jQuery UI Selectable @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/selectable/
*/
(function( factory ) {
//>>label: Selectable
//>>group: Interactions
//>>description: Allows groups of elements to be selected with the mouse.
//>>docs: http://api.jqueryui.com/selectable/
//>>demos: http://jqueryui.com/selectable/
//>>css.structure: ../../themes/base/selectable.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./mouse",
"./widget"
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget("ui.selectable", $.ui.mouse, {
version: "1.11.4",
return $.widget( "ui.selectable", $.ui.mouse, {
version: "@VERSION",
options: {
appendTo: "body",
autoRefresh: true,
@ -34,7 +43,7 @@ return $.widget("ui.selectable", $.ui.mouse, {
filter: "*",
tolerance: "touch",
// callbacks
// Callbacks
selected: null,
selecting: null,
start: null,
@ -43,21 +52,25 @@ return $.widget("ui.selectable", $.ui.mouse, {
unselecting: null
},
_create: function() {
var selectees,
that = this;
var that = this;
this.element.addClass("ui-selectable");
this._addClass( "ui-selectable" );
this.dragged = false;
// cache selectee children based on filter
// Cache selectee children based on filter
this.refresh = function() {
selectees = $(that.options.filter, that.element[0]);
selectees.addClass("ui-selectee");
selectees.each(function() {
var $this = $(this),
pos = $this.offset();
$.data(this, "selectable-item", {
that.elementPos = $( that.element[ 0 ] ).offset();
that.selectees = $( that.options.filter, that.element[ 0 ] );
that._addClass( that.selectees, "ui-selectee" );
that.selectees.each( function() {
var $this = $( this ),
selecteeOffset = $this.offset(),
pos = {
left: selecteeOffset.left - that.elementPos.left,
top: selecteeOffset.top - that.elementPos.top
};
$.data( this, "selectable-item", {
element: this,
$element: $this,
left: pos.left,
@ -65,223 +78,240 @@ return $.widget("ui.selectable", $.ui.mouse, {
right: pos.left + $this.outerWidth(),
bottom: pos.top + $this.outerHeight(),
startselected: false,
selected: $this.hasClass("ui-selected"),
selecting: $this.hasClass("ui-selecting"),
unselecting: $this.hasClass("ui-unselecting")
});
});
selected: $this.hasClass( "ui-selected" ),
selecting: $this.hasClass( "ui-selecting" ),
unselecting: $this.hasClass( "ui-unselecting" )
} );
} );
};
this.refresh();
this.selectees = selectees.addClass("ui-selectee");
this._mouseInit();
this.helper = $("<div class='ui-selectable-helper'></div>");
this.helper = $( "<div>" );
this._addClass( this.helper, "ui-selectable-helper" );
},
_destroy: function() {
this.selectees
.removeClass("ui-selectee")
.removeData("selectable-item");
this.element
.removeClass("ui-selectable ui-selectable-disabled");
this.selectees.removeData( "selectable-item" );
this._mouseDestroy();
},
_mouseStart: function(event) {
_mouseStart: function( event ) {
var that = this,
options = this.options;
this.opos = [ event.pageX, event.pageY ];
this.elementPos = $( this.element[ 0 ] ).offset();
if (this.options.disabled) {
if ( this.options.disabled ) {
return;
}
this.selectees = $(options.filter, this.element[0]);
this.selectees = $( options.filter, this.element[ 0 ] );
this._trigger("start", event);
this._trigger( "start", event );
$( options.appendTo ).append( this.helper );
$(options.appendTo).append(this.helper);
// position helper (lasso)
this.helper.css({
this.helper.css( {
"left": event.pageX,
"top": event.pageY,
"width": 0,
"height": 0
});
} );
if (options.autoRefresh) {
if ( options.autoRefresh ) {
this.refresh();
}
this.selectees.filter(".ui-selected").each(function() {
var selectee = $.data(this, "selectable-item");
this.selectees.filter( ".ui-selected" ).each( function() {
var selectee = $.data( this, "selectable-item" );
selectee.startselected = true;
if (!event.metaKey && !event.ctrlKey) {
selectee.$element.removeClass("ui-selected");
if ( !event.metaKey && !event.ctrlKey ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
selectee.$element.addClass("ui-unselecting");
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
unselecting: selectee.element
});
}
});
$(event.target).parents().addBack().each(function() {
// selectable UNSELECTING callback
that._trigger( "unselecting", event, {
unselecting: selectee.element
} );
}
} );
$( event.target ).parents().addBack().each( function() {
var doSelect,
selectee = $.data(this, "selectable-item");
if (selectee) {
doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
selectee = $.data( this, "selectable-item" );
if ( selectee ) {
doSelect = ( !event.metaKey && !event.ctrlKey ) ||
!selectee.$element.hasClass( "ui-selected" );
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
selectee.unselecting = !doSelect;
selectee.selecting = doSelect;
selectee.selected = doSelect;
// selectable (UN)SELECTING callback
if (doSelect) {
that._trigger("selecting", event, {
if ( doSelect ) {
that._trigger( "selecting", event, {
selecting: selectee.element
});
} );
} else {
that._trigger("unselecting", event, {
that._trigger( "unselecting", event, {
unselecting: selectee.element
});
} );
}
return false;
}
});
} );
},
_mouseDrag: function(event) {
_mouseDrag: function( event ) {
this.dragged = true;
if (this.options.disabled) {
if ( this.options.disabled ) {
return;
}
var tmp,
that = this,
options = this.options,
x1 = this.opos[0],
y1 = this.opos[1],
x1 = this.opos[ 0 ],
y1 = this.opos[ 1 ],
x2 = event.pageX,
y2 = event.pageY;
if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
if ( x1 > x2 ) {
tmp = x2; x2 = x1; x1 = tmp;
}
if ( y1 > y2 ) {
tmp = y2; y2 = y1; y1 = tmp;
}
this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
this.selectees.each(function() {
var selectee = $.data(this, "selectable-item"),
hit = false;
this.selectees.each( function() {
var selectee = $.data( this, "selectable-item" ),
hit = false,
offset = {};
//prevent helper from being selected if appendTo: selectable
if (!selectee || selectee.element === that.element[0]) {
if ( !selectee || selectee.element === that.element[ 0 ] ) {
return;
}
if (options.tolerance === "touch") {
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
} else if (options.tolerance === "fit") {
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
offset.left = selectee.left + that.elementPos.left;
offset.right = selectee.right + that.elementPos.left;
offset.top = selectee.top + that.elementPos.top;
offset.bottom = selectee.bottom + that.elementPos.top;
if ( options.tolerance === "touch" ) {
hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
offset.bottom < y1 ) );
} else if ( options.tolerance === "fit" ) {
hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
offset.bottom < y2 );
}
if (hit) {
if ( hit ) {
// SELECT
if (selectee.selected) {
selectee.$element.removeClass("ui-selected");
if ( selectee.selected ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
}
if (selectee.unselecting) {
selectee.$element.removeClass("ui-unselecting");
if ( selectee.unselecting ) {
that._removeClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = false;
}
if (!selectee.selecting) {
selectee.$element.addClass("ui-selecting");
if ( !selectee.selecting ) {
that._addClass( selectee.$element, "ui-selecting" );
selectee.selecting = true;
// selectable SELECTING callback
that._trigger("selecting", event, {
that._trigger( "selecting", event, {
selecting: selectee.element
});
} );
}
} else {
// UNSELECT
if (selectee.selecting) {
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
selectee.$element.removeClass("ui-selecting");
if ( selectee.selecting ) {
if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
that._removeClass( selectee.$element, "ui-selecting" );
selectee.selecting = false;
selectee.$element.addClass("ui-selected");
that._addClass( selectee.$element, "ui-selected" );
selectee.selected = true;
} else {
selectee.$element.removeClass("ui-selecting");
that._removeClass( selectee.$element, "ui-selecting" );
selectee.selecting = false;
if (selectee.startselected) {
selectee.$element.addClass("ui-unselecting");
if ( selectee.startselected ) {
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
}
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
that._trigger( "unselecting", event, {
unselecting: selectee.element
});
} );
}
}
if (selectee.selected) {
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
selectee.$element.removeClass("ui-selected");
if ( selectee.selected ) {
if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
that._removeClass( selectee.$element, "ui-selected" );
selectee.selected = false;
selectee.$element.addClass("ui-unselecting");
that._addClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = true;
// selectable UNSELECTING callback
that._trigger("unselecting", event, {
that._trigger( "unselecting", event, {
unselecting: selectee.element
});
} );
}
}
}
});
} );
return false;
},
_mouseStop: function(event) {
_mouseStop: function( event ) {
var that = this;
this.dragged = false;
$(".ui-unselecting", this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass("ui-unselecting");
$( ".ui-unselecting", this.element[ 0 ] ).each( function() {
var selectee = $.data( this, "selectable-item" );
that._removeClass( selectee.$element, "ui-unselecting" );
selectee.unselecting = false;
selectee.startselected = false;
that._trigger("unselected", event, {
that._trigger( "unselected", event, {
unselected: selectee.element
});
});
$(".ui-selecting", this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
} );
} );
$( ".ui-selecting", this.element[ 0 ] ).each( function() {
var selectee = $.data( this, "selectable-item" );
that._removeClass( selectee.$element, "ui-selecting" )
._addClass( selectee.$element, "ui-selected" );
selectee.selecting = false;
selectee.selected = true;
selectee.startselected = true;
that._trigger("selected", event, {
that._trigger( "selected", event, {
selected: selectee.element
});
});
this._trigger("stop", event);
} );
} );
this._trigger( "stop", event );
this.helper.remove();
return false;
}
});
} );
}));
} );

View file

@ -1,36 +1,57 @@
/*!
* jQuery UI Selectmenu 1.11.4
* jQuery UI Selectmenu @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/selectmenu
*/
(function( factory ) {
//>>label: Selectmenu
//>>group: Widgets
/* eslint-disable max-len */
//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
/* eslint-enable max-len */
//>>docs: http://api.jqueryui.com/selectmenu/
//>>demos: http://jqueryui.com/selectmenu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./position",
"./menu"
"./menu",
"../form-reset-mixin",
"../keycode",
"../labels",
"../position",
"../unique-id",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.selectmenu", {
version: "1.11.4",
return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
version: "@VERSION",
defaultElement: "<select>",
options: {
appendTo: null,
classes: {
"ui-selectmenu-button-open": "ui-corner-top",
"ui-selectmenu-button-closed": "ui-corner-all"
},
disabled: null,
icons: {
button: "ui-icon-triangle-1-s"
@ -40,9 +61,9 @@ return $.widget( "ui.selectmenu", {
at: "left bottom",
collision: "none"
},
width: null,
width: false,
// callbacks
// Callbacks
change: null,
close: null,
focus: null,
@ -60,64 +81,66 @@ return $.widget( "ui.selectmenu", {
this._drawButton();
this._drawMenu();
this._bindFormResetHandler();
if ( this.options.disabled ) {
this.disable();
}
this._rendered = false;
this.menuItems = $();
},
_drawButton: function() {
var that = this;
var icon,
that = this,
item = this._parseOption(
this.element.find( "option:selected" ),
this.element[ 0 ].selectedIndex
);
// Associate existing label with the new button
this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
this._on( this.label, {
this.labels = this.element.labels().attr( "for", this.ids.button );
this._on( this.labels, {
click: function( event ) {
this.button.focus();
this.button.trigger( "focus" );
event.preventDefault();
}
});
} );
// Hide original select element
this.element.hide();
// Create button
this.button = $( "<span>", {
"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
tabindex: this.options.disabled ? -1 : 0,
id: this.ids.button,
role: "combobox",
"aria-expanded": "false",
"aria-autocomplete": "list",
"aria-owns": this.ids.menu,
"aria-haspopup": "true"
})
"aria-haspopup": "true",
title: this.element.attr( "title" )
} )
.insertAfter( this.element );
$( "<span>", {
"class": "ui-icon " + this.options.icons.button
})
.prependTo( this.button );
this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
"ui-button ui-widget" );
this.buttonText = $( "<span>", {
"class": "ui-selectmenu-text"
})
icon = $( "<span>" ).appendTo( this.button );
this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
this.buttonItem = this._renderButtonItem( item )
.appendTo( this.button );
this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
this._resizeButton();
if ( this.options.width !== false ) {
this._resizeButton();
}
this._on( this.button, this._buttonEvents );
this.button.one( "focusin", function() {
// Delay rendering the menu items until the button receives focus.
// The menu may have already been rendered via a programmatic open.
if ( !that.menuItems ) {
if ( !that._rendered ) {
that._refreshMenu();
}
});
this._hoverable( this.button );
this._focusable( this.button );
} );
},
_drawMenu: function() {
@ -128,23 +151,24 @@ return $.widget( "ui.selectmenu", {
"aria-hidden": "true",
"aria-labelledby": this.ids.button,
id: this.ids.menu
});
} );
// Wrap menu
this.menuWrap = $( "<div>", {
"class": "ui-selectmenu-menu ui-front"
})
.append( this.menu )
.appendTo( this._appendTo() );
this.menuWrap = $( "<div>" ).append( this.menu );
this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
this.menuWrap.appendTo( this._appendTo() );
// Initialize menu widget
this.menuInstance = this.menu
.menu({
.menu( {
classes: {
"ui-menu": "ui-corner-bottom"
},
role: "listbox",
select: function( event, ui ) {
event.preventDefault();
// support: IE8
// Support: IE8
// If the item was selected via a click, the text selection
// will be destroyed in IE
that._setSelection();
@ -166,14 +190,9 @@ return $.widget( "ui.selectmenu", {
that.button.attr( "aria-activedescendant",
that.menuItems.eq( item.index ).attr( "id" ) );
}
})
} )
.menu( "instance" );
// Adjust menu styles to dropdown
this.menu
.addClass( "ui-corner-bottom" )
.removeClass( "ui-corner-all" );
// Don't close the menu on mouseleave
this.menuInstance._off( this.menu, "mouseleave" );
@ -190,27 +209,37 @@ return $.widget( "ui.selectmenu", {
refresh: function() {
this._refreshMenu();
this._setText( this.buttonText, this._getSelectedItem().text() );
if ( !this.options.width ) {
this.buttonItem.replaceWith(
this.buttonItem = this._renderButtonItem(
// Fall back to an empty object in case there are no options
this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
)
);
if ( this.options.width === null ) {
this._resizeButton();
}
},
_refreshMenu: function() {
this.menu.empty();
var item,
options = this.element.find( "option" );
if ( !options.length ) {
return;
}
this.menu.empty();
this._parseOptions( options );
this._renderMenu( this.menu, this.items );
this.menuInstance.refresh();
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
this.menuItems = this.menu.find( "li" )
.not( ".ui-selectmenu-optgroup" )
.find( ".ui-menu-item-wrapper" );
this._rendered = true;
if ( !options.length ) {
return;
}
item = this._getSelectedItem();
@ -228,15 +257,20 @@ return $.widget( "ui.selectmenu", {
}
// If this is the first time the menu is being opened, render the items
if ( !this.menuItems ) {
if ( !this._rendered ) {
this._refreshMenu();
} else {
// Menu clears focus on close, reset focus to selected item
this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
this.menuInstance.focus( null, this._getSelectedItem() );
}
// If there are no options, don't open the menu
if ( !this.menuItems.length ) {
return;
}
this.isOpen = true;
this._toggleAttr();
this._resizeMenu();
@ -273,26 +307,38 @@ return $.widget( "ui.selectmenu", {
return this.menu;
},
_renderButtonItem: function( item ) {
var buttonItem = $( "<span>" );
this._setText( buttonItem, item.label );
this._addClass( buttonItem, "ui-selectmenu-text" );
return buttonItem;
},
_renderMenu: function( ul, items ) {
var that = this,
currentOptgroup = "";
$.each( items, function( index, item ) {
var li;
if ( item.optgroup !== currentOptgroup ) {
$( "<li>", {
"class": "ui-selectmenu-optgroup ui-menu-divider" +
( item.element.parent( "optgroup" ).prop( "disabled" ) ?
" ui-state-disabled" :
"" ),
li = $( "<li>", {
text: item.optgroup
})
.appendTo( ul );
} );
that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
( item.element.parent( "optgroup" ).prop( "disabled" ) ?
" ui-state-disabled" :
"" ) );
li.appendTo( ul );
currentOptgroup = item.optgroup;
}
that._renderItemData( ul, item );
});
} );
},
_renderItemData: function( ul, item ) {
@ -300,14 +346,17 @@ return $.widget( "ui.selectmenu", {
},
_renderItem: function( ul, item ) {
var li = $( "<li>" );
var li = $( "<li>" ),
wrapper = $( "<div>", {
title: item.element.attr( "title" )
} );
if ( item.disabled ) {
li.addClass( "ui-state-disabled" );
this._addClass( li, null, "ui-state-disabled" );
}
this._setText( li, item.label );
this._setText( wrapper, item.label );
return li.appendTo( ul );
return li.append( wrapper ).appendTo( ul );
},
_setText: function( element, value ) {
@ -323,9 +372,9 @@ return $.widget( "ui.selectmenu", {
filter = ".ui-menu-item";
if ( this.isOpen ) {
item = this.menuItems.eq( this.focusIndex );
item = this.menuItems.eq( this.focusIndex ).parent( "li" );
} else {
item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
filter += ":not(.ui-state-disabled)";
}
@ -341,7 +390,7 @@ return $.widget( "ui.selectmenu", {
},
_getSelectedItem: function() {
return this.menuItems.eq( this.element[ 0 ].selectedIndex );
return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
},
_toggle: function( event ) {
@ -360,15 +409,15 @@ return $.widget( "ui.selectmenu", {
selection.removeAllRanges();
selection.addRange( this.range );
// support: IE8
// Support: IE8
} else {
this.range.select();
}
// support: IE
// Support: IE
// Setting the text selection kills the button focus in IE, but
// restoring the focus doesn't kill the selection.
this.button.focus();
this.button.trigger( "focus" );
},
_documentClick: {
@ -377,7 +426,8 @@ return $.widget( "ui.selectmenu", {
return;
}
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
$.escapeSelector( this.ids.button ) ).length ) {
this.close( event );
}
}
@ -395,7 +445,7 @@ return $.widget( "ui.selectmenu", {
this.range = selection.getRangeAt( 0 );
}
// support: IE8
// Support: IE8
} else {
this.range = document.selection.createRange();
}
@ -409,54 +459,54 @@ return $.widget( "ui.selectmenu", {
keydown: function( event ) {
var preventDefault = true;
switch ( event.keyCode ) {
case $.ui.keyCode.TAB:
case $.ui.keyCode.ESCAPE:
this.close( event );
preventDefault = false;
break;
case $.ui.keyCode.ENTER:
if ( this.isOpen ) {
this._selectFocusedItem( event );
}
break;
case $.ui.keyCode.UP:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "prev", event );
}
break;
case $.ui.keyCode.DOWN:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "next", event );
}
break;
case $.ui.keyCode.SPACE:
if ( this.isOpen ) {
this._selectFocusedItem( event );
} else {
this._toggle( event );
}
break;
case $.ui.keyCode.LEFT:
case $.ui.keyCode.TAB:
case $.ui.keyCode.ESCAPE:
this.close( event );
preventDefault = false;
break;
case $.ui.keyCode.ENTER:
if ( this.isOpen ) {
this._selectFocusedItem( event );
}
break;
case $.ui.keyCode.UP:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "prev", event );
break;
case $.ui.keyCode.RIGHT:
}
break;
case $.ui.keyCode.DOWN:
if ( event.altKey ) {
this._toggle( event );
} else {
this._move( "next", event );
break;
case $.ui.keyCode.HOME:
case $.ui.keyCode.PAGE_UP:
this._move( "first", event );
break;
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_DOWN:
this._move( "last", event );
break;
default:
this.menu.trigger( event );
preventDefault = false;
}
break;
case $.ui.keyCode.SPACE:
if ( this.isOpen ) {
this._selectFocusedItem( event );
} else {
this._toggle( event );
}
break;
case $.ui.keyCode.LEFT:
this._move( "prev", event );
break;
case $.ui.keyCode.RIGHT:
this._move( "next", event );
break;
case $.ui.keyCode.HOME:
case $.ui.keyCode.PAGE_UP:
this._move( "first", event );
break;
case $.ui.keyCode.END:
case $.ui.keyCode.PAGE_DOWN:
this._move( "last", event );
break;
default:
this.menu.trigger( event );
preventDefault = false;
}
if ( preventDefault ) {
@ -466,7 +516,7 @@ return $.widget( "ui.selectmenu", {
},
_selectFocusedItem: function( event ) {
var item = this.menuItems.eq( this.focusIndex );
var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
if ( !item.hasClass( "ui-state-disabled" ) ) {
this._select( item.data( "ui-selectmenu-item" ), event );
}
@ -477,7 +527,7 @@ return $.widget( "ui.selectmenu", {
// Change native select element
this.element[ 0 ].selectedIndex = item.index;
this._setText( this.buttonText, item.label );
this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
this._setAria( item );
this._trigger( "select", event, { item: item } );
@ -491,18 +541,18 @@ return $.widget( "ui.selectmenu", {
_setAria: function( item ) {
var id = this.menuItems.eq( item.index ).attr( "id" );
this.button.attr({
this.button.attr( {
"aria-labelledby": id,
"aria-activedescendant": id
});
} );
this.menu.attr( "aria-activedescendant", id );
},
_setOption: function( key, value ) {
if ( key === "icons" ) {
this.button.find( "span.ui-icon" )
.removeClass( this.options.icons.button )
.addClass( value.button );
var icon = this.button.find( "span.ui-icon" );
this._removeClass( icon, null, this.options.icons.button )
._addClass( icon, null, value.button );
}
this._super( key, value );
@ -511,26 +561,27 @@ return $.widget( "ui.selectmenu", {
this.menuWrap.appendTo( this._appendTo() );
}
if ( key === "disabled" ) {
this.menuInstance.option( "disabled", value );
this.button
.toggleClass( "ui-state-disabled", value )
.attr( "aria-disabled", value );
this.element.prop( "disabled", value );
if ( value ) {
this.button.attr( "tabindex", -1 );
this.close();
} else {
this.button.attr( "tabindex", 0 );
}
}
if ( key === "width" ) {
this._resizeButton();
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this.menuInstance.option( "disabled", value );
this.button.attr( "aria-disabled", value );
this._toggleClass( this.button, null, "ui-state-disabled", value );
this.element.prop( "disabled", value );
if ( value ) {
this.button.attr( "tabindex", -1 );
this.close();
} else {
this.button.attr( "tabindex", 0 );
}
},
_appendTo: function() {
var element = this.options.appendTo;
@ -541,7 +592,7 @@ return $.widget( "ui.selectmenu", {
}
if ( !element || !element[ 0 ] ) {
element = this.element.closest( ".ui-front" );
element = this.element.closest( ".ui-front, dialog" );
}
if ( !element.length ) {
@ -552,18 +603,31 @@ return $.widget( "ui.selectmenu", {
},
_toggleAttr: function() {
this.button
.toggleClass( "ui-corner-top", this.isOpen )
.toggleClass( "ui-corner-all", !this.isOpen )
.attr( "aria-expanded", this.isOpen );
this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
this.button.attr( "aria-expanded", this.isOpen );
// We can't use two _toggleClass() calls here, because we need to make sure
// we always remove classes first and add them second, otherwise if both classes have the
// same theme class, it will be removed after we add it.
this._removeClass( this.button, "ui-selectmenu-button-" +
( this.isOpen ? "closed" : "open" ) )
._addClass( this.button, "ui-selectmenu-button-" +
( this.isOpen ? "open" : "closed" ) )
._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
this.menu.attr( "aria-hidden", !this.isOpen );
},
_resizeButton: function() {
var width = this.options.width;
if ( !width ) {
// For `width: false`, just remove inline style and stop
if ( width === false ) {
this.button.css( "width", "" );
return;
}
// For `width: null`, match the width of the original element
if ( width === null ) {
width = this.element.show().outerWidth();
this.element.hide();
}
@ -575,7 +639,7 @@ return $.widget( "ui.selectmenu", {
this.menu.outerWidth( Math.max(
this.button.outerWidth(),
// support: IE10
// Support: IE10
// IE10 wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping
this.menu.width( "" ).outerWidth() + 1
@ -583,33 +647,47 @@ return $.widget( "ui.selectmenu", {
},
_getCreateOptions: function() {
return { disabled: this.element.prop( "disabled" ) };
var options = this._super();
options.disabled = this.element.prop( "disabled" );
return options;
},
_parseOptions: function( options ) {
var data = [];
options.each(function( index, item ) {
var option = $( item ),
optgroup = option.parent( "optgroup" );
data.push({
element: option,
index: index,
value: option.val(),
label: option.text(),
optgroup: optgroup.attr( "label" ) || "",
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
});
});
var that = this,
data = [];
options.each( function( index, item ) {
if ( item.hidden ) {
return;
}
data.push( that._parseOption( $( item ), index ) );
} );
this.items = data;
},
_parseOption: function( option, index ) {
var optgroup = option.parent( "optgroup" );
return {
element: option,
index: index,
value: option.val(),
label: option.text(),
optgroup: optgroup.attr( "label" ) || "",
disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
};
},
_destroy: function() {
this._unbindFormResetHandler();
this.menuWrap.remove();
this.button.remove();
this.element.show();
this.element.removeUniqueId();
this.label.attr( "for", this.ids.element );
this.labels.attr( "for", this.ids.element );
}
});
} ] );
}));
} );

View file

@ -1,36 +1,56 @@
/*!
* jQuery UI Slider 1.11.4
* jQuery UI Slider @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/slider/
*/
(function( factory ) {
//>>label: Slider
//>>group: Widgets
//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
//>>docs: http://api.jqueryui.com/slider/
//>>demos: http://jqueryui.com/slider/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/slider.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./mouse",
"./widget"
"../keycode",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.slider", $.ui.mouse, {
version: "1.11.4",
version: "@VERSION",
widgetEventPrefix: "slide",
options: {
animate: false,
classes: {
"ui-slider": "ui-corner-all",
"ui-slider-handle": "ui-corner-all",
// Note: ui-widget-header isn't the most fittingly semantic framework class for this
// element, but worked best visually with a variety of themes
"ui-slider-range": "ui-corner-all ui-widget-header"
},
distance: 0,
max: 100,
min: 0,
@ -40,14 +60,14 @@ return $.widget( "ui.slider", $.ui.mouse, {
value: 0,
values: null,
// callbacks
// Callbacks
change: null,
slide: null,
start: null,
stop: null
},
// number of pages in a slider
// Number of pages in a slider
// (how many times can you page up/down to go through the whole range)
numPages: 5,
@ -60,15 +80,10 @@ return $.widget( "ui.slider", $.ui.mouse, {
this._mouseInit();
this._calculateNewMax();
this.element
.addClass( "ui-slider" +
" ui-slider-" + this.orientation +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all");
this._addClass( "ui-slider ui-slider-" + this.orientation,
"ui-widget ui-widget-content" );
this._refresh();
this._setOption( "disabled", this.options.disabled );
this._animateOff = false;
},
@ -83,8 +98,8 @@ return $.widget( "ui.slider", $.ui.mouse, {
_createHandles: function() {
var i, handleCount,
options = this.options,
existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
existingHandles = this.element.find( ".ui-slider-handle" ),
handle = "<span tabindex='0'></span>",
handles = [];
handleCount = ( options.values && options.values.length ) || 1;
@ -100,47 +115,48 @@ return $.widget( "ui.slider", $.ui.mouse, {
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
this.handle = this.handles.eq( 0 );
this.handles.each(function( i ) {
$( this ).data( "ui-slider-handle-index", i );
});
this.handles.each( function( i ) {
$( this )
.data( "ui-slider-handle-index", i )
.attr( "tabIndex", 0 );
} );
},
_createRange: function() {
var options = this.options,
classes = "";
var options = this.options;
if ( options.range ) {
if ( options.range === true ) {
if ( !options.values ) {
options.values = [ this._valueMin(), this._valueMin() ];
} else if ( options.values.length && options.values.length !== 2 ) {
options.values = [ options.values[0], options.values[0] ];
} else if ( $.isArray( options.values ) ) {
options.values = options.values.slice(0);
options.values = [ options.values[ 0 ], options.values[ 0 ] ];
} else if ( Array.isArray( options.values ) ) {
options.values = options.values.slice( 0 );
}
}
if ( !this.range || !this.range.length ) {
this.range = $( "<div></div>" )
this.range = $( "<div>" )
.appendTo( this.element );
classes = "ui-slider-range" +
// note: this isn't the most fittingly semantic framework class for this element,
// but worked best visually with a variety of themes
" ui-widget-header ui-corner-all";
this._addClass( this.range, "ui-slider-range" );
} else {
this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
// Handle range switching from true to min/max
.css({
"left": "",
"bottom": ""
});
}
this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
this.range.addClass( classes +
( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
// Handle range switching from true to min/max
this.range.css( {
"left": "",
"bottom": ""
} );
}
if ( options.range === "min" || options.range === "max" ) {
this._addClass( this.range, "ui-slider-range-" + options.range );
}
} else {
if ( this.range ) {
this.range.remove();
@ -162,14 +178,6 @@ return $.widget( "ui.slider", $.ui.mouse, {
this.range.remove();
}
this.element
.removeClass( "ui-slider" +
" ui-slider-horizontal" +
" ui-slider-vertical" +
" ui-widget" +
" ui-widget-content" +
" ui-corner-all" );
this._mouseDestroy();
},
@ -191,16 +199,16 @@ return $.widget( "ui.slider", $.ui.mouse, {
position = { x: event.pageX, y: event.pageY };
normValue = this._normValueFromMouse( position );
distance = this._valueMax() - this._valueMin() + 1;
this.handles.each(function( i ) {
var thisDistance = Math.abs( normValue - that.values(i) );
if (( distance > thisDistance ) ||
this.handles.each( function( i ) {
var thisDistance = Math.abs( normValue - that.values( i ) );
if ( ( distance > thisDistance ) ||
( distance === thisDistance &&
(i === that._lastChangedValue || that.values(i) === o.min ))) {
( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
distance = thisDistance;
closestHandle = $( this );
index = i;
}
});
} );
allowed = this._start( event, index );
if ( allowed === false ) {
@ -210,9 +218,8 @@ return $.widget( "ui.slider", $.ui.mouse, {
this._handleIndex = index;
closestHandle
.addClass( "ui-state-active" )
.focus();
this._addClass( closestHandle, null, "ui-state-active" );
closestHandle.trigger( "focus" );
offset = closestHandle.offset();
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
@ -220,9 +227,9 @@ return $.widget( "ui.slider", $.ui.mouse, {
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
top: event.pageY - offset.top -
( closestHandle.height() / 2 ) -
( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
};
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
@ -246,7 +253,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
},
_mouseStop: function( event ) {
this.handles.removeClass( "ui-state-active" );
this._removeClass( this.handles, null, "ui-state-active" );
this._mouseSliding = false;
this._stop( event, this._handleIndex );
@ -272,10 +279,12 @@ return $.widget( "ui.slider", $.ui.mouse, {
if ( this.orientation === "horizontal" ) {
pixelTotal = this.elementSize.width;
pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
pixelMouse = position.x - this.elementOffset.left -
( this._clickOffset ? this._clickOffset.left : 0 );
} else {
pixelTotal = this.elementSize.height;
pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
pixelMouse = position.y - this.elementOffset.top -
( this._clickOffset ? this._clickOffset.top : 0 );
}
percentMouse = ( pixelMouse / pixelTotal );
@ -295,88 +304,73 @@ return $.widget( "ui.slider", $.ui.mouse, {
return this._trimAlignValue( valueMouse );
},
_start: function( event, index ) {
_uiHash: function( index, value, values ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
handleIndex: index,
value: value !== undefined ? value : this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
if ( this._hasMultipleValues() ) {
uiHash.value = value !== undefined ? value : this.values( index );
uiHash.values = values || this.values();
}
return this._trigger( "start", event, uiHash );
return uiHash;
},
_hasMultipleValues: function() {
return this.options.values && this.options.values.length;
},
_start: function( event, index ) {
return this._trigger( "start", event, this._uiHash( index ) );
},
_slide: function( event, index, newVal ) {
var otherVal,
newValues,
allowed;
var allowed, otherVal,
currentValue = this.value(),
newValues = this.values();
if ( this.options.values && this.options.values.length ) {
if ( this._hasMultipleValues() ) {
otherVal = this.values( index ? 0 : 1 );
currentValue = this.values( index );
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
) {
newVal = otherVal;
if ( this.options.values.length === 2 && this.options.range === true ) {
newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
}
if ( newVal !== this.values( index ) ) {
newValues = this.values();
newValues[ index ] = newVal;
// A slide can be canceled by returning false from the slide callback
allowed = this._trigger( "slide", event, {
handle: this.handles[ index ],
value: newVal,
values: newValues
} );
otherVal = this.values( index ? 0 : 1 );
if ( allowed !== false ) {
this.values( index, newVal );
}
}
newValues[ index ] = newVal;
}
if ( newVal === currentValue ) {
return;
}
allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
// A slide can be canceled by returning false from the slide callback
if ( allowed === false ) {
return;
}
if ( this._hasMultipleValues() ) {
this.values( index, newVal );
} else {
if ( newVal !== this.value() ) {
// A slide can be canceled by returning false from the slide callback
allowed = this._trigger( "slide", event, {
handle: this.handles[ index ],
value: newVal
} );
if ( allowed !== false ) {
this.value( newVal );
}
}
this.value( newVal );
}
},
_stop: function( event, index ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
}
this._trigger( "stop", event, uiHash );
this._trigger( "stop", event, this._uiHash( index ) );
},
_change: function( event, index ) {
if ( !this._keySliding && !this._mouseSliding ) {
var uiHash = {
handle: this.handles[ index ],
value: this.value()
};
if ( this.options.values && this.options.values.length ) {
uiHash.value = this.values( index );
uiHash.values = this.values();
}
//store the last changed value index for reference when handles overlap
this._lastChangedValue = index;
this._trigger( "change", event, uiHash );
this._trigger( "change", event, this._uiHash( index ) );
}
},
@ -404,7 +398,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
if ( arguments.length ) {
if ( $.isArray( arguments[ 0 ] ) ) {
if ( Array.isArray( arguments[ 0 ] ) ) {
vals = this.options.values;
newValues = arguments[ 0 ];
for ( i = 0; i < vals.length; i += 1 ) {
@ -413,7 +407,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
this._refreshValue();
} else {
if ( this.options.values && this.options.values.length ) {
if ( this._hasMultipleValues() ) {
return this._values( index );
} else {
return this.value();
@ -438,23 +432,21 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
}
if ( $.isArray( this.options.values ) ) {
if ( Array.isArray( this.options.values ) ) {
valsLength = this.options.values.length;
}
if ( key === "disabled" ) {
this.element.toggleClass( "ui-state-disabled", !!value );
}
this._super( key, value );
switch ( key ) {
case "orientation":
this._detectOrientation();
this.element
.removeClass( "ui-slider-horizontal ui-slider-vertical" )
.addClass( "ui-slider-" + this.orientation );
this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
._addClass( "ui-slider-" + this.orientation );
this._refreshValue();
if ( this.options.range ) {
this._refreshRange( value );
}
// Reset positioning from previous orientation
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
@ -468,7 +460,9 @@ return $.widget( "ui.slider", $.ui.mouse, {
case "values":
this._animateOff = true;
this._refreshValue();
for ( i = 0; i < valsLength; i += 1 ) {
// Start from the last handle to prevent unreachable handles (#9046)
for ( i = valsLength - 1; i >= 0; i-- ) {
this._change( null, i );
}
this._animateOff = false;
@ -489,6 +483,12 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
},
_setOptionDisabled: function( value ) {
this._super( value );
this._toggleClass( null, "ui-state-disabled", !!value );
},
//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value: function() {
@ -511,11 +511,12 @@ return $.widget( "ui.slider", $.ui.mouse, {
val = this._trimAlignValue( val );
return val;
} else if ( this.options.values && this.options.values.length ) {
} else if ( this._hasMultipleValues() ) {
// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals = this.options.values.slice();
for ( i = 0; i < vals.length; i += 1) {
for ( i = 0; i < vals.length; i += 1 ) {
vals[ i ] = this._trimAlignValue( vals[ i ] );
}
@ -525,7 +526,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
},
// returns the step-aligned value that val is closest to, between (inclusive) min and max
// Returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue: function( val ) {
if ( val <= this._valueMin() ) {
return this._valueMin();
@ -534,24 +535,29 @@ return $.widget( "ui.slider", $.ui.mouse, {
return this._valueMax();
}
var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = (val - this._valueMin()) % step,
valModStep = ( val - this._valueMin() ) % step,
alignValue = val - valModStep;
if ( Math.abs(valModStep) * 2 >= step ) {
if ( Math.abs( valModStep ) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat( alignValue.toFixed(5) );
return parseFloat( alignValue.toFixed( 5 ) );
},
_calculateNewMax: function() {
var max = this.options.max,
min = this._valueMin(),
step = this.options.step,
aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
aboveMin = Math.round( ( max - min ) / step ) * step;
max = aboveMin + min;
if ( max > this.options.max ) {
//If max is not divisible by step, rounding off may increase its value
max -= step;
}
this.max = parseFloat( max.toFixed( this._precision() ) );
},
@ -577,6 +583,15 @@ return $.widget( "ui.slider", $.ui.mouse, {
return this.max;
},
_refreshRange: function( orientation ) {
if ( orientation === "vertical" ) {
this.range.css( { "width": "", "left": "" } );
}
if ( orientation === "horizontal" ) {
this.range.css( { "height": "", "bottom": "" } );
}
},
_refreshValue: function() {
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange = this.options.range,
@ -585,30 +600,45 @@ return $.widget( "ui.slider", $.ui.mouse, {
animate = ( !this._animateOff ) ? o.animate : false,
_set = {};
if ( this.options.values && this.options.values.length ) {
this.handles.each(function( i ) {
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
if ( this._hasMultipleValues() ) {
this.handles.each( function( i ) {
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( that.options.range === true ) {
if ( that.orientation === "horizontal" ) {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
left: valPercent + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
that.range[ animate ? "animate" : "css" ]( {
width: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
} else {
if ( i === 0 ) {
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
bottom: ( valPercent ) + "%"
}, o.animate );
}
if ( i === 1 ) {
that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
that.range[ animate ? "animate" : "css" ]( {
height: ( valPercent - lastValPercent ) + "%"
}, {
queue: false,
duration: o.animate
} );
}
}
}
lastValPercent = valPercent;
});
} );
} else {
value = this.value();
valueMin = this._valueMin();
@ -620,16 +650,24 @@ return $.widget( "ui.slider", $.ui.mouse, {
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
if ( oRange === "min" && this.orientation === "horizontal" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "horizontal" ) {
this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
width: ( 100 - valPercent ) + "%"
}, o.animate );
}
if ( oRange === "min" && this.orientation === "vertical" ) {
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: valPercent + "%"
}, o.animate );
}
if ( oRange === "max" && this.orientation === "vertical" ) {
this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
height: ( 100 - valPercent ) + "%"
}, o.animate );
}
}
},
@ -651,7 +689,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
event.preventDefault();
if ( !this._keySliding ) {
this._keySliding = true;
$( event.target ).addClass( "ui-state-active" );
this._addClass( $( event.target ), null, "ui-state-active" );
allowed = this._start( event, index );
if ( allowed === false ) {
return;
@ -661,7 +699,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
}
step = this.options.step;
if ( this.options.values && this.options.values.length ) {
if ( this._hasMultipleValues() ) {
curVal = newVal = this.values( index );
} else {
curVal = newVal = this.value();
@ -681,7 +719,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
break;
case $.ui.keyCode.PAGE_DOWN:
newVal = this._trimAlignValue(
curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
@ -708,10 +746,10 @@ return $.widget( "ui.slider", $.ui.mouse, {
this._keySliding = false;
this._stop( event, index );
this._change( event, index );
$( event.target ).removeClass( "ui-state-active" );
this._removeClass( $( event.target ), null, "ui-state-active" );
}
}
}
});
} );
}));
} );

File diff suppressed because it is too large Load diff

View file

@ -1,31 +1,44 @@
/*!
* jQuery UI Spinner 1.11.4
* jQuery UI Spinner @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/spinner/
*/
(function( factory ) {
//>>label: Spinner
//>>group: Widgets
//>>description: Displays buttons to easily input numbers via the keyboard or mouse.
//>>docs: http://api.jqueryui.com/spinner/
//>>demos: http://jqueryui.com/spinner/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/spinner.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./button"
"./button",
"../version",
"../keycode",
"../safe-active-element",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
function spinner_modifier( fn ) {
function spinnerModifier( fn ) {
return function() {
var previous = this.element.val();
fn.apply( this, arguments );
@ -36,11 +49,16 @@ function spinner_modifier( fn ) {
};
}
return $.widget( "ui.spinner", {
version: "1.11.4",
$.widget( "ui.spinner", {
version: "@VERSION",
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
classes: {
"ui-spinner": "ui-corner-all",
"ui-spinner-down": "ui-corner-br",
"ui-spinner-up": "ui-corner-tr"
},
culture: null,
icons: {
down: "ui-icon-triangle-1-s",
@ -60,6 +78,7 @@ return $.widget( "ui.spinner", {
},
_create: function() {
// handle string values that need to be parsed
this._setOption( "max", this.options.max );
this._setOption( "min", this.options.min );
@ -68,6 +87,7 @@ return $.widget( "ui.spinner", {
// Only format if there is a value, prevents the field from being marked
// as invalid in Firefox, see #9573.
if ( this.value() !== "" ) {
// Format the value, but don't constrain.
this._value( this.element.val(), true );
}
@ -76,26 +96,26 @@ return $.widget( "ui.spinner", {
this._on( this._events );
this._refresh();
// turning off autocomplete prevents the browser from remembering the
// 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" );
}
});
} );
},
_getCreateOptions: function() {
var options = {},
element = this.element;
var options = this._super();
var element = this.element;
$.each( [ "min", "max", "step" ], function( i, option ) {
var value = element.attr( option );
if ( value !== undefined && value.length ) {
if ( value != null && value.length ) {
options[ option ] = value;
}
});
} );
return options;
},
@ -123,16 +143,20 @@ return $.widget( "ui.spinner", {
}
},
mousewheel: function( event, delta ) {
if ( !delta ) {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );
var isActive = this.element[ 0 ] === activeElement;
if ( !isActive || !delta ) {
return;
}
if ( !this.spinning && !this._start( event ) ) {
return false;
}
this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
clearTimeout( this.mousewheelTimer );
this.mousewheelTimer = this._delay(function() {
this.mousewheelTimer = this._delay( function() {
if ( this.spinning ) {
this._stop( event );
}
@ -147,44 +171,47 @@ return $.widget( "ui.spinner", {
// If the input is focused then this.previous is properly set from
// when the input first received focus. If the input is not focused
// then we need to set this.previous based on the value before spinning.
previous = this.element[0] === this.document[0].activeElement ?
previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
this.previous : this.element.val();
function checkFocus() {
var isActive = this.element[0] === this.document[0].activeElement;
var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
if ( !isActive ) {
this.element.focus();
this.element.trigger( "focus" );
this.previous = previous;
// support: IE
// IE sets focus asynchronously, so we need to check if focus
// moved off of the input because the user clicked on the button.
this._delay(function() {
this._delay( function() {
this.previous = previous;
});
} );
}
}
// ensure focus is on (or stays on) the text field
// Ensure focus is on (or stays on) the text field
event.preventDefault();
checkFocus.call( this );
// support: IE
// Support: IE
// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
// and check (again) if focus moved off of the input.
this.cancelBlur = true;
this._delay(function() {
this._delay( function() {
delete this.cancelBlur;
checkFocus.call( this );
});
} );
if ( this._start( event ) === false ) {
return;
}
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
this._repeat( null, $( event.currentTarget )
.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
"mouseup .ui-spinner-button": "_stop",
"mouseenter .ui-spinner-button": function( event ) {
// button will add ui-state-active if mouse was down while mouseleave and kept down
if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
return;
@ -193,41 +220,66 @@ return $.widget( "ui.spinner", {
if ( this._start( event ) === false ) {
return false;
}
this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
this._repeat( null, $( event.currentTarget )
.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
},
// TODO: do we really want to consider this a stop?
// shouldn't we just stop the repeater and wait until mouseup before
// we trigger the stop event?
"mouseleave .ui-spinner-button": "_stop"
},
_draw: function() {
var uiSpinner = this.uiSpinner = this.element
.addClass( "ui-spinner-input" )
// Support mobile enhanced option and make backcompat more sane
_enhance: function() {
this.uiSpinner = this.element
.attr( "autocomplete", "off" )
.wrap( this._uiSpinnerHtml() )
.wrap( "<span>" )
.parent()
// add buttons
.append( this._buttonHtml() );
// Add buttons
.append(
"<a></a><a></a>"
);
},
_draw: function() {
this._enhance();
this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
this._addClass( "ui-spinner-input" );
this.element.attr( "role", "spinbutton" );
// button bindings
this.buttons = uiSpinner.find( ".ui-spinner-button" )
// Button bindings
this.buttons = this.uiSpinner.children( "a" )
.attr( "tabIndex", -1 )
.button()
.removeClass( "ui-corner-all" );
.attr( "aria-hidden", true )
.button( {
classes: {
"ui-button": ""
}
} );
// TODO: Right now button does not support classes this is already updated in button PR
this._removeClass( this.buttons, "ui-corner-all" );
this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
this.buttons.first().button( {
"icon": this.options.icons.up,
"showLabel": false
} );
this.buttons.last().button( {
"icon": this.options.icons.down,
"showLabel": false
} );
// IE 6 doesn't understand height: 50% for the buttons
// unless the wrapper has an explicit height
if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
uiSpinner.height() > 0 ) {
uiSpinner.height( uiSpinner.height() );
}
// disable spinner if element was already disabled
if ( this.options.disabled ) {
this.disable();
if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
this.uiSpinner.height() > 0 ) {
this.uiSpinner.height( this.uiSpinner.height() );
}
},
@ -253,20 +305,6 @@ return $.widget( "ui.spinner", {
return false;
},
_uiSpinnerHtml: function() {
return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
},
_buttonHtml: function() {
return "" +
"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
"<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
"</a>" +
"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
"<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
"</a>";
},
_start: function( event ) {
if ( !this.spinning && this._trigger( "start", event ) === false ) {
return false;
@ -283,7 +321,7 @@ return $.widget( "ui.spinner", {
i = i || 500;
clearTimeout( this.timer );
this.timer = this._delay(function() {
this.timer = this._delay( function() {
this._repeat( 40, steps, event );
}, i );
@ -299,7 +337,7 @@ return $.widget( "ui.spinner", {
value = this._adjustValue( value + step * this._increment( this.counter ) );
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
this._value( value );
this.counter++;
}
@ -309,7 +347,7 @@ return $.widget( "ui.spinner", {
var incremental = this.options.incremental;
if ( incremental ) {
return $.isFunction( incremental ) ?
return typeof incremental === "function" ?
incremental( i ) :
Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
}
@ -335,20 +373,22 @@ return $.widget( "ui.spinner", {
var base, aboveMin,
options = this.options;
// make sure we're at a valid step
// Make sure we're at a valid step
// - find out where we are relative to the base (min or 0)
base = options.min !== null ? options.min : 0;
aboveMin = value - base;
// - round to the nearest step
aboveMin = Math.round(aboveMin / options.step) * options.step;
aboveMin = Math.round( aboveMin / options.step ) * options.step;
// - rounding is based on 0, so adjust back to our base
value = base + aboveMin;
// fix precision from bad JS floating point math
// Fix precision from bad JS floating point math
value = parseFloat( value.toFixed( this._precision() ) );
// clamp the value
if ( options.max !== null && value > options.max) {
// Clamp the value
if ( options.max !== null && value > options.max ) {
return options.max;
}
if ( options.min !== null && value < options.min ) {
@ -371,8 +411,10 @@ return $.widget( "ui.spinner", {
},
_setOption: function( key, value ) {
var prevValue, first, last;
if ( key === "culture" || key === "numberFormat" ) {
var prevValue = this._parse( this.element.val() );
prevValue = this._parse( this.element.val() );
this.options[ key ] = value;
this.element.val( this._format( prevValue ) );
return;
@ -384,26 +426,28 @@ return $.widget( "ui.spinner", {
}
}
if ( key === "icons" ) {
this.buttons.first().find( ".ui-icon" )
.removeClass( this.options.icons.up )
.addClass( value.up );
this.buttons.last().find( ".ui-icon" )
.removeClass( this.options.icons.down )
.addClass( value.down );
first = this.buttons.first().find( ".ui-icon" );
this._removeClass( first, null, this.options.icons.up );
this._addClass( first, null, value.up );
last = this.buttons.last().find( ".ui-icon" );
this._removeClass( last, null, this.options.icons.down );
this._addClass( last, null, value.down );
}
this._super( key, value );
if ( key === "disabled" ) {
this.widget().toggleClass( "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
this.buttons.button( value ? "disable" : "enable" );
}
},
_setOptions: spinner_modifier(function( options ) {
_setOptionDisabled: function( value ) {
this._super( value );
this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
this.element.prop( "disabled", !!value );
this.buttons.button( value ? "disable" : "enable" );
},
_setOptions: spinnerModifier( function( options ) {
this._super( options );
}),
} ),
_parse: function( val ) {
if ( typeof val === "string" && val !== "" ) {
@ -423,27 +467,28 @@ return $.widget( "ui.spinner", {
},
_refresh: function() {
this.element.attr({
this.element.attr( {
"aria-valuemin": this.options.min,
"aria-valuemax": this.options.max,
// TODO: what should we do with values that can't be parsed?
"aria-valuenow": this._parse( this.element.val() )
});
} );
},
isValid: function() {
var value = this.value();
// null is invalid
// Null is invalid
if ( value === null ) {
return false;
}
// if value gets adjusted, it's invalid
// If value gets adjusted, it's invalid
return value === this._adjustValue( value );
},
// update the value without triggering change
// Update the value without triggering change
_value: function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
@ -461,54 +506,77 @@ return $.widget( "ui.spinner", {
_destroy: function() {
this.element
.removeClass( "ui-spinner-input" )
.prop( "disabled", false )
.removeAttr( "autocomplete" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
this.uiSpinner.replaceWith( this.element );
},
stepUp: spinner_modifier(function( steps ) {
stepUp: spinnerModifier( function( steps ) {
this._stepUp( steps );
}),
} ),
_stepUp: function( steps ) {
if ( this._start() ) {
this._spin( (steps || 1) * this.options.step );
this._spin( ( steps || 1 ) * this.options.step );
this._stop();
}
},
stepDown: spinner_modifier(function( steps ) {
stepDown: spinnerModifier( function( steps ) {
this._stepDown( steps );
}),
} ),
_stepDown: function( steps ) {
if ( this._start() ) {
this._spin( (steps || 1) * -this.options.step );
this._spin( ( steps || 1 ) * -this.options.step );
this._stop();
}
},
pageUp: spinner_modifier(function( pages ) {
this._stepUp( (pages || 1) * this.options.page );
}),
pageUp: spinnerModifier( function( pages ) {
this._stepUp( ( pages || 1 ) * this.options.page );
} ),
pageDown: spinner_modifier(function( pages ) {
this._stepDown( (pages || 1) * this.options.page );
}),
pageDown: spinnerModifier( function( pages ) {
this._stepDown( ( pages || 1 ) * this.options.page );
} ),
value: function( newVal ) {
if ( !arguments.length ) {
return this._parse( this.element.val() );
}
spinner_modifier( this._value ).call( this, newVal );
spinnerModifier( this._value ).call( this, newVal );
},
widget: function() {
return this.uiSpinner;
}
});
} );
}));
// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for spinner html extension points
$.widget( "ui.spinner", $.ui.spinner, {
_enhance: function() {
this.uiSpinner = this.element
.attr( "autocomplete", "off" )
.wrap( this._uiSpinnerHtml() )
.parent()
// Add buttons
.append( this._buttonHtml() );
},
_uiSpinnerHtml: function() {
return "<span>";
},
_buttonHtml: function() {
return "<a></a><a></a>";
}
} );
}
return $.ui.spinner;
} );

View file

@ -0,0 +1,38 @@
/*!
* jQuery UI Tabbable @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :tabbable Selector
//>>group: Core
//>>description: Selects elements which can be tabbed to.
//>>docs: http://api.jqueryui.com/tabbable-selector/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version", "./focusable" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.extend( $.expr.pseudos, {
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
hasTabindex = tabIndex != null;
return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
}
} );
} );

View file

@ -1,61 +1,77 @@
/*!
* jQuery UI Tabs 1.11.4
* jQuery UI Tabs @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/tabs/
*/
(function( factory ) {
//>>label: Tabs
//>>group: Widgets
//>>description: Transforms a set of container elements into a tab structure.
//>>docs: http://api.jqueryui.com/tabs/
//>>demos: http://jqueryui.com/tabs/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tabs.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget"
"../keycode",
"../safe-active-element",
"../unique-id",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.tabs", {
version: "1.11.4",
$.widget( "ui.tabs", {
version: "@VERSION",
delay: 300,
options: {
active: null,
classes: {
"ui-tabs": "ui-corner-all",
"ui-tabs-nav": "ui-corner-all",
"ui-tabs-panel": "ui-corner-bottom",
"ui-tabs-tab": "ui-corner-top"
},
collapsible: false,
event: "click",
heightStyle: "content",
hide: null,
show: null,
// callbacks
// Callbacks
activate: null,
beforeActivate: null,
beforeLoad: null,
load: null
},
_isLocal: (function() {
_isLocal: ( function() {
var rhash = /#.*$/;
return function( anchor ) {
var anchorUrl, locationUrl;
// support: IE7
// IE7 doesn't normalize the href property when set via script (#9317)
anchor = anchor.cloneNode( false );
anchorUrl = anchor.href.replace( rhash, "" );
locationUrl = location.href.replace( rhash, "" );
// decoding may throw an error if the URL isn't UTF-8 (#9518)
// Decoding may throw an error if the URL isn't UTF-8 (#9518)
try {
anchorUrl = decodeURIComponent( anchorUrl );
} catch ( error ) {}
@ -65,7 +81,7 @@ return $.widget( "ui.tabs", {
return anchor.hash.length > 1 && anchorUrl === locationUrl;
};
})(),
} )(),
_create: function() {
var that = this,
@ -73,24 +89,23 @@ return $.widget( "ui.tabs", {
this.running = false;
this.element
.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
.toggleClass( "ui-tabs-collapsible", options.collapsible );
this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
this._processTabs();
options.active = this._initialActive();
// Take disabling tabs via class attribute from HTML
// into account and update option properly.
if ( $.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
if ( Array.isArray( options.disabled ) ) {
options.disabled = $.uniqueSort( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
})
} )
) ).sort();
}
// check for length avoids error when initializing empty list
// Check for length avoids error when initializing empty list
if ( this.options.active !== false && this.anchors.length ) {
this.active = this._findActive( options.active );
} else {
@ -110,28 +125,29 @@ return $.widget( "ui.tabs", {
locationHash = location.hash.substring( 1 );
if ( active === null ) {
// check the fragment identifier in the URL
if ( locationHash ) {
this.tabs.each(function( i, tab ) {
this.tabs.each( function( i, tab ) {
if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
active = i;
return false;
}
});
} );
}
// check for a tab marked active via a class
// Check for a tab marked active via a class
if ( active === null ) {
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
}
// no active tab, set to false
// No active tab, set to false
if ( active === null || active === -1 ) {
active = this.tabs.length ? 0 : false;
}
}
// handle numbers: negative, out of range
// Handle numbers: negative, out of range
if ( active !== false ) {
active = this.tabs.index( this.tabs.eq( active ) );
if ( active === -1 ) {
@ -139,7 +155,7 @@ return $.widget( "ui.tabs", {
}
}
// don't allow collapsible: false and active: false
// Don't allow collapsible: false and active: false
if ( !collapsible && active === false && this.anchors.length ) {
active = 0;
}
@ -155,7 +171,7 @@ return $.widget( "ui.tabs", {
},
_tabKeydown: function( event ) {
var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
selectedIndex = this.tabs.index( focusedTab ),
goingForward = true;
@ -164,36 +180,39 @@ return $.widget( "ui.tabs", {
}
switch ( event.keyCode ) {
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward = false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex = this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex = 0;
break;
case $.ui.keyCode.SPACE:
// Activate only, no collapsing
event.preventDefault();
clearTimeout( this.activating );
this._activate( selectedIndex );
return;
case $.ui.keyCode.ENTER:
// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();
clearTimeout( this.activating );
// Determine if we should collapse or activate
this._activate( selectedIndex === this.options.active ? false : selectedIndex );
return;
default:
return;
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward = false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex = this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex = 0;
break;
case $.ui.keyCode.SPACE:
// Activate only, no collapsing
event.preventDefault();
clearTimeout( this.activating );
this._activate( selectedIndex );
return;
case $.ui.keyCode.ENTER:
// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();
clearTimeout( this.activating );
// Determine if we should collapse or activate
this._activate( selectedIndex === this.options.active ? false : selectedIndex );
return;
default:
return;
}
// Focus the appropriate tab, based on which key was pressed
@ -210,7 +229,7 @@ return $.widget( "ui.tabs", {
focusedTab.attr( "aria-selected", "false" );
this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
this.activating = this._delay(function() {
this.activating = this._delay( function() {
this.option( "active", selectedIndex );
}, this.delay );
}
@ -224,7 +243,7 @@ return $.widget( "ui.tabs", {
// Ctrl+up moves focus to the current tab
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
event.preventDefault();
this.active.focus();
this.active.trigger( "focus" );
}
},
@ -262,27 +281,23 @@ return $.widget( "ui.tabs", {
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).focus();
this.tabs.eq( index ).trigger( "focus" );
return index;
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
if ( key === "disabled" ) {
// don't use the widget factory's disabled handling
this._setupDisabled( value );
return;
}
this._super( key, value);
this._super( key, value );
if ( key === "collapsible" ) {
this.element.toggleClass( "ui-tabs-collapsible", value );
this._toggleClass( "ui-tabs-collapsible", null, value );
// Setting collapsible: false while collapsed; open first panel
if ( !value && this.options.active === false ) {
this._activate( 0 );
@ -306,30 +321,35 @@ return $.widget( "ui.tabs", {
var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
// Get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
return lis.index( tab );
});
} );
this._processTabs();
// was collapsed or no tabs
// Was collapsed or no tabs
if ( options.active === false || !this.anchors.length ) {
options.active = false;
this.active = $();
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
// all remaining tabs are disabled
if ( this.tabs.length === options.disabled.length ) {
options.active = false;
this.active = $();
// activate previous tab
} else {
this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
}
// was active, active tab still exists
} else {
// make sure active index is correct
options.active = this.tabs.index( this.active );
}
@ -338,37 +358,37 @@ return $.widget( "ui.tabs", {
},
_refresh: function() {
this._setupDisabled( this.options.disabled );
this._setOptionDisabled( this.options.disabled );
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );
this.tabs.not( this.active ).attr({
this.tabs.not( this.active ).attr( {
"aria-selected": "false",
"aria-expanded": "false",
tabIndex: -1
});
} );
this.panels.not( this._getPanelForTab( this.active ) )
.hide()
.attr({
.attr( {
"aria-hidden": "true"
});
} );
// Make sure one tab is in the tab order
if ( !this.active.length ) {
this.tabs.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active
.addClass( "ui-tabs-active ui-state-active" )
.attr({
.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
} );
this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
this._getPanelForTab( this.active )
.show()
.attr({
.attr( {
"aria-hidden": "false"
});
} );
}
},
@ -378,60 +398,62 @@ return $.widget( "ui.tabs", {
prevAnchors = this.anchors,
prevPanels = this.panels;
this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.attr( "role", "tablist" )
this.tablist = this._getList().attr( "role", "tablist" );
this._addClass( this.tablist, "ui-tabs-nav",
"ui-helper-reset ui-helper-clearfix ui-widget-header" );
// Prevent users from focusing disabled tabs via click
.delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
// Prevent users from focusing disabled tabs via click
this.tablist
.on( "mousedown" + this.eventNamespace, "> li", function( event ) {
if ( $( this ).is( ".ui-state-disabled" ) ) {
event.preventDefault();
}
})
} )
// support: IE <9
// Support: IE <9
// Preventing the default action in mousedown doesn't prevent IE
// from focusing the element, so if the anchor gets focused, blur.
// We don't have to worry about focusing the previously focused
// element since clicking on a non-focusable element should focus
// the body anyway.
.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
.on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
}
});
} );
this.tabs = this.tablist.find( "> li:has(a[href])" )
.addClass( "ui-state-default ui-corner-top" )
.attr({
.attr( {
role: "tab",
tabIndex: -1
});
} );
this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
this.anchors = this.tabs.map(function() {
return $( "a", this )[ 0 ];
})
.addClass( "ui-tabs-anchor" )
.attr({
role: "presentation",
this.anchors = this.tabs.map( function() {
return $( "a", this )[ 0 ];
} )
.attr( {
tabIndex: -1
});
} );
this._addClass( this.anchors, "ui-tabs-anchor" );
this.panels = $();
this.anchors.each(function( i, anchor ) {
this.anchors.each( function( i, anchor ) {
var selector, panel, panelId,
anchorId = $( anchor ).uniqueId().attr( "id" ),
tab = $( anchor ).closest( "li" ),
originalAriaControls = tab.attr( "aria-controls" );
// inline tab
// Inline tab
if ( that._isLocal( anchor ) ) {
selector = anchor.hash;
panelId = selector.substring( 1 );
panel = that.element.find( that._sanitizeSelector( selector ) );
// remote tab
} else {
// If the tab doesn't already have aria-controls,
// generate an id by using a throw-away element
panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
@ -444,22 +466,21 @@ return $.widget( "ui.tabs", {
panel.attr( "aria-live", "polite" );
}
if ( panel.length) {
if ( panel.length ) {
that.panels = that.panels.add( panel );
}
if ( originalAriaControls ) {
tab.data( "ui-tabs-aria-controls", originalAriaControls );
}
tab.attr({
tab.attr( {
"aria-controls": panelId,
"aria-labelledby": anchorId
});
} );
panel.attr( "aria-labelledby", anchorId );
});
} );
this.panels
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.attr( "role", "tabpanel" );
this.panels.attr( "role", "tabpanel" );
this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
// Avoid memory leaks (#10056)
if ( prevTabs ) {
@ -469,20 +490,21 @@ return $.widget( "ui.tabs", {
}
},
// allow overriding how to find the list for rare usage scenarios (#7715)
// Allow overriding how to find the list for rare usage scenarios (#7715)
_getList: function() {
return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
},
_createPanel: function( id ) {
return $( "<div>" )
.attr( "id", id )
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.data( "ui-tabs-destroy", true );
},
_setupDisabled: function( disabled ) {
if ( $.isArray( disabled ) ) {
_setOptionDisabled: function( disabled ) {
var currentItem, li, i;
if ( Array.isArray( disabled ) ) {
if ( !disabled.length ) {
disabled = false;
} else if ( disabled.length === this.anchors.length ) {
@ -490,37 +512,40 @@ return $.widget( "ui.tabs", {
}
}
// disable tabs
for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
// Disable tabs
for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
currentItem = $( li );
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
$( li )
.addClass( "ui-state-disabled" )
.attr( "aria-disabled", "true" );
currentItem.attr( "aria-disabled", "true" );
this._addClass( currentItem, null, "ui-state-disabled" );
} else {
$( li )
.removeClass( "ui-state-disabled" )
.removeAttr( "aria-disabled" );
currentItem.removeAttr( "aria-disabled" );
this._removeClass( currentItem, null, "ui-state-disabled" );
}
}
this.options.disabled = disabled;
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
disabled === true );
},
_setupEvents: function( event ) {
var events = {};
if ( event ) {
$.each( event.split(" "), function( index, eventName ) {
$.each( event.split( " " ), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
} );
}
this._off( this.anchors.add( this.tabs ).add( this.panels ) );
// Always prevent the default action, even when disabled
this._on( true, this.anchors, {
click: function( event ) {
event.preventDefault();
}
});
} );
this._on( this.anchors, events );
this._on( this.tabs, { keydown: "_tabKeydown" } );
this._on( this.panels, { keydown: "_panelKeydown" } );
@ -537,7 +562,7 @@ return $.widget( "ui.tabs", {
maxHeight = parent.height();
maxHeight -= this.element.outerHeight() - this.element.height();
this.element.siblings( ":visible" ).each(function() {
this.element.siblings( ":visible" ).each( function() {
var elem = $( this ),
position = elem.css( "position" );
@ -545,22 +570,22 @@ return $.widget( "ui.tabs", {
return;
}
maxHeight -= elem.outerHeight( true );
});
} );
this.element.children().not( this.panels ).each(function() {
this.element.children().not( this.panels ).each( function() {
maxHeight -= $( this ).outerHeight( true );
});
} );
this.panels.each(function() {
this.panels.each( function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
} )
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.panels.each(function() {
this.panels.each( function() {
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
}).height( maxHeight );
} ).height( maxHeight );
}
},
@ -583,12 +608,16 @@ return $.widget( "ui.tabs", {
event.preventDefault();
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
@ -611,7 +640,7 @@ return $.widget( "ui.tabs", {
this._toggle( event, eventData );
},
// handles show/hide for selecting tabs
// Handles show/hide for selecting tabs
_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
@ -625,7 +654,7 @@ return $.widget( "ui.tabs", {
}
function show() {
eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
if ( toShow.length && that.options.show ) {
that._show( toShow, that.options.show, complete );
@ -635,63 +664,66 @@ return $.widget( "ui.tabs", {
}
}
// start out by hiding, then showing, then completing
// Start out by hiding, then showing, then completing
if ( toHide.length && this.options.hide ) {
this._hide( toHide, this.options.hide, function() {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
that._removeClass( eventData.oldTab.closest( "li" ),
"ui-tabs-active", "ui-state-active" );
show();
});
} );
} else {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
this._removeClass( eventData.oldTab.closest( "li" ),
"ui-tabs-active", "ui-state-active" );
toHide.hide();
show();
}
toHide.attr( "aria-hidden", "true" );
eventData.oldTab.attr({
eventData.oldTab.attr( {
"aria-selected": "false",
"aria-expanded": "false"
});
} );
// If we're switching tabs, remove the old tab from the tab order.
// If we're opening from collapsed state, remove the previous tab from the tab order.
// If we're collapsing, then keep the collapsing tab in the tab order.
if ( toShow.length && toHide.length ) {
eventData.oldTab.attr( "tabIndex", -1 );
} else if ( toShow.length ) {
this.tabs.filter(function() {
this.tabs.filter( function() {
return $( this ).attr( "tabIndex" ) === 0;
})
.attr( "tabIndex", -1 );
} )
.attr( "tabIndex", -1 );
}
toShow.attr( "aria-hidden", "false" );
eventData.newTab.attr({
eventData.newTab.attr( {
"aria-selected": "true",
"aria-expanded": "true",
tabIndex: 0
});
} );
},
_activate: function( index ) {
var anchor,
active = this._findActive( index );
// trying to activate the already active panel
// Trying to activate the already active panel
if ( active[ 0 ] === this.active[ 0 ] ) {
return;
}
// trying to collapse, simulate a click on the current active header
// Trying to collapse, simulate a click on the current active header
if ( !active.length ) {
active = this.active;
}
anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
this._eventHandler({
this._eventHandler( {
target: anchor,
currentTarget: anchor,
preventDefault: $.noop
});
} );
},
_findActive: function( index ) {
@ -699,9 +731,11 @@ return $.widget( "ui.tabs", {
},
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
index = this.anchors.index( this.anchors.filter( "[href$='" +
$.escapeSelector( index ) + "']" ) );
}
return index;
@ -712,39 +746,24 @@ return $.widget( "ui.tabs", {
this.xhr.abort();
}
this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
this.tablist
.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.removeAttr( "role" );
.removeAttr( "role" )
.off( this.eventNamespace );
this.anchors
.removeClass( "ui-tabs-anchor" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeAttr( "role tabIndex" )
.removeUniqueId();
this.tablist.unbind( this.eventNamespace );
this.tabs.add( this.panels ).each(function() {
this.tabs.add( this.panels ).each( function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
$( this )
.removeClass( "ui-state-default ui-state-active ui-state-disabled " +
"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-live" )
.removeAttr( "aria-busy" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-expanded" )
.removeAttr( "role" );
$( this ).removeAttr( "role tabIndex " +
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
}
});
} );
this.tabs.each(function() {
this.tabs.each( function() {
var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) {
@ -754,7 +773,7 @@ return $.widget( "ui.tabs", {
} else {
li.removeAttr( "aria-controls" );
}
});
} );
this.panels.show();
@ -773,17 +792,17 @@ return $.widget( "ui.tabs", {
disabled = false;
} else {
index = this._getIndex( index );
if ( $.isArray( disabled ) ) {
if ( Array.isArray( disabled ) ) {
disabled = $.map( disabled, function( num ) {
return num !== index ? num : null;
});
} );
} else {
disabled = $.map( this.tabs, function( li, num ) {
return num !== index ? num : null;
});
} );
}
}
this._setupDisabled( disabled );
this._setOptionDisabled( disabled );
},
disable: function( index ) {
@ -799,13 +818,13 @@ return $.widget( "ui.tabs", {
if ( $.inArray( index, disabled ) !== -1 ) {
return;
}
if ( $.isArray( disabled ) ) {
if ( Array.isArray( disabled ) ) {
disabled = $.merge( [ index ], disabled ).sort();
} else {
disabled = [ index ];
}
}
this._setupDisabled( disabled );
this._setOptionDisabled( disabled );
},
load: function( index, event ) {
@ -823,7 +842,7 @@ return $.widget( "ui.tabs", {
that.panels.stop( false, true );
}
tab.removeClass( "ui-tabs-loading" );
that._removeClass( tab, "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
@ -831,45 +850,50 @@ return $.widget( "ui.tabs", {
}
};
// not remote
// Not remote
if ( this._isLocal( anchor[ 0 ] ) ) {
return;
}
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
// support: jQuery <1.8
// Support: jQuery <1.8
// jQuery <1.8 returns false if the request is canceled in beforeSend,
// but as of 1.8, $.ajax() always returns a jqXHR object.
if ( this.xhr && this.xhr.statusText !== "canceled" ) {
tab.addClass( "ui-tabs-loading" );
this._addClass( tab, "ui-tabs-loading" );
panel.attr( "aria-busy", "true" );
this.xhr
.done(function( response, status, jqXHR ) {
.done( function( response, status, jqXHR ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
setTimeout( function() {
panel.html( response );
that._trigger( "load", event, eventData );
complete( jqXHR, status );
}, 1 );
})
.fail(function( jqXHR, status ) {
} )
.fail( function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
setTimeout( function() {
complete( jqXHR, status );
}, 1 );
});
} );
}
},
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
url: anchor.attr( "href" ),
// Support: IE <11 only
// Strip any hash that exists to prevent errors with the Ajax request
url: anchor.attr( "href" ).replace( /#.*$/, "" ),
beforeSend: function( jqXHR, settings ) {
return that._trigger( "beforeLoad", event,
$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
@ -881,6 +905,21 @@ return $.widget( "ui.tabs", {
var id = $( tab ).attr( "aria-controls" );
return this.element.find( this._sanitizeSelector( "#" + id ) );
}
});
} );
}));
// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for ui-tab class (now ui-tabs-tab)
$.widget( "ui.tabs", $.ui.tabs, {
_processTabs: function() {
this._superApply( arguments );
this._addClass( this.tabs, "ui-tab" );
}
} );
}
return $.ui.tabs;
} );

View file

@ -1,41 +1,57 @@
/*!
* jQuery UI Tooltip 1.11.4
* jQuery UI Tooltip @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/tooltip/
*/
(function( factory ) {
//>>label: Tooltip
//>>group: Widgets
//>>description: Shows additional information for any element on hover or focus.
//>>docs: http://api.jqueryui.com/tooltip/
//>>demos: http://jqueryui.com/tooltip/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tooltip.css
//>>css.theme: ../../themes/base/theme.css
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
define( [
"jquery",
"./core",
"./widget",
"./position"
"../keycode",
"../position",
"../unique-id",
"../version",
"../widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
return $.widget( "ui.tooltip", {
version: "1.11.4",
$.widget( "ui.tooltip", {
version: "@VERSION",
options: {
classes: {
"ui-tooltip": "ui-corner-all ui-widget-shadow"
},
content: function() {
// support: IE<9, Opera in jQuery <1.7
// .text() can't accept undefined, so coerce to a string
var title = $( this ).attr( "title" ) || "";
var title = $( this ).attr( "title" );
// Escape title, since we're going from an attribute to raw HTML
return $( "<a>" ).text( title ).html();
},
hide: true,
// Disabled elements have inconsistent behavior across browsers (#8661)
items: "[title]:not([disabled])",
position: {
@ -44,25 +60,24 @@ return $.widget( "ui.tooltip", {
collision: "flipfit flip"
},
show: true,
tooltipClass: null,
track: false,
// callbacks
// Callbacks
close: null,
open: null
},
_addDescribedBy: function( elem, id ) {
var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
describedby.push( id );
elem
.data( "ui-tooltip-id", id )
.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
.attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) );
},
_removeDescribedBy: function( elem ) {
var id = elem.data( "ui-tooltip-id" ),
describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
index = $.inArray( id, describedby );
if ( index !== -1 ) {
@ -70,7 +85,7 @@ return $.widget( "ui.tooltip", {
}
elem.removeData( "ui-tooltip-id" );
describedby = $.trim( describedby.join( " " ) );
describedby = String.prototype.trim.call( describedby.join( " " ) );
if ( describedby ) {
elem.attr( "aria-describedby", describedby );
} else {
@ -79,10 +94,10 @@ return $.widget( "ui.tooltip", {
},
_create: function() {
this._on({
this._on( {
mouseover: "open",
focusin: "open"
});
} );
// IDs of generated tooltips, needed for destroy
this.tooltips = {};
@ -90,74 +105,75 @@ return $.widget( "ui.tooltip", {
// IDs of parent tooltips where we removed the title attribute
this.parents = {};
if ( this.options.disabled ) {
this._disable();
}
// Append the aria-live region so tooltips announce correctly
this.liveRegion = $( "<div>" )
.attr({
.attr( {
role: "log",
"aria-live": "assertive",
"aria-relevant": "additions"
})
.addClass( "ui-helper-hidden-accessible" )
} )
.appendTo( this.document[ 0 ].body );
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
this.disabledTitles = $( [] );
},
_setOption: function( key, value ) {
var that = this;
if ( key === "disabled" ) {
this[ value ? "_disable" : "_enable" ]();
this.options[ key ] = value;
// disable element style changes
return;
}
this._super( key, value );
if ( key === "content" ) {
$.each( this.tooltips, function( id, tooltipData ) {
that._updateContent( tooltipData.element );
});
} );
}
},
_setOptionDisabled: function( value ) {
this[ value ? "_disable" : "_enable" ]();
},
_disable: function() {
var that = this;
// close open tooltips
// Close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
var event = $.Event( "blur" );
event.target = event.currentTarget = tooltipData.element[ 0 ];
that.close( event, true );
});
} );
// remove title attributes to prevent native tooltips
this.element.find( this.options.items ).addBack().each(function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
element
.data( "ui-tooltip-title", element.attr( "title" ) )
.removeAttr( "title" );
}
});
// Remove title attributes to prevent native tooltips
this.disabledTitles = this.disabledTitles.add(
this.element.find( this.options.items ).addBack()
.filter( function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
return element
.data( "ui-tooltip-title", element.attr( "title" ) )
.removeAttr( "title" );
}
} )
);
},
_enable: function() {
// restore title attributes
this.element.find( this.options.items ).addBack().each(function() {
this.disabledTitles.each( function() {
var element = $( this );
if ( element.data( "ui-tooltip-title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
});
} );
this.disabledTitles = $( [] );
},
open: function( event ) {
var that = this,
target = $( event ? event.target : this.element )
// we need closest here due to mouseover bubbling,
// but always pointing at the same event target
.closest( this.options.items );
@ -173,9 +189,9 @@ return $.widget( "ui.tooltip", {
target.data( "ui-tooltip-open", true );
// kill parent tooltips, custom or native, for hover
// Kill parent tooltips, custom or native, for hover
if ( event && event.type === "mouseover" ) {
target.parents().each(function() {
target.parents().each( function() {
var parent = $( this ),
blurEvent;
if ( parent.data( "ui-tooltip-open" ) ) {
@ -191,7 +207,7 @@ return $.widget( "ui.tooltip", {
};
parent.attr( "title", "" );
}
});
} );
}
this._registerCloseHandlers( event, target );
@ -204,22 +220,23 @@ return $.widget( "ui.tooltip", {
that = this,
eventType = event ? event.type : null;
if ( typeof contentOption === "string" ) {
if ( typeof contentOption === "string" || contentOption.nodeType ||
contentOption.jquery ) {
return this._open( event, target, contentOption );
}
content = contentOption.call( target[0], function( response ) {
content = contentOption.call( target[ 0 ], function( response ) {
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay(function() {
that._delay( function() {
// Ignore async response if tooltip was closed already
if ( !target.data( "ui-tooltip-open" ) ) {
return;
}
// jQuery creates a special event for focusin when it doesn't
// JQuery creates a special event for focusin when it doesn't
// exist natively. To improve performance, the native event
// object is reused and the type is changed. Therefore, we can't
// rely on the type being correct after the event finished
@ -228,8 +245,8 @@ return $.widget( "ui.tooltip", {
event.type = eventType;
}
this._open( event, target, response );
});
});
} );
} );
if ( content ) {
this._open( event, target, content );
}
@ -251,7 +268,7 @@ return $.widget( "ui.tooltip", {
return;
}
// if we have a title, clear it to prevent the native tooltip
// If we have a title, clear it to prevent the native tooltip
// we have to check first to avoid defining a title if none exists
// (we don't want to cause an element to start matching [title])
//
@ -275,13 +292,10 @@ return $.widget( "ui.tooltip", {
// JAWS announces deletions even when aria-relevant="additions"
// Voiceover will sometimes re-read the entire log region's contents from the beginning
this.liveRegion.children().hide();
if ( content.clone ) {
a11yContent = content.clone();
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
} else {
a11yContent = content;
}
$( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
a11yContent.appendTo( this.liveRegion );
function position( event ) {
positionOption.of = event;
@ -293,11 +307,12 @@ return $.widget( "ui.tooltip", {
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
this._on( this.document, {
mousemove: position
});
} );
// trigger once to override element-relative positioning
position( event );
} else {
tooltip.position( $.extend({
tooltip.position( $.extend( {
of: target
}, this.options.position ) );
}
@ -305,16 +320,18 @@ return $.widget( "ui.tooltip", {
tooltip.hide();
this._show( tooltip, this.options.show );
// Handle tracking tooltips that are shown with a delay (#8644). As soon
// as the tooltip is visible, position the tooltip using the most recent
// event.
if ( this.options.show && this.options.show.delay ) {
delayedShow = this.delayedShow = setInterval(function() {
// Adds the check to add the timers only when both delay and track options are set (#14682)
if ( this.options.track && this.options.show && this.options.show.delay ) {
delayedShow = this.delayedShow = setInterval( function() {
if ( tooltip.is( ":visible" ) ) {
position( positionOption.of );
clearInterval( delayedShow );
}
}, $.fx.interval );
}, 13 );
}
this._trigger( "open", event, { tooltip: tooltip } );
@ -324,8 +341,8 @@ return $.widget( "ui.tooltip", {
var events = {
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
fakeEvent.currentTarget = target[0];
var fakeEvent = $.Event( event );
fakeEvent.currentTarget = target[ 0 ];
this.close( fakeEvent, true );
}
}
@ -335,7 +352,10 @@ return $.widget( "ui.tooltip", {
// tooltips will handle this in destroy.
if ( target[ 0 ] !== this.element[ 0 ] ) {
events.remove = function() {
this._removeTooltip( this._find( target ).tooltip );
var targetElement = this._find( target );
if ( targetElement ) {
this._removeTooltip( targetElement.tooltip );
}
};
}
@ -367,7 +387,7 @@ return $.widget( "ui.tooltip", {
tooltip = tooltipData.tooltip;
// disabling closes the tooltip, so we need to track when we're closing
// Disabling closes the tooltip, so we need to track when we're closing
// to avoid an infinite loop in case the tooltip becomes disabled on close
if ( tooltipData.closing ) {
return;
@ -376,7 +396,7 @@ return $.widget( "ui.tooltip", {
// Clear the interval for delayed tracking tooltips
clearInterval( this.delayedShow );
// only set title if we had one before (see comment in _open())
// Only set title if we had one before (see comment in _open())
// If the title attribute has changed since open(), don't restore
if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
@ -388,7 +408,7 @@ return $.widget( "ui.tooltip", {
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
that._removeTooltip( $( this ) );
});
} );
target.removeData( "ui-tooltip-open" );
this._off( target, "mouseleave focusout keyup" );
@ -403,7 +423,7 @@ return $.widget( "ui.tooltip", {
$.each( this.parents, function( id, parent ) {
$( parent.element ).attr( "title", parent.title );
delete that.parents[ id ];
});
} );
}
tooltipData.closing = true;
@ -414,17 +434,14 @@ return $.widget( "ui.tooltip", {
},
_tooltip: function( element ) {
var tooltip = $( "<div>" )
.attr( "role", "tooltip" )
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
( this.options.tooltipClass || "" ) ),
var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
content = $( "<div>" ).appendTo( tooltip ),
id = tooltip.uniqueId().attr( "id" );
$( "<div>" )
.addClass( "ui-tooltip-content" )
.appendTo( tooltip );
this._addClass( content, "ui-tooltip-content" );
this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
tooltip.appendTo( this.document[0].body );
tooltip.appendTo( this._appendTo( element ) );
return this.tooltips[ id ] = {
element: element,
@ -438,15 +455,30 @@ return $.widget( "ui.tooltip", {
},
_removeTooltip: function( tooltip ) {
// Clear the interval for delayed tracking tooltips
clearInterval( this.delayedShow );
tooltip.remove();
delete this.tooltips[ tooltip.attr( "id" ) ];
},
_appendTo: function( target ) {
var element = target.closest( ".ui-front, dialog" );
if ( !element.length ) {
element = this.document[ 0 ].body;
}
return element;
},
_destroy: function() {
var that = this;
// close open tooltips
// Close open tooltips
$.each( this.tooltips, function( id, tooltipData ) {
// Delegate to close method to handle common cleanup
var event = $.Event( "blur" ),
element = tooltipData.element;
@ -459,15 +491,37 @@ return $.widget( "ui.tooltip", {
// Restore the title
if ( element.data( "ui-tooltip-title" ) ) {
// If the title attribute has changed since open(), don't restore
if ( !element.attr( "title" ) ) {
element.attr( "title", element.data( "ui-tooltip-title" ) );
}
element.removeData( "ui-tooltip-title" );
}
});
} );
this.liveRegion.remove();
}
});
} );
}));
// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for tooltipClass option
$.widget( "ui.tooltip", $.ui.tooltip, {
options: {
tooltipClass: null
},
_tooltip: function() {
var tooltipData = this._superApply( arguments );
if ( this.options.tooltipClass ) {
tooltipData.tooltip.addClass( this.options.tooltipClass );
}
return tooltipData;
}
} );
}
return $.ui.tooltip;
} );

View file

@ -0,0 +1,52 @@
/*!
* jQuery UI Unique ID @VERSION
* http://jqueryui.com
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: uniqueId
//>>group: Core
//>>description: Functions to generate and remove uniqueId's
//>>docs: http://api.jqueryui.com/uniqueId/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
return $.fn.extend( {
uniqueId: ( function() {
var uuid = 0;
return function() {
return this.each( function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
} );
};
} )(),
removeUniqueId: function() {
return this.each( function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
} );
}
} );
} );

20
include/thirdparty/jquery_ui/version.js vendored Normal file
View file

@ -0,0 +1,20 @@
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} )( function( $ ) {
"use strict";
$.ui = $.ui || {};
return $.ui.version = "@VERSION";
} );

View file

@ -1,113 +1,130 @@
/*!
* jQuery UI Widget 1.11.4
* jQuery UI Widget @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function( factory ) {
//>>label: Widget
//>>group: Core
//>>description: Provides a factory for creating stateful widgets with a common API.
//>>docs: http://api.jqueryui.com/jQuery.widget/
//>>demos: http://jqueryui.com/widget/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
} )( function( $ ) {
"use strict";
var widget_uuid = 0,
widget_slice = Array.prototype.slice;
var widgetUuid = 0;
var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
var widgetSlice = Array.prototype.slice;
$.cleanData = (function( orig ) {
$.cleanData = ( function( orig ) {
return function( elems ) {
var events, elem, i;
for ( i = 0; (elem = elems[i]) != null; i++ ) {
try {
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
// http://bugs.jquery.com/ticket/8235
} catch ( e ) {}
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
}
orig( elems );
};
})( $.cleanData );
} )( $.cleanData );
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
var existingConstructor, constructor, basePrototype;
// ProxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
var proxiedPrototype = {};
var namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
var fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
if ( Array.isArray( prototype ) ) {
prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
}
// Create selector for plugin
$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// allow instantiation without "new" keyword
if ( !this._createWidget ) {
// Allow instantiation without "new" keyword
if ( !this || !this._createWidget ) {
return new constructor( options, element );
}
// allow instantiation without initializing for simple inheritance
// Allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// extend with the existing constructor to carry over any static properties
// Extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// Copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// track widgets that inherit from this widget in case this widget is
// Track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
} );
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// We need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
if ( typeof value !== "function" ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
},
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
};
proxiedPrototype[ prop ] = ( function() {
function _super() {
return base.prototype[ prop ].apply( this, arguments );
}
function _superApply( args ) {
return base.prototype[ prop ].apply( this, args );
}
return function() {
var __super = this._super,
__superApply = this._superApply,
returnValue;
var __super = this._super;
var __superApply = this._superApply;
var returnValue;
this._super = _super;
this._superApply = _superApply;
@ -119,19 +136,20 @@ $.widget = function( name, base, prototype ) {
return returnValue;
};
})();
});
} )();
} );
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
} );
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
@ -141,11 +159,13 @@ $.widget = function( name, base, prototype ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// Redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
});
// remove the list of existing child constructors from the old constructor
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
child._proto );
} );
// Remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
@ -158,21 +178,25 @@ $.widget = function( name, base, prototype ) {
};
$.widget.extend = function( target ) {
var input = widget_slice.call( arguments, 1 ),
inputIndex = 0,
inputLength = input.length,
key,
value;
var input = widgetSlice.call( arguments, 1 );
var inputIndex = 0;
var inputLength = input.length;
var key;
var value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
@ -186,41 +210,56 @@ $.widget.extend = function( target ) {
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = widget_slice.call( arguments, 1 ),
returnValue = this;
var isMethodCall = typeof options === "string";
var args = widgetSlice.call( arguments, 1 );
var returnValue = this;
if ( isMethodCall ) {
this.each(function() {
var methodValue,
instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
});
// If this is an empty collection, we need to have the instance method
// return undefined instead of the jQuery instance
if ( !this.length && options === "instance" ) {
returnValue = undefined;
} else {
this.each( function() {
var methodValue;
var instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name +
" prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( typeof instance[ options ] !== "function" ||
options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name +
" widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
} );
}
} else {
// Allow multiple hashes to be passed on init
if ( args.length ) {
options = $.widget.extend.apply( null, [ options ].concat(args) );
options = $.widget.extend.apply( null, [ options ].concat( args ) );
}
this.each(function() {
this.each( function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} );
@ -230,7 +269,7 @@ $.widget.bridge = function( name, object ) {
} else {
$.data( this, fullName, new object( options, this ) );
}
});
} );
}
return returnValue;
@ -244,21 +283,25 @@ $.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
classes: {},
disabled: false,
// callbacks
// Callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = widget_uuid++;
this.uuid = widgetUuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.bindings = $();
this.hoverable = $();
this.focusable = $();
this.classesElementLookup = {};
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
@ -268,13 +311,15 @@ $.Widget.prototype = {
this.destroy();
}
}
});
} );
this.document = $( element.style ?
// element within the document
// Element within the document
element.ownerDocument :
// element is window or document
// Element is window or document
element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
}
this.options = $.widget.extend( {},
@ -283,36 +328,46 @@ $.Widget.prototype = {
options );
this._create();
if ( this.options.disabled ) {
this._setOptionDisabled( this.options.disabled );
}
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
_getCreateOptions: function() {
return {};
},
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
var that = this;
this._destroy();
// we can probably remove the unbind calls in 2.0
$.each( this.classesElementLookup, function( key, value ) {
that._removeClass( value, key );
} );
// We can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
.removeData( this.widgetFullName )
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
.off( this.eventNamespace )
.removeData( this.widgetFullName );
this.widget()
.unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
.off( this.eventNamespace )
.removeAttr( "aria-disabled" );
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
// Clean up events and states
this.bindings.off( this.eventNamespace );
},
_destroy: $.noop,
widget: function() {
@ -320,18 +375,20 @@ $.Widget.prototype = {
},
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
var options = key;
var parts;
var curOption;
var i;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
// Don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
@ -358,6 +415,7 @@ $.Widget.prototype = {
return this;
},
_setOptions: function( options ) {
var key;
@ -367,42 +425,172 @@ $.Widget.prototype = {
return this;
},
_setOption: function( key, value ) {
if ( key === "classes" ) {
this._setOptionClasses( value );
}
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
.toggleClass( this.widgetFullName + "-disabled", !!value );
// If the widget is becoming disabled, then nothing is interactive
if ( value ) {
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
}
this._setOptionDisabled( value );
}
return this;
},
enable: function() {
return this._setOptions({ disabled: false });
_setOptionClasses: function( value ) {
var classKey, elements, currentElements;
for ( classKey in value ) {
currentElements = this.classesElementLookup[ classKey ];
if ( value[ classKey ] === this.options.classes[ classKey ] ||
!currentElements ||
!currentElements.length ) {
continue;
}
// We are doing this to create a new jQuery object because the _removeClass() call
// on the next line is going to destroy the reference to the current elements being
// tracked. We need to save a copy of this collection so that we can add the new classes
// below.
elements = $( currentElements.get() );
this._removeClass( currentElements, classKey );
// We don't use _addClass() here, because that uses this.options.classes
// for generating the string of classes. We want to use the value passed in from
// _setOption(), this is the new value of the classes option which was passed to
// _setOption(). We pass this value directly to _classes().
elements.addClass( this._classes( {
element: elements,
keys: classKey,
classes: value,
add: true
} ) );
}
},
_setOptionDisabled: function( value ) {
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
// If the widget is becoming disabled, then nothing is interactive
if ( value ) {
this._removeClass( this.hoverable, null, "ui-state-hover" );
this._removeClass( this.focusable, null, "ui-state-focus" );
}
},
enable: function() {
return this._setOptions( { disabled: false } );
},
disable: function() {
return this._setOptions({ disabled: true });
return this._setOptions( { disabled: true } );
},
_classes: function( options ) {
var full = [];
var that = this;
options = $.extend( {
element: this.element,
classes: this.options.classes || {}
}, options );
function bindRemoveEvent() {
var nodesToBind = [];
options.element.each( function( _, element ) {
var isTracked = $.map( that.classesElementLookup, function( elements ) {
return elements;
} )
.some( function( elements ) {
return elements.is( element );
} );
if ( !isTracked ) {
nodesToBind.push( element );
}
} );
that._on( $( nodesToBind ), {
remove: "_untrackClassesElement"
} );
}
function processClassString( classes, checkOption ) {
var current, i;
for ( i = 0; i < classes.length; i++ ) {
current = that.classesElementLookup[ classes[ i ] ] || $();
if ( options.add ) {
bindRemoveEvent();
current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
} else {
current = $( current.not( options.element ).get() );
}
that.classesElementLookup[ classes[ i ] ] = current;
full.push( classes[ i ] );
if ( checkOption && options.classes[ classes[ i ] ] ) {
full.push( options.classes[ classes[ i ] ] );
}
}
}
if ( options.keys ) {
processClassString( options.keys.match( /\S+/g ) || [], true );
}
if ( options.extra ) {
processClassString( options.extra.match( /\S+/g ) || [] );
}
return full.join( " " );
},
_untrackClassesElement: function( event ) {
var that = this;
$.each( that.classesElementLookup, function( key, value ) {
if ( $.inArray( event.target, value ) !== -1 ) {
that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
}
} );
this._off( $( event.target ) );
},
_removeClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, false );
},
_addClass: function( element, keys, extra ) {
return this._toggleClass( element, keys, extra, true );
},
_toggleClass: function( element, keys, extra, add ) {
add = ( typeof add === "boolean" ) ? add : extra;
var shift = ( typeof element === "string" || element === null ),
options = {
extra: shift ? keys : extra,
keys: shift ? element : keys,
element: shift ? this.element : element,
add: add
};
options.element.toggleClass( this._classes( options ), add );
return this;
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this;
var delegateElement;
var instance = this;
// no suppressDisabledCheck flag, shuffle arguments
// No suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
// No element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
@ -414,39 +602,41 @@ $.Widget.prototype = {
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// Allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// copy the guid so direct unbinding works
// Copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
var match = event.match( /^([\w:-]*)\s*(.*)$/ );
var eventName = match[ 1 ] + instance.eventNamespace;
var selector = match[ 2 ];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
delegateElement.on( eventName, selector, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
element.on( eventName, handlerProxy );
}
});
} );
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
element.off( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
@ -467,40 +657,41 @@ $.Widget.prototype = {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
$( event.currentTarget ).addClass( "ui-state-hover" );
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
},
mouseleave: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-hover" );
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
}
});
} );
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
$( event.currentTarget ).addClass( "ui-state-focus" );
this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
},
focusout: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-focus" );
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
}
});
} );
},
_trigger: function( type, event, data ) {
var prop, orig,
callback = this.options[ type ];
var prop, orig;
var callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// the original event may come from any element
// The original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// copy original event properties over to the new event
// Copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
@ -511,8 +702,8 @@ $.Widget.prototype = {
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
return !( typeof callback === "function" &&
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
@ -522,37 +713,44 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions,
effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
var hasOptions;
var effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
} else if ( options === true ) {
options = {};
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue(function( next ) {
element.queue( function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
});
} );
}
};
});
} );
return $.widget;
}));
} );

View file

@ -1,752 +0,0 @@
/*!
* jQuery Migrate - v1.4.1 - 2016-05-19
* Copyright jQuery Foundation and other contributors
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
jQuery.migrateVersion = "1.4.1";
var warnedAbout = {};
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;
// Show a message on the console so devs know we're active
if ( window.console && window.console.log ) {
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
}
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg) {
var console = window.console;
if ( !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
if ( Object.defineProperty ) {
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
// allow property to be overwritten in case some other plugin wants it
try {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
});
return;
} catch( err ) {
// IE8 is a dope about Object.defineProperty, can't warn there
}
}
// Non-ES5 (or broken) browser; just set the property
jQuery._definePropertyBroken = true;
obj[ prop ] = value;
}
if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
function() { return null; },
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
function() { return undefined; },
rnoType = /^(?:input|button)$/i,
rnoAttrNodeType = /^[238]$/,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
ruseDefault = /^(?:checked|selected)$/i;
// jQuery.attrFn
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
// Since pass is used internally, we only warn for new jQuery
// versions where there isn't a pass arg in the formal params
if ( oldAttr.length < 4 ) {
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
}
if ( elem && !rnoAttrNodeType.test( nType ) &&
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
return jQuery( elem )[ name ]( value );
}
}
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
}
// Restore boolHook for boolean property/attribute synchronization
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
jQuery.attrHooks[ lowerName ] = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" &&
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// Warn only for attributes that can remain distinct from their properties post-1.9
if ( ruseDefault.test( lowerName ) ) {
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
}
}
return oldAttr.call( jQuery, elem, name, value );
};
// attrHooks: value
jQuery.attrHooks.value = {
get: function( elem, name ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrGet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrSet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
oldParseJSON = jQuery.parseJSON,
rspaceAngle = /^\s*</,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Note: XSS check is done below after string is trimmed
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match, ret;
if ( selector && typeof selector === "string" ) {
if ( !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( !rspaceAngle.test( selector ) ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
// Consistently reject any HTML-like string starting with a hash (gh-9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
}
// Now process using loose rules; let pre-1.8 play too
// Is this a jQuery context? parseHTML expects a DOM element (#178)
if ( context && context.context && context.context.nodeType ) {
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this,
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
context || document, true ), context, rootjQuery );
}
}
}
ret = oldInit.apply( this, arguments );
// Fill in selector and context properties so .live() works
if ( selector && selector.selector !== undefined ) {
// A jQuery object, copy its properties
ret.selector = selector.selector;
ret.context = selector.context;
} else {
ret.selector = typeof selector === "string" ? selector : "";
if ( selector ) {
ret.context = selector.nodeType? selector : context || document;
}
}
return ret;
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
var findProp;
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
return oldParseJSON.apply( this, arguments );
};
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
// Don't clobber any existing jQuery.browser in case it's different
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
// Warn if the code tries to get jQuery.browser
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
return instance instanceof jQuerySub ?
instance :
jQuerySub( instance );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
migrateWarn( "jQuery.sub() is deprecated" );
return jQuerySub;
};
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
return this.length;
};
var internalSwapCall = false;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
if ( jQuery.swap ) {
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
if ( oldHook ) {
jQuery.cssHooks[ name ].get = function() {
var ret;
internalSwapCall = true;
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
return ret;
};
}
});
}
jQuery.swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
if ( !internalSwapCall ) {
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
}
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
converters: {
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
jQuery.fn.data = function( name ) {
var ret, evt,
elem = this[0];
// Handles 1.7 which has this behavior and 1.8 which doesn't
if ( elem && name === "events" && arguments.length === 1 ) {
ret = jQuery.data( elem, name );
evt = jQuery._data( elem, name );
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
return evt;
}
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i;
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
if ( !jQuery.clean ) {
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
migrateWarn("jQuery.clean() is deprecated");
var i, elem, handleScript, jsTags,
ret = [];
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
// Complex logic lifted directly from jQuery 1.8
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
oldToggle = jQuery.fn.toggle,
oldLive = jQuery.fn.live,
oldDie = jQuery.fn.die,
oldLoad = jQuery.fn.load,
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
return events;
}
if ( rhoverHack.test( events ) ) {
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
}
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
// Event props removed in 1.9, put them back if needed; no practical way to warn them
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
}
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
if ( jQuery.event.dispatch ) {
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
}
// Support for 'hover' pseudo-event and ajax event warnings
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( elem !== document && rajaxEvent.test( types ) ) {
migrateWarn( "AJAX events should be attached to document: " + types );
}
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
};
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
};
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.fn[ name ] = function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
}
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.bind.apply( this, args );
}
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
return this;
};
});
jQuery.fn.toggle = function( fn, fn2 ) {
// Don't mess with animation or css toggles
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
return oldToggle.apply( this, arguments );
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
};
jQuery.fn.live = function( types, data, fn ) {
migrateWarn("jQuery.fn.live() is deprecated");
if ( oldLive ) {
return oldLive.apply( this, arguments );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
};
jQuery.fn.die = function( types, fn ) {
migrateWarn("jQuery.fn.die() is deprecated");
if ( oldDie ) {
return oldDie.apply( this, arguments );
}
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
};
// Turn global events into document-triggered events
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
if ( !elem && !rajaxEvent.test( event ) ) {
migrateWarn( "Global events are undocumented and deprecated" );
}
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
};
jQuery.each( ajaxEvents.split("|"),
function( _, name ) {
jQuery.event.special[ name ] = {
setup: function() {
var elem = this;
// The document needs no shimming; must be !== for oldIE
if ( elem !== document ) {
jQuery.event.add( document, name + "." + jQuery.guid, function() {
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
});
jQuery._data( this, name, jQuery.guid++ );
}
return false;
},
teardown: function() {
if ( this !== document ) {
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
}
return false;
}
};
}
);
jQuery.event.special.ready = {
setup: function() {
if ( this === document ) {
migrateWarn( "'ready' event is deprecated" );
}
}
};
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
oldFnFind = jQuery.fn.find;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
return oldSelf.apply( this, arguments );
};
jQuery.fn.find = function( selector ) {
var ret = oldFnFind.apply( this, arguments );
ret.context = this.context;
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
};
// jQuery 1.6 did not support Callbacks, do not warn there
if ( jQuery.Callbacks ) {
var oldDeferred = jQuery.Deferred,
tuples = [
// action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory"),
jQuery.Callbacks("memory") ]
];
jQuery.Deferred = function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
migrateWarn( "deferred.pipe() is deprecated" );
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
});
});
fns = null;
}).promise();
};
deferred.isResolved = function() {
migrateWarn( "deferred.isResolved is deprecated" );
return deferred.state() === "resolved";
};
deferred.isRejected = function() {
migrateWarn( "deferred.isRejected is deprecated" );
return deferred.state() === "rejected";
};
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
};
}
})( jQuery, window );

File diff suppressed because one or more lines are too long

View file

@ -1,859 +0,0 @@
/*!
* jQuery Migrate - v3.3.2 - 2020-11-17T23:22Z
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], function( jQuery ) {
return factory( jQuery, window );
} );
} else if ( typeof module === "object" && module.exports ) {
// Node/CommonJS
// eslint-disable-next-line no-undef
module.exports = factory( require( "jquery" ), window );
} else {
// Browser globals
factory( jQuery, window );
}
} )( function( jQuery, window ) {
"use strict";
jQuery.migrateVersion = "3.3.2";
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
function compareVersions( v1, v2 ) {
var i,
rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
v1p = rVersionParts.exec( v1 ) || [ ],
v2p = rVersionParts.exec( v2 ) || [ ];
for ( i = 1; i <= 3; i++ ) {
if ( +v1p[ i ] > +v2p[ i ] ) {
return 1;
}
if ( +v1p[ i ] < +v2p[ i ] ) {
return -1;
}
}
return 0;
}
function jQueryVersionSince( version ) {
return compareVersions( jQuery.fn.jquery, version ) >= 0;
}
( function() {
// Support: IE9 only
// IE9 only creates console object when dev tools are first opened
// IE9 console is a host object, callable but doesn't have .apply()
if ( !window.console || !window.console.log ) {
return;
}
// Need jQuery 3.0.0+ and no older Migrate loaded
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) {
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
}
if ( jQuery.migrateWarnings ) {
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
}
// Show a message on the console so devs know we're active
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
} )();
var warnedAbout = {};
// By default each warning is only reported once.
jQuery.migrateDeduplicateWarnings = true;
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg ) {
var console = window.console;
if ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
} );
}
function migrateWarnFunc( obj, prop, newFunc, msg ) {
obj[ prop ] = function() {
migrateWarn( msg );
return newFunc.apply( this, arguments );
};
}
if ( window.document.compatMode === "BackCompat" ) {
// JQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var findProp,
class2type = {},
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
jQuery.fn.init = function( arg1 ) {
var args = Array.prototype.slice.call( arguments );
if ( typeof arg1 === "string" && arg1 === "#" ) {
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
migrateWarn( "jQuery( '#' ) is not a valid selector" );
args[ 0 ] = [];
}
return oldInit.apply( this, args );
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
window.document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
window.document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// The number of elements contained in the matched element set
migrateWarnFunc( jQuery.fn, "size", function() {
return this.length;
},
"jQuery.fn.size() is deprecated and removed; use the .length property" );
migrateWarnFunc( jQuery, "parseJSON", function() {
return JSON.parse.apply( null, arguments );
},
"jQuery.parseJSON is deprecated; use JSON.parse" );
migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
"jQuery.holdReady is deprecated" );
migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
"jQuery.unique is deprecated; use jQuery.uniqueSort" );
// Now jQuery.expr.pseudos is the standard incantation
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
// Prior to jQuery 3.1.1 there were internal refs so we don't warn there
if ( jQueryVersionSince( "3.1.1" ) ) {
migrateWarnFunc( jQuery, "trim", function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
"jQuery.trim is deprecated; use String.prototype.trim" );
}
// Prior to jQuery 3.2 there were internal refs so we don't warn there
if ( jQueryVersionSince( "3.2.0" ) ) {
migrateWarnFunc( jQuery, "nodeName", function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
"jQuery.nodeName is deprecated" );
migrateWarnFunc( jQuery, "isArray", Array.isArray,
"jQuery.isArray is deprecated; use Array.isArray"
);
}
if ( jQueryVersionSince( "3.3.0" ) ) {
migrateWarnFunc( jQuery, "isNumeric", function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = typeof obj;
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
"jQuery.isNumeric() is deprecated"
);
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
split( " " ),
function( _, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
migrateWarnFunc( jQuery, "type", function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ Object.prototype.toString.call( obj ) ] || "object" :
typeof obj;
},
"jQuery.type is deprecated" );
migrateWarnFunc( jQuery, "isFunction",
function( obj ) {
return typeof obj === "function";
},
"jQuery.isFunction() is deprecated" );
migrateWarnFunc( jQuery, "isWindow",
function( obj ) {
return obj != null && obj === obj.window;
},
"jQuery.isWindow() is deprecated"
);
}
// Support jQuery slim which excludes the ajax module
if ( jQuery.ajax ) {
var oldAjax = jQuery.ajax,
rjsonp = /(=)\?(?=&|$)|\?\?/;
jQuery.ajax = function( ) {
var jQXHR = oldAjax.apply( this, arguments );
// Be sure we got a jQXHR (e.g., not sync)
if ( jQXHR.promise ) {
migrateWarnFunc( jQXHR, "success", jQXHR.done,
"jQXHR.success is deprecated and removed" );
migrateWarnFunc( jQXHR, "error", jQXHR.fail,
"jQXHR.error is deprecated and removed" );
migrateWarnFunc( jQXHR, "complete", jQXHR.always,
"jQXHR.complete is deprecated and removed" );
}
return jQXHR;
};
// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion
// behavior is gone in jQuery 4.0 and as it has security implications, we don't
// want to restore the legacy behavior.
if ( !jQueryVersionSince( "4.0.0" ) ) {
// Register this prefilter before the jQuery one. Otherwise, a promoted
// request is transformed into one with the script dataType and we can't
// catch it anymore.
jQuery.ajaxPrefilter( "+json", function( s ) {
// Warn if JSON-to-JSONP auto-promotion happens.
if ( s.jsonp !== false && ( rjsonp.test( s.url ) ||
typeof s.data === "string" &&
( s.contentType || "" )
.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
rjsonp.test( s.data )
) ) {
migrateWarn( "JSON-to-JSONP auto-promotion is deprecated" );
}
} );
}
}
var oldRemoveAttr = jQuery.fn.removeAttr,
oldToggleClass = jQuery.fn.toggleClass,
rmatchNonSpace = /\S+/g;
jQuery.fn.removeAttr = function( name ) {
var self = this;
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
if ( jQuery.expr.match.bool.test( attr ) ) {
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
self.prop( attr, false );
}
} );
return oldRemoveAttr.apply( this, arguments );
};
jQuery.fn.toggleClass = function( state ) {
// Only deprecating no-args or single boolean arg
if ( state !== undefined && typeof state !== "boolean" ) {
return oldToggleClass.apply( this, arguments );
}
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
// Toggle entire class name of each element
return this.each( function() {
var className = this.getAttribute && this.getAttribute( "class" ) || "";
if ( className ) {
jQuery.data( this, "__className__", className );
}
// If the element has a class name or if we're passed `false`,
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if ( this.setAttribute ) {
this.setAttribute( "class",
className || state === false ?
"" :
jQuery.data( this, "__className__" ) || ""
);
}
} );
};
function camelCase( string ) {
return string.replace( /-([a-z])/g, function( _, letter ) {
return letter.toUpperCase();
} );
}
var oldFnCss,
internalSwapCall = false,
ralphaStart = /^[a-z]/,
// The regex visualized:
//
// /----------\
// | | /-------\
// | / Top \ | | |
// /--- Border ---+-| Right |-+---+- Width -+---\
// | | Bottom | |
// | \ Left / |
// | |
// | /----------\ |
// | /-------------\ | | |- END
// | | | | / Top \ | |
// | | / Margin \ | | | Right | | |
// |---------+-| |-+---+-| Bottom |-+----|
// | \ Padding / \ Left / |
// BEGIN -| |
// | /---------\ |
// | | | |
// | | / Min \ | / Width \ |
// \--------------+-| |-+---| |---/
// \ Max / \ Height /
rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
if ( jQuery.swap ) {
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
if ( oldHook ) {
jQuery.cssHooks[ name ].get = function() {
var ret;
internalSwapCall = true;
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
return ret;
};
}
} );
}
jQuery.swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
if ( !internalSwapCall ) {
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
}
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
set: function() {
migrateWarn( "JQMIGRATE: jQuery.cssProps is deprecated" );
return Reflect.set.apply( this, arguments );
}
} );
}
// Create a dummy jQuery.cssNumber if missing. It won't be used by jQuery but
// it will prevent code adding new keys to it unconditionally from crashing.
if ( !jQuery.cssNumber ) {
jQuery.cssNumber = {};
}
function isAutoPx( prop ) {
// The first test is used to ensure that:
// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
// 2. The prop is not empty.
return ralphaStart.test( prop ) &&
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
}
oldFnCss = jQuery.fn.css;
jQuery.fn.css = function( name, value ) {
var camelName,
origThis = this;
if ( name && typeof name === "object" && !Array.isArray( name ) ) {
jQuery.each( name, function( n, v ) {
jQuery.fn.css.call( origThis, n, v );
} );
return this;
}
if ( typeof value === "number" ) {
camelName = camelCase( name );
if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) {
migrateWarn( "Number-typed values are deprecated for jQuery.fn.css( \"" +
name + "\", value )" );
}
}
return oldFnCss.apply( this, arguments );
};
var oldData = jQuery.data;
jQuery.data = function( elem, name, value ) {
var curData, sameKeys, key;
// Name can be an object, and each entry in the object is meant to be set as data
if ( name && typeof name === "object" && arguments.length === 2 ) {
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
sameKeys = {};
for ( key in name ) {
if ( key !== camelCase( key ) ) {
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
curData[ key ] = name[ key ];
} else {
sameKeys[ key ] = name[ key ];
}
}
oldData.call( this, elem, sameKeys );
return name;
}
// If the name is transformed, look for the un-transformed name in the data object
if ( name && typeof name === "string" && name !== camelCase( name ) ) {
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
if ( curData && name in curData ) {
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
if ( arguments.length > 2 ) {
curData[ name ] = value;
}
return curData[ name ];
}
}
return oldData.apply( this, arguments );
};
// Support jQuery slim which excludes the effects module
if ( jQuery.fx ) {
var intervalValue, intervalMsg,
oldTweenRun = jQuery.Tween.prototype.run,
linearEasing = function( pct ) {
return pct;
};
jQuery.Tween.prototype.run = function( ) {
if ( jQuery.easing[ this.easing ].length > 1 ) {
migrateWarn(
"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
);
jQuery.easing[ this.easing ] = linearEasing;
}
oldTweenRun.apply( this, arguments );
};
intervalValue = jQuery.fx.interval || 13;
intervalMsg = "jQuery.fx.interval is deprecated";
// Support: IE9, Android <=4.4
// Avoid false positives on browsers that lack rAF
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
if ( window.requestAnimationFrame ) {
Object.defineProperty( jQuery.fx, "interval", {
configurable: true,
enumerable: true,
get: function() {
if ( !window.document.hidden ) {
migrateWarn( intervalMsg );
}
return intervalValue;
},
set: function( newValue ) {
migrateWarn( intervalMsg );
intervalValue = newValue;
}
} );
}
}
var oldLoad = jQuery.fn.load,
oldEventAdd = jQuery.event.add,
originalFix = jQuery.event.fix;
jQuery.event.props = [];
jQuery.event.fixHooks = {};
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
"jQuery.event.props.concat() is deprecated and removed" );
jQuery.event.fix = function( originalEvent ) {
var event,
type = originalEvent.type,
fixHook = this.fixHooks[ type ],
props = jQuery.event.props;
if ( props.length ) {
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
while ( props.length ) {
jQuery.event.addProp( props.pop() );
}
}
if ( fixHook && !fixHook._migrated_ ) {
fixHook._migrated_ = true;
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
if ( ( props = fixHook.props ) && props.length ) {
while ( props.length ) {
jQuery.event.addProp( props.pop() );
}
}
}
event = originalFix.call( this, originalEvent );
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
};
jQuery.event.add = function( elem, types ) {
// This misses the multiple-types case but that seems awfully rare
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
}
return oldEventAdd.apply( this, arguments );
};
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.fn[ name ] = function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
}
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.on.apply( this, args );
}
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
return this;
};
} );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
// Trigger "ready" event only once, on document ready
jQuery( function() {
jQuery( window.document ).triggerHandler( "ready" );
} );
jQuery.event.special.ready = {
setup: function() {
if ( this === window.document ) {
migrateWarn( "'ready' event is deprecated" );
}
}
};
jQuery.fn.extend( {
bind: function( types, data, fn ) {
migrateWarn( "jQuery.fn.bind() is deprecated" );
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
migrateWarn( "jQuery.fn.unbind() is deprecated" );
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
migrateWarn( "jQuery.fn.delegate() is deprecated" );
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
},
hover: function( fnOver, fnOut ) {
migrateWarn( "jQuery.fn.hover() is deprecated" );
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
}
} );
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
origHtmlPrefilter = jQuery.htmlPrefilter,
makeMarkup = function( html ) {
var doc = window.document.implementation.createHTMLDocument( "" );
doc.body.innerHTML = html;
return doc.body && doc.body.innerHTML;
},
warnIfChanged = function( html ) {
var changed = html.replace( rxhtmlTag, "<$1></$2>" );
if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
migrateWarn( "HTML tags must be properly nested and closed: " + html );
}
};
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
jQuery.htmlPrefilter = function( html ) {
warnIfChanged( html );
return html.replace( rxhtmlTag, "<$1></$2>" );
};
};
jQuery.htmlPrefilter = function( html ) {
warnIfChanged( html );
return origHtmlPrefilter( html );
};
var oldOffset = jQuery.fn.offset;
jQuery.fn.offset = function() {
var elem = this[ 0 ];
if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
return arguments.length ? this : undefined;
}
return oldOffset.apply( this, arguments );
};
// Support jQuery slim which excludes the ajax module
// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
// so it doesn't make sense for the slim build.
if ( jQuery.ajax ) {
var oldParam = jQuery.param;
jQuery.param = function( data, traditional ) {
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
if ( traditional === undefined && ajaxTraditional ) {
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
traditional = ajaxTraditional;
}
return oldParam.call( this, data, traditional );
};
}
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
jQuery.fn.andSelf = function() {
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
return oldSelf.apply( this, arguments );
};
// Support jQuery slim which excludes the deferred module in jQuery 4.0+
if ( jQuery.Deferred ) {
var oldDeferred = jQuery.Deferred,
tuples = [
// Action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "rejected" ],
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ) ]
];
jQuery.Deferred = function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
migrateWarn( "deferred.pipe() is deprecated" );
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = typeof fns[ i ] === "function" && fns[ i ];
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && typeof returned.promise === "function" ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
};
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
};
// Preserve handler of uncaught exceptions in promise chains
jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
}
return jQuery;
} );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -56,13 +56,12 @@ class Combine{
//jquery migrate
'migrate' => [
'file' => '/include/thirdparty/js/jquery-migrate-3.3.2.min.js',
'file' => '/include/thirdparty/js/jquery-migrate.min.js',
'package' => 'jquery',
'label' => 'Migrate',
'cdn' => [
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.3.2/jquery-migrate.min.js',
'Google' => '//code.jquery.com/jquery-migrate-3.3.2.min.js',
'CDN 2.24 (old)' => '//code.jquery.com/jquery-migrate-1.4.1.min.js',
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.4.0/jquery-migrate.min.js',
'Jsdelivr' => '//cdn.jsdelivr.net/npm/jquery-migrate@3.4.0/dist/jquery-migrate.min.js',
],
],
@ -74,8 +73,7 @@ class Combine{
'label' => 'jQuery',
'cdn' => [
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
'Google' => '//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js',
'CDN 2.24 (old)' => '//code.jquery.com/jquery-2.2.4.min.js',
'Jsdelivr' => '//cdn.jsdelivr.net/gh/jquery/jquery@3.6.0/dist/jquery.min.js',
],
],
@ -85,18 +83,18 @@ class Combine{
'type' => 'css',
'package' => 'jquery_ui',
'cdn' => [
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css',
'Google' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.min.css',
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/smoothness/jquery-ui.min.css',
'Jsdelivr' => '//cdn.jsdelivr.net/npm/jquery-ui@1.13.2/dist/themes/smoothness/jquery-ui.min.css',
],
],
'ui-core' => [
'file' => '/include/thirdparty/jquery_ui/core.js', //jquery-ui.min.js'
'file' => '/include/thirdparty/jquery_ui/jquery-ui.min.js', //core.js',
'package' => 'jquery_ui',
'label' => 'jQuery UI',
'cdn' => [
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js',
'Google' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js',
'CloudFlare' => '//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js',
'Jsdelivr' => '//cdn.jsdelivr.net/npm/jquery-ui@1.13.2/dist/jquery-ui.min.js',
],
],