mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Update jQuery step two:
- Add jquery-migrate.js v.3.3.1 to core and load it in debug mode when `SCRIPT_DEBUG` is true. - Add jquery.min.js, update jquery.js to 3.5.1 non-minified. This should help when debugging. - Rebuild jQuery UI 1.12.1 and add it to core. - Fix/adjust tests to match the above changes. See #50564. Built from https://develop.svn.wordpress.org/trunk@49101 git-svn-id: http://core.svn.wordpress.org/trunk@48863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c64f0c663
commit
5cee7eced0
1163
wp-includes/js/jquery/jquery-migrate.js
vendored
1163
wp-includes/js/jquery/jquery-migrate.js
vendored
File diff suppressed because it is too large
Load Diff
4
wp-includes/js/jquery/jquery-migrate.min.js
vendored
4
wp-includes/js/jquery/jquery-migrate.min.js
vendored
File diff suppressed because one or more lines are too long
10877
wp-includes/js/jquery/jquery.js
vendored
10877
wp-includes/js/jquery/jquery.js
vendored
File diff suppressed because one or more lines are too long
3
wp-includes/js/jquery/jquery.min.js
vendored
Normal file
3
wp-includes/js/jquery/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
610
wp-includes/js/jquery/ui/accordion.js
vendored
Normal file
610
wp-includes/js/jquery/ui/accordion.js
vendored
Normal file
@ -0,0 +1,610 @@
|
||||
/*!
|
||||
* jQuery UI Accordion 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Accordion
|
||||
//>>group: Widgets
|
||||
// jscs:disable maximumLineLength
|
||||
//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
|
||||
// jscs:enable maximumLineLength
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.accordion", {
|
||||
version: "1.12.1",
|
||||
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",
|
||||
heightStyle: "auto",
|
||||
icons: {
|
||||
activeHeader: "ui-icon-triangle-1-s",
|
||||
header: "ui-icon-triangle-1-e"
|
||||
},
|
||||
|
||||
// Callbacks
|
||||
activate: null,
|
||||
beforeActivate: null
|
||||
},
|
||||
|
||||
hideProps: {
|
||||
borderTopWidth: "hide",
|
||||
borderBottomWidth: "hide",
|
||||
paddingTop: "hide",
|
||||
paddingBottom: "hide",
|
||||
height: "hide"
|
||||
},
|
||||
|
||||
showProps: {
|
||||
borderTopWidth: "show",
|
||||
borderBottomWidth: "show",
|
||||
paddingTop: "show",
|
||||
paddingBottom: "show",
|
||||
height: "show"
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
var options = this.options;
|
||||
|
||||
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;
|
||||
}
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
_getCreateEventData: function() {
|
||||
return {
|
||||
header: this.active,
|
||||
panel: !this.active.length ? $() : this.active.next()
|
||||
};
|
||||
},
|
||||
|
||||
_createIcons: function() {
|
||||
var icon, children,
|
||||
icons = this.options.icons;
|
||||
|
||||
if ( 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._removeClass( this.headers, "ui-accordion-icons" );
|
||||
this.headers.children( ".ui-accordion-header-icon" ).remove();
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
var contents;
|
||||
|
||||
// Clean up main element
|
||||
this.element.removeAttr( "role" );
|
||||
|
||||
// Clean up headers
|
||||
this.headers
|
||||
.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
|
||||
.removeUniqueId();
|
||||
|
||||
this._destroyIcons();
|
||||
|
||||
// Clean up content panels
|
||||
contents = this.headers.next()
|
||||
.css( "display", "" )
|
||||
.removeAttr( "role aria-hidden aria-labelledby" )
|
||||
.removeUniqueId();
|
||||
|
||||
if ( this.options.heightStyle !== "content" ) {
|
||||
contents.css( "height", "" );
|
||||
}
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "active" ) {
|
||||
|
||||
// _activate() will handle invalid values and update this.options
|
||||
this._activate( value );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key === "event" ) {
|
||||
if ( this.options.event ) {
|
||||
this._off( this.headers, this.options.event );
|
||||
}
|
||||
this._setupEvents( value );
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
// Setting collapsible: false while collapsed; open first panel
|
||||
if ( key === "collapsible" && !value && this.options.active === false ) {
|
||||
this._activate( 0 );
|
||||
}
|
||||
|
||||
if ( key === "icons" ) {
|
||||
this._destroyIcons();
|
||||
if ( value ) {
|
||||
this._createIcons();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_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
|
||||
this._toggleClass( null, "ui-state-disabled", !!value );
|
||||
this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
|
||||
!!value );
|
||||
},
|
||||
|
||||
_keydown: function( event ) {
|
||||
if ( event.altKey || event.ctrlKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keyCode = $.ui.keyCode,
|
||||
length = this.headers.length,
|
||||
currentIndex = this.headers.index( event.target ),
|
||||
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;
|
||||
}
|
||||
|
||||
if ( toFocus ) {
|
||||
$( event.target ).attr( "tabIndex", -1 );
|
||||
$( toFocus ).attr( "tabIndex", 0 );
|
||||
$( toFocus ).trigger( "focus" );
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
_panelKeyDown: function( event ) {
|
||||
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
|
||||
$( event.currentTarget ).prev().trigger( "focus" );
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var options = this.options;
|
||||
this._processPanels();
|
||||
|
||||
// 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 ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
this._destroyIcons();
|
||||
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
_processPanels: function() {
|
||||
var prevHeaders = this.headers,
|
||||
prevPanels = this.panels;
|
||||
|
||||
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().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 ) {
|
||||
this._off( prevHeaders.not( this.headers ) );
|
||||
this._off( prevPanels.not( this.panels ) );
|
||||
}
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
var maxHeight,
|
||||
options = this.options,
|
||||
heightStyle = options.heightStyle,
|
||||
parent = this.element.parent();
|
||||
|
||||
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() {
|
||||
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();
|
||||
|
||||
// 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( {
|
||||
"aria-selected": "true",
|
||||
"aria-expanded": "true",
|
||||
tabIndex: 0
|
||||
} )
|
||||
.next()
|
||||
.attr( {
|
||||
"aria-hidden": "false"
|
||||
} );
|
||||
}
|
||||
|
||||
this._createIcons();
|
||||
|
||||
this._setupEvents( options.event );
|
||||
|
||||
if ( heightStyle === "fill" ) {
|
||||
maxHeight = parent.height();
|
||||
this.element.siblings( ":visible" ).each( function() {
|
||||
var elem = $( this ),
|
||||
position = elem.css( "position" );
|
||||
|
||||
if ( position === "absolute" || position === "fixed" ) {
|
||||
return;
|
||||
}
|
||||
maxHeight -= elem.outerHeight( true );
|
||||
} );
|
||||
|
||||
this.headers.each( function() {
|
||||
maxHeight -= $( this ).outerHeight( true );
|
||||
} );
|
||||
|
||||
this.headers.next()
|
||||
.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() {
|
||||
var isVisible = $( this ).is( ":visible" );
|
||||
if ( !isVisible ) {
|
||||
$( this ).show();
|
||||
}
|
||||
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
|
||||
if ( !isVisible ) {
|
||||
$( this ).hide();
|
||||
}
|
||||
} )
|
||||
.height( maxHeight );
|
||||
}
|
||||
},
|
||||
|
||||
_activate: function( index ) {
|
||||
var active = this._findActive( index )[ 0 ];
|
||||
|
||||
// Trying to activate the already active panel
|
||||
if ( active === this.active[ 0 ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Trying to collapse, simulate a click on the currently active header
|
||||
active = active || this.active[ 0 ];
|
||||
|
||||
this._eventHandler( {
|
||||
target: active,
|
||||
currentTarget: active,
|
||||
preventDefault: $.noop
|
||||
} );
|
||||
},
|
||||
|
||||
_findActive: function( selector ) {
|
||||
return typeof selector === "number" ? this.headers.eq( selector ) : $();
|
||||
},
|
||||
|
||||
_setupEvents: function( event ) {
|
||||
var events = {
|
||||
keydown: "_keydown"
|
||||
};
|
||||
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._hoverable( this.headers );
|
||||
this._focusable( this.headers );
|
||||
},
|
||||
|
||||
_eventHandler: function( event ) {
|
||||
var activeChildren, clickedChildren,
|
||||
options = this.options,
|
||||
active = this.active,
|
||||
clicked = $( event.currentTarget ),
|
||||
clickedIsActive = clicked[ 0 ] === active[ 0 ],
|
||||
collapsing = clickedIsActive && options.collapsible,
|
||||
toShow = collapsing ? $() : clicked.next(),
|
||||
toHide = active.next(),
|
||||
eventData = {
|
||||
oldHeader: active,
|
||||
oldPanel: toHide,
|
||||
newHeader: collapsing ? $() : clicked,
|
||||
newPanel: toShow
|
||||
};
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (
|
||||
|
||||
// click on active header, but not collapsible
|
||||
( clickedIsActive && !options.collapsible ) ||
|
||||
|
||||
// allow canceling activation
|
||||
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.active = collapsing ? false : this.headers.index( clicked );
|
||||
|
||||
// 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
|
||||
// corner classes on the previously active header stay after the animation
|
||||
this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
|
||||
if ( options.icons ) {
|
||||
activeChildren = active.children( ".ui-accordion-header-icon" );
|
||||
this._removeClass( activeChildren, null, options.icons.activeHeader )
|
||||
._addClass( activeChildren, null, options.icons.header );
|
||||
}
|
||||
|
||||
if ( !clickedIsActive ) {
|
||||
this._removeClass( clicked, "ui-accordion-header-collapsed" )
|
||||
._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
|
||||
if ( options.icons ) {
|
||||
clickedChildren = clicked.children( ".ui-accordion-header-icon" );
|
||||
this._removeClass( clickedChildren, null, options.icons.header )
|
||||
._addClass( clickedChildren, null, options.icons.activeHeader );
|
||||
}
|
||||
|
||||
this._addClass( clicked.next(), "ui-accordion-content-active" );
|
||||
}
|
||||
},
|
||||
|
||||
_toggle: function( data ) {
|
||||
var toShow = data.newPanel,
|
||||
toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
|
||||
|
||||
// Handle activating a panel during the animation for another activation
|
||||
this.prevShow.add( this.prevHide ).stop( true, true );
|
||||
this.prevShow = toShow;
|
||||
this.prevHide = toHide;
|
||||
|
||||
if ( this.options.animate ) {
|
||||
this._animate( toShow, toHide, data );
|
||||
} else {
|
||||
toHide.hide();
|
||||
toShow.show();
|
||||
this._toggleComplete( data );
|
||||
}
|
||||
|
||||
toHide.attr( {
|
||||
"aria-hidden": "true"
|
||||
} );
|
||||
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( {
|
||||
"tabIndex": -1,
|
||||
"aria-expanded": "false"
|
||||
} );
|
||||
} else if ( toShow.length ) {
|
||||
this.headers.filter( function() {
|
||||
return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
|
||||
} )
|
||||
.attr( "tabIndex", -1 );
|
||||
}
|
||||
|
||||
toShow
|
||||
.attr( "aria-hidden", "false" )
|
||||
.prev()
|
||||
.attr( {
|
||||
"aria-selected": "true",
|
||||
"aria-expanded": "true",
|
||||
tabIndex: 0
|
||||
} );
|
||||
},
|
||||
|
||||
_animate: function( toShow, toHide, data ) {
|
||||
var total, easing, duration,
|
||||
that = this,
|
||||
adjust = 0,
|
||||
boxSizing = toShow.css( "box-sizing" ),
|
||||
down = toShow.length &&
|
||||
( !toHide.length || ( toShow.index() < toHide.index() ) ),
|
||||
animate = this.options.animate || {},
|
||||
options = down && animate.down || animate,
|
||||
complete = function() {
|
||||
that._toggleComplete( data );
|
||||
};
|
||||
|
||||
if ( typeof options === "number" ) {
|
||||
duration = options;
|
||||
}
|
||||
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;
|
||||
|
||||
if ( !toHide.length ) {
|
||||
return toShow.animate( this.showProps, duration, easing, complete );
|
||||
}
|
||||
if ( !toShow.length ) {
|
||||
return toHide.animate( this.hideProps, duration, easing, complete );
|
||||
}
|
||||
|
||||
total = toShow.show().outerHeight();
|
||||
toHide.animate( this.hideProps, {
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
step: function( now, fx ) {
|
||||
fx.now = Math.round( now );
|
||||
}
|
||||
} );
|
||||
toShow
|
||||
.hide()
|
||||
.animate( this.showProps, {
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
complete: complete,
|
||||
step: function( now, fx ) {
|
||||
fx.now = Math.round( now );
|
||||
if ( fx.prop !== "height" ) {
|
||||
if ( boxSizing === "content-box" ) {
|
||||
adjust += fx.now;
|
||||
}
|
||||
} else if ( that.options.heightStyle !== "content" ) {
|
||||
fx.now = Math.round( total - toHide.outerHeight() - adjust );
|
||||
adjust = 0;
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
_toggleComplete: function( data ) {
|
||||
var toHide = data.oldPanel,
|
||||
prev = toHide.prev();
|
||||
|
||||
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 ) {
|
||||
toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
|
||||
}
|
||||
this._trigger( "activate", null, data );
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/accordion.min.js
vendored
6
wp-includes/js/jquery/ui/accordion.min.js
vendored
File diff suppressed because one or more lines are too long
678
wp-includes/js/jquery/ui/autocomplete.js
vendored
Normal file
678
wp-includes/js/jquery/ui/autocomplete.js
vendored
Normal file
@ -0,0 +1,678 @@
|
||||
/*!
|
||||
* jQuery UI Autocomplete 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./menu",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.autocomplete", {
|
||||
version: "1.12.1",
|
||||
defaultElement: "<input>",
|
||||
options: {
|
||||
appendTo: null,
|
||||
autoFocus: false,
|
||||
delay: 300,
|
||||
minLength: 1,
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
collision: "none"
|
||||
},
|
||||
source: null,
|
||||
|
||||
// Callbacks
|
||||
change: null,
|
||||
close: null,
|
||||
focus: null,
|
||||
open: null,
|
||||
response: null,
|
||||
search: null,
|
||||
select: null
|
||||
},
|
||||
|
||||
requestIndex: 0,
|
||||
pending: 0,
|
||||
|
||||
_create: function() {
|
||||
|
||||
// Some browsers only repeat keydown events, not keypress events,
|
||||
// so we use the suppressKeyPress flag to determine if we've already
|
||||
// handled the keydown event. #7269
|
||||
// Unfortunately the code for & in keypress is the same as the up arrow,
|
||||
// so we use the suppressKeyPressRepeat flag to avoid handling keypress
|
||||
// events when we know the keydown event was used to modify the
|
||||
// search term. #7799
|
||||
var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
|
||||
nodeName = this.element[ 0 ].nodeName.toLowerCase(),
|
||||
isTextarea = nodeName === "textarea",
|
||||
isInput = nodeName === "input";
|
||||
|
||||
// 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._addClass( "ui-autocomplete-input" );
|
||||
this.element.attr( "autocomplete", "off" );
|
||||
|
||||
this._on( this.element, {
|
||||
keydown: function( event ) {
|
||||
if ( this.element.prop( "readOnly" ) ) {
|
||||
suppressKeyPress = true;
|
||||
suppressInput = true;
|
||||
suppressKeyPressRepeat = true;
|
||||
return;
|
||||
}
|
||||
|
||||
suppressKeyPress = false;
|
||||
suppressInput = false;
|
||||
suppressKeyPressRepeat = false;
|
||||
var keyCode = $.ui.keyCode;
|
||||
switch ( event.keyCode ) {
|
||||
case keyCode.PAGE_UP:
|
||||
suppressKeyPress = true;
|
||||
this._move( "previousPage", event );
|
||||
break;
|
||||
case keyCode.PAGE_DOWN:
|
||||
suppressKeyPress = true;
|
||||
this._move( "nextPage", event );
|
||||
break;
|
||||
case keyCode.UP:
|
||||
suppressKeyPress = true;
|
||||
this._keyEvent( "previous", event );
|
||||
break;
|
||||
case keyCode.DOWN:
|
||||
suppressKeyPress = true;
|
||||
this._keyEvent( "next", event );
|
||||
break;
|
||||
case keyCode.ENTER:
|
||||
|
||||
// when menu is open and has focus
|
||||
if ( this.menu.active ) {
|
||||
|
||||
// #6055 - Opera still allows the keypress to occur
|
||||
// which causes forms to submit
|
||||
suppressKeyPress = true;
|
||||
event.preventDefault();
|
||||
this.menu.select( event );
|
||||
}
|
||||
break;
|
||||
case keyCode.TAB:
|
||||
if ( this.menu.active ) {
|
||||
this.menu.select( event );
|
||||
}
|
||||
break;
|
||||
case keyCode.ESCAPE:
|
||||
if ( this.menu.element.is( ":visible" ) ) {
|
||||
if ( !this.isMultiLine ) {
|
||||
this._value( this.term );
|
||||
}
|
||||
this.close( event );
|
||||
|
||||
// Different browsers have different default behavior for escape
|
||||
// Single press can mean undo or clear
|
||||
// Double press in IE means clear the whole form
|
||||
event.preventDefault();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
suppressKeyPressRepeat = true;
|
||||
|
||||
// search timeout should be triggered before the input value is changed
|
||||
this._searchTimeout( event );
|
||||
break;
|
||||
}
|
||||
},
|
||||
keypress: function( event ) {
|
||||
if ( suppressKeyPress ) {
|
||||
suppressKeyPress = false;
|
||||
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( suppressKeyPressRepeat ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Replicate some key handlers to allow them to repeat in Firefox and Opera
|
||||
var keyCode = $.ui.keyCode;
|
||||
switch ( event.keyCode ) {
|
||||
case keyCode.PAGE_UP:
|
||||
this._move( "previousPage", event );
|
||||
break;
|
||||
case keyCode.PAGE_DOWN:
|
||||
this._move( "nextPage", event );
|
||||
break;
|
||||
case keyCode.UP:
|
||||
this._keyEvent( "previous", event );
|
||||
break;
|
||||
case keyCode.DOWN:
|
||||
this._keyEvent( "next", event );
|
||||
break;
|
||||
}
|
||||
},
|
||||
input: function( event ) {
|
||||
if ( suppressInput ) {
|
||||
suppressInput = false;
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
this._searchTimeout( event );
|
||||
},
|
||||
focus: function() {
|
||||
this.selectedItem = null;
|
||||
this.previous = this._value();
|
||||
},
|
||||
blur: function( event ) {
|
||||
if ( this.cancelBlur ) {
|
||||
delete this.cancelBlur;
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout( this.searching );
|
||||
this.close( event );
|
||||
this._change( event );
|
||||
}
|
||||
} );
|
||||
|
||||
this._initSource();
|
||||
this.menu = $( "<ul>" )
|
||||
.appendTo( this._appendTo() )
|
||||
.menu( {
|
||||
|
||||
// disable ARIA support, the live region takes care of that
|
||||
role: null
|
||||
} )
|
||||
.hide()
|
||||
.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
|
||||
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;
|
||||
|
||||
// Support: IE 8 only
|
||||
// Right clicking a menu item or selecting text from the menu items will
|
||||
// result in focus moving out of the input. However, we've already received
|
||||
// and ignored the blur event because of the cancelBlur flag set above. So
|
||||
// we restore focus to ensure that the menu closes properly based on the user's
|
||||
// next actions.
|
||||
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
|
||||
this.element.trigger( "focus" );
|
||||
}
|
||||
} );
|
||||
},
|
||||
menufocus: function( event, ui ) {
|
||||
var label, item;
|
||||
|
||||
// support: Firefox
|
||||
// Prevent accidental activation of menu items in Firefox (#7024 #9118)
|
||||
if ( this.isNewMenu ) {
|
||||
this.isNewMenu = false;
|
||||
if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
|
||||
this.menu.blur();
|
||||
|
||||
this.document.one( "mousemove", function() {
|
||||
$( event.target ).trigger( event.originalEvent );
|
||||
} );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
// 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 );
|
||||
}
|
||||
},
|
||||
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 ] !== $.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.previous = previous;
|
||||
this.selectedItem = item;
|
||||
} );
|
||||
}
|
||||
|
||||
if ( false !== this._trigger( "select", event, { item: item } ) ) {
|
||||
this._value( item.value );
|
||||
}
|
||||
|
||||
// reset the term after the select event
|
||||
// this allows custom select handling to work properly
|
||||
this.term = this._value();
|
||||
|
||||
this.close( event );
|
||||
this.selectedItem = item;
|
||||
}
|
||||
} );
|
||||
|
||||
this.liveRegion = $( "<div>", {
|
||||
role: "status",
|
||||
"aria-live": "assertive",
|
||||
"aria-relevant": "additions"
|
||||
} )
|
||||
.appendTo( this.document[ 0 ].body );
|
||||
|
||||
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.removeAttr( "autocomplete" );
|
||||
this.menu.element.remove();
|
||||
this.liveRegion.remove();
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
this._super( key, value );
|
||||
if ( key === "source" ) {
|
||||
this._initSource();
|
||||
}
|
||||
if ( key === "appendTo" ) {
|
||||
this.menu.element.appendTo( this._appendTo() );
|
||||
}
|
||||
if ( key === "disabled" && value && this.xhr ) {
|
||||
this.xhr.abort();
|
||||
}
|
||||
},
|
||||
|
||||
_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;
|
||||
|
||||
if ( element ) {
|
||||
element = element.jquery || element.nodeType ?
|
||||
$( element ) :
|
||||
this.document.find( element ).eq( 0 );
|
||||
}
|
||||
|
||||
if ( !element || !element[ 0 ] ) {
|
||||
element = this.element.closest( ".ui-front, dialog" );
|
||||
}
|
||||
|
||||
if ( !element.length ) {
|
||||
element = this.document[ 0 ].body;
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
_initSource: function() {
|
||||
var array, url,
|
||||
that = this;
|
||||
if ( $.isArray( this.options.source ) ) {
|
||||
array = this.options.source;
|
||||
this.source = function( request, response ) {
|
||||
response( $.ui.autocomplete.filter( array, request.term ) );
|
||||
};
|
||||
} else if ( typeof this.options.source === "string" ) {
|
||||
url = this.options.source;
|
||||
this.source = function( request, response ) {
|
||||
if ( that.xhr ) {
|
||||
that.xhr.abort();
|
||||
}
|
||||
that.xhr = $.ajax( {
|
||||
url: url,
|
||||
data: request,
|
||||
dataType: "json",
|
||||
success: function( data ) {
|
||||
response( data );
|
||||
},
|
||||
error: function() {
|
||||
response( [] );
|
||||
}
|
||||
} );
|
||||
};
|
||||
} else {
|
||||
this.source = this.options.source;
|
||||
}
|
||||
},
|
||||
|
||||
_searchTimeout: function( event ) {
|
||||
clearTimeout( this.searching );
|
||||
this.searching = this._delay( function() {
|
||||
|
||||
// Search if the value has changed, or if the user retypes the same value (see #7434)
|
||||
var equalValues = this.term === this._value(),
|
||||
menuVisible = this.menu.element.is( ":visible" ),
|
||||
modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
||||
|
||||
if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
|
||||
this.selectedItem = null;
|
||||
this.search( null, event );
|
||||
}
|
||||
}, this.options.delay );
|
||||
},
|
||||
|
||||
search: function( value, event ) {
|
||||
value = value != null ? value : this._value();
|
||||
|
||||
// Always save the actual value, not the one passed as an argument
|
||||
this.term = this._value();
|
||||
|
||||
if ( value.length < this.options.minLength ) {
|
||||
return this.close( event );
|
||||
}
|
||||
|
||||
if ( this._trigger( "search", event ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
return this._search( value );
|
||||
},
|
||||
|
||||
_search: function( value ) {
|
||||
this.pending++;
|
||||
this._addClass( "ui-autocomplete-loading" );
|
||||
this.cancelSearch = false;
|
||||
|
||||
this.source( { term: value }, this._response() );
|
||||
},
|
||||
|
||||
_response: function() {
|
||||
var index = ++this.requestIndex;
|
||||
|
||||
return $.proxy( function( content ) {
|
||||
if ( index === this.requestIndex ) {
|
||||
this.__response( content );
|
||||
}
|
||||
|
||||
this.pending--;
|
||||
if ( !this.pending ) {
|
||||
this._removeClass( "ui-autocomplete-loading" );
|
||||
}
|
||||
}, this );
|
||||
},
|
||||
|
||||
__response: function( content ) {
|
||||
if ( content ) {
|
||||
content = this._normalize( content );
|
||||
}
|
||||
this._trigger( "response", null, { content: content } );
|
||||
if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
|
||||
this._suggest( content );
|
||||
this._trigger( "open" );
|
||||
} else {
|
||||
|
||||
// use ._close() instead of .close() so we don't cancel future searches
|
||||
this._close();
|
||||
}
|
||||
},
|
||||
|
||||
close: function( event ) {
|
||||
this.cancelSearch = true;
|
||||
this._close( event );
|
||||
},
|
||||
|
||||
_close: function( event ) {
|
||||
|
||||
// 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();
|
||||
this.isNewMenu = true;
|
||||
this._trigger( "close", event );
|
||||
}
|
||||
},
|
||||
|
||||
_change: function( event ) {
|
||||
if ( this.previous !== this._value() ) {
|
||||
this._trigger( "change", event, { item: this.selectedItem } );
|
||||
}
|
||||
},
|
||||
|
||||
_normalize: function( items ) {
|
||||
|
||||
// assume all items have the right format when the first item is complete
|
||||
if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
|
||||
return items;
|
||||
}
|
||||
return $.map( items, function( item ) {
|
||||
if ( typeof item === "string" ) {
|
||||
return {
|
||||
label: item,
|
||||
value: item
|
||||
};
|
||||
}
|
||||
return $.extend( {}, item, {
|
||||
label: item.label || item.value,
|
||||
value: item.value || item.label
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
_suggest: function( items ) {
|
||||
var ul = this.menu.element.empty();
|
||||
this._renderMenu( ul, items );
|
||||
this.isNewMenu = true;
|
||||
this.menu.refresh();
|
||||
|
||||
// Size and position menu
|
||||
ul.show();
|
||||
this._resizeMenu();
|
||||
ul.position( $.extend( {
|
||||
of: this.element
|
||||
}, this.options.position ) );
|
||||
|
||||
if ( this.options.autoFocus ) {
|
||||
this.menu.next();
|
||||
}
|
||||
|
||||
// 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,
|
||||
this.element.outerWidth()
|
||||
) );
|
||||
},
|
||||
|
||||
_renderMenu: function( ul, items ) {
|
||||
var that = this;
|
||||
$.each( items, function( index, item ) {
|
||||
that._renderItemData( ul, item );
|
||||
} );
|
||||
},
|
||||
|
||||
_renderItemData: function( ul, item ) {
|
||||
return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
|
||||
},
|
||||
|
||||
_renderItem: function( ul, item ) {
|
||||
return $( "<li>" )
|
||||
.append( $( "<div>" ).text( item.label ) )
|
||||
.appendTo( ul );
|
||||
},
|
||||
|
||||
_move: function( direction, event ) {
|
||||
if ( !this.menu.element.is( ":visible" ) ) {
|
||||
this.search( null, event );
|
||||
return;
|
||||
}
|
||||
if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
|
||||
this.menu.isLastItem() && /^next/.test( direction ) ) {
|
||||
|
||||
if ( !this.isMultiLine ) {
|
||||
this._value( this.term );
|
||||
}
|
||||
|
||||
this.menu.blur();
|
||||
return;
|
||||
}
|
||||
this.menu[ direction ]( event );
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.menu.element;
|
||||
},
|
||||
|
||||
_value: function() {
|
||||
return this.valueMethod.apply( this.element, arguments );
|
||||
},
|
||||
|
||||
_keyEvent: function( keyEvent, event ) {
|
||||
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
|
||||
this._move( keyEvent, event );
|
||||
|
||||
// Prevents moving cursor to beginning/end of the text field in some browsers
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
// 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 ) {
|
||||
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
|
||||
},
|
||||
filter: function( array, term ) {
|
||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
|
||||
return $.grep( array, function( value ) {
|
||||
return matcher.test( value.label || value.value || value );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
// Live region extension, adding a `messages` option
|
||||
// NOTE: This is an experimental API. We are still investigating
|
||||
// a full solution for string manipulation and internationalization.
|
||||
$.widget( "ui.autocomplete", $.ui.autocomplete, {
|
||||
options: {
|
||||
messages: {
|
||||
noResults: "No search results.",
|
||||
results: function( amount ) {
|
||||
return amount + ( amount > 1 ? " results are" : " result is" ) +
|
||||
" available, use up and down arrow keys to navigate.";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
__response: function( content ) {
|
||||
var message;
|
||||
this._superApply( arguments );
|
||||
if ( this.options.disabled || this.cancelSearch ) {
|
||||
return;
|
||||
}
|
||||
if ( content && content.length ) {
|
||||
message = this.options.messages.results( content.length );
|
||||
} else {
|
||||
message = this.options.messages.noResults;
|
||||
}
|
||||
this.liveRegion.children().hide();
|
||||
$( "<div>" ).text( message ).appendTo( this.liveRegion );
|
||||
}
|
||||
} );
|
||||
|
||||
return $.ui.autocomplete;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/autocomplete.min.js
vendored
6
wp-includes/js/jquery/ui/autocomplete.min.js
vendored
File diff suppressed because one or more lines are too long
385
wp-includes/js/jquery/ui/button.js
vendored
Normal file
385
wp-includes/js/jquery/ui/button.js
vendored
Normal file
@ -0,0 +1,385 @@
|
||||
/*!
|
||||
* jQuery UI Button 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
|
||||
// These are only for backcompat
|
||||
// TODO: Remove after 1.12
|
||||
"./controlgroup",
|
||||
"./checkboxradio",
|
||||
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.button", {
|
||||
version: "1.12.1",
|
||||
defaultElement: "<button>",
|
||||
options: {
|
||||
classes: {
|
||||
"ui-button": "ui-corner-all"
|
||||
},
|
||||
disabled: null,
|
||||
icon: null,
|
||||
iconPosition: "beginning",
|
||||
label: 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() {
|
||||
if ( !this.option.showLabel & !this.options.icon ) {
|
||||
this.options.showLabel = true;
|
||||
}
|
||||
|
||||
// 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.hasTitle = !!this.element.attr( "title" );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
this._addClass( "ui-button", "ui-widget" );
|
||||
this._setOption( "disabled", this.options.disabled );
|
||||
this._enhance();
|
||||
|
||||
if ( this.element.is( "a" ) ) {
|
||||
this._on( {
|
||||
"keyup": function( event ) {
|
||||
if ( event.keyCode === $.ui.keyCode.SPACE ) {
|
||||
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" );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
_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.removeAttr( "role" );
|
||||
|
||||
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 ) {
|
||||
if ( key === "icon" ) {
|
||||
if ( value ) {
|
||||
this._updateIcon( key, value );
|
||||
} else if ( this.icon ) {
|
||||
this.icon.remove();
|
||||
if ( this.iconSpace ) {
|
||||
this.iconSpace.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.blur();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
|
||||
// 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._setOptions( { disabled: isDisabled } );
|
||||
}
|
||||
|
||||
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.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() {
|
||||
if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
|
||||
( this.length && this[ 0 ].tagName === "INPUT" && (
|
||||
this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
|
||||
) ) ) {
|
||||
return orig.apply( this, arguments );
|
||||
}
|
||||
if ( !$.ui.checkboxradio ) {
|
||||
$.error( "Checkboxradio widget missing" );
|
||||
}
|
||||
if ( arguments.length === 0 ) {
|
||||
return this.checkboxradio( {
|
||||
"icon": false
|
||||
} );
|
||||
}
|
||||
return this.checkboxradio.apply( this, arguments );
|
||||
};
|
||||
} )( $.fn.button );
|
||||
|
||||
$.fn.buttonset = function() {
|
||||
if ( !$.ui.controlgroup ) {
|
||||
$.error( "Controlgroup widget missing" );
|
||||
}
|
||||
if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
|
||||
return this.controlgroup.apply( this,
|
||||
[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
|
||||
}
|
||||
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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/button.min.js
vendored
6
wp-includes/js/jquery/ui/button.min.js
vendored
File diff suppressed because one or more lines are too long
283
wp-includes/js/jquery/ui/checkboxradio.js
vendored
Normal file
283
wp-includes/js/jquery/ui/checkboxradio.js
vendored
Normal file
@ -0,0 +1,283 @@
|
||||
/*!
|
||||
* jQuery UI Checkboxradio 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery 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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
|
||||
version: "1.12.1",
|
||||
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;
|
||||
var that = this;
|
||||
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.
|
||||
this.label.contents().not( this.element[ 0 ] ).each( function() {
|
||||
|
||||
// The label contents could be text, html, or a mix. We concat each element to get a
|
||||
// string representation of the label, without the input as part of it.
|
||||
that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
|
||||
} );
|
||||
|
||||
// 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" );
|
||||
if ( this.icon ) {
|
||||
this._addClass( this.icon, null, "ui-state-hover" );
|
||||
}
|
||||
}
|
||||
|
||||
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='" + $.ui.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;
|
||||
|
||||
} ) );
|
9
wp-includes/js/jquery/ui/checkboxradio.min.js
vendored
Normal file
9
wp-includes/js/jquery/ui/checkboxradio.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Checkboxradio 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core"],e):e(jQuery)}(function(o){return o.widget("ui.checkboxradio",[o.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,t=this,s=this._super()||{};return this._readType(),i=this.element.labels(),this.label=o(i[i.length-1]),this.label.length||o.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){t.originalLabel+=3===this.nodeType?o(this).text():this.outerHTML}),this.originalLabel&&(s.label=this.originalLabel),null!=(e=this.element[0].disabled)&&(s.disabled=e),s},_create:function(){var e=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(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"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),e&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),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 e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||o.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e=this.element[0].name,i="input[name='"+o.ui.escapeSelector(e)+"']";return e?(this.form.length?o(this.form[0].elements).filter(i):o(i).filter(function(){return 0===o(this).form().length})).not(this.element):o([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=o(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(e,i){if("label"!==e||i){if(this._super(e,i),"disabled"===e)return this._toggleClass(this.label,null,"ui-state-disabled",i),void(this.element[0].disabled=i);this.refresh()}},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=o("<span>"),this.iconSpace=o("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var e=this.label.contents().not(this.element[0]);this.icon&&(e=e.not(this.icon[0])),this.iconSpace&&(e=e.not(this.iconSpace[0])),e.remove(),this.label.append(this.options.label)},refresh:function(){var e=this.element[0].checked,i=this.element[0].disabled;this._updateIcon(e),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),null!==this.options.label&&this._updateLabel(),i!==this.options.disabled&&this._setOptions({disabled:i})}}]),o.ui.checkboxradio});
|
298
wp-includes/js/jquery/ui/controlgroup.js
vendored
Normal file
298
wp-includes/js/jquery/ui/controlgroup.js
vendored
Normal file
@ -0,0 +1,298 @@
|
||||
/*!
|
||||
* jQuery UI Controlgroup 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery 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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
|
||||
|
||||
return $.widget( "ui.controlgroup", {
|
||||
version: "1.12.1",
|
||||
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 = $( $.unique( 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 = $.trim( 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" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
} ) );
|
9
wp-includes/js/jquery/ui/controlgroup.min.js
vendored
Normal file
9
wp-includes/js/jquery/ui/controlgroup.min.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Controlgroup 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(t){"function"==typeof define&&define.amd?define(["jquery","./core"],t):t(jQuery)}(function(u){var s=/ui-corner-([a-z]){2,6}/g;return u.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,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()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var l=this,r=[];u.each(this.options.items,function(o,t){var e,s={};if(t)return"controlgroupLabel"===o?((e=l.element.find(t)).each(function(){var t=u(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),l._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(r=r.concat(e.get()))):void(u.fn[o]&&(s=l["_"+o+"Options"]?l["_"+o+"Options"]("middle"):{classes:{}},l.element.find(t).each(function(){var t=u(this),e=t[o]("instance"),i=u.widget.extend({},s);if("button"!==o||!t.parent(".ui-spinner").length){(e=e||t[o]()[o]("instance"))&&(i.classes=l._resolveClassesValues(i.classes,e)),t[o](i);var n=t[o]("widget");u.data(n[0],"ui-controlgroup-data",e||t[o]("instance")),r.push(n[0])}})))}),this.childWidgets=u(u.unique(r)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=u(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){var i=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,i)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,n={classes:{}};return n.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],n},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,n){var o={};return u.each(i,function(t){var e=n.options.classes[t]||"";e=u.trim(e.replace(s,"")),o[t]=(e+" "+i[t]).replace(/\s+/g," ")}),o},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var o,s=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),o=this.childWidgets,this.options.onlyVisible&&(o=o.filter(":visible")),o.length&&(u.each(["first","last"],function(t,e){var i=o[e]().data("ui-controlgroup-data");if(i&&s["_"+i.widgetName+"Options"]){var n=s["_"+i.widgetName+"Options"](1===o.length?"only":e);n.classes=s._resolveClassesValues(n.classes,i),i.element[i.widgetName](n)}else s._updateCornerClass(o[e](),e)}),this._callChildMethod("refresh"))}})});
|
1768
wp-includes/js/jquery/ui/core.js
vendored
Normal file
1768
wp-includes/js/jquery/ui/core.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
111
wp-includes/js/jquery/ui/core.min.js
vendored
111
wp-includes/js/jquery/ui/core.min.js
vendored
File diff suppressed because one or more lines are too long
2119
wp-includes/js/jquery/ui/datepicker.js
vendored
Normal file
2119
wp-includes/js/jquery/ui/datepicker.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
wp-includes/js/jquery/ui/datepicker.min.js
vendored
6
wp-includes/js/jquery/ui/datepicker.min.js
vendored
File diff suppressed because one or more lines are too long
932
wp-includes/js/jquery/ui/dialog.js
vendored
Normal file
932
wp-includes/js/jquery/ui/dialog.js
vendored
Normal file
@ -0,0 +1,932 @@
|
||||
/*!
|
||||
* jQuery UI Dialog 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./button",
|
||||
"./draggable",
|
||||
"./mouse",
|
||||
"./resizable",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.dialog", {
|
||||
version: "1.12.1",
|
||||
options: {
|
||||
appendTo: "body",
|
||||
autoOpen: true,
|
||||
buttons: [],
|
||||
classes: {
|
||||
"ui-dialog": "ui-corner-all",
|
||||
"ui-dialog-titlebar": "ui-corner-all"
|
||||
},
|
||||
closeOnEscape: true,
|
||||
closeText: "Close",
|
||||
draggable: true,
|
||||
hide: null,
|
||||
height: "auto",
|
||||
maxHeight: null,
|
||||
maxWidth: null,
|
||||
minHeight: 150,
|
||||
minWidth: 150,
|
||||
modal: false,
|
||||
position: {
|
||||
my: "center",
|
||||
at: "center",
|
||||
of: window,
|
||||
collision: "fit",
|
||||
|
||||
// Ensure the titlebar is always visible
|
||||
using: function( pos ) {
|
||||
var topOffset = $( this ).css( pos ).offset().top;
|
||||
if ( topOffset < 0 ) {
|
||||
$( this ).css( "top", pos.top - topOffset );
|
||||
}
|
||||
}
|
||||
},
|
||||
resizable: true,
|
||||
show: null,
|
||||
title: null,
|
||||
width: 300,
|
||||
|
||||
// Callbacks
|
||||
beforeClose: null,
|
||||
close: null,
|
||||
drag: null,
|
||||
dragStart: null,
|
||||
dragStop: null,
|
||||
focus: null,
|
||||
open: null,
|
||||
resize: null,
|
||||
resizeStart: null,
|
||||
resizeStop: null
|
||||
},
|
||||
|
||||
sizeRelatedOptions: {
|
||||
buttons: true,
|
||||
height: true,
|
||||
maxHeight: true,
|
||||
maxWidth: true,
|
||||
minHeight: true,
|
||||
minWidth: true,
|
||||
width: true
|
||||
},
|
||||
|
||||
resizableRelatedOptions: {
|
||||
maxHeight: true,
|
||||
maxWidth: true,
|
||||
minHeight: true,
|
||||
minWidth: true
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this.originalCss = {
|
||||
display: this.element[ 0 ].style.display,
|
||||
width: this.element[ 0 ].style.width,
|
||||
minHeight: this.element[ 0 ].style.minHeight,
|
||||
maxHeight: this.element[ 0 ].style.maxHeight,
|
||||
height: this.element[ 0 ].style.height
|
||||
};
|
||||
this.originalPosition = {
|
||||
parent: this.element.parent(),
|
||||
index: this.element.parent().children().index( this.element )
|
||||
};
|
||||
this.originalTitle = this.element.attr( "title" );
|
||||
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" )
|
||||
.appendTo( this.uiDialog );
|
||||
|
||||
this._addClass( "ui-dialog-content", "ui-widget-content" );
|
||||
|
||||
this._createTitlebar();
|
||||
this._createButtonPane();
|
||||
|
||||
if ( this.options.draggable && $.fn.draggable ) {
|
||||
this._makeDraggable();
|
||||
}
|
||||
if ( this.options.resizable && $.fn.resizable ) {
|
||||
this._makeResizable();
|
||||
}
|
||||
|
||||
this._isOpen = false;
|
||||
|
||||
this._trackFocus();
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
if ( this.options.autoOpen ) {
|
||||
this.open();
|
||||
}
|
||||
},
|
||||
|
||||
_appendTo: function() {
|
||||
var element = this.options.appendTo;
|
||||
if ( element && ( element.jquery || element.nodeType ) ) {
|
||||
return $( element );
|
||||
}
|
||||
return this.document.find( element || "body" ).eq( 0 );
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
var next,
|
||||
originalPosition = this.originalPosition;
|
||||
|
||||
this._untrackInstance();
|
||||
this._destroyOverlay();
|
||||
|
||||
this.element
|
||||
.removeUniqueId()
|
||||
.css( this.originalCss )
|
||||
|
||||
// Without detaching first, the following becomes really slow
|
||||
.detach();
|
||||
|
||||
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 );
|
||||
} else {
|
||||
originalPosition.parent.append( this.element );
|
||||
}
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.uiDialog;
|
||||
},
|
||||
|
||||
disable: $.noop,
|
||||
enable: $.noop,
|
||||
|
||||
close: function( event ) {
|
||||
var that = this;
|
||||
|
||||
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isOpen = false;
|
||||
this._focusedElement = null;
|
||||
this._destroyOverlay();
|
||||
this._untrackInstance();
|
||||
|
||||
if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
|
||||
|
||||
// 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() {
|
||||
return this._isOpen;
|
||||
},
|
||||
|
||||
moveToTop: function() {
|
||||
this._moveToTop();
|
||||
},
|
||||
|
||||
_moveToTop: function( event, silent ) {
|
||||
var moved = false,
|
||||
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
|
||||
return +$( this ).css( "z-index" );
|
||||
} ).get(),
|
||||
zIndexMax = Math.max.apply( null, zIndices );
|
||||
|
||||
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
|
||||
this.uiDialog.css( "z-index", zIndexMax + 1 );
|
||||
moved = true;
|
||||
}
|
||||
|
||||
if ( moved && !silent ) {
|
||||
this._trigger( "focus", event );
|
||||
}
|
||||
return moved;
|
||||
},
|
||||
|
||||
open: function() {
|
||||
var that = this;
|
||||
if ( this._isOpen ) {
|
||||
if ( this._moveToTop() ) {
|
||||
this._focusTabbable();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._isOpen = true;
|
||||
this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
|
||||
|
||||
this._size();
|
||||
this._position();
|
||||
this._createOverlay();
|
||||
this._moveToTop( null, true );
|
||||
|
||||
// Ensure the overlay is moved to the top with the dialog, but only when
|
||||
// opening. The overlay shouldn't move after the dialog is open so that
|
||||
// modeless dialogs opened after the modal dialog stack properly.
|
||||
if ( this.overlay ) {
|
||||
this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
|
||||
}
|
||||
|
||||
this._show( this.uiDialog, this.options.show, function() {
|
||||
that._focusTabbable();
|
||||
that._trigger( "focus" );
|
||||
} );
|
||||
|
||||
// Track the dialog immediately upon openening in case a focus event
|
||||
// somehow occurs outside of the dialog before an element inside the
|
||||
// dialog is focused (#10152)
|
||||
this._makeFocusTarget();
|
||||
|
||||
this._trigger( "open" );
|
||||
},
|
||||
|
||||
_focusTabbable: function() {
|
||||
|
||||
// Set focus to the first match:
|
||||
// 1. An element that was focused previously
|
||||
// 2. First element inside the dialog matching [autofocus]
|
||||
// 3. Tabbable element inside the content element
|
||||
// 4. Tabbable element inside the buttonpane
|
||||
// 5. The close button
|
||||
// 6. The dialog itself
|
||||
var hasFocus = this._focusedElement;
|
||||
if ( !hasFocus ) {
|
||||
hasFocus = this.element.find( "[autofocus]" );
|
||||
}
|
||||
if ( !hasFocus.length ) {
|
||||
hasFocus = this.element.find( ":tabbable" );
|
||||
}
|
||||
if ( !hasFocus.length ) {
|
||||
hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
|
||||
}
|
||||
if ( !hasFocus.length ) {
|
||||
hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
|
||||
}
|
||||
if ( !hasFocus.length ) {
|
||||
hasFocus = this.uiDialog;
|
||||
}
|
||||
hasFocus.eq( 0 ).trigger( "focus" );
|
||||
},
|
||||
|
||||
_keepFocus: function( event ) {
|
||||
function checkFocus() {
|
||||
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
|
||||
isActive = this.uiDialog[ 0 ] === activeElement ||
|
||||
$.contains( this.uiDialog[ 0 ], activeElement );
|
||||
if ( !isActive ) {
|
||||
this._focusTabbable();
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
checkFocus.call( this );
|
||||
|
||||
// support: IE
|
||||
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
|
||||
// so we check again later
|
||||
this._delay( checkFocus );
|
||||
},
|
||||
|
||||
_createWrapper: function() {
|
||||
this.uiDialog = $( "<div>" )
|
||||
.hide()
|
||||
.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 &&
|
||||
event.keyCode === $.ui.keyCode.ESCAPE ) {
|
||||
event.preventDefault();
|
||||
this.close( event );
|
||||
return;
|
||||
}
|
||||
|
||||
// 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" );
|
||||
|
||||
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.trigger( "focus" );
|
||||
} );
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
mousedown: function( event ) {
|
||||
if ( this._moveToTop( event ) ) {
|
||||
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( {
|
||||
"aria-describedby": this.element.uniqueId().attr( "id" )
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
_createTitlebar: function() {
|
||||
var uiDialogTitle;
|
||||
|
||||
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.trigger( "focus" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// 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: $( "<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().prependTo( this.uiDialogTitlebar );
|
||||
this._addClass( uiDialogTitle, "ui-dialog-title" );
|
||||
this._title( uiDialogTitle );
|
||||
|
||||
this.uiDialogTitlebar.prependTo( this.uiDialog );
|
||||
|
||||
this.uiDialog.attr( {
|
||||
"aria-labelledby": uiDialogTitle.attr( "id" )
|
||||
} );
|
||||
},
|
||||
|
||||
_title: function( title ) {
|
||||
if ( this.options.title ) {
|
||||
title.text( this.options.title );
|
||||
} else {
|
||||
title.html( " " );
|
||||
}
|
||||
},
|
||||
|
||||
_createButtonPane: function() {
|
||||
this.uiDialogButtonPane = $( "<div>" );
|
||||
this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
|
||||
"ui-widget-content ui-helper-clearfix" );
|
||||
|
||||
this.uiButtonSet = $( "<div>" )
|
||||
.appendTo( this.uiDialogButtonPane );
|
||||
this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
|
||||
|
||||
this._createButtons();
|
||||
},
|
||||
|
||||
_createButtons: function() {
|
||||
var that = this,
|
||||
buttons = this.options.buttons;
|
||||
|
||||
// If we already have a button pane, remove it
|
||||
this.uiDialogButtonPane.remove();
|
||||
this.uiButtonSet.empty();
|
||||
|
||||
if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
|
||||
this._removeClass( this.uiDialog, "ui-dialog-buttons" );
|
||||
return;
|
||||
}
|
||||
|
||||
$.each( buttons, function( name, props ) {
|
||||
var click, buttonOptions;
|
||||
props = $.isFunction( props ) ?
|
||||
{ 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;
|
||||
buttonOptions = {
|
||||
icon: props.icon,
|
||||
iconPosition: props.iconPosition,
|
||||
showLabel: props.showLabel,
|
||||
|
||||
// Deprecated options
|
||||
icons: props.icons,
|
||||
text: props.text
|
||||
};
|
||||
|
||||
delete props.click;
|
||||
delete props.icon;
|
||||
delete props.iconPosition;
|
||||
delete props.showLabel;
|
||||
|
||||
// Deprecated options
|
||||
delete props.icons;
|
||||
if ( typeof props.text === "boolean" ) {
|
||||
delete props.text;
|
||||
}
|
||||
|
||||
$( "<button></button>", props )
|
||||
.button( buttonOptions )
|
||||
.appendTo( that.uiButtonSet )
|
||||
.on( "click", function() {
|
||||
click.apply( that.element[ 0 ], arguments );
|
||||
} );
|
||||
} );
|
||||
this._addClass( this.uiDialog, "ui-dialog-buttons" );
|
||||
this.uiDialogButtonPane.appendTo( this.uiDialog );
|
||||
},
|
||||
|
||||
_makeDraggable: function() {
|
||||
var that = this,
|
||||
options = this.options;
|
||||
|
||||
function filteredUi( ui ) {
|
||||
return {
|
||||
position: ui.position,
|
||||
offset: ui.offset
|
||||
};
|
||||
}
|
||||
|
||||
this.uiDialog.draggable( {
|
||||
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
|
||||
handle: ".ui-dialog-titlebar",
|
||||
containment: "document",
|
||||
start: function( event, ui ) {
|
||||
that._addClass( $( this ), "ui-dialog-dragging" );
|
||||
that._blockFrames();
|
||||
that._trigger( "dragStart", event, filteredUi( ui ) );
|
||||
},
|
||||
drag: function( event, ui ) {
|
||||
that._trigger( "drag", event, filteredUi( ui ) );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
var left = ui.offset.left - that.document.scrollLeft(),
|
||||
top = ui.offset.top - that.document.scrollTop();
|
||||
|
||||
options.position = {
|
||||
my: "left top",
|
||||
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
|
||||
"top" + ( top >= 0 ? "+" : "" ) + top,
|
||||
of: that.window
|
||||
};
|
||||
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" ),
|
||||
resizeHandles = typeof handles === "string" ?
|
||||
handles :
|
||||
"n,e,s,w,se,sw,ne,nw";
|
||||
|
||||
function filteredUi( ui ) {
|
||||
return {
|
||||
originalPosition: ui.originalPosition,
|
||||
originalSize: ui.originalSize,
|
||||
position: ui.position,
|
||||
size: ui.size
|
||||
};
|
||||
}
|
||||
|
||||
this.uiDialog.resizable( {
|
||||
cancel: ".ui-dialog-content",
|
||||
containment: "document",
|
||||
alsoResize: this.element,
|
||||
maxWidth: options.maxWidth,
|
||||
maxHeight: options.maxHeight,
|
||||
minWidth: options.minWidth,
|
||||
minHeight: this._minHeight(),
|
||||
handles: resizeHandles,
|
||||
start: function( event, ui ) {
|
||||
that._addClass( $( this ), "ui-dialog-resizing" );
|
||||
that._blockFrames();
|
||||
that._trigger( "resizeStart", event, filteredUi( ui ) );
|
||||
},
|
||||
resize: function( event, ui ) {
|
||||
that._trigger( "resize", event, filteredUi( ui ) );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
var offset = that.uiDialog.offset(),
|
||||
left = offset.left - that.document.scrollLeft(),
|
||||
top = offset.top - that.document.scrollTop();
|
||||
|
||||
options.height = that.uiDialog.height();
|
||||
options.width = that.uiDialog.width();
|
||||
options.position = {
|
||||
my: "left top",
|
||||
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
|
||||
"top" + ( top >= 0 ? "+" : "" ) + top,
|
||||
of: that.window
|
||||
};
|
||||
that._removeClass( $( this ), "ui-dialog-resizing" );
|
||||
that._unblockFrames();
|
||||
that._trigger( "resizeStop", event, filteredUi( ui ) );
|
||||
}
|
||||
} )
|
||||
.css( "position", position );
|
||||
},
|
||||
|
||||
_trackFocus: function() {
|
||||
this._on( this.widget(), {
|
||||
focusin: function( event ) {
|
||||
this._makeFocusTarget();
|
||||
this._focusedElement = $( event.target );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
_makeFocusTarget: function() {
|
||||
this._untrackInstance();
|
||||
this._trackingInstances().unshift( this );
|
||||
},
|
||||
|
||||
_untrackInstance: function() {
|
||||
var instances = this._trackingInstances(),
|
||||
exists = $.inArray( this, instances );
|
||||
if ( exists !== -1 ) {
|
||||
instances.splice( exists, 1 );
|
||||
}
|
||||
},
|
||||
|
||||
_trackingInstances: function() {
|
||||
var instances = this.document.data( "ui-dialog-instances" );
|
||||
if ( !instances ) {
|
||||
instances = [];
|
||||
this.document.data( "ui-dialog-instances", instances );
|
||||
}
|
||||
return instances;
|
||||
},
|
||||
|
||||
_minHeight: function() {
|
||||
var options = this.options;
|
||||
|
||||
return options.height === "auto" ?
|
||||
options.minHeight :
|
||||
Math.min( options.minHeight, options.height );
|
||||
},
|
||||
|
||||
_position: function() {
|
||||
|
||||
// Need to show the dialog to get the actual offset in the position plugin
|
||||
var isVisible = this.uiDialog.is( ":visible" );
|
||||
if ( !isVisible ) {
|
||||
this.uiDialog.show();
|
||||
}
|
||||
this.uiDialog.position( this.options.position );
|
||||
if ( !isVisible ) {
|
||||
this.uiDialog.hide();
|
||||
}
|
||||
},
|
||||
|
||||
_setOptions: function( options ) {
|
||||
var that = this,
|
||||
resize = false,
|
||||
resizableOptions = {};
|
||||
|
||||
$.each( options, function( key, value ) {
|
||||
that._setOption( key, value );
|
||||
|
||||
if ( key in that.sizeRelatedOptions ) {
|
||||
resize = true;
|
||||
}
|
||||
if ( key in that.resizableRelatedOptions ) {
|
||||
resizableOptions[ key ] = value;
|
||||
}
|
||||
} );
|
||||
|
||||
if ( resize ) {
|
||||
this._size();
|
||||
this._position();
|
||||
}
|
||||
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDialog.resizable( "option", resizableOptions );
|
||||
}
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
var isDraggable, isResizable,
|
||||
uiDialog = this.uiDialog;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "appendTo" ) {
|
||||
this.uiDialog.appendTo( this._appendTo() );
|
||||
}
|
||||
|
||||
if ( key === "buttons" ) {
|
||||
this._createButtons();
|
||||
}
|
||||
|
||||
if ( key === "closeText" ) {
|
||||
this.uiDialogTitlebarClose.button( {
|
||||
|
||||
// Ensure that we always pass a string
|
||||
label: $( "<a>" ).text( "" + this.options.closeText ).html()
|
||||
} );
|
||||
}
|
||||
|
||||
if ( key === "draggable" ) {
|
||||
isDraggable = uiDialog.is( ":data(ui-draggable)" );
|
||||
if ( isDraggable && !value ) {
|
||||
uiDialog.draggable( "destroy" );
|
||||
}
|
||||
|
||||
if ( !isDraggable && value ) {
|
||||
this._makeDraggable();
|
||||
}
|
||||
}
|
||||
|
||||
if ( key === "position" ) {
|
||||
this._position();
|
||||
}
|
||||
|
||||
if ( key === "resizable" ) {
|
||||
|
||||
// currently resizable, becoming non-resizable
|
||||
isResizable = uiDialog.is( ":data(ui-resizable)" );
|
||||
if ( isResizable && !value ) {
|
||||
uiDialog.resizable( "destroy" );
|
||||
}
|
||||
|
||||
// Currently resizable, changing handles
|
||||
if ( isResizable && typeof value === "string" ) {
|
||||
uiDialog.resizable( "option", "handles", value );
|
||||
}
|
||||
|
||||
// Currently non-resizable, becoming resizable
|
||||
if ( !isResizable && value !== false ) {
|
||||
this._makeResizable();
|
||||
}
|
||||
}
|
||||
|
||||
if ( key === "title" ) {
|
||||
this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
|
||||
}
|
||||
},
|
||||
|
||||
_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( {
|
||||
width: "auto",
|
||||
minHeight: 0,
|
||||
maxHeight: "none",
|
||||
height: 0
|
||||
} );
|
||||
|
||||
if ( options.minWidth > options.width ) {
|
||||
options.width = options.minWidth;
|
||||
}
|
||||
|
||||
// Reset wrapper sizing
|
||||
// determine the height of all the non-content elements
|
||||
nonContentHeight = this.uiDialog.css( {
|
||||
height: "auto",
|
||||
width: options.width
|
||||
} )
|
||||
.outerHeight();
|
||||
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
||||
maxContentHeight = typeof options.maxHeight === "number" ?
|
||||
Math.max( 0, options.maxHeight - nonContentHeight ) :
|
||||
"none";
|
||||
|
||||
if ( options.height === "auto" ) {
|
||||
this.element.css( {
|
||||
minHeight: minContentHeight,
|
||||
maxHeight: maxContentHeight,
|
||||
height: "auto"
|
||||
} );
|
||||
} else {
|
||||
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
|
||||
}
|
||||
|
||||
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
|
||||
}
|
||||
},
|
||||
|
||||
_blockFrames: function() {
|
||||
this.iframeBlocks = this.document.find( "iframe" ).map( function() {
|
||||
var iframe = $( this );
|
||||
|
||||
return $( "<div>" )
|
||||
.css( {
|
||||
position: "absolute",
|
||||
width: iframe.outerWidth(),
|
||||
height: iframe.outerHeight()
|
||||
} )
|
||||
.appendTo( iframe.parent() )
|
||||
.offset( iframe.offset() )[ 0 ];
|
||||
} );
|
||||
},
|
||||
|
||||
_unblockFrames: function() {
|
||||
if ( this.iframeBlocks ) {
|
||||
this.iframeBlocks.remove();
|
||||
delete this.iframeBlocks;
|
||||
}
|
||||
},
|
||||
|
||||
_allowInteraction: function( event ) {
|
||||
if ( $( event.target ).closest( ".ui-dialog" ).length ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Remove hack when datepicker implements
|
||||
// the .ui-front logic (#8989)
|
||||
return !!$( event.target ).closest( ".ui-datepicker" ).length;
|
||||
},
|
||||
|
||||
_createOverlay: function() {
|
||||
if ( !this.options.modal ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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() {
|
||||
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;
|
||||
}
|
||||
|
||||
if ( !this._allowInteraction( event ) ) {
|
||||
event.preventDefault();
|
||||
this._trackingInstances()[ 0 ]._focusTabbable();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
this.overlay = $( "<div>" )
|
||||
.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 );
|
||||
},
|
||||
|
||||
_destroyOverlay: function() {
|
||||
if ( !this.options.modal ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.overlay ) {
|
||||
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
|
||||
|
||||
if ( !overlays ) {
|
||||
this._off( this.document, "focusin" );
|
||||
this.document.removeData( "ui-dialog-overlays" );
|
||||
} else {
|
||||
this.document.data( "ui-dialog-overlays", overlays );
|
||||
}
|
||||
|
||||
this.overlay.remove();
|
||||
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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/dialog.min.js
vendored
6
wp-includes/js/jquery/ui/dialog.min.js
vendored
File diff suppressed because one or more lines are too long
1244
wp-includes/js/jquery/ui/draggable.js
vendored
Normal file
1244
wp-includes/js/jquery/ui/draggable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
wp-includes/js/jquery/ui/draggable.min.js
vendored
6
wp-includes/js/jquery/ui/draggable.min.js
vendored
File diff suppressed because one or more lines are too long
496
wp-includes/js/jquery/ui/droppable.js
vendored
Normal file
496
wp-includes/js/jquery/ui/droppable.js
vendored
Normal file
@ -0,0 +1,496 @@
|
||||
/*!
|
||||
* jQuery UI Droppable 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Droppable
|
||||
//>>group: Interactions
|
||||
//>>description: Enables drop targets for draggable elements.
|
||||
//>>docs: http://api.jqueryui.com/droppable/
|
||||
//>>demos: http://jqueryui.com/droppable/
|
||||
|
||||
( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./draggable",
|
||||
"./mouse",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.droppable", {
|
||||
version: "1.12.1",
|
||||
widgetEventPrefix: "drop",
|
||||
options: {
|
||||
accept: "*",
|
||||
addClasses: true,
|
||||
greedy: false,
|
||||
scope: "default",
|
||||
tolerance: "intersect",
|
||||
|
||||
// Callbacks
|
||||
activate: null,
|
||||
deactivate: null,
|
||||
drop: null,
|
||||
out: null,
|
||||
over: null
|
||||
},
|
||||
_create: function() {
|
||||
|
||||
var proportions,
|
||||
o = this.options,
|
||||
accept = o.accept;
|
||||
|
||||
this.isover = false;
|
||||
this.isout = true;
|
||||
|
||||
this.accept = $.isFunction( accept ) ? 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 :
|
||||
proportions = {
|
||||
width: this.element[ 0 ].offsetWidth,
|
||||
height: this.element[ 0 ].offsetHeight
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
this._addToManager( o.scope );
|
||||
|
||||
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 );
|
||||
},
|
||||
|
||||
_splice: function( drop ) {
|
||||
var i = 0;
|
||||
for ( ; i < drop.length; i++ ) {
|
||||
if ( drop[ i ] === this ) {
|
||||
drop.splice( i, 1 );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
|
||||
|
||||
this._splice( drop );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
|
||||
if ( key === "accept" ) {
|
||||
this.accept = $.isFunction( value ) ? value : function( d ) {
|
||||
return d.is( value );
|
||||
};
|
||||
} else if ( key === "scope" ) {
|
||||
var drop = $.ui.ddmanager.droppables[ this.options.scope ];
|
||||
|
||||
this._splice( drop );
|
||||
this._addToManager( value );
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
},
|
||||
|
||||
_activate: function( event ) {
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
|
||||
this._addActiveClass();
|
||||
if ( draggable ) {
|
||||
this._trigger( "activate", event, this.ui( draggable ) );
|
||||
}
|
||||
},
|
||||
|
||||
_deactivate: function( event ) {
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
|
||||
this._removeActiveClass();
|
||||
if ( draggable ) {
|
||||
this._trigger( "deactivate", event, this.ui( draggable ) );
|
||||
}
|
||||
},
|
||||
|
||||
_over: function( event ) {
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
|
||||
// Bail if draggable and droppable are same element
|
||||
if ( !draggable || ( draggable.currentItem ||
|
||||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
|
||||
draggable.element ) ) ) {
|
||||
this._addHoverClass();
|
||||
this._trigger( "over", event, this.ui( draggable ) );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_out: function( event ) {
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
|
||||
// Bail if draggable and droppable are same element
|
||||
if ( !draggable || ( draggable.currentItem ||
|
||||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
|
||||
draggable.element ) ) ) {
|
||||
this._removeHoverClass();
|
||||
this._trigger( "out", event, this.ui( draggable ) );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_drop: function( event, custom ) {
|
||||
|
||||
var draggable = custom || $.ui.ddmanager.current,
|
||||
childrenIntersection = false;
|
||||
|
||||
// Bail if draggable and droppable are same element
|
||||
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 )
|
||||
) &&
|
||||
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 ) ) ) {
|
||||
this._removeActiveClass();
|
||||
this._removeHoverClass();
|
||||
|
||||
this._trigger( "drop", event, this.ui( draggable ) );
|
||||
return this.element;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
ui: function( c ) {
|
||||
return {
|
||||
draggable: ( c.currentItem || c.element ),
|
||||
helper: c.helper,
|
||||
position: c.position,
|
||||
offset: c.positionAbs
|
||||
};
|
||||
},
|
||||
|
||||
// Extension points just to make backcompat sane and avoid duplicating logic
|
||||
// TODO: Remove in 1.13 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" );
|
||||
}
|
||||
} );
|
||||
|
||||
var intersect = $.ui.intersect = ( function() {
|
||||
function isOverAxis( x, reference, size ) {
|
||||
return ( x >= reference ) && ( x < ( reference + size ) );
|
||||
}
|
||||
|
||||
return function( draggable, droppable, toleranceMode, event ) {
|
||||
|
||||
if ( !droppable.offset ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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,
|
||||
t = droppable.offset.top,
|
||||
r = l + droppable.proportions().width,
|
||||
b = t + droppable.proportions().height;
|
||||
|
||||
switch ( toleranceMode ) {
|
||||
case "fit":
|
||||
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
|
||||
case "intersect":
|
||||
return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
|
||||
x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
|
||||
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 );
|
||||
case "touch":
|
||||
return (
|
||||
( y1 >= t && y1 <= b ) || // Top edge touching
|
||||
( y2 >= t && y2 <= b ) || // Bottom edge touching
|
||||
( y1 < t && y2 > b ) // Surrounded vertically
|
||||
) && (
|
||||
( x1 >= l && x1 <= r ) || // Left edge touching
|
||||
( x2 >= l && x2 <= r ) || // Right edge touching
|
||||
( x1 < l && x2 > r ) // Surrounded horizontally
|
||||
);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
} )();
|
||||
|
||||
/*
|
||||
This manager tracks offsets of draggables and droppables
|
||||
*/
|
||||
$.ui.ddmanager = {
|
||||
current: null,
|
||||
droppables: { "default": [] },
|
||||
prepareOffsets: function( t, event ) {
|
||||
|
||||
var i, j,
|
||||
m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
|
||||
type = event ? event.type : null, // workaround for #2317
|
||||
list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
|
||||
|
||||
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 ) ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter out elements in the current dragged item
|
||||
for ( j = 0; j < list.length; j++ ) {
|
||||
if ( list[ j ] === m[ i ].element[ 0 ] ) {
|
||||
m[ i ].proportions().height = 0;
|
||||
continue droppablesLoop;
|
||||
}
|
||||
}
|
||||
|
||||
m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
|
||||
if ( !m[ i ].visible ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Activate the droppable if used directly from draggables
|
||||
if ( type === "mousedown" ) {
|
||||
m[ i ]._activate.call( m[ i ], event );
|
||||
}
|
||||
|
||||
m[ i ].offset = m[ i ].element.offset();
|
||||
m[ i ].proportions( {
|
||||
width: m[ i ].element[ 0 ].offsetWidth,
|
||||
height: m[ i ].element[ 0 ].offsetHeight
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
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 &&
|
||||
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 ) ) ) {
|
||||
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" ).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 ( draggable.options.refreshPositions ) {
|
||||
$.ui.ddmanager.prepareOffsets( draggable, event );
|
||||
}
|
||||
|
||||
// Run through all droppables and check their positions based on specific tolerance options
|
||||
$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
|
||||
|
||||
if ( this.options.disabled || this.greedyChild || !this.visible ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var parentInstance, scope, parent,
|
||||
intersects = intersect( draggable, this, this.options.tolerance, event ),
|
||||
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() {
|
||||
return $( this ).droppable( "instance" ).options.scope === scope;
|
||||
} );
|
||||
|
||||
if ( parent.length ) {
|
||||
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
|
||||
parentInstance.greedyChild = ( c === "isover" );
|
||||
}
|
||||
}
|
||||
|
||||
// We just moved into a greedy child
|
||||
if ( parentInstance && c === "isover" ) {
|
||||
parentInstance.isover = false;
|
||||
parentInstance.isout = true;
|
||||
parentInstance._out.call( parentInstance, event );
|
||||
}
|
||||
|
||||
this[ c ] = true;
|
||||
this[ c === "isout" ? "isover" : "isout" ] = false;
|
||||
this[ c === "isover" ? "_over" : "_out" ].call( this, event );
|
||||
|
||||
// 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" ).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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/droppable.min.js
vendored
6
wp-includes/js/jquery/ui/droppable.min.js
vendored
File diff suppressed because one or more lines are too long
69
wp-includes/js/jquery/ui/effect-blind.js
vendored
Normal file
69
wp-includes/js/jquery/ui/effect-blind.js
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* jQuery UI Effects Blind 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Blind Effect
|
||||
//>>group: Effects
|
||||
//>>description: Blinds the element.
|
||||
//>>docs: http://api.jqueryui.com/blind-effect/
|
||||
//>>demos: http://jqueryui.com/effect/
|
||||
|
||||
( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
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 );
|
||||
|
||||
animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
|
||||
|
||||
if ( options.mode === "show" ) {
|
||||
element.cssClip( animate.clip );
|
||||
if ( placeholder ) {
|
||||
placeholder.css( $.effects.clipToBox( animate ) );
|
||||
}
|
||||
|
||||
animate.clip = start;
|
||||
}
|
||||
|
||||
if ( placeholder ) {
|
||||
placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
|
||||
}
|
||||
|
||||
element.animate( animate, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-blind.min.js
vendored
6
wp-includes/js/jquery/ui/effect-blind.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Blind 1.11.4
|
||||
* jQuery UI Effects Blind 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/blind-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(m){return m.effects.effect.blind=function(e,t){var s,i,o,f=m(this),n=["position","top","bottom","left","right","height","width"],c=m.effects.setMode(f,e.mode||"hide"),r=e.direction||"up",a=/up|down|vertical/.test(r),p=a?"height":"width",d=a?"top":"left",u=/up|left|vertical|horizontal/.test(r),h={},l="show"===c;f.parent().is(".ui-effects-wrapper")?m.effects.save(f.parent(),n):m.effects.save(f,n),f.show(),i=(s=m.effects.createWrapper(f).css({overflow:"hidden"}))[p](),o=parseFloat(s.css(d))||0,h[p]=l?i:0,u||(f.css(a?"bottom":"right",0).css(a?"top":"left","auto").css({position:"absolute"}),h[d]=l?o:i+o),l&&(s.css(p,0),u||s.css(d,o+i)),s.animate(h,{duration:e.duration,easing:e.easing,queue:!1,complete:function(){"hide"===c&&f.hide(),m.effects.restore(f,n),m.effects.removeWrapper(f),t()}})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(r){return r.effects.define("blind","hide",function(e,t){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},o=r(this),n=e.direction||"up",c=o.cssClip(),f={clip:r.extend({},c)},l=r.effects.createPlaceholder(o);f.clip[i[n][0]]=f.clip[i[n][1]],"show"===e.mode&&(o.cssClip(f.clip),l&&l.css(r.effects.clipToBox(f)),f.clip=c),l&&l.animate(r.effects.clipToBox(f),e.duration,e.easing),o.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:t})})});
|
109
wp-includes/js/jquery/ui/effect-bounce.js
vendored
Normal file
109
wp-includes/js/jquery/ui/effect-bounce.js
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/*!
|
||||
* jQuery UI Effects Bounce 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "bounce", function( options, done ) {
|
||||
var upAnim, downAnim, refValue,
|
||||
element = $( this ),
|
||||
|
||||
// Defaults:
|
||||
mode = options.mode,
|
||||
hide = mode === "hide",
|
||||
show = mode === "show",
|
||||
direction = options.direction || "up",
|
||||
distance = options.distance,
|
||||
times = options.times || 5,
|
||||
|
||||
// Number of internal animations
|
||||
anims = times * 2 + ( show || hide ? 1 : 0 ),
|
||||
speed = options.duration / anims,
|
||||
easing = options.easing,
|
||||
|
||||
// Utility:
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
motion = ( direction === "up" || direction === "left" ),
|
||||
i = 0,
|
||||
|
||||
queuelen = element.queue().length;
|
||||
|
||||
$.effects.createPlaceholder( element );
|
||||
|
||||
refValue = element.css( ref );
|
||||
|
||||
// Default distance for the BIGGEST bounce is the outer Distance / 3
|
||||
if ( !distance ) {
|
||||
distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
|
||||
}
|
||||
|
||||
if ( show ) {
|
||||
downAnim = { opacity: 1 };
|
||||
downAnim[ ref ] = refValue;
|
||||
|
||||
// If we are showing, force opacity 0 and set the initial position
|
||||
// then do the "first" animation
|
||||
element
|
||||
.css( "opacity", 0 )
|
||||
.css( ref, motion ? -distance * 2 : distance * 2 )
|
||||
.animate( downAnim, speed, easing );
|
||||
}
|
||||
|
||||
// Start at the smallest distance if we are hiding
|
||||
if ( hide ) {
|
||||
distance = distance / Math.pow( 2, times - 1 );
|
||||
}
|
||||
|
||||
downAnim = {};
|
||||
downAnim[ ref ] = refValue;
|
||||
|
||||
// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
|
||||
for ( ; i < times; i++ ) {
|
||||
upAnim = {};
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
element
|
||||
.animate( upAnim, speed, easing )
|
||||
.animate( downAnim, speed, easing );
|
||||
|
||||
distance = hide ? distance * 2 : distance / 2;
|
||||
}
|
||||
|
||||
// Last Bounce when Hiding
|
||||
if ( hide ) {
|
||||
upAnim = { opacity: 0 };
|
||||
upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
|
||||
|
||||
element.animate( upAnim, speed, easing );
|
||||
}
|
||||
|
||||
element.queue( done );
|
||||
|
||||
$.effects.unshift( element, queuelen, anims + 1 );
|
||||
} );
|
||||
|
||||
} ) );
|
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Bounce 1.11.4
|
||||
* jQuery UI Effects Bounce 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/bounce-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(v){return v.effects.effect.bounce=function(e,t){var i,o,f,c=v(this),n=["position","top","bottom","left","right","height","width"],a=v.effects.setMode(c,e.mode||"effect"),s="hide"===a,p="show"===a,u=e.direction||"up",r=e.distance,d=e.times||5,h=2*d+(p||s?1:0),m=e.duration/h,y=e.easing,l="up"===u||"down"===u?"top":"left",g="up"===u||"left"===u,w=c.queue(),q=w.length;for((p||s)&&n.push("opacity"),v.effects.save(c,n),c.show(),v.effects.createWrapper(c),r=r||c["top"==l?"outerHeight":"outerWidth"]()/3,p&&((f={opacity:1})[l]=0,c.css("opacity",0).css(l,g?2*-r:2*r).animate(f,m,y)),s&&(r/=Math.pow(2,d-1)),i=(f={})[l]=0;i<d;i++)(o={})[l]=(g?"-=":"+=")+r,c.animate(o,m,y).animate(f,m,y),r=s?2*r:r/2;s&&((o={opacity:0})[l]=(g?"-=":"+=")+r,c.animate(o,m,y)),c.queue(function(){s&&c.hide(),v.effects.restore(c,n),v.effects.removeWrapper(c),t()}),1<q&&w.splice.apply(w,[1,0].concat(w.splice(q,1+h))),c.dequeue()}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(w){return w.effects.define("bounce",function(e,t){var i,n,f,o=w(this),a=e.mode,c="hide"===a,u="show"===a,s=e.direction||"up",d=e.distance,r=e.times||5,p=2*r+(u||c?1:0),h=e.duration/p,m=e.easing,y="up"===s||"down"===s?"top":"left",l="up"===s||"left"===s,g=0,q=o.queue().length;for(w.effects.createPlaceholder(o),f=o.css(y),d=d||o["top"==y?"outerHeight":"outerWidth"]()/3,u&&((n={opacity:1})[y]=f,o.css("opacity",0).css(y,l?2*-d:2*d).animate(n,h,m)),c&&(d/=Math.pow(2,r-1)),(n={})[y]=f;g<r;g++)(i={})[y]=(l?"-=":"+=")+d,o.animate(i,h,m).animate(n,h,m),d=c?2*d:d/2;c&&((i={opacity:0})[y]=(l?"-=":"+=")+d,o.animate(i,h,m)),o.queue(t),w.effects.unshift(o,q,1+p)})});
|
64
wp-includes/js/jquery/ui/effect-clip.js
vendored
Normal file
64
wp-includes/js/jquery/ui/effect-clip.js
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*!
|
||||
* jQuery UI Effects Clip 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
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";
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
$.effects.createPlaceholder( element );
|
||||
|
||||
if ( options.mode === "show" ) {
|
||||
element.cssClip( animate.clip );
|
||||
animate.clip = start;
|
||||
}
|
||||
|
||||
element.animate( animate, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-clip.min.js
vendored
6
wp-includes/js/jquery/ui/effect-clip.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Clip 1.11.4
|
||||
* jQuery UI Effects Clip 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/clip-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(u){return u.effects.effect.clip=function(e,t){var i,f,o,c=u(this),n=["position","top","bottom","left","right","height","width"],s="show"===u.effects.setMode(c,e.mode||"hide"),r="vertical"===(e.direction||"vertical"),a=r?"height":"width",d=r?"top":"left",h={};u.effects.save(c,n),c.show(),i=u.effects.createWrapper(c).css({overflow:"hidden"}),o=(f="IMG"===c[0].tagName?i:c)[a](),s&&(f.css(a,0),f.css(d,o/2)),h[a]=s?o:0,h[d]=s?0:o/2,f.animate(h,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){s||c.hide(),u.effects.restore(c,n),u.effects.removeWrapper(c),t()}})}});
|
||||
!function(t){"function"==typeof define&&define.amd?define(["jquery","./effect"],t):t(jQuery)}(function(a){return a.effects.define("clip","hide",function(t,e){var i,o={},n=a(this),c=t.direction||"vertical",f="both"===c,r=f||"horizontal"===c,l=f||"vertical"===c;i=n.cssClip(),o.clip={top:l?(i.bottom-i.top)/2:i.top,right:r?(i.right-i.left)/2:i.right,bottom:l?(i.bottom-i.top)/2:i.bottom,left:r?(i.right-i.left)/2:i.left},a.effects.createPlaceholder(n),"show"===t.mode&&(n.cssClip(o.clip),o.clip=i),n.animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:e})})});
|
68
wp-includes/js/jquery/ui/effect-drop.js
vendored
Normal file
68
wp-includes/js/jquery/ui/effect-drop.js
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* jQuery UI Effects Drop 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "drop", "hide", function( options, done ) {
|
||||
|
||||
var distance,
|
||||
element = $( this ),
|
||||
mode = options.mode,
|
||||
show = mode === "show",
|
||||
direction = options.direction || "left",
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
|
||||
oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
|
||||
animation = {
|
||||
opacity: 0
|
||||
};
|
||||
|
||||
$.effects.createPlaceholder( element );
|
||||
|
||||
distance = options.distance ||
|
||||
element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
|
||||
|
||||
animation[ ref ] = motion + distance;
|
||||
|
||||
if ( show ) {
|
||||
element.css( animation );
|
||||
|
||||
animation[ ref ] = oppositeMotion + distance;
|
||||
animation.opacity = 1;
|
||||
}
|
||||
|
||||
// Animate
|
||||
element.animate( animation, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-drop.min.js
vendored
6
wp-includes/js/jquery/ui/effect-drop.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Drop 1.11.4
|
||||
* jQuery UI Effects Drop 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/drop-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(a){return a.effects.effect.drop=function(e,t){var o,i=a(this),f=["position","top","bottom","left","right","opacity","height","width"],n=a.effects.setMode(i,e.mode||"hide"),s="show"===n,c=e.direction||"left",p="up"===c||"down"===c?"top":"left",r="up"===c||"left"===c?"pos":"neg",d={opacity:s?1:0};a.effects.save(i,f),i.show(),a.effects.createWrapper(i),o=e.distance||i["top"==p?"outerHeight":"outerWidth"](!0)/2,s&&i.css("opacity",0).css(p,"pos"==r?-o:o),d[p]=(s?"pos"==r?"+=":"-=":"pos"==r?"-=":"+=")+o,i.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===n&&i.hide(),a.effects.restore(i,f),a.effects.removeWrapper(i),t()}})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(r){return r.effects.define("drop","hide",function(e,t){var i,n=r(this),o="show"===e.mode,f=e.direction||"left",c="up"===f||"down"===f?"top":"left",d="up"===f||"left"===f?"-=":"+=",u="+="==d?"-=":"+=",a={opacity:0};r.effects.createPlaceholder(n),i=e.distance||n["top"==c?"outerHeight":"outerWidth"](!0)/2,a[c]=d+i,o&&(n.css(a),a[c]=u+i,a.opacity=1),n.animate(a,{queue:!1,duration:e.duration,easing:e.easing,complete:t})})});
|
110
wp-includes/js/jquery/ui/effect-explode.js
vendored
Normal file
110
wp-includes/js/jquery/ui/effect-explode.js
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
/*!
|
||||
* jQuery UI Effects Explode 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Explode Effect
|
||||
//>>group: Effects
|
||||
// jscs:disable maximumLineLength
|
||||
//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
|
||||
// jscs:enable maximumLineLength
|
||||
//>>docs: http://api.jqueryui.com/explode-effect/
|
||||
//>>demos: http://jqueryui.com/effect/
|
||||
|
||||
( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "explode", "hide", function( options, done ) {
|
||||
|
||||
var i, j, left, top, mx, my,
|
||||
rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
|
||||
cells = rows,
|
||||
element = $( this ),
|
||||
mode = options.mode,
|
||||
show = mode === "show",
|
||||
|
||||
// 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( element.outerWidth() / cells ),
|
||||
height = Math.ceil( element.outerHeight() / rows ),
|
||||
pieces = [];
|
||||
|
||||
// Children animate complete:
|
||||
function childComplete() {
|
||||
pieces.push( this );
|
||||
if ( pieces.length === rows * cells ) {
|
||||
animComplete();
|
||||
}
|
||||
}
|
||||
|
||||
// Clone the element for each row and cell.
|
||||
for ( i = 0; i < rows; i++ ) { // ===>
|
||||
top = offset.top + i * height;
|
||||
my = i - ( rows - 1 ) / 2;
|
||||
|
||||
for ( j = 0; j < cells; j++ ) { // |||
|
||||
left = offset.left + j * width;
|
||||
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
|
||||
element
|
||||
.clone()
|
||||
.appendTo( "body" )
|
||||
.wrap( "<div></div>" )
|
||||
.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
|
||||
.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
|
||||
}, options.duration || 500, options.easing, childComplete );
|
||||
}
|
||||
}
|
||||
|
||||
function animComplete() {
|
||||
element.css( {
|
||||
visibility: "visible"
|
||||
} );
|
||||
$( pieces ).remove();
|
||||
done();
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Explode 1.11.4
|
||||
* jQuery UI Effects Explode 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/explode-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(b){return b.effects.effect.explode=function(e,i){var t,o,s,f,n,d,c=e.pieces?Math.round(Math.sqrt(e.pieces)):3,a=c,h=b(this),l="show"===b.effects.setMode(h,e.mode||"hide"),p=h.show().css("visibility","hidden").offset(),u=Math.ceil(h.outerWidth()/a),r=Math.ceil(h.outerHeight()/c),v=[];function y(){v.push(this),v.length===c*a&&function(){h.css({visibility:"visible"}),b(v).remove(),l||h.hide();i()}()}for(t=0;t<c;t++)for(f=p.top+t*r,d=t-(c-1)/2,o=0;o<a;o++)s=p.left+o*u,n=o-(a-1)/2,h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*u,top:-t*r}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:u,height:r,left:s+(l?n*u:0),top:f+(l?d*r:0),opacity:l?0:1}).animate({left:s+(l?0:n*u),top:f+(l?0:d*r),opacity:l?1:0},e.duration||500,e.easing,y)}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(b){return b.effects.define("explode","hide",function(e,i){var t,o,s,n,f,d,a=e.pieces?Math.round(Math.sqrt(e.pieces)):3,c=a,l=b(this),h="show"===e.mode,p=l.show().css("visibility","hidden").offset(),r=Math.ceil(l.outerWidth()/c),u=Math.ceil(l.outerHeight()/a),v=[];function y(){v.push(this),v.length===a*c&&(l.css({visibility:"visible"}),b(v).remove(),i())}for(t=0;t<a;t++)for(n=p.top+t*u,d=t-(a-1)/2,o=0;o<c;o++)s=p.left+o*r,f=o-(c-1)/2,l.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*r,top:-t*u}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:r,height:u,left:s+(h?f*r:0),top:n+(h?d*u:0),opacity:h?0:1}).animate({left:s+(h?0:f*r),top:n+(h?0:d*u),opacity:h?1:0},e.duration||500,e.easing,y)})});
|
46
wp-includes/js/jquery/ui/effect-fade.js
vendored
Normal file
46
wp-includes/js/jquery/ui/effect-fade.js
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fade 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Fade Effect
|
||||
//>>group: Effects
|
||||
//>>description: Fades the element.
|
||||
//>>docs: http://api.jqueryui.com/fade-effect/
|
||||
//>>demos: http://jqueryui.com/effect/
|
||||
|
||||
( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "fade", "toggle", function( options, done ) {
|
||||
var show = options.mode === "show";
|
||||
|
||||
$( this )
|
||||
.css( "opacity", show ? 0 : 1 )
|
||||
.animate( {
|
||||
opacity: show ? 1 : 0
|
||||
}, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-fade.min.js
vendored
6
wp-includes/js/jquery/ui/effect-fade.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fade 1.11.4
|
||||
* jQuery UI Effects Fade 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fade-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(i){return i.effects.effect.fade=function(e,t){var f=i(this),n=i.effects.setMode(f,e.mode||"toggle");f.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:t})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(t){return t.effects.define("fade","toggle",function(e,n){var i="show"===e.mode;t(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:n})})});
|
88
wp-includes/js/jquery/ui/effect-fold.js
vendored
Normal file
88
wp-includes/js/jquery/ui/effect-fold.js
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fold 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "fold", "hide", function( options, done ) {
|
||||
|
||||
// Create element
|
||||
var element = $( this ),
|
||||
mode = options.mode,
|
||||
show = mode === "show",
|
||||
hide = mode === "hide",
|
||||
size = options.size || 15,
|
||||
percent = /([0-9]+)%/.exec( size ),
|
||||
horizFirst = !!options.horizFirst,
|
||||
ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
|
||||
duration = options.duration / 2,
|
||||
|
||||
placeholder = $.effects.createPlaceholder( element ),
|
||||
|
||||
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 ) {
|
||||
element.cssClip( animation2.clip );
|
||||
if ( placeholder ) {
|
||||
placeholder.css( $.effects.clipToBox( animation2 ) );
|
||||
}
|
||||
|
||||
animation2.clip = start;
|
||||
}
|
||||
|
||||
// Animate
|
||||
element
|
||||
.queue( function( next ) {
|
||||
if ( placeholder ) {
|
||||
placeholder
|
||||
.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
|
||||
.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
|
||||
}
|
||||
|
||||
next();
|
||||
} )
|
||||
.animate( animation1, duration, options.easing )
|
||||
.animate( animation2, duration, options.easing )
|
||||
.queue( done );
|
||||
|
||||
$.effects.unshift( element, queuelen, 4 );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-fold.min.js
vendored
6
wp-includes/js/jquery/ui/effect-fold.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Fold 1.11.4
|
||||
* jQuery UI Effects Fold 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/fold-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(v){return v.effects.effect.fold=function(e,t){var i,h,f=v(this),n=["position","top","bottom","left","right","height","width"],o=v.effects.setMode(f,e.mode||"hide"),s="show"===o,d="hide"===o,r=e.size||15,c=/([0-9]+)%/.exec(r),a=!!e.horizFirst,g=s!=a,w=g?["width","height"]:["height","width"],u=e.duration/2,p={},m={};v.effects.save(f,n),f.show(),i=v.effects.createWrapper(f).css({overflow:"hidden"}),h=g?[i.width(),i.height()]:[i.height(),i.width()],c&&(r=parseInt(c[1],10)/100*h[d?0:1]),s&&i.css(a?{height:0,width:r}:{height:r,width:0}),p[w[0]]=s?h[0]:r,m[w[1]]=s?h[1]:0,i.animate(p,u,e.easing).animate(m,u,e.easing,function(){d&&f.hide(),v.effects.restore(f,n),v.effects.removeWrapper(f),t()})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(g){return g.effects.define("fold","hide",function(i,e){var t=g(this),n=i.mode,c="show"===n,f="hide"===n,o=i.size||15,s=/([0-9]+)%/.exec(o),a=!!i.horizFirst?["right","bottom"]:["bottom","right"],l=i.duration/2,u=g.effects.createPlaceholder(t),p=t.cssClip(),d={clip:g.extend({},p)},r={clip:g.extend({},p)},h=[p[a[0]],p[a[1]]],m=t.queue().length;s&&(o=parseInt(s[1],10)/100*h[f?0:1]),d.clip[a[0]]=o,r.clip[a[0]]=o,r.clip[a[1]]=0,c&&(t.cssClip(r.clip),u&&u.css(g.effects.clipToBox(r)),r.clip=p),t.queue(function(e){u&&u.animate(g.effects.clipToBox(d),l,i.easing).animate(g.effects.clipToBox(r),l,i.easing),e()}).animate(d,l,i.easing).animate(r,l,i.easing).queue(e),g.effects.unshift(t,m,4)})});
|
56
wp-includes/js/jquery/ui/effect-highlight.js
vendored
Normal file
56
wp-includes/js/jquery/ui/effect-highlight.js
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* jQuery UI Effects Highlight 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "highlight", "show", function( options, done ) {
|
||||
var element = $( this ),
|
||||
animation = {
|
||||
backgroundColor: element.css( "backgroundColor" )
|
||||
};
|
||||
|
||||
if ( options.mode === "hide" ) {
|
||||
animation.opacity = 0;
|
||||
}
|
||||
|
||||
$.effects.saveStyle( element );
|
||||
|
||||
element
|
||||
.css( {
|
||||
backgroundImage: "none",
|
||||
backgroundColor: options.color || "#ffff99"
|
||||
} )
|
||||
.animate( animation, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Highlight 1.11.4
|
||||
* jQuery UI Effects Highlight 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/highlight-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(i){return i.effects.effect.highlight=function(e,o){var n=i(this),f=["backgroundImage","backgroundColor","opacity"],c=i.effects.setMode(n,e.mode||"show"),t={backgroundColor:n.css("backgroundColor")};"hide"===c&&(t.opacity=0),i.effects.save(n,f),n.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(t,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===c&&n.hide(),i.effects.restore(n,f),o()}})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(i){return i.effects.define("highlight","show",function(e,n){var o=i(this),f={backgroundColor:o.css("backgroundColor")};"hide"===e.mode&&(f.opacity=0),i.effects.saveStyle(o),o.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:n})})});
|
41
wp-includes/js/jquery/ui/effect-puff.js
vendored
Normal file
41
wp-includes/js/jquery/ui/effect-puff.js
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/*!
|
||||
* jQuery UI Effects Puff 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect",
|
||||
"./effect-scale"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "puff", "hide", function( options, done ) {
|
||||
var newOptions = $.extend( true, {}, options, {
|
||||
fade: true,
|
||||
percent: parseInt( options.percent, 10 ) || 150
|
||||
} );
|
||||
|
||||
$.effects.effect.scale.call( this, newOptions, done );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-puff.min.js
vendored
6
wp-includes/js/jquery/ui/effect-puff.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Puff 1.11.4
|
||||
* jQuery UI Effects Puff 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/puff-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-scale"],e):e(jQuery)}(function(r){return r.effects.effect.puff=function(e,t){var f=r(this),i=r.effects.setMode(f,e.mode||"hide"),h="hide"===i,d=parseInt(e.percent,10)||150,o=d/100,u={height:f.height(),width:f.width(),outerHeight:f.outerHeight(),outerWidth:f.outerWidth()};r.extend(e,{effect:"scale",queue:!1,fade:!0,mode:i,complete:t,percent:h?d:100,from:h?u:{height:u.height*o,width:u.width*o,outerHeight:u.outerHeight*o,outerWidth:u.outerWidth*o}}),f.effect(e)}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-scale"],e):e(jQuery)}(function(t){return t.effects.define("puff","hide",function(e,f){var n=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,n,f)})});
|
63
wp-includes/js/jquery/ui/effect-pulsate.js
vendored
Normal file
63
wp-includes/js/jquery/ui/effect-pulsate.js
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* jQuery UI Effects Pulsate 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "pulsate", "show", function( options, done ) {
|
||||
var element = $( this ),
|
||||
mode = options.mode,
|
||||
show = mode === "show",
|
||||
hide = mode === "hide",
|
||||
showhide = show || hide,
|
||||
|
||||
// Showing or hiding leaves off the "last" animation
|
||||
anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
|
||||
duration = options.duration / anims,
|
||||
animateTo = 0,
|
||||
i = 1,
|
||||
queuelen = element.queue().length;
|
||||
|
||||
if ( show || !element.is( ":visible" ) ) {
|
||||
element.css( "opacity", 0 ).show();
|
||||
animateTo = 1;
|
||||
}
|
||||
|
||||
// Anims - 1 opacity "toggles"
|
||||
for ( ; i < anims; i++ ) {
|
||||
element.animate( { opacity: animateTo }, duration, options.easing );
|
||||
animateTo = 1 - animateTo;
|
||||
}
|
||||
|
||||
element.animate( { opacity: animateTo }, duration, options.easing );
|
||||
|
||||
element.queue( done );
|
||||
|
||||
$.effects.unshift( element, queuelen, anims + 1 );
|
||||
} );
|
||||
|
||||
} ) );
|
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Pulsate 1.11.4
|
||||
* jQuery UI Effects Pulsate 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/pulsate-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(r){return r.effects.effect.pulsate=function(e,i){var t,n=r(this),f=r.effects.setMode(n,e.mode||"show"),c="show"===f,o="hide"===f,s=c||"hide"===f,u=2*(e.times||5)+(s?1:0),a=e.duration/u,d=0,p=n.queue(),h=p.length;for(!c&&n.is(":visible")||(n.css("opacity",0).show(),d=1),t=1;t<u;t++)n.animate({opacity:d},a,e.easing),d=1-d;n.animate({opacity:d},a,e.easing),n.queue(function(){o&&n.hide(),i()}),1<h&&p.splice.apply(p,[1,0].concat(p.splice(h,1+u))),n.dequeue()}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(h){return h.effects.define("pulsate","show",function(e,i){var n=h(this),t=e.mode,f="show"===t,s=f||"hide"===t,o=2*(e.times||5)+(s?1:0),u=e.duration/o,a=0,c=1,d=n.queue().length;for(!f&&n.is(":visible")||(n.css("opacity",0).show(),a=1);c<o;c++)n.animate({opacity:a},u,e.easing),a=1-a;n.animate({opacity:a},u,e.easing),n.queue(i),h.effects.unshift(n,d,1+o)})});
|
55
wp-includes/js/jquery/ui/effect-scale.js
vendored
Normal file
55
wp-includes/js/jquery/ui/effect-scale.js
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/*!
|
||||
* jQuery UI Effects Scale 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect",
|
||||
"./effect-size"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "scale", function( options, done ) {
|
||||
|
||||
// Create element
|
||||
var el = $( this ),
|
||||
mode = options.mode,
|
||||
percent = parseInt( options.percent, 10 ) ||
|
||||
( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
|
||||
|
||||
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 ) {
|
||||
newOptions.from.opacity = 1;
|
||||
newOptions.to.opacity = 0;
|
||||
}
|
||||
|
||||
$.effects.effect.size.call( this, newOptions, done );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-scale.min.js
vendored
6
wp-includes/js/jquery/ui/effect-scale.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Scale 1.11.4
|
||||
* jQuery UI Effects Scale 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/scale-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-size"],e):e(jQuery)}(function(a){return a.effects.effect.scale=function(e,t){var i=a(this),o=a.extend(!0,{},e),h=a.effects.setMode(i,e.mode||"effect"),f=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===h?0:100),r=e.direction||"both",c=e.origin,d={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()},n="horizontal"!==r?f/100:1,u="vertical"!==r?f/100:1;o.effect="size",o.queue=!1,o.complete=t,"effect"!==h&&(o.origin=c||["middle","center"],o.restore=!0),o.from=e.from||("show"===h?{height:0,width:0,outerHeight:0,outerWidth:0}:d),o.to={height:d.height*n,width:d.width*u,outerHeight:d.outerHeight*n,outerWidth:d.outerWidth*u},o.fade&&("show"===h&&(o.from.opacity=0,o.to.opacity=1),"hide"===h&&(o.from.opacity=1,o.to.opacity=0)),i.effect(o)}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect","./effect-size"],e):e(jQuery)}(function(o){return o.effects.define("scale",function(e,f){var t=o(this),n=e.mode,i=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),c=o.extend(!0,{from:o.effects.scaledDimensions(t),to:o.effects.scaledDimensions(t,i,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(c.from.opacity=1,c.to.opacity=0),o.effects.effect.size.call(this,c,f)})});
|
73
wp-includes/js/jquery/ui/effect-shake.js
vendored
Normal file
73
wp-includes/js/jquery/ui/effect-shake.js
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* jQuery UI Effects Shake 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "shake", function( options, done ) {
|
||||
|
||||
var i = 1,
|
||||
element = $( this ),
|
||||
direction = options.direction || "left",
|
||||
distance = options.distance || 20,
|
||||
times = options.times || 3,
|
||||
anims = times * 2 + 1,
|
||||
speed = Math.round( options.duration / anims ),
|
||||
ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
|
||||
positiveMotion = ( direction === "up" || direction === "left" ),
|
||||
animation = {},
|
||||
animation1 = {},
|
||||
animation2 = {},
|
||||
|
||||
queuelen = element.queue().length;
|
||||
|
||||
$.effects.createPlaceholder( element );
|
||||
|
||||
// Animation
|
||||
animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
|
||||
animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
|
||||
animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
|
||||
|
||||
// Animate
|
||||
element.animate( animation, speed, options.easing );
|
||||
|
||||
// Shakes
|
||||
for ( ; i < times; i++ ) {
|
||||
element
|
||||
.animate( animation1, speed, options.easing )
|
||||
.animate( animation2, speed, options.easing );
|
||||
}
|
||||
|
||||
element
|
||||
.animate( animation1, speed, options.easing )
|
||||
.animate( animation, speed / 2, options.easing )
|
||||
.queue( done );
|
||||
|
||||
$.effects.unshift( element, queuelen, anims + 1 );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-shake.min.js
vendored
6
wp-includes/js/jquery/ui/effect-shake.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Shake 1.11.4
|
||||
* jQuery UI Effects Shake 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/shake-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(y){return y.effects.effect.shake=function(e,t){var i,f=y(this),n=["position","top","bottom","left","right","height","width"],a=y.effects.setMode(f,e.mode||"effect"),o=e.direction||"left",s=e.distance||20,c=e.times||3,r=2*c+1,u=Math.round(e.duration/r),d="up"===o||"down"===o?"top":"left",p="up"===o||"left"===o,h={},m={},g={},l=f.queue(),q=l.length;for(y.effects.save(f,n),f.show(),y.effects.createWrapper(f),h[d]=(p?"-=":"+=")+s,m[d]=(p?"+=":"-=")+2*s,g[d]=(p?"-=":"+=")+2*s,f.animate(h,u,e.easing),i=1;i<c;i++)f.animate(m,u,e.easing).animate(g,u,e.easing);f.animate(m,u,e.easing).animate(h,u/2,e.easing).queue(function(){"hide"===a&&f.hide(),y.effects.restore(f,n),y.effects.removeWrapper(f),t()}),1<q&&l.splice.apply(l,[1,0].concat(l.splice(q,1+r))),f.dequeue()}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(l){return l.effects.define("shake",function(e,n){var t=1,i=l(this),a=e.direction||"left",f=e.distance||20,u=e.times||3,s=2*u+1,c=Math.round(e.duration/s),o="up"===a||"down"===a?"top":"left",d="up"===a||"left"===a,r={},m={},g={},h=i.queue().length;for(l.effects.createPlaceholder(i),r[o]=(d?"-=":"+=")+f,m[o]=(d?"+=":"-=")+2*f,g[o]=(d?"-=":"+=")+2*f,i.animate(r,c,e.easing);t<u;t++)i.animate(m,c,e.easing).animate(g,c,e.easing);i.animate(m,c,e.easing).animate(r,c/2,e.easing).queue(n),l.effects.unshift(i,h,1+s)})});
|
190
wp-includes/js/jquery/ui/effect-size.js
vendored
Normal file
190
wp-includes/js/jquery/ui/effect-size.js
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
/*!
|
||||
* jQuery UI Effects Size 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.effects.define( "size", function( options, done ) {
|
||||
|
||||
// Create element
|
||||
var baseline, factor, temp,
|
||||
element = $( this ),
|
||||
|
||||
// Copy for children
|
||||
cProps = [ "fontSize" ],
|
||||
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
|
||||
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
|
||||
|
||||
// Set options
|
||||
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" ) {
|
||||
temp = from;
|
||||
from = to;
|
||||
to = temp;
|
||||
}
|
||||
|
||||
// Set scaling factor
|
||||
factor = {
|
||||
from: {
|
||||
y: from.height / original.height,
|
||||
x: from.width / original.width
|
||||
},
|
||||
to: {
|
||||
y: to.height / original.height,
|
||||
x: to.width / original.width
|
||||
}
|
||||
};
|
||||
|
||||
// Scale the css box
|
||||
if ( scale === "box" || scale === "both" ) {
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
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 ) {
|
||||
from = $.effects.setTransition( element, hProps, factor.from.x, from );
|
||||
to = $.effects.setTransition( element, hProps, factor.to.x, to );
|
||||
}
|
||||
}
|
||||
|
||||
// Scale the content
|
||||
if ( scale === "content" || scale === "both" ) {
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
from = $.effects.setTransition( element, cProps, factor.from.y, from );
|
||||
to = $.effects.setTransition( element, cProps, factor.to.y, to );
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust the position properties based on the provided origin points
|
||||
if ( origin ) {
|
||||
baseline = $.effects.getBaseline( origin, original );
|
||||
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;
|
||||
}
|
||||
element.css( from );
|
||||
|
||||
// Animate the children if desired
|
||||
if ( scale === "content" || scale === "both" ) {
|
||||
|
||||
vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
|
||||
hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
|
||||
|
||||
// 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 ),
|
||||
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
|
||||
};
|
||||
|
||||
// Vertical props scaling
|
||||
if ( factor.from.y !== factor.to.y ) {
|
||||
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 ) {
|
||||
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( childFrom );
|
||||
child.animate( childTo, options.duration, options.easing, function() {
|
||||
|
||||
// Restore children
|
||||
if ( restore ) {
|
||||
$.effects.restoreStyle( child );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
// Animate
|
||||
element.animate( to, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: function() {
|
||||
|
||||
var offset = element.offset();
|
||||
|
||||
if ( to.opacity === 0 ) {
|
||||
element.css( "opacity", from.opacity );
|
||||
}
|
||||
|
||||
if ( !restore ) {
|
||||
element
|
||||
.css( "position", position === "static" ? "relative" : position )
|
||||
.offset( offset );
|
||||
|
||||
// Need to save style here so that automatic style restoration
|
||||
// doesn't restore to the original styles from before the animation.
|
||||
$.effects.saveStyle( element );
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-size.min.js
vendored
6
wp-includes/js/jquery/ui/effect-size.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Size 1.11.4
|
||||
* jQuery UI Effects Size 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/size-effect/
|
||||
*/
|
||||
!function(t){"function"==typeof define&&define.amd?define(["jquery","./effect"],t):t(jQuery)}(function(x){return x.effects.effect.size=function(r,t){var o,e,h,n=x(this),i=["position","top","bottom","left","right","width","height","overflow","opacity"],s=["width","height","overflow"],f=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],d=x.effects.setMode(n,r.mode||"effect"),m=r.restore||"effect"!==d,g=r.scale||"both",u=r.origin||["middle","center"],p=n.css("position"),y=m?i:["position","top","bottom","left","right","overflow","opacity"],w={height:0,width:0,outerHeight:0,outerWidth:0};"show"===d&&n.show(),o={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===r.mode&&"show"===d?(n.from=r.to||w,n.to=r.from||o):(n.from=r.from||("show"===d?w:o),n.to=r.to||("hide"===d?w:o)),h={from:{y:n.from.height/o.height,x:n.from.width/o.width},to:{y:n.to.height/o.height,x:n.to.width/o.width}},"box"!==g&&"both"!==g||(h.from.y!==h.to.y&&(y=y.concat(c),n.from=x.effects.setTransition(n,c,h.from.y,n.from),n.to=x.effects.setTransition(n,c,h.to.y,n.to)),h.from.x!==h.to.x&&(y=y.concat(a),n.from=x.effects.setTransition(n,a,h.from.x,n.from),n.to=x.effects.setTransition(n,a,h.to.x,n.to))),"content"!==g&&"both"!==g||h.from.y!==h.to.y&&(y=y.concat(f).concat(s),n.from=x.effects.setTransition(n,f,h.from.y,n.from),n.to=x.effects.setTransition(n,f,h.to.y,n.to)),x.effects.save(n,y),n.show(),x.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),u&&(e=x.effects.getBaseline(u,o),n.from.top=(o.outerHeight-n.outerHeight())*e.y,n.from.left=(o.outerWidth-n.outerWidth())*e.x,n.to.top=(o.outerHeight-n.to.outerHeight)*e.y,n.to.left=(o.outerWidth-n.to.outerWidth)*e.x),n.css(n.from),"content"!==g&&"both"!==g||(c=c.concat(["marginTop","marginBottom"]).concat(f),a=a.concat(["marginLeft","marginRight"]),s=i.concat(c).concat(a),n.find("*[width]").each(function(){var t=x(this),o=t.height(),e=t.width(),i=t.outerHeight(),f=t.outerWidth();m&&x.effects.save(t,s),t.from={height:o*h.from.y,width:e*h.from.x,outerHeight:i*h.from.y,outerWidth:f*h.from.x},t.to={height:o*h.to.y,width:e*h.to.x,outerHeight:o*h.to.y,outerWidth:e*h.to.x},h.from.y!==h.to.y&&(t.from=x.effects.setTransition(t,c,h.from.y,t.from),t.to=x.effects.setTransition(t,c,h.to.y,t.to)),h.from.x!==h.to.x&&(t.from=x.effects.setTransition(t,a,h.from.x,t.from),t.to=x.effects.setTransition(t,a,h.to.x,t.to)),t.css(t.from),t.animate(t.to,r.duration,r.easing,function(){m&&x.effects.restore(t,s)})})),n.animate(n.to,{queue:!1,duration:r.duration,easing:r.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===d&&n.hide(),x.effects.restore(n,y),m||("static"===p?n.css({position:"relative",top:n.to.top,left:n.to.left}):x.each(["top","left"],function(f,t){n.css(t,function(t,o){var e=parseInt(o,10),i=f?n.to.left:n.to.top;return"auto"===o?i+"px":e+i+"px"})})),x.effects.removeWrapper(n),t()}})}});
|
||||
!function(t){"function"==typeof define&&define.amd?define(["jquery","./effect"],t):t(jQuery)}(function(x){return x.effects.define("size",function(f,e){var t,n,o,i=x(this),s=["fontSize"],r=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=f.mode,a="effect"!==c,d=f.scale||"both",g=f.origin||["middle","center"],m=i.css("position"),u=i.position(),y=x.effects.scaledDimensions(i),p=f.from||y,l=f.to||x.effects.scaledDimensions(i,0);x.effects.createPlaceholder(i),"show"===c&&(o=p,p=l,l=o),n={from:{y:p.height/y.height,x:p.width/y.width},to:{y:l.height/y.height,x:l.width/y.width}},"box"!==d&&"both"!==d||(n.from.y!==n.to.y&&(p=x.effects.setTransition(i,r,n.from.y,p),l=x.effects.setTransition(i,r,n.to.y,l)),n.from.x!==n.to.x&&(p=x.effects.setTransition(i,h,n.from.x,p),l=x.effects.setTransition(i,h,n.to.x,l))),"content"!==d&&"both"!==d||n.from.y!==n.to.y&&(p=x.effects.setTransition(i,s,n.from.y,p),l=x.effects.setTransition(i,s,n.to.y,l)),g&&(t=x.effects.getBaseline(g,y),p.top=(y.outerHeight-p.outerHeight)*t.y+u.top,p.left=(y.outerWidth-p.outerWidth)*t.x+u.left,l.top=(y.outerHeight-l.outerHeight)*t.y+u.top,l.left=(y.outerWidth-l.outerWidth)*t.x+u.left),i.css(p),"content"!==d&&"both"!==d||(r=r.concat(["marginTop","marginBottom"]).concat(s),h=h.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=x(this),e=x.effects.scaledDimensions(t),o={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},i={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(o=x.effects.setTransition(t,r,n.from.y,o),i=x.effects.setTransition(t,r,n.to.y,i)),n.from.x!==n.to.x&&(o=x.effects.setTransition(t,h,n.from.x,o),i=x.effects.setTransition(t,h,n.to.x,i)),a&&x.effects.saveStyle(t),t.css(o),t.animate(i,f.duration,f.easing,function(){a&&x.effects.restoreStyle(t)})})),i.animate(l,{queue:!1,duration:f.duration,easing:f.easing,complete:function(){var t=i.offset();0===l.opacity&&i.css("opacity",p.opacity),a||(i.css("position","static"===m?"relative":m).offset(t),x.effects.saveStyle(i)),e()}})})});
|
75
wp-includes/js/jquery/ui/effect-slide.js
vendored
Normal file
75
wp-includes/js/jquery/ui/effect-slide.js
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* jQuery UI Effects Slide 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
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 = {};
|
||||
|
||||
$.effects.createPlaceholder( element );
|
||||
|
||||
startClip = element.cssClip();
|
||||
startRef = element.position()[ ref ];
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Actually animate
|
||||
element.animate( animation, {
|
||||
queue: false,
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: done
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/effect-slide.min.js
vendored
6
wp-includes/js/jquery/ui/effect-slide.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Slide 1.11.4
|
||||
* jQuery UI Effects Slide 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/slide-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(a){return a.effects.effect.slide=function(e,t){var f,i=a(this),o=["position","top","bottom","left","right","width","height"],n=a.effects.setMode(i,e.mode||"show"),s="show"===n,r=e.direction||"left",c="up"===r||"down"===r?"top":"left",d="up"===r||"left"===r,u={};a.effects.save(i,o),i.show(),f=e.distance||i["top"==c?"outerHeight":"outerWidth"](!0),a.effects.createWrapper(i).css({overflow:"hidden"}),s&&i.css(c,d?isNaN(f)?"-"+f:-f:f),u[c]=(s?d?"+=":"-=":d?"-=":"+=")+f,i.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===n&&i.hide(),a.effects.restore(i,o),a.effects.removeWrapper(i),t()}})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(r){return r.effects.define("slide","show",function(e,t){var i,o,n=r(this),c={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},f=e.mode,l=e.direction||"left",p="up"===l||"down"===l?"top":"left",s="up"===l||"left"===l,u=e.distance||n["top"==p?"outerHeight":"outerWidth"](!0),d={};r.effects.createPlaceholder(n),i=n.cssClip(),o=n.position()[p],d[p]=(s?-1:1)*u+o,d.clip=n.cssClip(),d.clip[c[l][1]]=d.clip[c[l][0]],"show"===f&&(n.cssClip(d.clip),n.css(p,d[p]),d.clip=i,d[p]=o),n.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:t})})});
|
39
wp-includes/js/jquery/ui/effect-transfer.js
vendored
Normal file
39
wp-includes/js/jquery/ui/effect-transfer.js
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/*!
|
||||
* jQuery UI Effects Transfer 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./effect"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
var effect;
|
||||
if ( $.uiBackCompat !== false ) {
|
||||
effect = $.effects.define( "transfer", function( options, done ) {
|
||||
$( this ).transfer( options, done );
|
||||
} );
|
||||
}
|
||||
return effect;
|
||||
|
||||
} ) );
|
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Effects Transfer 1.11.4
|
||||
* jQuery UI Effects Transfer 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/transfer-effect/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(u){return u.effects.effect.transfer=function(e,t){var i=u(this),n=u(e.to),f="fixed"===n.css("position"),o=u("body"),s=f?o.scrollTop():0,d=f?o.scrollLeft():0,r=n.offset(),c={top:r.top-s,left:r.left-d,height:n.innerHeight(),width:n.innerWidth()},a=i.offset(),l=u("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(e.className).css({top:a.top-s,left:a.left-d,height:i.innerHeight(),width:i.innerWidth(),position:f?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){l.remove(),t()})}});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./effect"],e):e(jQuery)}(function(n){var e;return!1!==n.uiBackCompat&&(e=n.effects.define("transfer",function(e,f){n(this).transfer(e,f)})),e});
|
1639
wp-includes/js/jquery/ui/effect.js
vendored
Normal file
1639
wp-includes/js/jquery/ui/effect.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
wp-includes/js/jquery/ui/effect.min.js
vendored
8
wp-includes/js/jquery/ui/effect.min.js
vendored
File diff suppressed because one or more lines are too long
668
wp-includes/js/jquery/ui/menu.js
vendored
Normal file
668
wp-includes/js/jquery/ui/menu.js
vendored
Normal file
@ -0,0 +1,668 @@
|
||||
/*!
|
||||
* jQuery UI Menu 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.menu", {
|
||||
version: "1.12.1",
|
||||
defaultElement: "<ul>",
|
||||
delay: 300,
|
||||
options: {
|
||||
icons: {
|
||||
submenu: "ui-icon-caret-1-e"
|
||||
},
|
||||
items: "> *",
|
||||
menus: "ul",
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "right top"
|
||||
},
|
||||
role: "menu",
|
||||
|
||||
// Callbacks
|
||||
blur: null,
|
||||
focus: null,
|
||||
select: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this.activeMenu = this.element;
|
||||
|
||||
// Flag used to prevent firing of the click handler
|
||||
// as the event bubbles up through nested menus
|
||||
this.mouseHandled = false;
|
||||
this.element
|
||||
.uniqueId()
|
||||
.attr( {
|
||||
role: this.options.role,
|
||||
tabIndex: 0
|
||||
} );
|
||||
|
||||
this._addClass( "ui-menu", "ui-widget ui-widget-content" );
|
||||
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();
|
||||
},
|
||||
"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 );
|
||||
|
||||
// Only set the mouseHandled flag if the event will bubble, see #9469.
|
||||
if ( !event.isPropagationStopped() ) {
|
||||
this.mouseHandled = true;
|
||||
}
|
||||
|
||||
// Open submenu on click
|
||||
if ( target.has( ".ui-menu" ).length ) {
|
||||
this.expand( event );
|
||||
} else if ( !this.element.is( ":focus" ) &&
|
||||
active.closest( ".ui-menu" ).length ) {
|
||||
|
||||
// Redirect focus to the menu
|
||||
this.element.trigger( "focus", [ true ] );
|
||||
|
||||
// If the active item is on the top level, let it stay active.
|
||||
// Otherwise, blur the active item since it is no longer visible.
|
||||
if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
|
||||
clearTimeout( this.timer );
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mouseenter .ui-menu-item": function( event ) {
|
||||
|
||||
// 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 actualTarget = $( event.target ).closest( ".ui-menu-item" ),
|
||||
target = $( event.currentTarget );
|
||||
|
||||
// Ignore bubbled events on parent items, see #11641
|
||||
if ( actualTarget[ 0 ] !== target[ 0 ] ) {
|
||||
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 );
|
||||
},
|
||||
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 );
|
||||
|
||||
if ( !keepActiveItem ) {
|
||||
this.focus( event, item );
|
||||
}
|
||||
},
|
||||
blur: function( event ) {
|
||||
this._delay( function() {
|
||||
var notContained = !$.contains(
|
||||
this.element[ 0 ],
|
||||
$.ui.safeActiveElement( this.document[ 0 ] )
|
||||
);
|
||||
if ( notContained ) {
|
||||
this.collapseAll( event );
|
||||
}
|
||||
} );
|
||||
},
|
||||
keydown: "_keydown"
|
||||
} );
|
||||
|
||||
this.refresh();
|
||||
|
||||
// Clicks outside of a menu collapse any open menus
|
||||
this._on( this.document, {
|
||||
click: function( event ) {
|
||||
if ( this._closeOnDocumentClick( event ) ) {
|
||||
this.collapseAll( event );
|
||||
}
|
||||
|
||||
// Reset the mouseHandled flag
|
||||
this.mouseHandled = false;
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
_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()
|
||||
.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
|
||||
"tabIndex" )
|
||||
.removeUniqueId()
|
||||
.show();
|
||||
|
||||
submenus.children().each( function() {
|
||||
var elem = $( this );
|
||||
if ( elem.data( "ui-menu-submenu-caret" ) ) {
|
||||
elem.remove();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
_keydown: function( event ) {
|
||||
var match, prev, character, skip,
|
||||
preventDefault = true;
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
this.previousPage( event );
|
||||
break;
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
this.nextPage( event );
|
||||
break;
|
||||
case $.ui.keyCode.HOME:
|
||||
this._move( "first", "first", event );
|
||||
break;
|
||||
case $.ui.keyCode.END:
|
||||
this._move( "last", "last", event );
|
||||
break;
|
||||
case $.ui.keyCode.UP:
|
||||
this.previous( event );
|
||||
break;
|
||||
case $.ui.keyCode.DOWN:
|
||||
this.next( event );
|
||||
break;
|
||||
case $.ui.keyCode.LEFT:
|
||||
this.collapse( event );
|
||||
break;
|
||||
case $.ui.keyCode.RIGHT:
|
||||
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
|
||||
this.expand( event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.ENTER:
|
||||
case $.ui.keyCode.SPACE:
|
||||
this._activate( event );
|
||||
break;
|
||||
case $.ui.keyCode.ESCAPE:
|
||||
this.collapse( event );
|
||||
break;
|
||||
default:
|
||||
preventDefault = false;
|
||||
prev = this.previousFilter || "";
|
||||
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 ) {
|
||||
skip = true;
|
||||
} else {
|
||||
character = prev + character;
|
||||
}
|
||||
|
||||
match = this._filterMenuItems( character );
|
||||
match = skip && match.index( this.active.next() ) !== -1 ?
|
||||
this.active.nextAll( ".ui-menu-item" ) :
|
||||
match;
|
||||
|
||||
// If no matches on the current filter, reset to the last character pressed
|
||||
// to move down the menu to the first item that starts with that character
|
||||
if ( !match.length ) {
|
||||
character = String.fromCharCode( event.keyCode );
|
||||
match = this._filterMenuItems( character );
|
||||
}
|
||||
|
||||
if ( match.length ) {
|
||||
this.focus( event, match );
|
||||
this.previousFilter = character;
|
||||
this.filterTimer = this._delay( function() {
|
||||
delete this.previousFilter;
|
||||
}, 1000 );
|
||||
} else {
|
||||
delete this.previousFilter;
|
||||
}
|
||||
}
|
||||
|
||||
if ( preventDefault ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
_activate: function( event ) {
|
||||
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
|
||||
if ( this.active.children( "[aria-haspopup='true']" ).length ) {
|
||||
this.expand( event );
|
||||
} else {
|
||||
this.select( event );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var menus, items, newSubmenus, newItems, newWrappers,
|
||||
that = this,
|
||||
icon = this.options.icons.submenu,
|
||||
submenus = this.element.find( this.options.menus );
|
||||
|
||||
this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
|
||||
|
||||
// Initialize nested menus
|
||||
newSubmenus = submenus.filter( ":not(.ui-menu)" )
|
||||
.hide()
|
||||
.attr( {
|
||||
role: this.options.role,
|
||||
"aria-hidden": "true",
|
||||
"aria-expanded": "false"
|
||||
} )
|
||||
.each( function() {
|
||||
var menu = $( this ),
|
||||
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( 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() {
|
||||
var item = $( this );
|
||||
if ( that._isDivider( item ) ) {
|
||||
that._addClass( item, "ui-menu-divider", "ui-widget-content" );
|
||||
}
|
||||
} );
|
||||
|
||||
// Don't refresh list items that are already adapted
|
||||
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" );
|
||||
|
||||
// If the active item has been removed, blur the menu
|
||||
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
|
||||
this.blur();
|
||||
}
|
||||
},
|
||||
|
||||
_itemRole: function() {
|
||||
return {
|
||||
menu: "menuitem",
|
||||
listbox: "option"
|
||||
}[ this.options.role ];
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "icons" ) {
|
||||
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, activeParent;
|
||||
this.blur( event, event && event.type === "focus" );
|
||||
|
||||
this._scrollIntoView( item );
|
||||
|
||||
this.active = item.first();
|
||||
|
||||
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 ) {
|
||||
this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
|
||||
}
|
||||
|
||||
// Highlight active parent menu item, if any
|
||||
activeParent = this.active
|
||||
.parent()
|
||||
.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._close();
|
||||
}, this.delay );
|
||||
}
|
||||
|
||||
nested = item.children( ".ui-menu" );
|
||||
if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
|
||||
this._startOpening( nested );
|
||||
}
|
||||
this.activeMenu = item.parent();
|
||||
|
||||
this._trigger( "focus", event, { item: item } );
|
||||
},
|
||||
|
||||
_scrollIntoView: function( item ) {
|
||||
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
|
||||
if ( this._hasScroll() ) {
|
||||
borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
|
||||
paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
|
||||
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
|
||||
scroll = this.activeMenu.scrollTop();
|
||||
elementHeight = this.activeMenu.height();
|
||||
itemHeight = item.outerHeight();
|
||||
|
||||
if ( offset < 0 ) {
|
||||
this.activeMenu.scrollTop( scroll + offset );
|
||||
} else if ( offset + itemHeight > elementHeight ) {
|
||||
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
blur: function( event, fromFocus ) {
|
||||
if ( !fromFocus ) {
|
||||
clearTimeout( this.timer );
|
||||
}
|
||||
|
||||
if ( !this.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._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 caret icon
|
||||
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.timer = this._delay( function() {
|
||||
this._close();
|
||||
this._open( submenu );
|
||||
}, this.delay );
|
||||
},
|
||||
|
||||
_open: function( submenu ) {
|
||||
var position = $.extend( {
|
||||
of: this.active
|
||||
}, this.options.position );
|
||||
|
||||
clearTimeout( this.timer );
|
||||
this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
|
||||
.hide()
|
||||
.attr( "aria-hidden", "true" );
|
||||
|
||||
submenu
|
||||
.show()
|
||||
.removeAttr( "aria-hidden" )
|
||||
.attr( "aria-expanded", "true" )
|
||||
.position( position );
|
||||
},
|
||||
|
||||
collapseAll: function( event, all ) {
|
||||
clearTimeout( this.timer );
|
||||
this.timer = this._delay( function() {
|
||||
|
||||
// If we were passed an event, look for the submenu that contains the event
|
||||
var currentMenu = all ? this.element :
|
||||
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
|
||||
|
||||
// If we found no valid submenu ancestor, use the main menu to close all
|
||||
// sub menus anyway
|
||||
if ( !currentMenu.length ) {
|
||||
currentMenu = this.element;
|
||||
}
|
||||
|
||||
this._close( currentMenu );
|
||||
|
||||
this.blur( event );
|
||||
|
||||
// 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 );
|
||||
},
|
||||
|
||||
// With no arguments, closes the currently active menu - if nothing is active
|
||||
// it closes all menus. If passed an argument, it will search for menus BELOW
|
||||
_close: function( startMenu ) {
|
||||
if ( !startMenu ) {
|
||||
startMenu = this.active ? this.active.parent() : this.element;
|
||||
}
|
||||
|
||||
startMenu.find( ".ui-menu" )
|
||||
.hide()
|
||||
.attr( "aria-hidden", "true" )
|
||||
.attr( "aria-expanded", "false" );
|
||||
},
|
||||
|
||||
_closeOnDocumentClick: function( event ) {
|
||||
return !$( event.target ).closest( ".ui-menu" ).length;
|
||||
},
|
||||
|
||||
_isDivider: function( item ) {
|
||||
|
||||
// Match hyphen, em dash, en dash
|
||||
return !/[^\-\u2014\u2013\s]/.test( item.text() );
|
||||
},
|
||||
|
||||
collapse: function( event ) {
|
||||
var newItem = this.active &&
|
||||
this.active.parent().closest( ".ui-menu-item", this.element );
|
||||
if ( newItem && newItem.length ) {
|
||||
this._close();
|
||||
this.focus( event, newItem );
|
||||
}
|
||||
},
|
||||
|
||||
expand: function( event ) {
|
||||
var newItem = this.active &&
|
||||
this.active
|
||||
.children( ".ui-menu " )
|
||||
.find( this.options.items )
|
||||
.first();
|
||||
|
||||
if ( newItem && newItem.length ) {
|
||||
this._open( newItem.parent() );
|
||||
|
||||
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
|
||||
this._delay( function() {
|
||||
this.focus( event, newItem );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
next: function( event ) {
|
||||
this._move( "next", "first", event );
|
||||
},
|
||||
|
||||
previous: function( event ) {
|
||||
this._move( "prev", "last", event );
|
||||
},
|
||||
|
||||
isFirstItem: function() {
|
||||
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
|
||||
},
|
||||
|
||||
isLastItem: function() {
|
||||
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
|
||||
},
|
||||
|
||||
_move: function( direction, filter, event ) {
|
||||
var next;
|
||||
if ( this.active ) {
|
||||
if ( direction === "first" || direction === "last" ) {
|
||||
next = this.active
|
||||
[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
|
||||
.eq( -1 );
|
||||
} else {
|
||||
next = this.active
|
||||
[ direction + "All" ]( ".ui-menu-item" )
|
||||
.eq( 0 );
|
||||
}
|
||||
}
|
||||
if ( !next || !next.length || !this.active ) {
|
||||
next = this.activeMenu.find( this.options.items )[ filter ]();
|
||||
}
|
||||
|
||||
this.focus( event, next );
|
||||
},
|
||||
|
||||
nextPage: function( event ) {
|
||||
var item, base, height;
|
||||
|
||||
if ( !this.active ) {
|
||||
this.next( event );
|
||||
return;
|
||||
}
|
||||
if ( this.isLastItem() ) {
|
||||
return;
|
||||
}
|
||||
if ( this._hasScroll() ) {
|
||||
base = this.active.offset().top;
|
||||
height = this.element.height();
|
||||
this.active.nextAll( ".ui-menu-item" ).each( function() {
|
||||
item = $( this );
|
||||
return item.offset().top - base - height < 0;
|
||||
} );
|
||||
|
||||
this.focus( event, item );
|
||||
} else {
|
||||
this.focus( event, this.activeMenu.find( this.options.items )
|
||||
[ !this.active ? "first" : "last" ]() );
|
||||
}
|
||||
},
|
||||
|
||||
previousPage: function( event ) {
|
||||
var item, base, height;
|
||||
if ( !this.active ) {
|
||||
this.next( event );
|
||||
return;
|
||||
}
|
||||
if ( this.isFirstItem() ) {
|
||||
return;
|
||||
}
|
||||
if ( this._hasScroll() ) {
|
||||
base = this.active.offset().top;
|
||||
height = this.element.height();
|
||||
this.active.prevAll( ".ui-menu-item" ).each( function() {
|
||||
item = $( this );
|
||||
return item.offset().top - base + height > 0;
|
||||
} );
|
||||
|
||||
this.focus( event, item );
|
||||
} else {
|
||||
this.focus( event, this.activeMenu.find( this.options.items ).first() );
|
||||
}
|
||||
},
|
||||
|
||||
_hasScroll: function() {
|
||||
return this.element.outerHeight() < this.element.prop( "scrollHeight" );
|
||||
},
|
||||
|
||||
select: function( event ) {
|
||||
|
||||
// TODO: It should never be possible to not have an active item at this
|
||||
// point, but the tests don't trigger mouseenter before click.
|
||||
this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
|
||||
var ui = { item: this.active };
|
||||
if ( !this.active.has( ".ui-menu" ).length ) {
|
||||
this.collapseAll( event, true );
|
||||
}
|
||||
this._trigger( "select", event, ui );
|
||||
},
|
||||
|
||||
_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 ).children( ".ui-menu-item-wrapper" ).text() ) );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/menu.min.js
vendored
6
wp-includes/js/jquery/ui/menu.min.js
vendored
File diff suppressed because one or more lines are too long
224
wp-includes/js/jquery/ui/mouse.js
vendored
Normal file
224
wp-includes/js/jquery/ui/mouse.js
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
/*!
|
||||
* jQuery UI Mouse 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Mouse
|
||||
//>>group: Widgets
|
||||
//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
|
||||
//>>docs: http://api.jqueryui.com/mouse/
|
||||
|
||||
( function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
var mouseHandled = false;
|
||||
$( document ).on( "mouseup", function() {
|
||||
mouseHandled = false;
|
||||
} );
|
||||
|
||||
return $.widget( "ui.mouse", {
|
||||
version: "1.12.1",
|
||||
options: {
|
||||
cancel: "input, textarea, button, select, option",
|
||||
distance: 1,
|
||||
delay: 0
|
||||
},
|
||||
_mouseInit: function() {
|
||||
var that = this;
|
||||
|
||||
this.element
|
||||
.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;
|
||||
},
|
||||
|
||||
// TODO: make sure destroying one instance of mouse doesn't mess with
|
||||
// other instances of mouse
|
||||
_mouseDestroy: function() {
|
||||
this.element.off( "." + this.widgetName );
|
||||
if ( this._mouseMoveDelegate ) {
|
||||
this.document
|
||||
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
|
||||
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
|
||||
}
|
||||
},
|
||||
|
||||
_mouseDown: function( event ) {
|
||||
|
||||
// don't let more than one widget handle mouseStart
|
||||
if ( mouseHandled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._mouseMoved = false;
|
||||
|
||||
// We may have missed mouseup (out of window)
|
||||
( this._mouseStarted && this._mouseUp( event ) );
|
||||
|
||||
this._mouseDownEvent = event;
|
||||
|
||||
var that = this,
|
||||
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 ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.mouseDelayMet = !this.options.delay;
|
||||
if ( !this.mouseDelayMet ) {
|
||||
this._mouseDelayTimer = setTimeout( function() {
|
||||
that.mouseDelayMet = true;
|
||||
}, this.options.delay );
|
||||
}
|
||||
|
||||
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" );
|
||||
}
|
||||
|
||||
// These delegates are required to keep context
|
||||
this._mouseMoveDelegate = function( event ) {
|
||||
return that._mouseMove( event );
|
||||
};
|
||||
this._mouseUpDelegate = function( event ) {
|
||||
return that._mouseUp( event );
|
||||
};
|
||||
|
||||
this.document
|
||||
.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
|
||||
.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
mouseHandled = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
_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 );
|
||||
|
||||
// Iframe mouseup check - mouseup occurred in another document
|
||||
} else if ( !event.which ) {
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( event.which || event.button ) {
|
||||
this._mouseMoved = true;
|
||||
}
|
||||
|
||||
if ( this._mouseStarted ) {
|
||||
this._mouseDrag( event );
|
||||
return event.preventDefault();
|
||||
}
|
||||
|
||||
if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
|
||||
this._mouseStarted =
|
||||
( this._mouseStart( this._mouseDownEvent, event ) !== false );
|
||||
( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
|
||||
}
|
||||
|
||||
return !this._mouseStarted;
|
||||
},
|
||||
|
||||
_mouseUp: function( event ) {
|
||||
this.document
|
||||
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
|
||||
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
|
||||
|
||||
if ( this._mouseStarted ) {
|
||||
this._mouseStarted = false;
|
||||
|
||||
if ( event.target === this._mouseDownEvent.target ) {
|
||||
$.data( event.target, this.widgetName + ".preventClickEvent", true );
|
||||
}
|
||||
|
||||
this._mouseStop( event );
|
||||
}
|
||||
|
||||
if ( this._mouseDelayTimer ) {
|
||||
clearTimeout( this._mouseDelayTimer );
|
||||
delete this._mouseDelayTimer;
|
||||
}
|
||||
|
||||
this.ignoreMissingWhich = false;
|
||||
mouseHandled = false;
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
_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 */ ) {
|
||||
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; }
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/mouse.min.js
vendored
6
wp-includes/js/jquery/ui/mouse.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Mouse 1.11.4
|
||||
* jQuery UI Mouse 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/mouse/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./widget"],e):e(jQuery)}(function(o){var u=!1;return o(document).mouseup(function(){u=!1}),o.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!u){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var t=this,s=1===e.which,i=!("string"!=typeof this.options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length;return!(s&&!i&&this._mouseCapture(e))||(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?(e.preventDefault(),!0):(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),u=!0))}},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),u=!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core"],e):e(jQuery)}(function(o){var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var t=this,i=1===e.which,s=!("string"!=typeof this.options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length;return!(i&&!s&&this._mouseCapture(e))||(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?(e.preventDefault(),!0):(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0))}},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
|
11
wp-includes/js/jquery/ui/position.min.js
vendored
11
wp-includes/js/jquery/ui/position.min.js
vendored
File diff suppressed because one or more lines are too long
177
wp-includes/js/jquery/ui/progressbar.js
vendored
Normal file
177
wp-includes/js/jquery/ui/progressbar.js
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
/*!
|
||||
* jQuery UI Progressbar 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Progressbar
|
||||
//>>group: Widgets
|
||||
// jscs:disable maximumLineLength
|
||||
//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
|
||||
// jscs:enable maximumLineLength
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.progressbar", {
|
||||
version: "1.12.1",
|
||||
options: {
|
||||
classes: {
|
||||
"ui-progressbar": "ui-corner-all",
|
||||
"ui-progressbar-value": "ui-corner-left",
|
||||
"ui-progressbar-complete": "ui-corner-right"
|
||||
},
|
||||
max: 100,
|
||||
value: 0,
|
||||
|
||||
change: null,
|
||||
complete: null
|
||||
},
|
||||
|
||||
min: 0,
|
||||
|
||||
_create: function() {
|
||||
|
||||
// Constrain initial value
|
||||
this.oldValue = this.options.value = this._constrainedValue();
|
||||
|
||||
this.element.attr( {
|
||||
|
||||
// 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.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
|
||||
|
||||
this.valueDiv.remove();
|
||||
},
|
||||
|
||||
value: function( newValue ) {
|
||||
if ( newValue === undefined ) {
|
||||
return this.options.value;
|
||||
}
|
||||
|
||||
this.options.value = this._constrainedValue( newValue );
|
||||
this._refreshValue();
|
||||
},
|
||||
|
||||
_constrainedValue: function( newValue ) {
|
||||
if ( newValue === undefined ) {
|
||||
newValue = this.options.value;
|
||||
}
|
||||
|
||||
this.indeterminate = newValue === false;
|
||||
|
||||
// Sanitize value
|
||||
if ( typeof newValue !== "number" ) {
|
||||
newValue = 0;
|
||||
}
|
||||
|
||||
return this.indeterminate ? false :
|
||||
Math.min( this.options.max, Math.max( this.min, newValue ) );
|
||||
},
|
||||
|
||||
_setOptions: function( options ) {
|
||||
|
||||
// Ensure "value" option is set after other values (like max)
|
||||
var value = options.value;
|
||||
delete options.value;
|
||||
|
||||
this._super( options );
|
||||
|
||||
this.options.value = this._constrainedValue( value );
|
||||
this._refreshValue();
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "max" ) {
|
||||
|
||||
// Don't allow a max less than min
|
||||
value = Math.max( this.min, 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 );
|
||||
},
|
||||
|
||||
_refreshValue: function() {
|
||||
var value = this.options.value,
|
||||
percentage = this._percentage();
|
||||
|
||||
this.valueDiv
|
||||
.toggle( this.indeterminate || value > this.min )
|
||||
.width( percentage.toFixed( 0 ) + "%" );
|
||||
|
||||
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>" ).appendTo( this.valueDiv );
|
||||
this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
|
||||
}
|
||||
} else {
|
||||
this.element.attr( {
|
||||
"aria-valuemax": this.options.max,
|
||||
"aria-valuenow": value
|
||||
} );
|
||||
if ( this.overlayDiv ) {
|
||||
this.overlayDiv.remove();
|
||||
this.overlayDiv = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( this.oldValue !== value ) {
|
||||
this.oldValue = value;
|
||||
this._trigger( "change" );
|
||||
}
|
||||
if ( value === this.options.max ) {
|
||||
this._trigger( "complete" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/progressbar.min.js
vendored
6
wp-includes/js/jquery/ui/progressbar.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Progressbar 1.11.4
|
||||
* jQuery UI Progressbar 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/progressbar/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core","./widget"],e):e(jQuery)}(function(t){return t.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=t("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),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.valueDiv.remove()},value:function(e){if(void 0===e)return this.options.value;this.options.value=this._constrainedValue(e),this._refreshValue()},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=!1===e,"number"!=typeof e&&(e=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var i=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(i),this._refreshValue()},_setOption:function(e,i){"max"===e&&(i=Math.max(this.min,i)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!i).attr("aria-disabled",i),this._super(e,i)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core"],e):e(jQuery)}(function(t){return t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(e){if(void 0===e)return this.options.value;this.options.value=this._constrainedValue(e),this._refreshValue()},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=!1===e,"number"!=typeof e&&(e=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var i=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(i),this._refreshValue()},_setOption:function(e,i){"max"===e&&(i=Math.max(this.min,i)),this._super(e,i)},_setOptionDisabled:function(e){this._super(e),this.element.attr("aria-disabled",e),this._toggleClass(null,"ui-state-disabled",!!e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})});
|
1198
wp-includes/js/jquery/ui/resizable.js
vendored
Normal file
1198
wp-includes/js/jquery/ui/resizable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
wp-includes/js/jquery/ui/resizable.min.js
vendored
6
wp-includes/js/jquery/ui/resizable.min.js
vendored
File diff suppressed because one or more lines are too long
309
wp-includes/js/jquery/ui/selectable.js
vendored
Normal file
309
wp-includes/js/jquery/ui/selectable.js
vendored
Normal file
@ -0,0 +1,309 @@
|
||||
/*!
|
||||
* jQuery UI Selectable 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./mouse",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.selectable", $.ui.mouse, {
|
||||
version: "1.12.1",
|
||||
options: {
|
||||
appendTo: "body",
|
||||
autoRefresh: true,
|
||||
distance: 0,
|
||||
filter: "*",
|
||||
tolerance: "touch",
|
||||
|
||||
// Callbacks
|
||||
selected: null,
|
||||
selecting: null,
|
||||
start: null,
|
||||
stop: null,
|
||||
unselected: null,
|
||||
unselecting: null
|
||||
},
|
||||
_create: function() {
|
||||
var that = this;
|
||||
|
||||
this._addClass( "ui-selectable" );
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
// Cache selectee children based on filter
|
||||
this.refresh = function() {
|
||||
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,
|
||||
top: pos.top,
|
||||
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" )
|
||||
} );
|
||||
} );
|
||||
};
|
||||
this.refresh();
|
||||
|
||||
this._mouseInit();
|
||||
|
||||
this.helper = $( "<div>" );
|
||||
this._addClass( this.helper, "ui-selectable-helper" );
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.selectees.removeData( "selectable-item" );
|
||||
this._mouseDestroy();
|
||||
},
|
||||
|
||||
_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 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectees = $( options.filter, this.element[ 0 ] );
|
||||
|
||||
this._trigger( "start", event );
|
||||
|
||||
$( options.appendTo ).append( this.helper );
|
||||
|
||||
// position helper (lasso)
|
||||
this.helper.css( {
|
||||
"left": event.pageX,
|
||||
"top": event.pageY,
|
||||
"width": 0,
|
||||
"height": 0
|
||||
} );
|
||||
|
||||
if ( options.autoRefresh ) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
this.selectees.filter( ".ui-selected" ).each( function() {
|
||||
var selectee = $.data( this, "selectable-item" );
|
||||
selectee.startselected = true;
|
||||
if ( !event.metaKey && !event.ctrlKey ) {
|
||||
that._removeClass( selectee.$element, "ui-selected" );
|
||||
selectee.selected = false;
|
||||
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() {
|
||||
var doSelect,
|
||||
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, {
|
||||
selecting: selectee.element
|
||||
} );
|
||||
} else {
|
||||
that._trigger( "unselecting", event, {
|
||||
unselecting: selectee.element
|
||||
} );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
},
|
||||
|
||||
_mouseDrag: function( event ) {
|
||||
|
||||
this.dragged = true;
|
||||
|
||||
if ( this.options.disabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tmp,
|
||||
that = this,
|
||||
options = this.options,
|
||||
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 } );
|
||||
|
||||
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 ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 ) {
|
||||
|
||||
// SELECT
|
||||
if ( selectee.selected ) {
|
||||
that._removeClass( selectee.$element, "ui-selected" );
|
||||
selectee.selected = false;
|
||||
}
|
||||
if ( selectee.unselecting ) {
|
||||
that._removeClass( selectee.$element, "ui-unselecting" );
|
||||
selectee.unselecting = false;
|
||||
}
|
||||
if ( !selectee.selecting ) {
|
||||
that._addClass( selectee.$element, "ui-selecting" );
|
||||
selectee.selecting = true;
|
||||
|
||||
// selectable SELECTING callback
|
||||
that._trigger( "selecting", event, {
|
||||
selecting: selectee.element
|
||||
} );
|
||||
}
|
||||
} else {
|
||||
|
||||
// UNSELECT
|
||||
if ( selectee.selecting ) {
|
||||
if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
|
||||
that._removeClass( selectee.$element, "ui-selecting" );
|
||||
selectee.selecting = false;
|
||||
that._addClass( selectee.$element, "ui-selected" );
|
||||
selectee.selected = true;
|
||||
} else {
|
||||
that._removeClass( selectee.$element, "ui-selecting" );
|
||||
selectee.selecting = false;
|
||||
if ( selectee.startselected ) {
|
||||
that._addClass( selectee.$element, "ui-unselecting" );
|
||||
selectee.unselecting = true;
|
||||
}
|
||||
|
||||
// selectable UNSELECTING callback
|
||||
that._trigger( "unselecting", event, {
|
||||
unselecting: selectee.element
|
||||
} );
|
||||
}
|
||||
}
|
||||
if ( selectee.selected ) {
|
||||
if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
|
||||
that._removeClass( selectee.$element, "ui-selected" );
|
||||
selectee.selected = false;
|
||||
|
||||
that._addClass( selectee.$element, "ui-unselecting" );
|
||||
selectee.unselecting = true;
|
||||
|
||||
// selectable UNSELECTING callback
|
||||
that._trigger( "unselecting", event, {
|
||||
unselecting: selectee.element
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_mouseStop: function( event ) {
|
||||
var that = this;
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
$( ".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, {
|
||||
unselected: selectee.element
|
||||
} );
|
||||
} );
|
||||
$( ".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, {
|
||||
selected: selectee.element
|
||||
} );
|
||||
} );
|
||||
this._trigger( "stop", event );
|
||||
|
||||
this.helper.remove();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/selectable.min.js
vendored
6
wp-includes/js/jquery/ui/selectable.min.js
vendored
@ -1,11 +1,9 @@
|
||||
/*!
|
||||
* jQuery UI Selectable 1.11.4
|
||||
* jQuery UI Selectable 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/selectable/
|
||||
*/
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],e):e(jQuery)}(function(u){return u.widget("ui.selectable",u.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,t=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){(e=u(t.options.filter,t.element[0])).addClass("ui-selectee"),e.each(function(){var e=u(this),t=e.offset();u.data(this,"selectable-item",{element:this,$element:e,left:t.left,top:t.top,right:t.left+e.outerWidth(),bottom:t.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=u("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(s){var l=this,e=this.options;this.opos=[s.pageX,s.pageY],this.options.disabled||(this.selectees=u(e.filter,this.element[0]),this._trigger("start",s),u(e.appendTo).append(this.helper),this.helper.css({left:s.pageX,top:s.pageY,width:0,height:0}),e.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var e=u.data(this,"selectable-item");e.startselected=!0,s.metaKey||s.ctrlKey||(e.$element.removeClass("ui-selected"),e.selected=!1,e.$element.addClass("ui-unselecting"),e.unselecting=!0,l._trigger("unselecting",s,{unselecting:e.element}))}),u(s.target).parents().addBack().each(function(){var e,t=u.data(this,"selectable-item");if(t)return e=!s.metaKey&&!s.ctrlKey||!t.$element.hasClass("ui-selected"),t.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),t.unselecting=!e,t.selecting=e,(t.selected=e)?l._trigger("selecting",s,{selecting:t.element}):l._trigger("unselecting",s,{unselecting:t.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var e,l=this,i=this.options,n=this.opos[0],c=this.opos[1],a=s.pageX,r=s.pageY;return a<n&&(e=a,a=n,n=e),r<c&&(e=r,r=c,c=e),this.helper.css({left:n,top:c,width:a-n,height:r-c}),this.selectees.each(function(){var e=u.data(this,"selectable-item"),t=!1;e&&e.element!==l.element[0]&&("touch"===i.tolerance?t=!(e.left>a||e.right<n||e.top>r||e.bottom<c):"fit"===i.tolerance&&(t=e.left>n&&e.right<a&&e.top>c&&e.bottom<r),t?(e.selected&&(e.$element.removeClass("ui-selected"),e.selected=!1),e.unselecting&&(e.$element.removeClass("ui-unselecting"),e.unselecting=!1),e.selecting||(e.$element.addClass("ui-selecting"),e.selecting=!0,l._trigger("selecting",s,{selecting:e.element}))):(e.selecting&&((s.metaKey||s.ctrlKey)&&e.startselected?(e.$element.removeClass("ui-selecting"),e.selecting=!1,e.$element.addClass("ui-selected"),e.selected=!0):(e.$element.removeClass("ui-selecting"),e.selecting=!1,e.startselected&&(e.$element.addClass("ui-unselecting"),e.unselecting=!0),l._trigger("unselecting",s,{unselecting:e.element}))),e.selected&&(s.metaKey||s.ctrlKey||e.startselected||(e.$element.removeClass("ui-selected"),e.selected=!1,e.$element.addClass("ui-unselecting"),e.unselecting=!0,l._trigger("unselecting",s,{unselecting:e.element})))))}),!1}},_mouseStop:function(t){var s=this;return this.dragged=!1,u(".ui-unselecting",this.element[0]).each(function(){var e=u.data(this,"selectable-item");e.$element.removeClass("ui-unselecting"),e.unselecting=!1,e.startselected=!1,s._trigger("unselected",t,{unselected:e.element})}),u(".ui-selecting",this.element[0]).each(function(){var e=u.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected"),e.selecting=!1,e.selected=!0,e.startselected=!0,s._trigger("selected",t,{selected:e.element})}),this._trigger("stop",t),this.helper.remove(),!1}})});
|
||||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./mouse","./core"],e):e(jQuery)}(function(u){return u.widget("ui.selectable",u.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var l=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){l.elementPos=u(l.element[0]).offset(),l.selectees=u(l.options.filter,l.element[0]),l._addClass(l.selectees,"ui-selectee"),l.selectees.each(function(){var e=u(this),t=e.offset(),s={left:t.left-l.elementPos.left,top:t.top-l.elementPos.top};u.data(this,"selectable-item",{element:this,$element:e,left:s.left,top:s.top,right:s.left+e.outerWidth(),bottom:s.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=u("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(s){var l=this,e=this.options;this.opos=[s.pageX,s.pageY],this.elementPos=u(this.element[0]).offset(),this.options.disabled||(this.selectees=u(e.filter,this.element[0]),this._trigger("start",s),u(e.appendTo).append(this.helper),this.helper.css({left:s.pageX,top:s.pageY,width:0,height:0}),e.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var e=u.data(this,"selectable-item");e.startselected=!0,s.metaKey||s.ctrlKey||(l._removeClass(e.$element,"ui-selected"),e.selected=!1,l._addClass(e.$element,"ui-unselecting"),e.unselecting=!0,l._trigger("unselecting",s,{unselecting:e.element}))}),u(s.target).parents().addBack().each(function(){var e,t=u.data(this,"selectable-item");if(t)return e=!s.metaKey&&!s.ctrlKey||!t.$element.hasClass("ui-selected"),l._removeClass(t.$element,e?"ui-unselecting":"ui-selected")._addClass(t.$element,e?"ui-selecting":"ui-unselecting"),t.unselecting=!e,t.selecting=e,(t.selected=e)?l._trigger("selecting",s,{selecting:t.element}):l._trigger("unselecting",s,{unselecting:t.element}),!1}))},_mouseDrag:function(l){if(this.dragged=!0,!this.options.disabled){var e,i=this,n=this.options,c=this.opos[0],a=this.opos[1],o=l.pageX,r=l.pageY;return o<c&&(e=o,o=c,c=e),r<a&&(e=r,r=a,a=e),this.helper.css({left:c,top:a,width:o-c,height:r-a}),this.selectees.each(function(){var e=u.data(this,"selectable-item"),t=!1,s={};e&&e.element!==i.element[0]&&(s.left=e.left+i.elementPos.left,s.right=e.right+i.elementPos.left,s.top=e.top+i.elementPos.top,s.bottom=e.bottom+i.elementPos.top,"touch"===n.tolerance?t=!(s.left>o||s.right<c||s.top>r||s.bottom<a):"fit"===n.tolerance&&(t=s.left>c&&s.right<o&&s.top>a&&s.bottom<r),t?(e.selected&&(i._removeClass(e.$element,"ui-selected"),e.selected=!1),e.unselecting&&(i._removeClass(e.$element,"ui-unselecting"),e.unselecting=!1),e.selecting||(i._addClass(e.$element,"ui-selecting"),e.selecting=!0,i._trigger("selecting",l,{selecting:e.element}))):(e.selecting&&((l.metaKey||l.ctrlKey)&&e.startselected?(i._removeClass(e.$element,"ui-selecting"),e.selecting=!1,i._addClass(e.$element,"ui-selected"),e.selected=!0):(i._removeClass(e.$element,"ui-selecting"),e.selecting=!1,e.startselected&&(i._addClass(e.$element,"ui-unselecting"),e.unselecting=!0),i._trigger("unselecting",l,{unselecting:e.element}))),e.selected&&(l.metaKey||l.ctrlKey||e.startselected||(i._removeClass(e.$element,"ui-selected"),e.selected=!1,i._addClass(e.$element,"ui-unselecting"),e.unselecting=!0,i._trigger("unselecting",l,{unselecting:e.element})))))}),!1}},_mouseStop:function(t){var s=this;return this.dragged=!1,u(".ui-unselecting",this.element[0]).each(function(){var e=u.data(this,"selectable-item");s._removeClass(e.$element,"ui-unselecting"),e.unselecting=!1,e.startselected=!1,s._trigger("unselected",t,{unselected:e.element})}),u(".ui-selecting",this.element[0]).each(function(){var e=u.data(this,"selectable-item");s._removeClass(e.$element,"ui-selecting")._addClass(e.$element,"ui-selected"),e.selecting=!1,e.selected=!0,e.startselected=!0,s._trigger("selected",t,{selected:e.element})}),this._trigger("stop",t),this.helper.remove(),!1}})});
|
680
wp-includes/js/jquery/ui/selectmenu.js
vendored
Normal file
680
wp-includes/js/jquery/ui/selectmenu.js
vendored
Normal file
@ -0,0 +1,680 @@
|
||||
/*!
|
||||
* jQuery UI Selectmenu 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>label: Selectmenu
|
||||
//>>group: Widgets
|
||||
// jscs:disable maximumLineLength
|
||||
//>>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.
|
||||
// jscs:enable maximumLineLength
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./menu",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
|
||||
version: "1.12.1",
|
||||
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"
|
||||
},
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
collision: "none"
|
||||
},
|
||||
width: false,
|
||||
|
||||
// Callbacks
|
||||
change: null,
|
||||
close: null,
|
||||
focus: null,
|
||||
open: null,
|
||||
select: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
var selectmenuId = this.element.uniqueId().attr( "id" );
|
||||
this.ids = {
|
||||
element: selectmenuId,
|
||||
button: selectmenuId + "-button",
|
||||
menu: selectmenuId + "-menu"
|
||||
};
|
||||
|
||||
this._drawButton();
|
||||
this._drawMenu();
|
||||
this._bindFormResetHandler();
|
||||
|
||||
this._rendered = false;
|
||||
this.menuItems = $();
|
||||
},
|
||||
|
||||
_drawButton: function() {
|
||||
var icon,
|
||||
that = this,
|
||||
item = this._parseOption(
|
||||
this.element.find( "option:selected" ),
|
||||
this.element[ 0 ].selectedIndex
|
||||
);
|
||||
|
||||
// Associate existing label with the new button
|
||||
this.labels = this.element.labels().attr( "for", this.ids.button );
|
||||
this._on( this.labels, {
|
||||
click: function( event ) {
|
||||
this.button.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
} );
|
||||
|
||||
// Hide original select element
|
||||
this.element.hide();
|
||||
|
||||
// Create button
|
||||
this.button = $( "<span>", {
|
||||
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",
|
||||
title: this.element.attr( "title" )
|
||||
} )
|
||||
.insertAfter( this.element );
|
||||
|
||||
this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
|
||||
"ui-button ui-widget" );
|
||||
|
||||
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 );
|
||||
|
||||
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._rendered ) {
|
||||
that._refreshMenu();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
_drawMenu: function() {
|
||||
var that = this;
|
||||
|
||||
// Create menu
|
||||
this.menu = $( "<ul>", {
|
||||
"aria-hidden": "true",
|
||||
"aria-labelledby": this.ids.button,
|
||||
id: this.ids.menu
|
||||
} );
|
||||
|
||||
// Wrap menu
|
||||
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( {
|
||||
classes: {
|
||||
"ui-menu": "ui-corner-bottom"
|
||||
},
|
||||
role: "listbox",
|
||||
select: function( event, ui ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Support: IE8
|
||||
// If the item was selected via a click, the text selection
|
||||
// will be destroyed in IE
|
||||
that._setSelection();
|
||||
|
||||
that._select( ui.item.data( "ui-selectmenu-item" ), event );
|
||||
},
|
||||
focus: function( event, ui ) {
|
||||
var item = ui.item.data( "ui-selectmenu-item" );
|
||||
|
||||
// Prevent inital focus from firing and check if its a newly focused item
|
||||
if ( that.focusIndex != null && item.index !== that.focusIndex ) {
|
||||
that._trigger( "focus", event, { item: item } );
|
||||
if ( !that.isOpen ) {
|
||||
that._select( item, event );
|
||||
}
|
||||
}
|
||||
that.focusIndex = item.index;
|
||||
|
||||
that.button.attr( "aria-activedescendant",
|
||||
that.menuItems.eq( item.index ).attr( "id" ) );
|
||||
}
|
||||
} )
|
||||
.menu( "instance" );
|
||||
|
||||
// Don't close the menu on mouseleave
|
||||
this.menuInstance._off( this.menu, "mouseleave" );
|
||||
|
||||
// Cancel the menu's collapseAll on document click
|
||||
this.menuInstance._closeOnDocumentClick = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
// Selects often contain empty items, but never contain dividers
|
||||
this.menuInstance._isDivider = function() {
|
||||
return false;
|
||||
};
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
this._refreshMenu();
|
||||
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() {
|
||||
var item,
|
||||
options = this.element.find( "option" );
|
||||
|
||||
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" )
|
||||
.find( ".ui-menu-item-wrapper" );
|
||||
|
||||
this._rendered = true;
|
||||
|
||||
if ( !options.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
item = this._getSelectedItem();
|
||||
|
||||
// Update the menu to have the correct item focused
|
||||
this.menuInstance.focus( null, item );
|
||||
this._setAria( item.data( "ui-selectmenu-item" ) );
|
||||
|
||||
// Set disabled state
|
||||
this._setOption( "disabled", this.element.prop( "disabled" ) );
|
||||
},
|
||||
|
||||
open: function( event ) {
|
||||
if ( this.options.disabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is the first time the menu is being opened, render the items
|
||||
if ( !this._rendered ) {
|
||||
this._refreshMenu();
|
||||
} else {
|
||||
|
||||
// Menu clears focus on close, reset focus to selected item
|
||||
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();
|
||||
this._position();
|
||||
|
||||
this._on( this.document, this._documentClick );
|
||||
|
||||
this._trigger( "open", event );
|
||||
},
|
||||
|
||||
_position: function() {
|
||||
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
|
||||
},
|
||||
|
||||
close: function( event ) {
|
||||
if ( !this.isOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isOpen = false;
|
||||
this._toggleAttr();
|
||||
|
||||
this.range = null;
|
||||
this._off( this.document );
|
||||
|
||||
this._trigger( "close", event );
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.button;
|
||||
},
|
||||
|
||||
menuWidget: function() {
|
||||
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 = $( "<li>", {
|
||||
text: item.optgroup
|
||||
} );
|
||||
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 ) {
|
||||
return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
|
||||
},
|
||||
|
||||
_renderItem: function( ul, item ) {
|
||||
var li = $( "<li>" ),
|
||||
wrapper = $( "<div>", {
|
||||
title: item.element.attr( "title" )
|
||||
} );
|
||||
|
||||
if ( item.disabled ) {
|
||||
this._addClass( li, null, "ui-state-disabled" );
|
||||
}
|
||||
this._setText( wrapper, item.label );
|
||||
|
||||
return li.append( wrapper ).appendTo( ul );
|
||||
},
|
||||
|
||||
_setText: function( element, value ) {
|
||||
if ( value ) {
|
||||
element.text( value );
|
||||
} else {
|
||||
element.html( " " );
|
||||
}
|
||||
},
|
||||
|
||||
_move: function( direction, event ) {
|
||||
var item, next,
|
||||
filter = ".ui-menu-item";
|
||||
|
||||
if ( this.isOpen ) {
|
||||
item = this.menuItems.eq( this.focusIndex ).parent( "li" );
|
||||
} else {
|
||||
item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
|
||||
filter += ":not(.ui-state-disabled)";
|
||||
}
|
||||
|
||||
if ( direction === "first" || direction === "last" ) {
|
||||
next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
|
||||
} else {
|
||||
next = item[ direction + "All" ]( filter ).eq( 0 );
|
||||
}
|
||||
|
||||
if ( next.length ) {
|
||||
this.menuInstance.focus( event, next );
|
||||
}
|
||||
},
|
||||
|
||||
_getSelectedItem: function() {
|
||||
return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
|
||||
},
|
||||
|
||||
_toggle: function( event ) {
|
||||
this[ this.isOpen ? "close" : "open" ]( event );
|
||||
},
|
||||
|
||||
_setSelection: function() {
|
||||
var selection;
|
||||
|
||||
if ( !this.range ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( window.getSelection ) {
|
||||
selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange( this.range );
|
||||
|
||||
// Support: IE8
|
||||
} else {
|
||||
this.range.select();
|
||||
}
|
||||
|
||||
// Support: IE
|
||||
// Setting the text selection kills the button focus in IE, but
|
||||
// restoring the focus doesn't kill the selection.
|
||||
this.button.focus();
|
||||
},
|
||||
|
||||
_documentClick: {
|
||||
mousedown: function( event ) {
|
||||
if ( !this.isOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
|
||||
$.ui.escapeSelector( this.ids.button ) ).length ) {
|
||||
this.close( event );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buttonEvents: {
|
||||
|
||||
// Prevent text selection from being reset when interacting with the selectmenu (#10144)
|
||||
mousedown: function() {
|
||||
var selection;
|
||||
|
||||
if ( window.getSelection ) {
|
||||
selection = window.getSelection();
|
||||
if ( selection.rangeCount ) {
|
||||
this.range = selection.getRangeAt( 0 );
|
||||
}
|
||||
|
||||
// Support: IE8
|
||||
} else {
|
||||
this.range = document.selection.createRange();
|
||||
}
|
||||
},
|
||||
|
||||
click: function( event ) {
|
||||
this._setSelection();
|
||||
this._toggle( event );
|
||||
},
|
||||
|
||||
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:
|
||||
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 ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_selectFocusedItem: function( event ) {
|
||||
var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
|
||||
if ( !item.hasClass( "ui-state-disabled" ) ) {
|
||||
this._select( item.data( "ui-selectmenu-item" ), event );
|
||||
}
|
||||
},
|
||||
|
||||
_select: function( item, event ) {
|
||||
var oldIndex = this.element[ 0 ].selectedIndex;
|
||||
|
||||
// Change native select element
|
||||
this.element[ 0 ].selectedIndex = item.index;
|
||||
this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
|
||||
this._setAria( item );
|
||||
this._trigger( "select", event, { item: item } );
|
||||
|
||||
if ( item.index !== oldIndex ) {
|
||||
this._trigger( "change", event, { item: item } );
|
||||
}
|
||||
|
||||
this.close( event );
|
||||
},
|
||||
|
||||
_setAria: function( item ) {
|
||||
var id = this.menuItems.eq( item.index ).attr( "id" );
|
||||
|
||||
this.button.attr( {
|
||||
"aria-labelledby": id,
|
||||
"aria-activedescendant": id
|
||||
} );
|
||||
this.menu.attr( "aria-activedescendant", id );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "icons" ) {
|
||||
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 );
|
||||
|
||||
if ( key === "appendTo" ) {
|
||||
this.menuWrap.appendTo( this._appendTo() );
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if ( element ) {
|
||||
element = element.jquery || element.nodeType ?
|
||||
$( element ) :
|
||||
this.document.find( element ).eq( 0 );
|
||||
}
|
||||
|
||||
if ( !element || !element[ 0 ] ) {
|
||||
element = this.element.closest( ".ui-front, dialog" );
|
||||
}
|
||||
|
||||
if ( !element.length ) {
|
||||
element = this.document[ 0 ].body;
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
_toggleAttr: function() {
|
||||
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;
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
this.button.outerWidth( width );
|
||||
},
|
||||
|
||||
_resizeMenu: function() {
|
||||
this.menu.outerWidth( Math.max(
|
||||
this.button.outerWidth(),
|
||||
|
||||
// Support: IE10
|
||||
// IE10 wraps long text (possibly a rounding bug)
|
||||
// so we add 1px to avoid the wrapping
|
||||
this.menu.width( "" ).outerWidth() + 1
|
||||
) );
|
||||
},
|
||||
|
||||
_getCreateOptions: function() {
|
||||
var options = this._super();
|
||||
|
||||
options.disabled = this.element.prop( "disabled" );
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_parseOptions: function( options ) {
|
||||
var that = this,
|
||||
data = [];
|
||||
options.each( function( index, item ) {
|
||||
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.labels.attr( "for", this.ids.element );
|
||||
}
|
||||
} ] );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/selectmenu.min.js
vendored
6
wp-includes/js/jquery/ui/selectmenu.min.js
vendored
File diff suppressed because one or more lines are too long
750
wp-includes/js/jquery/ui/slider.js
vendored
Normal file
750
wp-includes/js/jquery/ui/slider.js
vendored
Normal file
@ -0,0 +1,750 @@
|
||||
/*!
|
||||
* jQuery UI Slider 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./mouse",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
return $.widget( "ui.slider", $.ui.mouse, {
|
||||
version: "1.12.1",
|
||||
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,
|
||||
orientation: "horizontal",
|
||||
range: false,
|
||||
step: 1,
|
||||
value: 0,
|
||||
values: null,
|
||||
|
||||
// Callbacks
|
||||
change: null,
|
||||
slide: null,
|
||||
start: null,
|
||||
stop: null
|
||||
},
|
||||
|
||||
// Number of pages in a slider
|
||||
// (how many times can you page up/down to go through the whole range)
|
||||
numPages: 5,
|
||||
|
||||
_create: function() {
|
||||
this._keySliding = false;
|
||||
this._mouseSliding = false;
|
||||
this._animateOff = true;
|
||||
this._handleIndex = null;
|
||||
this._detectOrientation();
|
||||
this._mouseInit();
|
||||
this._calculateNewMax();
|
||||
|
||||
this._addClass( "ui-slider ui-slider-" + this.orientation,
|
||||
"ui-widget ui-widget-content" );
|
||||
|
||||
this._refresh();
|
||||
|
||||
this._animateOff = false;
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
this._createRange();
|
||||
this._createHandles();
|
||||
this._setupEvents();
|
||||
this._refreshValue();
|
||||
},
|
||||
|
||||
_createHandles: function() {
|
||||
var i, handleCount,
|
||||
options = this.options,
|
||||
existingHandles = this.element.find( ".ui-slider-handle" ),
|
||||
handle = "<span tabindex='0'></span>",
|
||||
handles = [];
|
||||
|
||||
handleCount = ( options.values && options.values.length ) || 1;
|
||||
|
||||
if ( existingHandles.length > handleCount ) {
|
||||
existingHandles.slice( handleCount ).remove();
|
||||
existingHandles = existingHandles.slice( 0, handleCount );
|
||||
}
|
||||
|
||||
for ( i = existingHandles.length; i < handleCount; i++ ) {
|
||||
handles.push( handle );
|
||||
}
|
||||
|
||||
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 )
|
||||
.attr( "tabIndex", 0 );
|
||||
} );
|
||||
},
|
||||
|
||||
_createRange: function() {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !this.range || !this.range.length ) {
|
||||
this.range = $( "<div>" )
|
||||
.appendTo( this.element );
|
||||
|
||||
this._addClass( this.range, "ui-slider-range" );
|
||||
} else {
|
||||
this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
|
||||
|
||||
// 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();
|
||||
}
|
||||
this.range = null;
|
||||
}
|
||||
},
|
||||
|
||||
_setupEvents: function() {
|
||||
this._off( this.handles );
|
||||
this._on( this.handles, this._handleEvents );
|
||||
this._hoverable( this.handles );
|
||||
this._focusable( this.handles );
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.handles.remove();
|
||||
if ( this.range ) {
|
||||
this.range.remove();
|
||||
}
|
||||
|
||||
this._mouseDestroy();
|
||||
},
|
||||
|
||||
_mouseCapture: function( event ) {
|
||||
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
|
||||
that = this,
|
||||
o = this.options;
|
||||
|
||||
if ( o.disabled ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.elementSize = {
|
||||
width: this.element.outerWidth(),
|
||||
height: this.element.outerHeight()
|
||||
};
|
||||
this.elementOffset = this.element.offset();
|
||||
|
||||
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 ) ||
|
||||
( distance === thisDistance &&
|
||||
( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
|
||||
distance = thisDistance;
|
||||
closestHandle = $( this );
|
||||
index = i;
|
||||
}
|
||||
} );
|
||||
|
||||
allowed = this._start( event, index );
|
||||
if ( allowed === false ) {
|
||||
return false;
|
||||
}
|
||||
this._mouseSliding = true;
|
||||
|
||||
this._handleIndex = index;
|
||||
|
||||
this._addClass( closestHandle, null, "ui-state-active" );
|
||||
closestHandle.trigger( "focus" );
|
||||
|
||||
offset = closestHandle.offset();
|
||||
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
|
||||
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
||||
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 )
|
||||
};
|
||||
|
||||
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
|
||||
this._slide( event, index, normValue );
|
||||
}
|
||||
this._animateOff = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
_mouseStart: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
_mouseDrag: function( event ) {
|
||||
var position = { x: event.pageX, y: event.pageY },
|
||||
normValue = this._normValueFromMouse( position );
|
||||
|
||||
this._slide( event, this._handleIndex, normValue );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_mouseStop: function( event ) {
|
||||
this._removeClass( this.handles, null, "ui-state-active" );
|
||||
this._mouseSliding = false;
|
||||
|
||||
this._stop( event, this._handleIndex );
|
||||
this._change( event, this._handleIndex );
|
||||
|
||||
this._handleIndex = null;
|
||||
this._clickOffset = null;
|
||||
this._animateOff = false;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_detectOrientation: function() {
|
||||
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
|
||||
},
|
||||
|
||||
_normValueFromMouse: function( position ) {
|
||||
var pixelTotal,
|
||||
pixelMouse,
|
||||
percentMouse,
|
||||
valueTotal,
|
||||
valueMouse;
|
||||
|
||||
if ( this.orientation === "horizontal" ) {
|
||||
pixelTotal = this.elementSize.width;
|
||||
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 );
|
||||
}
|
||||
|
||||
percentMouse = ( pixelMouse / pixelTotal );
|
||||
if ( percentMouse > 1 ) {
|
||||
percentMouse = 1;
|
||||
}
|
||||
if ( percentMouse < 0 ) {
|
||||
percentMouse = 0;
|
||||
}
|
||||
if ( this.orientation === "vertical" ) {
|
||||
percentMouse = 1 - percentMouse;
|
||||
}
|
||||
|
||||
valueTotal = this._valueMax() - this._valueMin();
|
||||
valueMouse = this._valueMin() + percentMouse * valueTotal;
|
||||
|
||||
return this._trimAlignValue( valueMouse );
|
||||
},
|
||||
|
||||
_uiHash: function( index, value, values ) {
|
||||
var uiHash = {
|
||||
handle: this.handles[ index ],
|
||||
handleIndex: index,
|
||||
value: value !== undefined ? value : this.value()
|
||||
};
|
||||
|
||||
if ( this._hasMultipleValues() ) {
|
||||
uiHash.value = value !== undefined ? value : this.values( index );
|
||||
uiHash.values = values || this.values();
|
||||
}
|
||||
|
||||
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 allowed, otherVal,
|
||||
currentValue = this.value(),
|
||||
newValues = this.values();
|
||||
|
||||
if ( this._hasMultipleValues() ) {
|
||||
otherVal = this.values( index ? 0 : 1 );
|
||||
currentValue = this.values( index );
|
||||
|
||||
if ( this.options.values.length === 2 && this.options.range === true ) {
|
||||
newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, 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 {
|
||||
this.value( newVal );
|
||||
}
|
||||
},
|
||||
|
||||
_stop: function( event, index ) {
|
||||
this._trigger( "stop", event, this._uiHash( index ) );
|
||||
},
|
||||
|
||||
_change: function( event, index ) {
|
||||
if ( !this._keySliding && !this._mouseSliding ) {
|
||||
|
||||
//store the last changed value index for reference when handles overlap
|
||||
this._lastChangedValue = index;
|
||||
this._trigger( "change", event, this._uiHash( index ) );
|
||||
}
|
||||
},
|
||||
|
||||
value: function( newValue ) {
|
||||
if ( arguments.length ) {
|
||||
this.options.value = this._trimAlignValue( newValue );
|
||||
this._refreshValue();
|
||||
this._change( null, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
return this._value();
|
||||
},
|
||||
|
||||
values: function( index, newValue ) {
|
||||
var vals,
|
||||
newValues,
|
||||
i;
|
||||
|
||||
if ( arguments.length > 1 ) {
|
||||
this.options.values[ index ] = this._trimAlignValue( newValue );
|
||||
this._refreshValue();
|
||||
this._change( null, index );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( arguments.length ) {
|
||||
if ( $.isArray( arguments[ 0 ] ) ) {
|
||||
vals = this.options.values;
|
||||
newValues = arguments[ 0 ];
|
||||
for ( i = 0; i < vals.length; i += 1 ) {
|
||||
vals[ i ] = this._trimAlignValue( newValues[ i ] );
|
||||
this._change( null, i );
|
||||
}
|
||||
this._refreshValue();
|
||||
} else {
|
||||
if ( this._hasMultipleValues() ) {
|
||||
return this._values( index );
|
||||
} else {
|
||||
return this.value();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return this._values();
|
||||
}
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
var i,
|
||||
valsLength = 0;
|
||||
|
||||
if ( key === "range" && this.options.range === true ) {
|
||||
if ( value === "min" ) {
|
||||
this.options.value = this._values( 0 );
|
||||
this.options.values = null;
|
||||
} else if ( value === "max" ) {
|
||||
this.options.value = this._values( this.options.values.length - 1 );
|
||||
this.options.values = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $.isArray( this.options.values ) ) {
|
||||
valsLength = this.options.values.length;
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
switch ( key ) {
|
||||
case "orientation":
|
||||
this._detectOrientation();
|
||||
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", "" );
|
||||
break;
|
||||
case "value":
|
||||
this._animateOff = true;
|
||||
this._refreshValue();
|
||||
this._change( null, 0 );
|
||||
this._animateOff = false;
|
||||
break;
|
||||
case "values":
|
||||
this._animateOff = true;
|
||||
this._refreshValue();
|
||||
|
||||
// Start from the last handle to prevent unreachable handles (#9046)
|
||||
for ( i = valsLength - 1; i >= 0; i-- ) {
|
||||
this._change( null, i );
|
||||
}
|
||||
this._animateOff = false;
|
||||
break;
|
||||
case "step":
|
||||
case "min":
|
||||
case "max":
|
||||
this._animateOff = true;
|
||||
this._calculateNewMax();
|
||||
this._refreshValue();
|
||||
this._animateOff = false;
|
||||
break;
|
||||
case "range":
|
||||
this._animateOff = true;
|
||||
this._refresh();
|
||||
this._animateOff = false;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_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() {
|
||||
var val = this.options.value;
|
||||
val = this._trimAlignValue( val );
|
||||
|
||||
return val;
|
||||
},
|
||||
|
||||
//internal values getter
|
||||
// _values() returns array of values trimmed by min and max, aligned by step
|
||||
// _values( index ) returns single value trimmed by min and max, aligned by step
|
||||
_values: function( index ) {
|
||||
var val,
|
||||
vals,
|
||||
i;
|
||||
|
||||
if ( arguments.length ) {
|
||||
val = this.options.values[ index ];
|
||||
val = this._trimAlignValue( val );
|
||||
|
||||
return val;
|
||||
} 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 ) {
|
||||
vals[ i ] = this._trimAlignValue( vals[ i ] );
|
||||
}
|
||||
|
||||
return vals;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
// 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();
|
||||
}
|
||||
if ( val >= this._valueMax() ) {
|
||||
return this._valueMax();
|
||||
}
|
||||
var step = ( this.options.step > 0 ) ? this.options.step : 1,
|
||||
valModStep = ( val - this._valueMin() ) % step,
|
||||
alignValue = val - valModStep;
|
||||
|
||||
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 ) );
|
||||
},
|
||||
|
||||
_calculateNewMax: function() {
|
||||
var max = this.options.max,
|
||||
min = this._valueMin(),
|
||||
step = this.options.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() ) );
|
||||
},
|
||||
|
||||
_precision: function() {
|
||||
var precision = this._precisionOf( this.options.step );
|
||||
if ( this.options.min !== null ) {
|
||||
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
||||
}
|
||||
return precision;
|
||||
},
|
||||
|
||||
_precisionOf: function( num ) {
|
||||
var str = num.toString(),
|
||||
decimal = str.indexOf( "." );
|
||||
return decimal === -1 ? 0 : str.length - decimal - 1;
|
||||
},
|
||||
|
||||
_valueMin: function() {
|
||||
return this.options.min;
|
||||
},
|
||||
|
||||
_valueMax: function() {
|
||||
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,
|
||||
o = this.options,
|
||||
that = this,
|
||||
animate = ( !this._animateOff ) ? o.animate : false,
|
||||
_set = {};
|
||||
|
||||
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 );
|
||||
}
|
||||
if ( i === 1 ) {
|
||||
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 );
|
||||
}
|
||||
if ( i === 1 ) {
|
||||
that.range[ animate ? "animate" : "css" ]( {
|
||||
height: ( valPercent - lastValPercent ) + "%"
|
||||
}, {
|
||||
queue: false,
|
||||
duration: o.animate
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
lastValPercent = valPercent;
|
||||
} );
|
||||
} else {
|
||||
value = this.value();
|
||||
valueMin = this._valueMin();
|
||||
valueMax = this._valueMax();
|
||||
valPercent = ( valueMax !== valueMin ) ?
|
||||
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
|
||||
0;
|
||||
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
||||
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 );
|
||||
}
|
||||
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
||||
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 );
|
||||
}
|
||||
if ( oRange === "max" && this.orientation === "vertical" ) {
|
||||
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
||||
height: ( 100 - valPercent ) + "%"
|
||||
}, o.animate );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_handleEvents: {
|
||||
keydown: function( event ) {
|
||||
var allowed, curVal, newVal, step,
|
||||
index = $( event.target ).data( "ui-slider-handle-index" );
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case $.ui.keyCode.HOME:
|
||||
case $.ui.keyCode.END:
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
case $.ui.keyCode.UP:
|
||||
case $.ui.keyCode.RIGHT:
|
||||
case $.ui.keyCode.DOWN:
|
||||
case $.ui.keyCode.LEFT:
|
||||
event.preventDefault();
|
||||
if ( !this._keySliding ) {
|
||||
this._keySliding = true;
|
||||
this._addClass( $( event.target ), null, "ui-state-active" );
|
||||
allowed = this._start( event, index );
|
||||
if ( allowed === false ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
step = this.options.step;
|
||||
if ( this._hasMultipleValues() ) {
|
||||
curVal = newVal = this.values( index );
|
||||
} else {
|
||||
curVal = newVal = this.value();
|
||||
}
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case $.ui.keyCode.HOME:
|
||||
newVal = this._valueMin();
|
||||
break;
|
||||
case $.ui.keyCode.END:
|
||||
newVal = this._valueMax();
|
||||
break;
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
newVal = this._trimAlignValue(
|
||||
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
|
||||
);
|
||||
break;
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
newVal = this._trimAlignValue(
|
||||
curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
|
||||
break;
|
||||
case $.ui.keyCode.UP:
|
||||
case $.ui.keyCode.RIGHT:
|
||||
if ( curVal === this._valueMax() ) {
|
||||
return;
|
||||
}
|
||||
newVal = this._trimAlignValue( curVal + step );
|
||||
break;
|
||||
case $.ui.keyCode.DOWN:
|
||||
case $.ui.keyCode.LEFT:
|
||||
if ( curVal === this._valueMin() ) {
|
||||
return;
|
||||
}
|
||||
newVal = this._trimAlignValue( curVal - step );
|
||||
break;
|
||||
}
|
||||
|
||||
this._slide( event, index, newVal );
|
||||
},
|
||||
keyup: function( event ) {
|
||||
var index = $( event.target ).data( "ui-slider-handle-index" );
|
||||
|
||||
if ( this._keySliding ) {
|
||||
this._keySliding = false;
|
||||
this._stop( event, index );
|
||||
this._change( event, index );
|
||||
this._removeClass( $( event.target ), null, "ui-state-active" );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/slider.min.js
vendored
6
wp-includes/js/jquery/ui/slider.min.js
vendored
File diff suppressed because one or more lines are too long
1550
wp-includes/js/jquery/ui/sortable.js
vendored
Normal file
1550
wp-includes/js/jquery/ui/sortable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
wp-includes/js/jquery/ui/sortable.min.js
vendored
6
wp-includes/js/jquery/ui/sortable.min.js
vendored
File diff suppressed because one or more lines are too long
572
wp-includes/js/jquery/ui/spinner.js
vendored
Normal file
572
wp-includes/js/jquery/ui/spinner.js
vendored
Normal file
@ -0,0 +1,572 @@
|
||||
/*!
|
||||
* jQuery UI Spinner 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./button",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
function spinnerModifer( fn ) {
|
||||
return function() {
|
||||
var previous = this.element.val();
|
||||
fn.apply( this, arguments );
|
||||
this._refresh();
|
||||
if ( previous !== this.element.val() ) {
|
||||
this._trigger( "change" );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.widget( "ui.spinner", {
|
||||
version: "1.12.1",
|
||||
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",
|
||||
up: "ui-icon-triangle-1-n"
|
||||
},
|
||||
incremental: true,
|
||||
max: null,
|
||||
min: null,
|
||||
numberFormat: null,
|
||||
page: 10,
|
||||
step: 1,
|
||||
|
||||
change: null,
|
||||
spin: null,
|
||||
start: null,
|
||||
stop: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
|
||||
// handle string values that need to be parsed
|
||||
this._setOption( "max", this.options.max );
|
||||
this._setOption( "min", this.options.min );
|
||||
this._setOption( "step", this.options.step );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
this._draw();
|
||||
this._on( this._events );
|
||||
this._refresh();
|
||||
|
||||
// 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 = this._super();
|
||||
var element = this.element;
|
||||
|
||||
$.each( [ "min", "max", "step" ], function( i, option ) {
|
||||
var value = element.attr( option );
|
||||
if ( value != null && value.length ) {
|
||||
options[ option ] = value;
|
||||
}
|
||||
} );
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_events: {
|
||||
keydown: function( event ) {
|
||||
if ( this._start( event ) && this._keydown( event ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
keyup: "_stop",
|
||||
focus: function() {
|
||||
this.previous = this.element.val();
|
||||
},
|
||||
blur: function( event ) {
|
||||
if ( this.cancelBlur ) {
|
||||
delete this.cancelBlur;
|
||||
return;
|
||||
}
|
||||
|
||||
this._stop();
|
||||
this._refresh();
|
||||
if ( this.previous !== this.element.val() ) {
|
||||
this._trigger( "change", event );
|
||||
}
|
||||
},
|
||||
mousewheel: function( event, delta ) {
|
||||
if ( !delta ) {
|
||||
return;
|
||||
}
|
||||
if ( !this.spinning && !this._start( event ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
|
||||
clearTimeout( this.mousewheelTimer );
|
||||
this.mousewheelTimer = this._delay( function() {
|
||||
if ( this.spinning ) {
|
||||
this._stop( event );
|
||||
}
|
||||
}, 100 );
|
||||
event.preventDefault();
|
||||
},
|
||||
"mousedown .ui-spinner-button": function( event ) {
|
||||
var previous;
|
||||
|
||||
// We never want the buttons to have focus; whenever the user is
|
||||
// interacting with the spinner, the focus should be on the input.
|
||||
// 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 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
|
||||
this.previous : this.element.val();
|
||||
function checkFocus() {
|
||||
var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
|
||||
if ( !isActive ) {
|
||||
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.previous = previous;
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure focus is on (or stays on) the text field
|
||||
event.preventDefault();
|
||||
checkFocus.call( this );
|
||||
|
||||
// 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() {
|
||||
delete this.cancelBlur;
|
||||
checkFocus.call( this );
|
||||
} );
|
||||
|
||||
if ( this._start( event ) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if ( this._start( event ) === false ) {
|
||||
return false;
|
||||
}
|
||||
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"
|
||||
},
|
||||
|
||||
// Support mobile enhanced option and make backcompat more sane
|
||||
_enhance: function() {
|
||||
this.uiSpinner = this.element
|
||||
.attr( "autocomplete", "off" )
|
||||
.wrap( "<span>" )
|
||||
.parent()
|
||||
|
||||
// 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 = this.uiSpinner.children( "a" )
|
||||
.attr( "tabIndex", -1 )
|
||||
.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( this.uiSpinner.height() * 0.5 ) &&
|
||||
this.uiSpinner.height() > 0 ) {
|
||||
this.uiSpinner.height( this.uiSpinner.height() );
|
||||
}
|
||||
},
|
||||
|
||||
_keydown: function( event ) {
|
||||
var options = this.options,
|
||||
keyCode = $.ui.keyCode;
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
case keyCode.UP:
|
||||
this._repeat( null, 1, event );
|
||||
return true;
|
||||
case keyCode.DOWN:
|
||||
this._repeat( null, -1, event );
|
||||
return true;
|
||||
case keyCode.PAGE_UP:
|
||||
this._repeat( null, options.page, event );
|
||||
return true;
|
||||
case keyCode.PAGE_DOWN:
|
||||
this._repeat( null, -options.page, event );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_start: function( event ) {
|
||||
if ( !this.spinning && this._trigger( "start", event ) === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !this.counter ) {
|
||||
this.counter = 1;
|
||||
}
|
||||
this.spinning = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
_repeat: function( i, steps, event ) {
|
||||
i = i || 500;
|
||||
|
||||
clearTimeout( this.timer );
|
||||
this.timer = this._delay( function() {
|
||||
this._repeat( 40, steps, event );
|
||||
}, i );
|
||||
|
||||
this._spin( steps * this.options.step, event );
|
||||
},
|
||||
|
||||
_spin: function( step, event ) {
|
||||
var value = this.value() || 0;
|
||||
|
||||
if ( !this.counter ) {
|
||||
this.counter = 1;
|
||||
}
|
||||
|
||||
value = this._adjustValue( value + step * this._increment( this.counter ) );
|
||||
|
||||
if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
|
||||
this._value( value );
|
||||
this.counter++;
|
||||
}
|
||||
},
|
||||
|
||||
_increment: function( i ) {
|
||||
var incremental = this.options.incremental;
|
||||
|
||||
if ( incremental ) {
|
||||
return $.isFunction( incremental ) ?
|
||||
incremental( i ) :
|
||||
Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
_precision: function() {
|
||||
var precision = this._precisionOf( this.options.step );
|
||||
if ( this.options.min !== null ) {
|
||||
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
||||
}
|
||||
return precision;
|
||||
},
|
||||
|
||||
_precisionOf: function( num ) {
|
||||
var str = num.toString(),
|
||||
decimal = str.indexOf( "." );
|
||||
return decimal === -1 ? 0 : str.length - decimal - 1;
|
||||
},
|
||||
|
||||
_adjustValue: function( value ) {
|
||||
var base, aboveMin,
|
||||
options = this.options;
|
||||
|
||||
// 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;
|
||||
|
||||
// - rounding is based on 0, so adjust back to our base
|
||||
value = base + aboveMin;
|
||||
|
||||
// Fix precision from bad JS floating point math
|
||||
value = parseFloat( value.toFixed( this._precision() ) );
|
||||
|
||||
// Clamp the value
|
||||
if ( options.max !== null && value > options.max ) {
|
||||
return options.max;
|
||||
}
|
||||
if ( options.min !== null && value < options.min ) {
|
||||
return options.min;
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
_stop: function( event ) {
|
||||
if ( !this.spinning ) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout( this.timer );
|
||||
clearTimeout( this.mousewheelTimer );
|
||||
this.counter = 0;
|
||||
this.spinning = false;
|
||||
this._trigger( "stop", event );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
var prevValue, first, last;
|
||||
|
||||
if ( key === "culture" || key === "numberFormat" ) {
|
||||
prevValue = this._parse( this.element.val() );
|
||||
this.options[ key ] = value;
|
||||
this.element.val( this._format( prevValue ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( key === "max" || key === "min" || key === "step" ) {
|
||||
if ( typeof value === "string" ) {
|
||||
value = this._parse( value );
|
||||
}
|
||||
}
|
||||
if ( key === "icons" ) {
|
||||
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 );
|
||||
},
|
||||
|
||||
_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: spinnerModifer( function( options ) {
|
||||
this._super( options );
|
||||
} ),
|
||||
|
||||
_parse: function( val ) {
|
||||
if ( typeof val === "string" && val !== "" ) {
|
||||
val = window.Globalize && this.options.numberFormat ?
|
||||
Globalize.parseFloat( val, 10, this.options.culture ) : +val;
|
||||
}
|
||||
return val === "" || isNaN( val ) ? null : val;
|
||||
},
|
||||
|
||||
_format: function( value ) {
|
||||
if ( value === "" ) {
|
||||
return "";
|
||||
}
|
||||
return window.Globalize && this.options.numberFormat ?
|
||||
Globalize.format( value, this.options.numberFormat, this.options.culture ) :
|
||||
value;
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
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
|
||||
if ( value === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If value gets adjusted, it's invalid
|
||||
return value === this._adjustValue( value );
|
||||
},
|
||||
|
||||
// Update the value without triggering change
|
||||
_value: function( value, allowAny ) {
|
||||
var parsed;
|
||||
if ( value !== "" ) {
|
||||
parsed = this._parse( value );
|
||||
if ( parsed !== null ) {
|
||||
if ( !allowAny ) {
|
||||
parsed = this._adjustValue( parsed );
|
||||
}
|
||||
value = this._format( parsed );
|
||||
}
|
||||
}
|
||||
this.element.val( value );
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.element
|
||||
.prop( "disabled", false )
|
||||
.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
|
||||
|
||||
this.uiSpinner.replaceWith( this.element );
|
||||
},
|
||||
|
||||
stepUp: spinnerModifer( function( steps ) {
|
||||
this._stepUp( steps );
|
||||
} ),
|
||||
_stepUp: function( steps ) {
|
||||
if ( this._start() ) {
|
||||
this._spin( ( steps || 1 ) * this.options.step );
|
||||
this._stop();
|
||||
}
|
||||
},
|
||||
|
||||
stepDown: spinnerModifer( function( steps ) {
|
||||
this._stepDown( steps );
|
||||
} ),
|
||||
_stepDown: function( steps ) {
|
||||
if ( this._start() ) {
|
||||
this._spin( ( steps || 1 ) * -this.options.step );
|
||||
this._stop();
|
||||
}
|
||||
},
|
||||
|
||||
pageUp: spinnerModifer( function( pages ) {
|
||||
this._stepUp( ( pages || 1 ) * this.options.page );
|
||||
} ),
|
||||
|
||||
pageDown: spinnerModifer( function( pages ) {
|
||||
this._stepDown( ( pages || 1 ) * this.options.page );
|
||||
} ),
|
||||
|
||||
value: function( newVal ) {
|
||||
if ( !arguments.length ) {
|
||||
return this._parse( this.element.val() );
|
||||
}
|
||||
spinnerModifer( 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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/spinner.min.js
vendored
6
wp-includes/js/jquery/ui/spinner.min.js
vendored
File diff suppressed because one or more lines are too long
919
wp-includes/js/jquery/ui/tabs.js
vendored
Normal file
919
wp-includes/js/jquery/ui/tabs.js
vendored
Normal file
@ -0,0 +1,919 @@
|
||||
/*!
|
||||
* jQuery UI Tabs 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.tabs", {
|
||||
version: "1.12.1",
|
||||
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
|
||||
activate: null,
|
||||
beforeActivate: null,
|
||||
beforeLoad: null,
|
||||
load: null
|
||||
},
|
||||
|
||||
_isLocal: ( function() {
|
||||
var rhash = /#.*$/;
|
||||
|
||||
return function( anchor ) {
|
||||
var anchorUrl, locationUrl;
|
||||
|
||||
anchorUrl = anchor.href.replace( rhash, "" );
|
||||
locationUrl = location.href.replace( rhash, "" );
|
||||
|
||||
// Decoding may throw an error if the URL isn't UTF-8 (#9518)
|
||||
try {
|
||||
anchorUrl = decodeURIComponent( anchorUrl );
|
||||
} catch ( error ) {}
|
||||
try {
|
||||
locationUrl = decodeURIComponent( locationUrl );
|
||||
} catch ( error ) {}
|
||||
|
||||
return anchor.hash.length > 1 && anchorUrl === locationUrl;
|
||||
};
|
||||
} )(),
|
||||
|
||||
_create: function() {
|
||||
var that = this,
|
||||
options = this.options;
|
||||
|
||||
this.running = false;
|
||||
|
||||
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(
|
||||
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
|
||||
return that.tabs.index( li );
|
||||
} )
|
||||
) ).sort();
|
||||
}
|
||||
|
||||
// Check for length avoids error when initializing empty list
|
||||
if ( this.options.active !== false && this.anchors.length ) {
|
||||
this.active = this._findActive( options.active );
|
||||
} else {
|
||||
this.active = $();
|
||||
}
|
||||
|
||||
this._refresh();
|
||||
|
||||
if ( this.active.length ) {
|
||||
this.load( options.active );
|
||||
}
|
||||
},
|
||||
|
||||
_initialActive: function() {
|
||||
var active = this.options.active,
|
||||
collapsible = this.options.collapsible,
|
||||
locationHash = location.hash.substring( 1 );
|
||||
|
||||
if ( active === null ) {
|
||||
|
||||
// check the fragment identifier in the URL
|
||||
if ( locationHash ) {
|
||||
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
|
||||
if ( active === null ) {
|
||||
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
|
||||
}
|
||||
|
||||
// No active tab, set to false
|
||||
if ( active === null || active === -1 ) {
|
||||
active = this.tabs.length ? 0 : false;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle numbers: negative, out of range
|
||||
if ( active !== false ) {
|
||||
active = this.tabs.index( this.tabs.eq( active ) );
|
||||
if ( active === -1 ) {
|
||||
active = collapsible ? false : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't allow collapsible: false and active: false
|
||||
if ( !collapsible && active === false && this.anchors.length ) {
|
||||
active = 0;
|
||||
}
|
||||
|
||||
return active;
|
||||
},
|
||||
|
||||
_getCreateEventData: function() {
|
||||
return {
|
||||
tab: this.active,
|
||||
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
|
||||
};
|
||||
},
|
||||
|
||||
_tabKeydown: function( event ) {
|
||||
var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
|
||||
selectedIndex = this.tabs.index( focusedTab ),
|
||||
goingForward = true;
|
||||
|
||||
if ( this._handlePageNav( event ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Focus the appropriate tab, based on which key was pressed
|
||||
event.preventDefault();
|
||||
clearTimeout( this.activating );
|
||||
selectedIndex = this._focusNextTab( selectedIndex, goingForward );
|
||||
|
||||
// Navigating with control/command key will prevent automatic activation
|
||||
if ( !event.ctrlKey && !event.metaKey ) {
|
||||
|
||||
// Update aria-selected immediately so that AT think the tab is already selected.
|
||||
// Otherwise AT may confuse the user by stating that they need to activate the tab,
|
||||
// but the tab will already be activated by the time the announcement finishes.
|
||||
focusedTab.attr( "aria-selected", "false" );
|
||||
this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
|
||||
|
||||
this.activating = this._delay( function() {
|
||||
this.option( "active", selectedIndex );
|
||||
}, this.delay );
|
||||
}
|
||||
},
|
||||
|
||||
_panelKeydown: function( event ) {
|
||||
if ( this._handlePageNav( event ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ctrl+up moves focus to the current tab
|
||||
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
|
||||
event.preventDefault();
|
||||
this.active.trigger( "focus" );
|
||||
}
|
||||
},
|
||||
|
||||
// Alt+page up/down moves focus to the previous/next tab (and activates)
|
||||
_handlePageNav: function( event ) {
|
||||
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
|
||||
this._activate( this._focusNextTab( this.options.active - 1, false ) );
|
||||
return true;
|
||||
}
|
||||
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
|
||||
this._activate( this._focusNextTab( this.options.active + 1, true ) );
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
_findNextTab: function( index, goingForward ) {
|
||||
var lastTabIndex = this.tabs.length - 1;
|
||||
|
||||
function constrain() {
|
||||
if ( index > lastTabIndex ) {
|
||||
index = 0;
|
||||
}
|
||||
if ( index < 0 ) {
|
||||
index = lastTabIndex;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
|
||||
index = goingForward ? index + 1 : index - 1;
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
_focusNextTab: function( index, goingForward ) {
|
||||
index = this._findNextTab( index, goingForward );
|
||||
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;
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "collapsible" ) {
|
||||
this._toggleClass( "ui-tabs-collapsible", null, value );
|
||||
|
||||
// Setting collapsible: false while collapsed; open first panel
|
||||
if ( !value && this.options.active === false ) {
|
||||
this._activate( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( key === "event" ) {
|
||||
this._setupEvents( value );
|
||||
}
|
||||
|
||||
if ( key === "heightStyle" ) {
|
||||
this._setupHeightStyle( value );
|
||||
}
|
||||
},
|
||||
|
||||
_sanitizeSelector: function( hash ) {
|
||||
return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var options = this.options,
|
||||
lis = this.tablist.children( ":has(a[href])" );
|
||||
|
||||
// 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
|
||||
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 );
|
||||
}
|
||||
|
||||
this._refresh();
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
this._setOptionDisabled( this.options.disabled );
|
||||
this._setupEvents( this.options.event );
|
||||
this._setupHeightStyle( this.options.heightStyle );
|
||||
|
||||
this.tabs.not( this.active ).attr( {
|
||||
"aria-selected": "false",
|
||||
"aria-expanded": "false",
|
||||
tabIndex: -1
|
||||
} );
|
||||
this.panels.not( this._getPanelForTab( this.active ) )
|
||||
.hide()
|
||||
.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
|
||||
.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( {
|
||||
"aria-hidden": "false"
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
_processTabs: function() {
|
||||
var that = this,
|
||||
prevTabs = this.tabs,
|
||||
prevAnchors = this.anchors,
|
||||
prevPanels = this.panels;
|
||||
|
||||
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
|
||||
this.tablist
|
||||
.on( "mousedown" + this.eventNamespace, "> li", function( event ) {
|
||||
if ( $( this ).is( ".ui-state-disabled" ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
} )
|
||||
|
||||
// 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.
|
||||
.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])" )
|
||||
.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 ];
|
||||
} )
|
||||
.attr( {
|
||||
role: "presentation",
|
||||
tabIndex: -1
|
||||
} );
|
||||
this._addClass( this.anchors, "ui-tabs-anchor" );
|
||||
|
||||
this.panels = $();
|
||||
|
||||
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
|
||||
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;
|
||||
selector = "#" + panelId;
|
||||
panel = that.element.find( selector );
|
||||
if ( !panel.length ) {
|
||||
panel = that._createPanel( panelId );
|
||||
panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
|
||||
}
|
||||
panel.attr( "aria-live", "polite" );
|
||||
}
|
||||
|
||||
if ( panel.length ) {
|
||||
that.panels = that.panels.add( panel );
|
||||
}
|
||||
if ( originalAriaControls ) {
|
||||
tab.data( "ui-tabs-aria-controls", originalAriaControls );
|
||||
}
|
||||
tab.attr( {
|
||||
"aria-controls": panelId,
|
||||
"aria-labelledby": anchorId
|
||||
} );
|
||||
panel.attr( "aria-labelledby", anchorId );
|
||||
} );
|
||||
|
||||
this.panels.attr( "role", "tabpanel" );
|
||||
this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
|
||||
|
||||
// Avoid memory leaks (#10056)
|
||||
if ( prevTabs ) {
|
||||
this._off( prevTabs.not( this.tabs ) );
|
||||
this._off( prevAnchors.not( this.anchors ) );
|
||||
this._off( prevPanels.not( this.panels ) );
|
||||
}
|
||||
},
|
||||
|
||||
// Allow overriding how to find the list for rare usage scenarios (#7715)
|
||||
_getList: function() {
|
||||
return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
|
||||
},
|
||||
|
||||
_createPanel: function( id ) {
|
||||
return $( "<div>" )
|
||||
.attr( "id", id )
|
||||
.data( "ui-tabs-destroy", true );
|
||||
},
|
||||
|
||||
_setOptionDisabled: function( disabled ) {
|
||||
var currentItem, li, i;
|
||||
|
||||
if ( $.isArray( disabled ) ) {
|
||||
if ( !disabled.length ) {
|
||||
disabled = false;
|
||||
} else if ( disabled.length === this.anchors.length ) {
|
||||
disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable tabs
|
||||
for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
|
||||
currentItem = $( li );
|
||||
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
|
||||
currentItem.attr( "aria-disabled", "true" );
|
||||
this._addClass( currentItem, null, "ui-state-disabled" );
|
||||
} else {
|
||||
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 ) {
|
||||
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" } );
|
||||
|
||||
this._focusable( this.tabs );
|
||||
this._hoverable( this.tabs );
|
||||
},
|
||||
|
||||
_setupHeightStyle: function( heightStyle ) {
|
||||
var maxHeight,
|
||||
parent = this.element.parent();
|
||||
|
||||
if ( heightStyle === "fill" ) {
|
||||
maxHeight = parent.height();
|
||||
maxHeight -= this.element.outerHeight() - this.element.height();
|
||||
|
||||
this.element.siblings( ":visible" ).each( function() {
|
||||
var elem = $( this ),
|
||||
position = elem.css( "position" );
|
||||
|
||||
if ( position === "absolute" || position === "fixed" ) {
|
||||
return;
|
||||
}
|
||||
maxHeight -= elem.outerHeight( true );
|
||||
} );
|
||||
|
||||
this.element.children().not( this.panels ).each( function() {
|
||||
maxHeight -= $( this ).outerHeight( true );
|
||||
} );
|
||||
|
||||
this.panels.each( function() {
|
||||
$( this ).height( Math.max( 0, maxHeight -
|
||||
$( this ).innerHeight() + $( this ).height() ) );
|
||||
} )
|
||||
.css( "overflow", "auto" );
|
||||
} else if ( heightStyle === "auto" ) {
|
||||
maxHeight = 0;
|
||||
this.panels.each( function() {
|
||||
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
|
||||
} ).height( maxHeight );
|
||||
}
|
||||
},
|
||||
|
||||
_eventHandler: function( event ) {
|
||||
var options = this.options,
|
||||
active = this.active,
|
||||
anchor = $( event.currentTarget ),
|
||||
tab = anchor.closest( "li" ),
|
||||
clickedIsActive = tab[ 0 ] === active[ 0 ],
|
||||
collapsing = clickedIsActive && options.collapsible,
|
||||
toShow = collapsing ? $() : this._getPanelForTab( tab ),
|
||||
toHide = !active.length ? $() : this._getPanelForTab( active ),
|
||||
eventData = {
|
||||
oldTab: active,
|
||||
oldPanel: toHide,
|
||||
newTab: collapsing ? $() : tab,
|
||||
newPanel: toShow
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
options.active = collapsing ? false : this.tabs.index( tab );
|
||||
|
||||
this.active = clickedIsActive ? $() : tab;
|
||||
if ( this.xhr ) {
|
||||
this.xhr.abort();
|
||||
}
|
||||
|
||||
if ( !toHide.length && !toShow.length ) {
|
||||
$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
|
||||
}
|
||||
|
||||
if ( toShow.length ) {
|
||||
this.load( this.tabs.index( tab ), event );
|
||||
}
|
||||
this._toggle( event, eventData );
|
||||
},
|
||||
|
||||
// Handles show/hide for selecting tabs
|
||||
_toggle: function( event, eventData ) {
|
||||
var that = this,
|
||||
toShow = eventData.newPanel,
|
||||
toHide = eventData.oldPanel;
|
||||
|
||||
this.running = true;
|
||||
|
||||
function complete() {
|
||||
that.running = false;
|
||||
that._trigger( "activate", event, eventData );
|
||||
}
|
||||
|
||||
function show() {
|
||||
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 );
|
||||
} else {
|
||||
toShow.show();
|
||||
complete();
|
||||
}
|
||||
}
|
||||
|
||||
// Start out by hiding, then showing, then completing
|
||||
if ( toHide.length && this.options.hide ) {
|
||||
this._hide( toHide, this.options.hide, function() {
|
||||
that._removeClass( eventData.oldTab.closest( "li" ),
|
||||
"ui-tabs-active", "ui-state-active" );
|
||||
show();
|
||||
} );
|
||||
} else {
|
||||
this._removeClass( eventData.oldTab.closest( "li" ),
|
||||
"ui-tabs-active", "ui-state-active" );
|
||||
toHide.hide();
|
||||
show();
|
||||
}
|
||||
|
||||
toHide.attr( "aria-hidden", "true" );
|
||||
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() {
|
||||
return $( this ).attr( "tabIndex" ) === 0;
|
||||
} )
|
||||
.attr( "tabIndex", -1 );
|
||||
}
|
||||
|
||||
toShow.attr( "aria-hidden", "false" );
|
||||
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
|
||||
if ( active[ 0 ] === this.active[ 0 ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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( {
|
||||
target: anchor,
|
||||
currentTarget: anchor,
|
||||
preventDefault: $.noop
|
||||
} );
|
||||
},
|
||||
|
||||
_findActive: function( index ) {
|
||||
return index === false ? $() : this.tabs.eq( index );
|
||||
},
|
||||
|
||||
_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$='" +
|
||||
$.ui.escapeSelector( index ) + "']" ) );
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
if ( this.xhr ) {
|
||||
this.xhr.abort();
|
||||
}
|
||||
|
||||
this.tablist
|
||||
.removeAttr( "role" )
|
||||
.off( this.eventNamespace );
|
||||
|
||||
this.anchors
|
||||
.removeAttr( "role tabIndex" )
|
||||
.removeUniqueId();
|
||||
|
||||
this.tabs.add( this.panels ).each( function() {
|
||||
if ( $.data( this, "ui-tabs-destroy" ) ) {
|
||||
$( this ).remove();
|
||||
} else {
|
||||
$( this ).removeAttr( "role tabIndex " +
|
||||
"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
|
||||
}
|
||||
} );
|
||||
|
||||
this.tabs.each( function() {
|
||||
var li = $( this ),
|
||||
prev = li.data( "ui-tabs-aria-controls" );
|
||||
if ( prev ) {
|
||||
li
|
||||
.attr( "aria-controls", prev )
|
||||
.removeData( "ui-tabs-aria-controls" );
|
||||
} else {
|
||||
li.removeAttr( "aria-controls" );
|
||||
}
|
||||
} );
|
||||
|
||||
this.panels.show();
|
||||
|
||||
if ( this.options.heightStyle !== "content" ) {
|
||||
this.panels.css( "height", "" );
|
||||
}
|
||||
},
|
||||
|
||||
enable: function( index ) {
|
||||
var disabled = this.options.disabled;
|
||||
if ( disabled === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( index === undefined ) {
|
||||
disabled = false;
|
||||
} else {
|
||||
index = this._getIndex( index );
|
||||
if ( $.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._setOptionDisabled( disabled );
|
||||
},
|
||||
|
||||
disable: function( index ) {
|
||||
var disabled = this.options.disabled;
|
||||
if ( disabled === true ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( index === undefined ) {
|
||||
disabled = true;
|
||||
} else {
|
||||
index = this._getIndex( index );
|
||||
if ( $.inArray( index, disabled ) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
if ( $.isArray( disabled ) ) {
|
||||
disabled = $.merge( [ index ], disabled ).sort();
|
||||
} else {
|
||||
disabled = [ index ];
|
||||
}
|
||||
}
|
||||
this._setOptionDisabled( disabled );
|
||||
},
|
||||
|
||||
load: function( index, event ) {
|
||||
index = this._getIndex( index );
|
||||
var that = this,
|
||||
tab = this.tabs.eq( index ),
|
||||
anchor = tab.find( ".ui-tabs-anchor" ),
|
||||
panel = this._getPanelForTab( tab ),
|
||||
eventData = {
|
||||
tab: tab,
|
||||
panel: panel
|
||||
},
|
||||
complete = function( jqXHR, status ) {
|
||||
if ( status === "abort" ) {
|
||||
that.panels.stop( false, true );
|
||||
}
|
||||
|
||||
that._removeClass( tab, "ui-tabs-loading" );
|
||||
panel.removeAttr( "aria-busy" );
|
||||
|
||||
if ( jqXHR === that.xhr ) {
|
||||
delete that.xhr;
|
||||
}
|
||||
};
|
||||
|
||||
// Not remote
|
||||
if ( this._isLocal( anchor[ 0 ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
|
||||
|
||||
// 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" ) {
|
||||
this._addClass( tab, "ui-tabs-loading" );
|
||||
panel.attr( "aria-busy", "true" );
|
||||
|
||||
this.xhr
|
||||
.done( function( response, status, jqXHR ) {
|
||||
|
||||
// support: jQuery <1.8
|
||||
// http://bugs.jquery.com/ticket/11778
|
||||
setTimeout( function() {
|
||||
panel.html( response );
|
||||
that._trigger( "load", event, eventData );
|
||||
|
||||
complete( jqXHR, status );
|
||||
}, 1 );
|
||||
} )
|
||||
.fail( function( jqXHR, status ) {
|
||||
|
||||
// support: jQuery <1.8
|
||||
// http://bugs.jquery.com/ticket/11778
|
||||
setTimeout( function() {
|
||||
complete( jqXHR, status );
|
||||
}, 1 );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
_ajaxSettings: function( anchor, event, eventData ) {
|
||||
var that = this;
|
||||
return {
|
||||
|
||||
// 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 ) );
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
_getPanelForTab: function( tab ) {
|
||||
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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/tabs.min.js
vendored
6
wp-includes/js/jquery/ui/tabs.min.js
vendored
File diff suppressed because one or more lines are too long
516
wp-includes/js/jquery/ui/tooltip.js
vendored
Normal file
516
wp-includes/js/jquery/ui/tooltip.js
vendored
Normal file
@ -0,0 +1,516 @@
|
||||
/*!
|
||||
* jQuery UI Tooltip 1.12.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
//>>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 ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [
|
||||
"jquery",
|
||||
"./core"
|
||||
], factory );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
$.widget( "ui.tooltip", {
|
||||
version: "1.12.1",
|
||||
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" ) || "";
|
||||
|
||||
// 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: {
|
||||
my: "left top+15",
|
||||
at: "left bottom",
|
||||
collision: "flipfit flip"
|
||||
},
|
||||
show: true,
|
||||
track: false,
|
||||
|
||||
// Callbacks
|
||||
close: null,
|
||||
open: null
|
||||
},
|
||||
|
||||
_addDescribedBy: function( elem, id ) {
|
||||
var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
|
||||
describedby.push( id );
|
||||
elem
|
||||
.data( "ui-tooltip-id", id )
|
||||
.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
|
||||
},
|
||||
|
||||
_removeDescribedBy: function( elem ) {
|
||||
var id = elem.data( "ui-tooltip-id" ),
|
||||
describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
|
||||
index = $.inArray( id, describedby );
|
||||
|
||||
if ( index !== -1 ) {
|
||||
describedby.splice( index, 1 );
|
||||
}
|
||||
|
||||
elem.removeData( "ui-tooltip-id" );
|
||||
describedby = $.trim( describedby.join( " " ) );
|
||||
if ( describedby ) {
|
||||
elem.attr( "aria-describedby", describedby );
|
||||
} else {
|
||||
elem.removeAttr( "aria-describedby" );
|
||||
}
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this._on( {
|
||||
mouseover: "open",
|
||||
focusin: "open"
|
||||
} );
|
||||
|
||||
// IDs of generated tooltips, needed for destroy
|
||||
this.tooltips = {};
|
||||
|
||||
// IDs of parent tooltips where we removed the title attribute
|
||||
this.parents = {};
|
||||
|
||||
// Append the aria-live region so tooltips announce correctly
|
||||
this.liveRegion = $( "<div>" )
|
||||
.attr( {
|
||||
role: "log",
|
||||
"aria-live": "assertive",
|
||||
"aria-relevant": "additions"
|
||||
} )
|
||||
.appendTo( this.document[ 0 ].body );
|
||||
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
|
||||
|
||||
this.disabledTitles = $( [] );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
var that = this;
|
||||
|
||||
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
|
||||
$.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.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.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 );
|
||||
|
||||
// No element to show a tooltip for or the tooltip is already open
|
||||
if ( !target.length || target.data( "ui-tooltip-id" ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( target.attr( "title" ) ) {
|
||||
target.data( "ui-tooltip-title", target.attr( "title" ) );
|
||||
}
|
||||
|
||||
target.data( "ui-tooltip-open", true );
|
||||
|
||||
// Kill parent tooltips, custom or native, for hover
|
||||
if ( event && event.type === "mouseover" ) {
|
||||
target.parents().each( function() {
|
||||
var parent = $( this ),
|
||||
blurEvent;
|
||||
if ( parent.data( "ui-tooltip-open" ) ) {
|
||||
blurEvent = $.Event( "blur" );
|
||||
blurEvent.target = blurEvent.currentTarget = this;
|
||||
that.close( blurEvent, true );
|
||||
}
|
||||
if ( parent.attr( "title" ) ) {
|
||||
parent.uniqueId();
|
||||
that.parents[ this.id ] = {
|
||||
element: this,
|
||||
title: parent.attr( "title" )
|
||||
};
|
||||
parent.attr( "title", "" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
this._registerCloseHandlers( event, target );
|
||||
this._updateContent( target, event );
|
||||
},
|
||||
|
||||
_updateContent: function( target, event ) {
|
||||
var content,
|
||||
contentOption = this.options.content,
|
||||
that = this,
|
||||
eventType = event ? event.type : null;
|
||||
|
||||
if ( typeof contentOption === "string" || contentOption.nodeType ||
|
||||
contentOption.jquery ) {
|
||||
return this._open( event, target, contentOption );
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// bubbling, so we set it back to the previous value. (#8740)
|
||||
if ( event ) {
|
||||
event.type = eventType;
|
||||
}
|
||||
this._open( event, target, response );
|
||||
} );
|
||||
} );
|
||||
if ( content ) {
|
||||
this._open( event, target, content );
|
||||
}
|
||||
},
|
||||
|
||||
_open: function( event, target, content ) {
|
||||
var tooltipData, tooltip, delayedShow, a11yContent,
|
||||
positionOption = $.extend( {}, this.options.position );
|
||||
|
||||
if ( !content ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Content can be updated multiple times. If the tooltip already
|
||||
// exists, then just update the content and bail.
|
||||
tooltipData = this._find( target );
|
||||
if ( tooltipData ) {
|
||||
tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
|
||||
return;
|
||||
}
|
||||
|
||||
// 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])
|
||||
//
|
||||
// We use removeAttr only for key events, to allow IE to export the correct
|
||||
// accessible attributes. For mouse events, set to empty string to avoid
|
||||
// native tooltip showing up (happens only when removing inside mouseover).
|
||||
if ( target.is( "[title]" ) ) {
|
||||
if ( event && event.type === "mouseover" ) {
|
||||
target.attr( "title", "" );
|
||||
} else {
|
||||
target.removeAttr( "title" );
|
||||
}
|
||||
}
|
||||
|
||||
tooltipData = this._tooltip( target );
|
||||
tooltip = tooltipData.tooltip;
|
||||
this._addDescribedBy( target, tooltip.attr( "id" ) );
|
||||
tooltip.find( ".ui-tooltip-content" ).html( content );
|
||||
|
||||
// Support: Voiceover on OS X, JAWS on IE <= 9
|
||||
// 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();
|
||||
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;
|
||||
if ( tooltip.is( ":hidden" ) ) {
|
||||
return;
|
||||
}
|
||||
tooltip.position( positionOption );
|
||||
}
|
||||
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( {
|
||||
of: target
|
||||
}, this.options.position ) );
|
||||
}
|
||||
|
||||
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.
|
||||
// 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 );
|
||||
}
|
||||
|
||||
this._trigger( "open", event, { tooltip: tooltip } );
|
||||
},
|
||||
|
||||
_registerCloseHandlers: function( event, target ) {
|
||||
var events = {
|
||||
keyup: function( event ) {
|
||||
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
|
||||
var fakeEvent = $.Event( event );
|
||||
fakeEvent.currentTarget = target[ 0 ];
|
||||
this.close( fakeEvent, true );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Only bind remove handler for delegated targets. Non-delegated
|
||||
// tooltips will handle this in destroy.
|
||||
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
||||
events.remove = function() {
|
||||
this._removeTooltip( this._find( target ).tooltip );
|
||||
};
|
||||
}
|
||||
|
||||
if ( !event || event.type === "mouseover" ) {
|
||||
events.mouseleave = "close";
|
||||
}
|
||||
if ( !event || event.type === "focusin" ) {
|
||||
events.focusout = "close";
|
||||
}
|
||||
this._on( true, target, events );
|
||||
},
|
||||
|
||||
close: function( event ) {
|
||||
var tooltip,
|
||||
that = this,
|
||||
target = $( event ? event.currentTarget : this.element ),
|
||||
tooltipData = this._find( target );
|
||||
|
||||
// The tooltip may already be closed
|
||||
if ( !tooltipData ) {
|
||||
|
||||
// We set ui-tooltip-open immediately upon open (in open()), but only set the
|
||||
// additional data once there's actually content to show (in _open()). So even if the
|
||||
// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
|
||||
// the period between open() and _open().
|
||||
target.removeData( "ui-tooltip-open" );
|
||||
return;
|
||||
}
|
||||
|
||||
tooltip = tooltipData.tooltip;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Clear the interval for delayed tracking tooltips
|
||||
clearInterval( this.delayedShow );
|
||||
|
||||
// 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" ) );
|
||||
}
|
||||
|
||||
this._removeDescribedBy( target );
|
||||
|
||||
tooltipData.hiding = true;
|
||||
tooltip.stop( true );
|
||||
this._hide( tooltip, this.options.hide, function() {
|
||||
that._removeTooltip( $( this ) );
|
||||
} );
|
||||
|
||||
target.removeData( "ui-tooltip-open" );
|
||||
this._off( target, "mouseleave focusout keyup" );
|
||||
|
||||
// Remove 'remove' binding only on delegated targets
|
||||
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
||||
this._off( target, "remove" );
|
||||
}
|
||||
this._off( this.document, "mousemove" );
|
||||
|
||||
if ( event && event.type === "mouseleave" ) {
|
||||
$.each( this.parents, function( id, parent ) {
|
||||
$( parent.element ).attr( "title", parent.title );
|
||||
delete that.parents[ id ];
|
||||
} );
|
||||
}
|
||||
|
||||
tooltipData.closing = true;
|
||||
this._trigger( "close", event, { tooltip: tooltip } );
|
||||
if ( !tooltipData.hiding ) {
|
||||
tooltipData.closing = false;
|
||||
}
|
||||
},
|
||||
|
||||
_tooltip: function( element ) {
|
||||
var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
|
||||
content = $( "<div>" ).appendTo( tooltip ),
|
||||
id = tooltip.uniqueId().attr( "id" );
|
||||
|
||||
this._addClass( content, "ui-tooltip-content" );
|
||||
this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
|
||||
|
||||
tooltip.appendTo( this._appendTo( element ) );
|
||||
|
||||
return this.tooltips[ id ] = {
|
||||
element: element,
|
||||
tooltip: tooltip
|
||||
};
|
||||
},
|
||||
|
||||
_find: function( target ) {
|
||||
var id = target.data( "ui-tooltip-id" );
|
||||
return id ? this.tooltips[ id ] : null;
|
||||
},
|
||||
|
||||
_removeTooltip: function( tooltip ) {
|
||||
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
|
||||
$.each( this.tooltips, function( id, tooltipData ) {
|
||||
|
||||
// Delegate to close method to handle common cleanup
|
||||
var event = $.Event( "blur" ),
|
||||
element = tooltipData.element;
|
||||
event.target = event.currentTarget = element[ 0 ];
|
||||
that.close( event, true );
|
||||
|
||||
// Remove immediately; destroying an open tooltip doesn't use the
|
||||
// hide animation
|
||||
$( "#" + id ).remove();
|
||||
|
||||
// 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;
|
||||
|
||||
} ) );
|
6
wp-includes/js/jquery/ui/tooltip.min.js
vendored
6
wp-includes/js/jquery/ui/tooltip.min.js
vendored
File diff suppressed because one or more lines are too long
11
wp-includes/js/jquery/ui/widget.min.js
vendored
11
wp-includes/js/jquery/ui/widget.min.js
vendored
File diff suppressed because one or more lines are too long
@ -690,7 +690,7 @@ function wp_default_scripts( $scripts ) {
|
||||
)
|
||||
);
|
||||
|
||||
$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 );
|
||||
$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-core' ), false, 1 );
|
||||
$scripts->set_translations( 'wp-pointer' );
|
||||
|
||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
|
||||
@ -729,50 +729,65 @@ function wp_default_scripts( $scripts ) {
|
||||
$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
|
||||
|
||||
// jQuery.
|
||||
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4-wp' );
|
||||
$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
|
||||
$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
|
||||
// The unminified jquery.js and jquery-migrate.js are included to facilitate debugging.
|
||||
$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.5.1' );
|
||||
$scripts->add( 'jquery-core', "/wp-includes/js/jquery/jquery$suffix.js", array(), '3.5.1' );
|
||||
$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.3.1' );
|
||||
|
||||
// Full jQuery UI.
|
||||
$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
|
||||
// The build process in 1.12.1 has changed significantly.
|
||||
// In order to keep backwards compatibility, and to keep the optimized loading,
|
||||
// the source files were flattened and included with some modifications for AMD loading.
|
||||
// A notable change is that 'jquery-ui-core' now contains 'jquery-ui-position' and 'jquery-ui-widget'.
|
||||
$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$suffix.js", array( 'jquery' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$suffix.js", array( 'jquery' ), '1.12.1', 1 );
|
||||
|
||||
$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$suffix.js", array( 'jquery-effects-core' ), '1.12.1', 1 );
|
||||
|
||||
$scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
|
||||
$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
|
||||
// Widgets
|
||||
$scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$suffix.js", array( 'jquery-ui-core', 'jquery-ui-controlgroup', 'jquery-ui-checkboxradio' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$suffix.js", array( 'jquery-ui-menu' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$suffix.js", array( 'jquery-ui-button' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
|
||||
// New in 1.12.1
|
||||
$scripts->add( 'jquery-ui-checkboxradio', "/wp-includes/js/jquery/ui/checkboxradio$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-controlgroup', "/wp-includes/js/jquery/ui/controlgroup$suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
|
||||
// Interactions
|
||||
$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$suffix.js", array( 'jquery-ui-draggable' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
|
||||
|
||||
// As of 1.12.1 `jquery-ui-position` and `jquery-ui-widget` are part of `jquery-ui-core`.
|
||||
// Listed here for back-compat.
|
||||
$scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
$scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.12.1', 1 );
|
||||
|
||||
// Strings for 'jquery-ui-autocomplete' live region messages.
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
@ -798,7 +813,7 @@ function wp_default_scripts( $scripts ) {
|
||||
$scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
|
||||
$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
|
||||
$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
|
||||
$scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-widget', 'jquery-ui-mouse' ), '0.2.2', 1 );
|
||||
$scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-core', 'jquery-ui-mouse' ), '0.2.2', 1 );
|
||||
|
||||
// Not used any more, registered for backward compatibility.
|
||||
$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-49100';
|
||||
$wp_version = '5.6-alpha-49101';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user