WordPress/wp-content/themes/twentytwenty/assets/js/customize.js
hellofromTonya 5c414db9ad External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].

Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285


git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 17:18:01 +00:00

28 lines
821 B
JavaScript

/* global wp, jQuery */
( function( $, api ) {
$( function() {
// Make it possible to reset the color based on a radio input's value.
// `active` can be either `custom` or `default`.
api.control( 'accent_hue_active' ).setting.bind( function( active ) {
var control = api.control( 'accent_hue' ); // Get the accent hue control.
if ( 'custom' === active ) {
// Activate the hue color picker control and focus it.
control.activate( {
completeCallback: function() {
control.focus();
}
} );
} else {
// If the `custom` option isn't selected, deactivate the hue color picker and set a default.
control.deactivate( {
completeCallback: function() {
control.setting.set( control.params.defaultValue );
}
} );
}
} );
} );
}( jQuery, wp.customize ) );