WordPress.org

Make WordPress Core

Ticket #15755: clear-bg-15755-refreshed.diff

File clear-bg-15755-refreshed.diff, 4.0 KB (added by lancewillett, 3 years ago)

Refreshed patch for trunk as of r17707

  • wp-admin/js/custom-background.js

     
    1 var farbtastic;function pickColor(a){farbtastic.setColor(a);jQuery("#background-color").val(a);jQuery("#custom-background-image").css("background-color",a)}jQuery(document).ready(function(){jQuery("#pickcolor").click(function(){jQuery("#colorPickerDiv").show();return false});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val(),a=b;if(a.charAt(0)!="#"){a="#"+a}a=a.replace(/[^#a-fA-F0-9]+/,"");if(a!=b){jQuery("#background-color").val(a)}if(a.length==4||a.length==7){pickColor(a)}});jQuery('input[name="background-position-x"]').change(function(){jQuery("#custom-background-image").css("background-position",jQuery(this).val()+" top")});jQuery('input[name="background-repeat"]').change(function(){jQuery("#custom-background-image").css("background-repeat",jQuery(this).val())});farbtastic=jQuery.farbtastic("#colorPickerDiv",function(a){pickColor(a)});pickColor(jQuery("#background-color").val());jQuery(document).mousedown(function(){jQuery("#colorPickerDiv").each(function(){var a=jQuery(this).css("display");if(a=="block"){jQuery(this).fadeOut(2)}})})}); 
    2  No newline at end of file 
     1var farbtastic;function pickColor(a){farbtastic.setColor(a);jQuery("#background-color").val(a);jQuery("#custom-background-image").css("background-color",a)}jQuery(document).ready(function(){jQuery("#pickcolor").click(function(){jQuery("#colorPickerDiv").show();return false});jQuery('#clearcolor').click(function(){pickColor('');return false;});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val(),a=b;if(a.charAt(0)!="#"){a="#"+a}a=a.replace(/[^#a-fA-F0-9]+/,"");if(a!=b){jQuery("#background-color").val(a)}if(a.length==4||a.length==7){pickColor(a)}});jQuery('input[name="background-position-x"]').change(function(){jQuery("#custom-background-image").css("background-position",jQuery(this).val()+" top")});jQuery('input[name="background-repeat"]').change(function(){jQuery("#custom-background-image").css("background-repeat",jQuery(this).val())});farbtastic=jQuery.farbtastic("#colorPickerDiv",function(a){pickColor(a)});pickColor(jQuery("#background-color").val());jQuery(document).mousedown(function(){jQuery("#colorPickerDiv").each(function(){var a=jQuery(this).css("display");if(a=="block"){jQuery(this).fadeOut(2)}})})}); 
     2 No newline at end of file 
  • wp-admin/js/custom-background.dev.js

     
    1212                return false; 
    1313        }); 
    1414 
     15        jQuery('#clearcolor').click(function() { 
     16                pickColor(''); // clear by sending empty string 
     17                return false; 
     18        }); 
     19 
    1520        jQuery('#background-color').keyup(function() { 
    1621                var _hex = jQuery('#background-color').val(), hex = _hex; 
    1722                if ( hex.charAt(0) != '#' ) 
  • wp-admin/custom-background.php

     
    295295<th scope="row"><?php _e( 'Color' ); ?></th> 
    296296<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> 
    297297<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> 
    298 <a class="hide-if-no-js" href="#" id="pickcolor"><?php _e('Select a Color'); ?></a> 
    299 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 
     298<a class="hide-if-no-js" href="#" id="pickcolor"><?php _e( 'Select a Color' ); ?></a> (<a class="hide-if-no-js" href="#" id="clearcolor"><?php _e( 'Clear' ); ?></a>) 
     299<div id="colorPickerDiv" style="z-index: 100; background: #eee; border: 1px solid #ccc; position: absolute; display: none;"></div> 
    300300</fieldset></td> 
    301301</tr> 
    302302</tbody>