diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index a79be95ab0..aef3300520 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -91,6 +91,7 @@ class Custom_Background { remove_theme_mod('background_image_thumb'); return; } + if ( isset($_POST['remove-background']) ) { // @TODO: Uploaded files are not removed here. check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove'); @@ -107,14 +108,16 @@ class Custom_Background { $repeat = 'repeat'; set_theme_mod('background_repeat', $repeat); } - if ( isset($_POST['background-position']) ) { + + if ( isset($_POST['background-position-x']) ) { check_admin_referer('custom-background'); - if ( in_array($_POST['background-position'], array('center', 'right', 'left')) ) - $position = $_POST['background-position']; + if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) + $position = $_POST['background-position-x']; else $position = 'left'; - set_theme_mod('background_position', $position); + set_theme_mod('background_position_x', $position); } + if ( isset($_POST['background-attachment']) ) { check_admin_referer('custom-background'); if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) @@ -123,6 +126,7 @@ class Custom_Background { $attachment = 'fixed'; set_theme_mod('background_attachment', $attachment); } + if ( isset($_POST['background-color']) ) { check_admin_referer('custom-background'); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); @@ -155,33 +159,29 @@ class Custom_Background { call_user_func($this->admin_image_div_callback); } else { ?> -

+

- + @@ -189,10 +189,11 @@ if ( get_background_image() ) { - @@ -201,10 +202,11 @@ if ( get_background_image() ) { - @@ -216,8 +218,7 @@ if ( get_background_image() ) {
-

- +

@@ -230,28 +231,27 @@ if ( get_background_image() ) {
-
+

-

+
- +
+

+
- +
+
- + - + - + @@ -262,10 +262,10 @@ if ( get_background_image() ) { @@ -284,7 +284,7 @@ if ( get_background_image() ) { - +
-
diff --git a/wp-admin/js/custom-background.dev.js b/wp-admin/js/custom-background.dev.js index 877939541b..1a88d7254d 100644 --- a/wp-admin/js/custom-background.dev.js +++ b/wp-admin/js/custom-background.dev.js @@ -12,8 +12,7 @@ jQuery(document).ready(function() { }); jQuery('#background-color').keyup(function() { - var _hex = jQuery('#background-color').val(); - var hex = _hex; + var _hex = jQuery('#background-color').val(), hex = _hex; if ( hex[0] != '#' ) hex = '#' + hex; hex = hex.replace(/[^#a-fA-F0-9]+/, ''); @@ -23,17 +22,13 @@ jQuery(document).ready(function() { pickColor( hex ); }); - jQuery('input[name="background-position"]').change(function() { - jQuery('#custom-background-image').css('background-position', 'top ' + jQuery(this).val()); + jQuery('input[name="background-position-x"]').change(function() { + jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top'); }); jQuery('select[name="background-repeat"]').change(function() { jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); }); - - jQuery('input[name="background-attachment"]').change(function() { - jQuery('#custom-background-image').css('background-attachment', jQuery(this).val()); - }); farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { pickColor(color); diff --git a/wp-admin/js/custom-background.js b/wp-admin/js/custom-background.js index 5371933ee6..e108f5ad24 100644 --- a/wp-admin/js/custom-background.js +++ b/wp-admin/js/custom-background.js @@ -1 +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()});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val();var a=b;if(a[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"]').change(function(){jQuery("#custom-background-image").css("background-position","top "+jQuery(this).val())});jQuery('select[name="background-repeat"]').change(function(){jQuery("#custom-background-image").css("background-repeat",jQuery(this).val())});jQuery('input[name="background-attachment"]').change(function(){jQuery("#custom-background-image").css("background-attachment",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)}})})}); \ No newline at end of file +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()});jQuery("#background-color").keyup(function(){var b=jQuery("#background-color").val(),a=b;if(a[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('select[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)}})})}); \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 84b4391083..8ff0cc3bb4 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -405,9 +405,8 @@ function wp_default_scripts( &$scripts ) { 'warnDeleteMenuItem' => __( "You are about to permanently delete this menu item. \n 'Cancel' to stop, 'OK' to delete." ), ) ); - $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('farbtastic'), '20100321' ); + $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('farbtastic'), '20100516' ); $scripts->add_data( 'custom-background', 'group', 1 ); - // See wp_just_in_time_script_localization() for translation data for this object } } @@ -529,9 +528,6 @@ function wp_just_in_time_script_localization() { 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' ) ); - wp_localize_script( 'custom-background', 'customBackgroundL10n', array( - 'backgroundcolor' => '#' . get_background_color(), - ) ); } /** diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 3034ace073..64aad1d339 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1553,7 +1553,7 @@ function _custom_background_cb() { $repeat = 'background-repeat: repeat;'; } - switch ( get_theme_mod('background_position', 'left') ) { + switch ( get_theme_mod('background_position_x', 'left') ) { case 'center': $position = 'background-position: top center;'; break;