[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/assets/js/ -> customize.js (source)

   1  /* global twentytwentyoneGetHexLum */
   2  
   3  ( function() {
   4      // Wait until the customizer has finished loading.
   5      wp.customize.bind( 'ready', function() {
   6          // Hide the "respect_user_color_preference" setting if the background-color is dark.
   7          if ( 127 > twentytwentyoneGetHexLum( wp.customize( 'background_color' ).get() ) ) {
   8              wp.customize.control( 'respect_user_color_preference' ).deactivate();
   9              wp.customize.control( 'respect_user_color_preference_notice' ).deactivate();
  10          }
  11  
  12          // Handle changes to the background-color.
  13          wp.customize( 'background_color', function( setting ) {
  14              setting.bind( function( value ) {
  15                  if ( 127 > twentytwentyoneGetHexLum( value ) ) {
  16                      wp.customize.control( 'respect_user_color_preference' ).deactivate();
  17                      wp.customize.control( 'respect_user_color_preference_notice' ).activate();
  18                  } else {
  19                      wp.customize.control( 'respect_user_color_preference' ).activate();
  20                      wp.customize.control( 'respect_user_color_preference_notice' ).deactivate();
  21                  }
  22              } );
  23          } );
  24      } );
  25  }() );


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1