Ticket #12186: background_js_fix.patch
File background_js_fix.patch, 3.6 KB (added by , 15 years ago) |
---|
-
wp-admin/custom-background.php
156 156 <td> 157 157 <style type="text/css"> 158 158 #custom-background-image { 159 <?php if ( get_background_color() ) { ?> 159 160 background-color: #<?php echo get_background_color()?>; 160 <?php if ( get_background_image() ) { ?> 161 background: url(<?php echo get_theme_mod('background_image_thumb', ''); ?>); 161 <?php } 162 if ( get_background_image() ) { ?> 163 background-image: url(<?php echo get_theme_mod('background_image_thumb', ''); ?>); 162 164 background-repeat: <?php echo get_theme_mod('background_repeat', 'no-repeat'); ?>; 163 165 background-position: top <?php echo get_theme_mod('background_position', 'left'); ?>; 164 166 background-attachment: <?php echo get_theme_mod('background_position', 'fixed'); ?>; … … 221 223 <th scope="row"><?php _e( 'Background Color' ); ?></th> 222 224 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> 223 225 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> 224 <input type="button" class="button " value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" />226 <input type="button" class="button hide-if-no-js" value="<?php esc_attr_e('Select a Color'); ?>" id="pickcolor" /> 225 227 226 228 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 227 229 </fieldset></td> -
wp-admin/js/custom-background.dev.js
1 var buttons = ['#pickcolor'],farbtastic;1 var farbtastic; 2 2 3 3 function pickColor(color) { 4 4 jQuery('#background-color').val(color); 5 farbtastic.setColor(color);6 5 jQuery('#custom-background-image').css('background-color', color); 6 farbtastic.setColor(color); 7 7 } 8 8 9 9 jQuery(document).ready(function() { 10 10 jQuery('#pickcolor').click(function() { 11 11 jQuery('#colorPickerDiv').show(); 12 12 }); 13 13 14 jQuery('#background-color').keyup(function() { 14 15 var _hex = jQuery('#background-color').val(); 15 16 var hex = _hex; … … 21 22 if ( hex.length == 4 || hex.length == 7 ) 22 23 pickColor( hex ); 23 24 }); 25 24 26 jQuery('input[name="background-position"]').change(function() { 25 jQuery('#custom-background-image').css('background-position', 'top ' +jQuery(this).val());27 jQuery('#custom-background-image').css('background-position', 'top ' + jQuery(this).val()); 26 28 }); 29 27 30 jQuery('select[name="background-repeat"]').change(function() { 28 31 jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); 29 32 }); … … 31 34 farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { 32 35 pickColor(color); 33 36 }); 34 pickColor(customBackgroundL10n.backgroundcolor); 35 }); 37 pickColor(jQuery('#background-color').val()); 36 38 37 jQuery(document).mousedown(function(){ 38 hide_picker(); // Make the picker disappear if you click outside its div element 39 }); 40 41 function hide_picker(what) { 42 var update = false; 43 jQuery('#colorPickerDiv').each(function(){ 44 var id = jQuery(this).attr('id'); 45 if ( id == what ) 46 return; 47 48 var display = jQuery(this).css('display'); 49 if ( display == 'block' ) 50 jQuery(this).fadeOut(2); 39 jQuery(document).mousedown(function(){ 40 jQuery('#colorPickerDiv').each(function(){ 41 var display = jQuery(this).css('display'); 42 if ( display == 'block' ) 43 jQuery(this).fadeOut(2); 44 }); 51 45 }); 52 } 53 No newline at end of file 46 });