]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/custom-background.dev.js
Wordpress 3.2.1-scripts
[autoinstalls/wordpress.git] / wp-admin / js / custom-background.dev.js
index 5b4b1543ccf3d52aa751e9336e7730b571befb05..b4dbc6657425f4eed440a7a0d4dfa2e38668a275 100644 (file)
@@ -4,6 +4,10 @@ function pickColor(color) {
        farbtastic.setColor(color);
        jQuery('#background-color').val(color);
        jQuery('#custom-background-image').css('background-color', color);
+       if ( color && color !== '#' )
+               jQuery('#clearcolor').show();
+       else
+               jQuery('#clearcolor').hide();
 }
 
 jQuery(document).ready(function() {
@@ -12,9 +16,14 @@ jQuery(document).ready(function() {
                return false;
        });
 
+       jQuery('#clearcolor a').click( function(e) {
+               pickColor('');
+               e.preventDefault();
+       });
+
        jQuery('#background-color').keyup(function() {
                var _hex = jQuery('#background-color').val(), hex = _hex;
-               if ( hex[0] != '#' )
+               if ( hex.charAt(0) != '#' )
                        hex = '#' + hex;
                hex = hex.replace(/[^#a-fA-F0-9]+/, '');
                if ( hex != _hex )