Default Themes: Import Twenty Nineteen from the 5.0 branch.
Merges [43808,43821,43842,43860,43892,43904,43909,43926-43929,43956,43961-43963] from the 5.0 branch to trunk.
Props allancole, karmatosed, kjellr, yingling017, mrasharirfan, milana_cap, fabiankaegy, westonruter, jorbin, netweb, b-07, khleomix, audrasjb, nielslange, mmaumio, richsalvucci, littlebigthing, dimadin, joyously, anevins, peterwilsoncc, dannycooper, iCaleb, siriokun, technosiren, travel_girl, azchughtai, ianbelanger, nadim1992, ismailelkorchi, nativeinside, chetan200891, grapplerulrich, ocean90, joshfeck, frankew, AbdulWahab610, mendezcode, eliorivero, melchoyce, joen, laurelfulford, mdawaffe, kraftbj, dsmart, nao, mayukojpn, enodekciw, ketuchetan, atanasangelovdev, poena, sharaz, artisticasad, mukesh27, burhandodhy, crunnells, aprakasa, themeroots, imonly_ik, tlxo, youthkee, brentswisher, smyoon315, mrahmadawais, desideveloper, Kau-Boy, mor10, mikeyarce, dingo_bastard, xkon, twoabove.
Fixes #45424.
Built from https://develop.svn.wordpress.org/trunk@44149
git-svn-id: http://core.svn.wordpress.org/trunk@43979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 03:33:41 +01:00
|
|
|
/**
|
2019-08-31 22:43:55 +02:00
|
|
|
* File customize-preview.js.
|
Default Themes: Import Twenty Nineteen from the 5.0 branch.
Merges [43808,43821,43842,43860,43892,43904,43909,43926-43929,43956,43961-43963] from the 5.0 branch to trunk.
Props allancole, karmatosed, kjellr, yingling017, mrasharirfan, milana_cap, fabiankaegy, westonruter, jorbin, netweb, b-07, khleomix, audrasjb, nielslange, mmaumio, richsalvucci, littlebigthing, dimadin, joyously, anevins, peterwilsoncc, dannycooper, iCaleb, siriokun, technosiren, travel_girl, azchughtai, ianbelanger, nadim1992, ismailelkorchi, nativeinside, chetan200891, grapplerulrich, ocean90, joshfeck, frankew, AbdulWahab610, mendezcode, eliorivero, melchoyce, joen, laurelfulford, mdawaffe, kraftbj, dsmart, nao, mayukojpn, enodekciw, ketuchetan, atanasangelovdev, poena, sharaz, artisticasad, mukesh27, burhandodhy, crunnells, aprakasa, themeroots, imonly_ik, tlxo, youthkee, brentswisher, smyoon315, mrahmadawais, desideveloper, Kau-Boy, mor10, mikeyarce, dingo_bastard, xkon, twoabove.
Fixes #45424.
Built from https://develop.svn.wordpress.org/trunk@44149
git-svn-id: http://core.svn.wordpress.org/trunk@43979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 03:33:41 +01:00
|
|
|
*
|
|
|
|
* Theme Customizer enhancements for a better user experience.
|
|
|
|
*
|
|
|
|
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function( $ ) {
|
|
|
|
|
|
|
|
// Primary color.
|
|
|
|
wp.customize( 'primary_color', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
// Update custom color CSS.
|
|
|
|
var style = $( '#custom-theme-colors' ),
|
|
|
|
hue = style.data( 'hue' ),
|
|
|
|
css = style.html(),
|
|
|
|
color;
|
|
|
|
|
|
|
|
if( 'custom' === to ){
|
|
|
|
// If a custom primary color is selected, use the currently set primary_color_hue
|
|
|
|
color = wp.customize.get().primary_color_hue;
|
|
|
|
} else {
|
|
|
|
// If the "default" option is selected, get the default primary_color_hue
|
|
|
|
color = 199;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
|
|
|
|
css = css.split( hue + ',' ).join( color + ',' );
|
|
|
|
style.html( css ).data( 'hue', color );
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Primary color hue.
|
|
|
|
wp.customize( 'primary_color_hue', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
|
|
|
|
// Update custom color CSS.
|
|
|
|
var style = $( '#custom-theme-colors' ),
|
|
|
|
hue = style.data( 'hue' ),
|
|
|
|
css = style.html();
|
|
|
|
|
|
|
|
// Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.
|
|
|
|
css = css.split( hue + ',' ).join( to + ',' );
|
|
|
|
style.html( css ).data( 'hue', to );
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Image filter.
|
|
|
|
wp.customize( 'image_filter', function( value ) {
|
|
|
|
value.bind( function( to ) {
|
|
|
|
if ( to ) {
|
|
|
|
$( 'body' ).addClass( 'image-filters-enabled' );
|
|
|
|
} else {
|
|
|
|
$( 'body' ).removeClass( 'image-filters-enabled' );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
})( jQuery );
|