Changeset 30126
- Timestamp:
- 10/31/2014 08:44:19 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r30102 r30126 870 870 } 871 871 }); 872 873 this.setting.bind( function ( value ) { 874 picker.val( value ); 875 picker.wpColorPicker( 'color', value ); 876 }); 872 877 } 873 878 }); -
trunk/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js
r30046 r30126 6 6 */ 7 7 8 ( function( wp) {9 wp.customize.controlConstructor.select = wp.customize.Control.extend( {8 ( function( api ) { 9 api.controlConstructor.select = api.Control.extend( { 10 10 ready: function() { 11 11 if ( 'color_scheme' === this.id ) { 12 var parentSection = this.container.closest( '.control-section' ),13 headerTextColor = parentSection.find( '#customize-control-header_textcolor .color-picker-hex' ),14 backgroundColor = parentSection.find( '#customize-control-background_color .color-picker-hex' ),15 sidebarColor = parentSection.find( '#customize-control-header_background_color .color-picker-hex' ),16 sidebarTextColor = parentSection.find( '#customize-control-sidebar_textcolor .color-picker-hex' );17 18 12 this.setting.bind( 'change', function( value ) { 19 // if Header Text is not hidden, update value20 if ( 'blank' !== wp.customize( 'header_textcolor' ).get() ) {21 wp.customize( 'header_textcolor' ).set( colorScheme[value].colors[4] );22 headerTextColor.val( colorScheme[value].colors[4])13 // If Header Text is not hidden, update value. 14 if ( 'blank' !== api( 'header_textcolor' ).get() ) { 15 api( 'header_textcolor' ).set( colorScheme[value].colors[4] ); 16 api.control( 'header_textcolor' ).container.find( '.color-picker-hex' ) 23 17 .data( 'data-default-color', colorScheme[value].colors[4] ) 24 .wpColorPicker( 'color', colorScheme[value].colors[4] )25 18 .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] ); 26 19 } 27 20 28 // update Background Color29 wp.customize( 'background_color' ).set( colorScheme[value].colors[0] );30 backgroundColor.val( colorScheme[value].colors[0])21 // Update Background Color. 22 api( 'background_color' ).set( colorScheme[value].colors[0] ); 23 api.control( 'background_color' ).container.find( '.color-picker-hex' ) 31 24 .data( 'data-default-color', colorScheme[value].colors[0] ) 32 .wpColorPicker( 'color', colorScheme[value].colors[0] )33 25 .wpColorPicker( 'defaultColor', colorScheme[value].colors[0] ); 34 26 35 // update Header/Sidebar Background Color36 wp.customize( 'header_background_color' ).set( colorScheme[value].colors[1] );37 sidebarColor.val( colorScheme[value].colors[1])27 // Update Header/Sidebar Background Color. 28 api( 'header_background_color' ).set( colorScheme[value].colors[1] ); 29 api.control( 'header_background_color' ).container.find( '.color-picker-hex' ) 38 30 .data( 'data-default-color', colorScheme[value].colors[1] ) 39 .wpColorPicker( 'color', colorScheme[value].colors[1] )40 31 .wpColorPicker( 'defaultColor', colorScheme[value].colors[1] ); 41 32 42 // update Sidebar Text Color43 wp.customize( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );44 sidebarTextColor.val( colorScheme[value].colors[4])33 // Update Sidebar Text Color. 34 api( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] ); 35 api.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' ) 45 36 .data( 'data-default-color', colorScheme[value].colors[4] ) 46 .wpColorPicker( 'color', colorScheme[value].colors[4] )47 37 .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] ); 48 38 } ); … … 50 40 } 51 41 } ); 52 } )( this.wp);42 } )( wp.customize );
Note: See TracChangeset
for help on using the changeset viewer.