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. git-svn-id: https://develop.svn.wordpress.org/trunk@49101 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0d313839e6
commit
9c50d3dda5
24
Gruntfile.js
24
Gruntfile.js
@ -131,12 +131,18 @@ module.exports = function(grunt) {
|
||||
qunit: ['tests/qunit/compiled.html']
|
||||
},
|
||||
file_append: {
|
||||
// grunt-file-append supports only strings for input and output.
|
||||
default_options: {
|
||||
files: [
|
||||
{
|
||||
append: 'jQuery.noConflict();',
|
||||
input: WORKING_DIR + 'wp-includes/js/jquery/jquery.js',
|
||||
output: WORKING_DIR + 'wp-includes/js/jquery/jquery.js'
|
||||
},
|
||||
{
|
||||
append: 'jQuery.noConflict();',
|
||||
input: WORKING_DIR + 'wp-includes/js/jquery/jquery.min.js',
|
||||
output: WORKING_DIR + 'wp-includes/js/jquery/jquery.min.js'
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -179,18 +185,10 @@ module.exports = function(grunt) {
|
||||
// Renamed to avoid conflict with jQuery hoverIntent.min.js (after minifying).
|
||||
[ WORKING_DIR + 'wp-includes/js/hoverintent-js.min.js' ]: [ './node_modules/hoverintent/dist/hoverintent.min.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/imagesloaded.min.js' ]: [ './node_modules/imagesloaded/imagesloaded.pkgd.min.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/dist/twemoji.js' ],
|
||||
[ WORKING_DIR + 'wp-includes/js/underscore.js' ]: [ './node_modules/underscore/underscore.js' ],
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: './node_modules/jquery-ui/ui/',
|
||||
src: '*.js',
|
||||
dest: SOURCE_DIR + 'wp-includes/js/jquery/ui/'
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -542,7 +540,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
options: grunt.file.readJSON('.jshintrc'),
|
||||
options: grunt.file.readJSON( '.jshintrc' ),
|
||||
grunt: {
|
||||
src: ['Gruntfile.js']
|
||||
},
|
||||
@ -552,7 +550,7 @@ module.exports = function(grunt) {
|
||||
'!tests/qunit/vendor/*',
|
||||
'!tests/qunit/editor/**'
|
||||
],
|
||||
options: grunt.file.readJSON('tests/qunit/.jshintrc')
|
||||
options: grunt.file.readJSON( 'tests/qunit/.jshintrc' )
|
||||
},
|
||||
themes: {
|
||||
expand: true,
|
||||
@ -727,7 +725,7 @@ module.exports = function(grunt) {
|
||||
ext: '.min.js',
|
||||
src: ['wp-includes/js/wp-embed.js']
|
||||
},
|
||||
jqueryui: {
|
||||
'jquery-ui': {
|
||||
options: {
|
||||
// Preserve comments that start with a bang.
|
||||
output: {
|
||||
@ -735,7 +733,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
expand: true,
|
||||
cwd: 'node_modules/jquery-ui/ui/',
|
||||
cwd: WORKING_DIR + 'wp-includes/js/jquery/ui/',
|
||||
dest: WORKING_DIR + 'wp-includes/js/jquery/ui/',
|
||||
ext: '.min.js',
|
||||
src: ['*.js']
|
||||
@ -1385,7 +1383,7 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask( 'uglify:all', [
|
||||
'uglify:core',
|
||||
'uglify:embed',
|
||||
'uglify:jqueryui',
|
||||
'uglify:jquery-ui',
|
||||
'uglify:imgareaselect',
|
||||
'uglify:jqueryform',
|
||||
'uglify:moment'
|
||||
|
22
package-lock.json
generated
22
package-lock.json
generated
@ -7506,7 +7506,7 @@
|
||||
},
|
||||
"create-hash": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -7519,7 +7519,7 @@
|
||||
},
|
||||
"create-hmac": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||
"resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -7585,7 +7585,7 @@
|
||||
},
|
||||
"css-color-names": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
|
||||
"resolved": "http://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
|
||||
"integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
|
||||
"dev": true
|
||||
},
|
||||
@ -8570,7 +8570,7 @@
|
||||
},
|
||||
"diffie-hellman": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
|
||||
"integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -15907,16 +15907,6 @@
|
||||
"jquery": ">=1.7.0"
|
||||
}
|
||||
},
|
||||
"jquery-migrate": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
|
||||
"integrity": "sha1-hRUvPsmalWJfT30Lz2LpuGOPWnY=",
|
||||
"dev": true
|
||||
},
|
||||
"jquery-ui": {
|
||||
"version": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
|
||||
"integrity": "sha512-yMLXNruSte8iAAOsShJvUdcwgrHbWrxBCoKfPGqDmgFkfNLbnXoHcyxgOvI2IbgfupFF2paOm0AvOq6iERedKQ=="
|
||||
},
|
||||
"js-base64": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
|
||||
@ -20410,7 +20400,7 @@
|
||||
},
|
||||
"react-autosize-textarea": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/react-autosize-textarea/-/react-autosize-textarea-3.0.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/react-autosize-textarea/-/react-autosize-textarea-3.0.3.tgz",
|
||||
"integrity": "sha512-iOSZK7RUuJ+iEwkJ9rqYciqtjQgrG1CCRFL6h8Bk61kODnRyEq4tS74IgXpI1t4S6jBBZVm+6ugaU+tWTlVxXg==",
|
||||
"requires": {
|
||||
"autosize": "^4.0.0",
|
||||
@ -22134,7 +22124,7 @@
|
||||
},
|
||||
"sha.js": {
|
||||
"version": "2.4.11",
|
||||
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -61,7 +61,6 @@
|
||||
"grunt-webpack": "^3.1.3",
|
||||
"ink-docstrap": "1.3.2",
|
||||
"install-changed": "1.1.0",
|
||||
"jquery-migrate": "1.4.1",
|
||||
"matchdep": "~2.0.0",
|
||||
"node-sass": "~4.14.1",
|
||||
"prettier": "npm:wp-prettier@2.0.5",
|
||||
@ -137,7 +136,6 @@
|
||||
"jquery-color": "https://github.com/jquery/jquery-color/archive/2.1.2.tar.gz",
|
||||
"jquery-form": "4.2.1",
|
||||
"jquery-hoverintent": "1.8.3",
|
||||
"jquery-ui": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
|
||||
"lodash": "4.17.19",
|
||||
"masonry-layout": "4.2.2",
|
||||
"moment": "2.27.0",
|
||||
|
835
src/js/_enqueues/vendor/jquery/jquery-migrate.js
vendored
Normal file
835
src/js/_enqueues/vendor/jquery/jquery-migrate.js
vendored
Normal file
@ -0,0 +1,835 @@
|
||||
/*!
|
||||
* jQuery Migrate - v3.3.1 - 2020-06-25T01:07Z
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
*/
|
||||
( function( factory ) {
|
||||
"use strict";
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define( [ "jquery" ], function( jQuery ) {
|
||||
return factory( jQuery, window );
|
||||
} );
|
||||
} else if ( typeof module === "object" && module.exports ) {
|
||||
|
||||
// Node/CommonJS
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = factory( require( "jquery" ), window );
|
||||
} else {
|
||||
|
||||
// Browser globals
|
||||
factory( jQuery, window );
|
||||
}
|
||||
} )( function( jQuery, window ) {
|
||||
"use strict";
|
||||
|
||||
jQuery.migrateVersion = "3.3.1";
|
||||
|
||||
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
|
||||
function compareVersions( v1, v2 ) {
|
||||
var i,
|
||||
rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
|
||||
v1p = rVersionParts.exec( v1 ) || [ ],
|
||||
v2p = rVersionParts.exec( v2 ) || [ ];
|
||||
|
||||
for ( i = 1; i <= 3; i++ ) {
|
||||
if ( +v1p[ i ] > +v2p[ i ] ) {
|
||||
return 1;
|
||||
}
|
||||
if ( +v1p[ i ] < +v2p[ i ] ) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function jQueryVersionSince( version ) {
|
||||
return compareVersions( jQuery.fn.jquery, version ) >= 0;
|
||||
}
|
||||
|
||||
( function() {
|
||||
|
||||
// Support: IE9 only
|
||||
// IE9 only creates console object when dev tools are first opened
|
||||
// IE9 console is a host object, callable but doesn't have .apply()
|
||||
if ( !window.console || !window.console.log ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need jQuery 3.0.0+ and no older Migrate loaded
|
||||
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) {
|
||||
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
|
||||
}
|
||||
if ( jQuery.migrateWarnings ) {
|
||||
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
|
||||
}
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
window.console.log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
|
||||
} )();
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// By default each warning is only reported once.
|
||||
jQuery.migrateDeduplicateWarnings = true;
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg ) {
|
||||
var console = window.console;
|
||||
if ( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function migrateWarnFunc( obj, prop, newFunc, msg ) {
|
||||
obj[ prop ] = function() {
|
||||
migrateWarn( msg );
|
||||
return newFunc.apply( this, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
if ( window.document.compatMode === "BackCompat" ) {
|
||||
|
||||
// JQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
var findProp,
|
||||
class2type = {},
|
||||
oldInit = jQuery.fn.init,
|
||||
oldFind = jQuery.find,
|
||||
|
||||
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
|
||||
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
|
||||
|
||||
// Support: Android <=4.0 only
|
||||
// Make sure we trim BOM and NBSP
|
||||
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
||||
|
||||
jQuery.fn.init = function( arg1 ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
if ( typeof arg1 === "string" && arg1 === "#" ) {
|
||||
|
||||
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
args[ 0 ] = [];
|
||||
}
|
||||
|
||||
return oldInit.apply( this, args );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
jQuery.find = function( selector ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
// Support: PhantomJS 1.x
|
||||
// String#match fails to match when used with a //g RegExp, only on some strings
|
||||
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
|
||||
|
||||
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
|
||||
// First see if qS thinks it's a valid selector, if so avoid a false positive
|
||||
try {
|
||||
window.document.querySelector( selector );
|
||||
} catch ( err1 ) {
|
||||
|
||||
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
|
||||
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
|
||||
return "[" + attr + op + "\"" + value + "\"]";
|
||||
} );
|
||||
|
||||
// If the regexp *may* have created an invalid selector, don't update it
|
||||
// Note that there may be false alarms if selector uses jQuery extensions
|
||||
try {
|
||||
window.document.querySelector( selector );
|
||||
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
|
||||
args[ 0 ] = selector;
|
||||
} catch ( err2 ) {
|
||||
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oldFind.apply( this, args );
|
||||
};
|
||||
|
||||
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
|
||||
for ( findProp in oldFind ) {
|
||||
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
|
||||
jQuery.find[ findProp ] = oldFind[ findProp ];
|
||||
}
|
||||
}
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
migrateWarnFunc( jQuery.fn, "size", function() {
|
||||
return this.length;
|
||||
},
|
||||
"jQuery.fn.size() is deprecated and removed; use the .length property" );
|
||||
|
||||
migrateWarnFunc( jQuery, "parseJSON", function() {
|
||||
return JSON.parse.apply( null, arguments );
|
||||
},
|
||||
"jQuery.parseJSON is deprecated; use JSON.parse" );
|
||||
|
||||
migrateWarnFunc( jQuery, "holdReady", jQuery.holdReady,
|
||||
"jQuery.holdReady is deprecated" );
|
||||
|
||||
migrateWarnFunc( jQuery, "unique", jQuery.uniqueSort,
|
||||
"jQuery.unique is deprecated; use jQuery.uniqueSort" );
|
||||
|
||||
// Now jQuery.expr.pseudos is the standard incantation
|
||||
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
|
||||
"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
|
||||
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
|
||||
"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
|
||||
|
||||
// Prior to jQuery 3.1.1 there were internal refs so we don't warn there
|
||||
if ( jQueryVersionSince( "3.1.1" ) ) {
|
||||
migrateWarnFunc( jQuery, "trim", function( text ) {
|
||||
return text == null ?
|
||||
"" :
|
||||
( text + "" ).replace( rtrim, "" );
|
||||
},
|
||||
"jQuery.trim is deprecated; use String.prototype.trim" );
|
||||
}
|
||||
|
||||
// Prior to jQuery 3.2 there were internal refs so we don't warn there
|
||||
if ( jQueryVersionSince( "3.2.0" ) ) {
|
||||
migrateWarnFunc( jQuery, "nodeName", function( elem, name ) {
|
||||
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
||||
},
|
||||
"jQuery.nodeName is deprecated" );
|
||||
}
|
||||
|
||||
if ( jQueryVersionSince( "3.3.0" ) ) {
|
||||
|
||||
migrateWarnFunc( jQuery, "isNumeric", function( obj ) {
|
||||
|
||||
// As of jQuery 3.0, isNumeric is limited to
|
||||
// strings and numbers (primitives or objects)
|
||||
// that can be coerced to finite numbers (gh-2662)
|
||||
var type = typeof obj;
|
||||
return ( type === "number" || type === "string" ) &&
|
||||
|
||||
// parseFloat NaNs numeric-cast false positives ("")
|
||||
// ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
|
||||
// subtraction forces infinities to NaN
|
||||
!isNaN( obj - parseFloat( obj ) );
|
||||
},
|
||||
"jQuery.isNumeric() is deprecated"
|
||||
);
|
||||
|
||||
// Populate the class2type map
|
||||
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
|
||||
split( " " ),
|
||||
function( _, name ) {
|
||||
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
||||
} );
|
||||
|
||||
migrateWarnFunc( jQuery, "type", function( obj ) {
|
||||
if ( obj == null ) {
|
||||
return obj + "";
|
||||
}
|
||||
|
||||
// Support: Android <=2.3 only (functionish RegExp)
|
||||
return typeof obj === "object" || typeof obj === "function" ?
|
||||
class2type[ Object.prototype.toString.call( obj ) ] || "object" :
|
||||
typeof obj;
|
||||
},
|
||||
"jQuery.type is deprecated" );
|
||||
|
||||
migrateWarnFunc( jQuery, "isFunction",
|
||||
function( obj ) {
|
||||
return typeof obj === "function";
|
||||
},
|
||||
"jQuery.isFunction() is deprecated" );
|
||||
|
||||
migrateWarnFunc( jQuery, "isWindow",
|
||||
function( obj ) {
|
||||
return obj != null && obj === obj.window;
|
||||
},
|
||||
"jQuery.isWindow() is deprecated"
|
||||
);
|
||||
|
||||
migrateWarnFunc( jQuery, "isArray", Array.isArray,
|
||||
"jQuery.isArray is deprecated; use Array.isArray"
|
||||
);
|
||||
}
|
||||
|
||||
// Support jQuery slim which excludes the ajax module
|
||||
if ( jQuery.ajax ) {
|
||||
|
||||
var oldAjax = jQuery.ajax;
|
||||
|
||||
jQuery.ajax = function( ) {
|
||||
var jQXHR = oldAjax.apply( this, arguments );
|
||||
|
||||
// Be sure we got a jQXHR (e.g., not sync)
|
||||
if ( jQXHR.promise ) {
|
||||
migrateWarnFunc( jQXHR, "success", jQXHR.done,
|
||||
"jQXHR.success is deprecated and removed" );
|
||||
migrateWarnFunc( jQXHR, "error", jQXHR.fail,
|
||||
"jQXHR.error is deprecated and removed" );
|
||||
migrateWarnFunc( jQXHR, "complete", jQXHR.always,
|
||||
"jQXHR.complete is deprecated and removed" );
|
||||
}
|
||||
|
||||
return jQXHR;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var oldRemoveAttr = jQuery.fn.removeAttr,
|
||||
oldToggleClass = jQuery.fn.toggleClass,
|
||||
rmatchNonSpace = /\S+/g;
|
||||
|
||||
jQuery.fn.removeAttr = function( name ) {
|
||||
var self = this;
|
||||
|
||||
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
|
||||
if ( jQuery.expr.match.bool.test( attr ) ) {
|
||||
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
|
||||
self.prop( attr, false );
|
||||
}
|
||||
} );
|
||||
|
||||
return oldRemoveAttr.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.toggleClass = function( state ) {
|
||||
|
||||
// Only deprecating no-args or single boolean arg
|
||||
if ( state !== undefined && typeof state !== "boolean" ) {
|
||||
return oldToggleClass.apply( this, arguments );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
|
||||
|
||||
// Toggle entire class name of each element
|
||||
return this.each( function() {
|
||||
var className = this.getAttribute && this.getAttribute( "class" ) || "";
|
||||
|
||||
if ( className ) {
|
||||
jQuery.data( this, "__className__", className );
|
||||
}
|
||||
|
||||
// If the element has a class name or if we're passed `false`,
|
||||
// then remove the whole classname (if there was one, the above saved it).
|
||||
// Otherwise bring back whatever was previously saved (if anything),
|
||||
// falling back to the empty string if nothing was stored.
|
||||
if ( this.setAttribute ) {
|
||||
this.setAttribute( "class",
|
||||
className || state === false ?
|
||||
"" :
|
||||
jQuery.data( this, "__className__" ) || ""
|
||||
);
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
function camelCase( string ) {
|
||||
return string.replace( /-([a-z])/g, function( _, letter ) {
|
||||
return letter.toUpperCase();
|
||||
} );
|
||||
}
|
||||
|
||||
var oldFnCss,
|
||||
internalSwapCall = false,
|
||||
ralphaStart = /^[a-z]/,
|
||||
|
||||
// The regex visualized:
|
||||
//
|
||||
// /----------\
|
||||
// | | /-------\
|
||||
// | / Top \ | | |
|
||||
// /--- Border ---+-| Right |-+---+- Width -+---\
|
||||
// | | Bottom | |
|
||||
// | \ Left / |
|
||||
// | |
|
||||
// | /----------\ |
|
||||
// | /-------------\ | | |- END
|
||||
// | | | | / Top \ | |
|
||||
// | | / Margin \ | | | Right | | |
|
||||
// |---------+-| |-+---+-| Bottom |-+----|
|
||||
// | \ Padding / \ Left / |
|
||||
// BEGIN -| |
|
||||
// | /---------\ |
|
||||
// | | | |
|
||||
// | | / Min \ | / Width \ |
|
||||
// \--------------+-| |-+---| |---/
|
||||
// \ Max / \ Height /
|
||||
rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
|
||||
|
||||
jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
|
||||
set: function() {
|
||||
migrateWarn( "JQMIGRATE: jQuery.cssProps is deprecated" );
|
||||
return Reflect.set.apply( this, arguments );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// Create a dummy jQuery.cssNumber if missing. It won't be used by jQuery but
|
||||
// it will prevent code adding new keys to it unconditionally from crashing.
|
||||
if ( !jQuery.cssNumber ) {
|
||||
jQuery.cssNumber = {};
|
||||
}
|
||||
|
||||
function isAutoPx( prop ) {
|
||||
|
||||
// The first test is used to ensure that:
|
||||
// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
|
||||
// 2. The prop is not empty.
|
||||
return ralphaStart.test( prop ) &&
|
||||
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
|
||||
}
|
||||
|
||||
oldFnCss = jQuery.fn.css;
|
||||
|
||||
jQuery.fn.css = function( name, value ) {
|
||||
var camelName,
|
||||
origThis = this;
|
||||
if ( name && typeof name === "object" && !Array.isArray( name ) ) {
|
||||
jQuery.each( name, function( n, v ) {
|
||||
jQuery.fn.css.call( origThis, n, v );
|
||||
} );
|
||||
}
|
||||
if ( typeof value === "number" ) {
|
||||
camelName = camelCase( name );
|
||||
if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) {
|
||||
migrateWarn( "Number-typed values are deprecated for jQuery.fn.css( \"" +
|
||||
name + "\", value )" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldFnCss.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldData = jQuery.data;
|
||||
|
||||
jQuery.data = function( elem, name, value ) {
|
||||
var curData, sameKeys, key;
|
||||
|
||||
// Name can be an object, and each entry in the object is meant to be set as data
|
||||
if ( name && typeof name === "object" && arguments.length === 2 ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
sameKeys = {};
|
||||
for ( key in name ) {
|
||||
if ( key !== camelCase( key ) ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + key );
|
||||
curData[ key ] = name[ key ];
|
||||
} else {
|
||||
sameKeys[ key ] = name[ key ];
|
||||
}
|
||||
}
|
||||
|
||||
oldData.call( this, elem, sameKeys );
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// If the name is transformed, look for the un-transformed name in the data object
|
||||
if ( name && typeof name === "string" && name !== camelCase( name ) ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
if ( curData && name in curData ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
|
||||
if ( arguments.length > 2 ) {
|
||||
curData[ name ] = value;
|
||||
}
|
||||
return curData[ name ];
|
||||
}
|
||||
}
|
||||
|
||||
return oldData.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Support jQuery slim which excludes the effects module
|
||||
if ( jQuery.fx ) {
|
||||
|
||||
var intervalValue, intervalMsg,
|
||||
oldTweenRun = jQuery.Tween.prototype.run,
|
||||
linearEasing = function( pct ) {
|
||||
return pct;
|
||||
};
|
||||
|
||||
jQuery.Tween.prototype.run = function( ) {
|
||||
if ( jQuery.easing[ this.easing ].length > 1 ) {
|
||||
migrateWarn(
|
||||
"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
|
||||
);
|
||||
|
||||
jQuery.easing[ this.easing ] = linearEasing;
|
||||
}
|
||||
|
||||
oldTweenRun.apply( this, arguments );
|
||||
};
|
||||
|
||||
intervalValue = jQuery.fx.interval || 13;
|
||||
intervalMsg = "jQuery.fx.interval is deprecated";
|
||||
|
||||
// Support: IE9, Android <=4.4
|
||||
// Avoid false positives on browsers that lack rAF
|
||||
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
|
||||
if ( window.requestAnimationFrame ) {
|
||||
Object.defineProperty( jQuery.fx, "interval", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
if ( !window.document.hidden ) {
|
||||
migrateWarn( intervalMsg );
|
||||
}
|
||||
return intervalValue;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( intervalMsg );
|
||||
intervalValue = newValue;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var oldLoad = jQuery.fn.load,
|
||||
oldEventAdd = jQuery.event.add,
|
||||
originalFix = jQuery.event.fix;
|
||||
|
||||
jQuery.event.props = [];
|
||||
jQuery.event.fixHooks = {};
|
||||
|
||||
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
|
||||
"jQuery.event.props.concat() is deprecated and removed" );
|
||||
|
||||
jQuery.event.fix = function( originalEvent ) {
|
||||
var event,
|
||||
type = originalEvent.type,
|
||||
fixHook = this.fixHooks[ type ],
|
||||
props = jQuery.event.props;
|
||||
|
||||
if ( props.length ) {
|
||||
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( fixHook && !fixHook._migrated_ ) {
|
||||
fixHook._migrated_ = true;
|
||||
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
|
||||
if ( ( props = fixHook.props ) && props.length ) {
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event = originalFix.call( this, originalEvent );
|
||||
|
||||
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
||||
};
|
||||
|
||||
jQuery.event.add = function( elem, types ) {
|
||||
|
||||
// This misses the multiple-types case but that seems awfully rare
|
||||
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
|
||||
migrateWarn( "jQuery(window).on('load'...) called after load event occurred" );
|
||||
}
|
||||
return oldEventAdd.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof args[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, args );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.on.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
} );
|
||||
|
||||
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
|
||||
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
||||
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
|
||||
function( _i, name ) {
|
||||
|
||||
// Handle event binding
|
||||
jQuery.fn[ name ] = function( data, fn ) {
|
||||
migrateWarn( "jQuery.fn." + name + "() event shorthand is deprecated" );
|
||||
return arguments.length > 0 ?
|
||||
this.on( name, null, data, fn ) :
|
||||
this.trigger( name );
|
||||
};
|
||||
} );
|
||||
|
||||
// Trigger "ready" event only once, on document ready
|
||||
jQuery( function() {
|
||||
jQuery( window.document ).triggerHandler( "ready" );
|
||||
} );
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() {
|
||||
if ( this === window.document ) {
|
||||
migrateWarn( "'ready' event is deprecated" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.extend( {
|
||||
|
||||
bind: function( types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.bind() is deprecated" );
|
||||
return this.on( types, null, data, fn );
|
||||
},
|
||||
unbind: function( types, fn ) {
|
||||
migrateWarn( "jQuery.fn.unbind() is deprecated" );
|
||||
return this.off( types, null, fn );
|
||||
},
|
||||
delegate: function( selector, types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.delegate() is deprecated" );
|
||||
return this.on( types, selector, data, fn );
|
||||
},
|
||||
undelegate: function( selector, types, fn ) {
|
||||
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
|
||||
return arguments.length === 1 ?
|
||||
this.off( selector, "**" ) :
|
||||
this.off( types, selector || "**", fn );
|
||||
},
|
||||
hover: function( fnOver, fnOut ) {
|
||||
migrateWarn( "jQuery.fn.hover() is deprecated" );
|
||||
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
|
||||
}
|
||||
} );
|
||||
|
||||
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
|
||||
origHtmlPrefilter = jQuery.htmlPrefilter,
|
||||
makeMarkup = function( html ) {
|
||||
var doc = window.document.implementation.createHTMLDocument( "" );
|
||||
doc.body.innerHTML = html;
|
||||
return doc.body && doc.body.innerHTML;
|
||||
},
|
||||
warnIfChanged = function( html ) {
|
||||
var changed = html.replace( rxhtmlTag, "<$1></$2>" );
|
||||
if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
|
||||
migrateWarn( "HTML tags must be properly nested and closed: " + html );
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
|
||||
jQuery.htmlPrefilter = function( html ) {
|
||||
warnIfChanged( html );
|
||||
return html.replace( rxhtmlTag, "<$1></$2>" );
|
||||
};
|
||||
};
|
||||
|
||||
jQuery.htmlPrefilter = function( html ) {
|
||||
warnIfChanged( html );
|
||||
return origHtmlPrefilter( html );
|
||||
};
|
||||
|
||||
var oldOffset = jQuery.fn.offset;
|
||||
|
||||
jQuery.fn.offset = function() {
|
||||
var elem = this[ 0 ];
|
||||
|
||||
if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
|
||||
return arguments.length ? this : undefined;
|
||||
}
|
||||
|
||||
return oldOffset.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Support jQuery slim which excludes the ajax module
|
||||
// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
|
||||
// so it doesn't make sense for the slim build.
|
||||
if ( jQuery.ajax ) {
|
||||
|
||||
var oldParam = jQuery.param;
|
||||
|
||||
jQuery.param = function( data, traditional ) {
|
||||
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
||||
|
||||
if ( traditional === undefined && ajaxTraditional ) {
|
||||
|
||||
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
|
||||
traditional = ajaxTraditional;
|
||||
}
|
||||
|
||||
return oldParam.call( this, data, traditional );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Support jQuery slim which excludes the deferred module in jQuery 4.0+
|
||||
if ( jQuery.Deferred ) {
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
|
||||
// Action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks( "memory" ),
|
||||
jQuery.Callbacks( "memory" ) ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred( function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = typeof fns[ i ] === "function" && fns[ i ];
|
||||
|
||||
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[ 1 ] ]( function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && typeof returned.promise === "function" ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
fns = null;
|
||||
} ).promise();
|
||||
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
// Preserve handler of uncaught exceptions in promise chains
|
||||
jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
|
||||
|
||||
}
|
||||
|
||||
return jQuery;
|
||||
} );
|
2
src/js/_enqueues/vendor/jquery/jquery-migrate.min.js
vendored
Normal file
2
src/js/_enqueues/vendor/jquery/jquery-migrate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10877
src/js/_enqueues/vendor/jquery/jquery.js
vendored
10877
src/js/_enqueues/vendor/jquery/jquery.js
vendored
File diff suppressed because one or more lines are too long
2
src/js/_enqueues/vendor/jquery/jquery.min.js
vendored
Normal file
2
src/js/_enqueues/vendor/jquery/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
610
src/js/_enqueues/vendor/jquery/ui/accordion.js
vendored
Normal file
610
src/js/_enqueues/vendor/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 );
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
678
src/js/_enqueues/vendor/jquery/ui/autocomplete.js
vendored
Normal file
678
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
385
src/js/_enqueues/vendor/jquery/ui/button.js
vendored
Normal file
385
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
283
src/js/_enqueues/vendor/jquery/ui/checkboxradio.js
vendored
Normal file
283
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
298
src/js/_enqueues/vendor/jquery/ui/controlgroup.js
vendored
Normal file
298
src/js/_enqueues/vendor/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" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
} ) );
|
1768
src/js/_enqueues/vendor/jquery/ui/core.js
vendored
Normal file
1768
src/js/_enqueues/vendor/jquery/ui/core.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2119
src/js/_enqueues/vendor/jquery/ui/datepicker.js
vendored
Normal file
2119
src/js/_enqueues/vendor/jquery/ui/datepicker.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
932
src/js/_enqueues/vendor/jquery/ui/dialog.js
vendored
Normal file
932
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
1244
src/js/_enqueues/vendor/jquery/ui/draggable.js
vendored
Normal file
1244
src/js/_enqueues/vendor/jquery/ui/draggable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
496
src/js/_enqueues/vendor/jquery/ui/droppable.js
vendored
Normal file
496
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
69
src/js/_enqueues/vendor/jquery/ui/effect-blind.js
vendored
Normal file
69
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
109
src/js/_enqueues/vendor/jquery/ui/effect-bounce.js
vendored
Normal file
109
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
64
src/js/_enqueues/vendor/jquery/ui/effect-clip.js
vendored
Normal file
64
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
68
src/js/_enqueues/vendor/jquery/ui/effect-drop.js
vendored
Normal file
68
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
110
src/js/_enqueues/vendor/jquery/ui/effect-explode.js
vendored
Normal file
110
src/js/_enqueues/vendor/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();
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
46
src/js/_enqueues/vendor/jquery/ui/effect-fade.js
vendored
Normal file
46
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
88
src/js/_enqueues/vendor/jquery/ui/effect-fold.js
vendored
Normal file
88
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
56
src/js/_enqueues/vendor/jquery/ui/effect-highlight.js
vendored
Normal file
56
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
41
src/js/_enqueues/vendor/jquery/ui/effect-puff.js
vendored
Normal file
41
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
63
src/js/_enqueues/vendor/jquery/ui/effect-pulsate.js
vendored
Normal file
63
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
55
src/js/_enqueues/vendor/jquery/ui/effect-scale.js
vendored
Normal file
55
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
73
src/js/_enqueues/vendor/jquery/ui/effect-shake.js
vendored
Normal file
73
src/js/_enqueues/vendor/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 );
|
||||
} );
|
||||
|
||||
} ) );
|
190
src/js/_enqueues/vendor/jquery/ui/effect-size.js
vendored
Normal file
190
src/js/_enqueues/vendor/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();
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
75
src/js/_enqueues/vendor/jquery/ui/effect-slide.js
vendored
Normal file
75
src/js/_enqueues/vendor/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
|
||||
} );
|
||||
} );
|
||||
|
||||
} ) );
|
39
src/js/_enqueues/vendor/jquery/ui/effect-transfer.js
vendored
Normal file
39
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
1639
src/js/_enqueues/vendor/jquery/ui/effect.js
vendored
Normal file
1639
src/js/_enqueues/vendor/jquery/ui/effect.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
668
src/js/_enqueues/vendor/jquery/ui/menu.js
vendored
Normal file
668
src/js/_enqueues/vendor/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() ) );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
224
src/js/_enqueues/vendor/jquery/ui/mouse.js
vendored
Normal file
224
src/js/_enqueues/vendor/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; }
|
||||
} );
|
||||
|
||||
} ) );
|
177
src/js/_enqueues/vendor/jquery/ui/progressbar.js
vendored
Normal file
177
src/js/_enqueues/vendor/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" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
1198
src/js/_enqueues/vendor/jquery/ui/resizable.js
vendored
Normal file
1198
src/js/_enqueues/vendor/jquery/ui/resizable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
309
src/js/_enqueues/vendor/jquery/ui/selectable.js
vendored
Normal file
309
src/js/_enqueues/vendor/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;
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} ) );
|
680
src/js/_enqueues/vendor/jquery/ui/selectmenu.js
vendored
Normal file
680
src/js/_enqueues/vendor/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 );
|
||||
}
|
||||
} ] );
|
||||
|
||||
} ) );
|
750
src/js/_enqueues/vendor/jquery/ui/slider.js
vendored
Normal file
750
src/js/_enqueues/vendor/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" );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
} ) );
|
1550
src/js/_enqueues/vendor/jquery/ui/sortable.js
vendored
Normal file
1550
src/js/_enqueues/vendor/jquery/ui/sortable.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
572
src/js/_enqueues/vendor/jquery/ui/spinner.js
vendored
Normal file
572
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
919
src/js/_enqueues/vendor/jquery/ui/tabs.js
vendored
Normal file
919
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
516
src/js/_enqueues/vendor/jquery/ui/tooltip.js
vendored
Normal file
516
src/js/_enqueues/vendor/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;
|
||||
|
||||
} ) );
|
@ -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 );
|
||||
|
@ -10,22 +10,23 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
||||
$scripts = new WP_Scripts;
|
||||
wp_default_scripts( $scripts );
|
||||
|
||||
$jquery_scripts = array(
|
||||
'jquery-core' => '/wp-includes/js/jquery/jquery.js',
|
||||
);
|
||||
if ( SCRIPT_DEBUG ) {
|
||||
$jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.js';
|
||||
$jquery_scripts = array(
|
||||
'jquery-core' => '/wp-includes/js/jquery/jquery.js',
|
||||
'jquery-migrate' => '/wp-includes/js/jquery/jquery-migrate.js',
|
||||
);
|
||||
} else {
|
||||
$jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.min.js';
|
||||
$jquery_scripts = array(
|
||||
'jquery-core' => '/wp-includes/js/jquery/jquery.min.js',
|
||||
'jquery-migrate' => '/wp-includes/js/jquery/jquery-migrate.min.js',
|
||||
);
|
||||
}
|
||||
|
||||
$object = $scripts->query( 'jquery', 'registered' );
|
||||
$this->assertInstanceOf( '_WP_Dependency', $object );
|
||||
|
||||
// As of 5.5 jQuery 1.12.4 is loaded without Migrate 1.4.1.
|
||||
// Disable, but keep the following test for 5.6 when jQuery would be updated to 3.5.1+ and
|
||||
// the latest Migrate will be used.
|
||||
/*
|
||||
// The following test is disabled in WP 5.5 as jQuery 1.12.4 is loaded without jQuery Migrate 1.4.1,
|
||||
// and reenabled in 5.6 when jQuery 3.5.1 is loaded with jQuery Migrate 3.3.1.
|
||||
$this->assertSameSets( $object->deps, array_keys( $jquery_scripts ) );
|
||||
foreach ( $object->deps as $dep ) {
|
||||
$o = $scripts->query( $dep, 'registered' );
|
||||
@ -33,7 +34,6 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
||||
$this->assertTrue( isset( $jquery_scripts[ $dep ] ) );
|
||||
$this->assertSame( $jquery_scripts[ $dep ], $o->src );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function test_presence_of_jquery_no_conflict() {
|
||||
@ -120,7 +120,7 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
// Match only one script tag for 5.5, revert to `{2}` for 5.6.
|
||||
$this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n){1}$/' );
|
||||
$this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n){2}$/' );
|
||||
|
||||
$scripts->do_items( false, 0 );
|
||||
$this->assertNotContains( 'jquery', $scripts->done );
|
||||
@ -130,10 +130,9 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
||||
$scripts->do_items( false, 1 );
|
||||
$this->assertContains( 'jquery', $scripts->done );
|
||||
|
||||
// Disable for 5.5 but keep for use in 5.6. See test_location_of_jquery() above.
|
||||
/*
|
||||
// The following test is disabled in WP 5.5 as jQuery 1.12.4 is loaded without jQuery Migrate 1.4.1,
|
||||
// and reenabled in 5.6 when jQuery 3.5.1 is loaded with Migrate 3.3.1.
|
||||
$this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' );
|
||||
$this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ JS;
|
||||
$wp_scripts->do_concat = true;
|
||||
|
||||
$ver = get_bloginfo( 'version' );
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n";
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
||||
|
||||
@ -657,7 +657,7 @@ JS;
|
||||
$wp_scripts->do_concat = true;
|
||||
|
||||
$ver = get_bloginfo( 'version' );
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n";
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
||||
$expected .= "<!--[if gte IE 9]>\n";
|
||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
||||
@ -686,7 +686,7 @@ JS;
|
||||
$wp_scripts->do_concat = true;
|
||||
|
||||
$ver = get_bloginfo( 'version' );
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n";
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
||||
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||
|
||||
@ -712,7 +712,7 @@ JS;
|
||||
$wp_scripts->do_concat = true;
|
||||
|
||||
$ver = get_bloginfo( 'version' );
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n";
|
||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
||||
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill.min.js' id='wp-polyfill-js'></script>\n";
|
||||
|
@ -2,9 +2,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>WordPress QUnit Test Suite</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<!-- Dependencies -->
|
||||
<script src="../../build/wp-includes/js/jquery/jquery.js"></script>
|
||||
<script src="../../build/wp-includes/js/jquery/jquery-migrate.js"></script>
|
||||
<script src="../../build/wp-includes/js/jquery/ui/core.min.js"></script>
|
||||
<script src="../../build/wp-includes/js/underscore.min.js"></script>
|
||||
<script src="../../build/wp-includes/js/backbone.min.js"></script>
|
||||
@ -93,7 +95,6 @@
|
||||
<script src="../../build/wp-includes/js/wp-api.js"></script>
|
||||
|
||||
<script type='text/javascript' src='../../build/wp-includes/js/jquery/ui/core.min.js'></script>
|
||||
<script type='text/javascript' src='../../build/wp-includes/js/jquery/ui/widget.min.js'></script>
|
||||
<script type='text/javascript' src='../../build/wp-includes/js/jquery/ui/mouse.min.js'></script>
|
||||
<script type='text/javascript' src='../../build/wp-includes/js/jquery/ui/sortable.min.js'></script>
|
||||
<script type='text/javascript' src='../../build/wp-includes/js/jquery/ui/draggable.min.js'></script>
|
||||
|
@ -6,7 +6,7 @@ wp.customize.settingConstructor.abbreviation = wp.customize.Setting.extend({
|
||||
}
|
||||
});
|
||||
|
||||
jQuery( window ).load( function() {
|
||||
jQuery( 'body' ).on( 'load', function() {
|
||||
'use strict';
|
||||
|
||||
var controlId, controlLabel, controlType, controlContent, controlDescription, controlData, mockControl,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* global wp */
|
||||
jQuery( window ).load( function() {
|
||||
jQuery( 'body' ).on( 'load', function() {
|
||||
|
||||
var api = wp.customize,
|
||||
primaryMenuId = 3,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* global wp */
|
||||
jQuery( window ).load( function() {
|
||||
jQuery( 'body' ).on( 'load', function() {
|
||||
|
||||
var api = wp.customize, $ = jQuery;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user