From e0957c8eb74d52245b3724286543ea7460e94f8b Mon Sep 17 00:00:00 2001 From: Matt Thomas Date: Fri, 6 Dec 2013 21:26:10 +0000 Subject: [PATCH] Adding autosave for color schemes and removing RTL handling. See #26387, props ryelle. Built from https://develop.svn.wordpress.org/trunk@26746 git-svn-id: http://core.svn.wordpress.org/trunk@26634 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/about.php | 4 +++- wp-admin/js/about.js | 16 ++++++++-------- wp-admin/js/about.min.js | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/wp-admin/about.php b/wp-admin/about.php index 955ded133c..0f9b1dc19a 100644 --- a/wp-admin/about.php +++ b/wp-admin/about.php @@ -81,15 +81,17 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

+ 1 && has_action('admin_color_scheme_picker') ) :?> -

visit your profile settings.' ), get_edit_profile_url( get_current_user_id() ) ); ?>

+

visit your profile settings.' ), get_edit_profile_url( $user_id ) ); ?>

diff --git a/wp-admin/js/about.js b/wp-admin/js/about.js index b7290cc20d..e96b72ce2c 100644 --- a/wp-admin/js/about.js +++ b/wp-admin/js/about.js @@ -1,4 +1,4 @@ -/* global isRtl */ +/* global ajaxurl */ (function($){ $(document).ready( function() { @@ -10,9 +10,6 @@ $colorpicker = $( '#color-picker' ); $stylesheet = $( '#colors-css' ); - if ( isRtl ){ - $stylesheet = $( '#colors-rtl-css' ); - } $colorpicker.on( 'click.colorpicker', '.color-option', function() { var colors, css_url, @@ -28,10 +25,6 @@ // Set color scheme // Load the colors stylesheet css_url = $this.children( '.css_url' ).val(); - if ( isRtl ){ - css_url = css_url.replace('.min', '-rtl.min'); - } - $stylesheet.attr( 'href', css_url ); // repaint icons @@ -45,6 +38,13 @@ wp.svgPainter.paint(); } } + + // update user option + $.post( ajaxurl, { + action: 'save-user-color-scheme', + color_scheme: $this.children( 'input[name="admin_color"]' ).val(), + nonce: $('#_wpnonce').val() + }); }); }); diff --git a/wp-admin/js/about.min.js b/wp-admin/js/about.min.js index 05529d1033..28d5f043b6 100644 --- a/wp-admin/js/about.min.js +++ b/wp-admin/js/about.min.js @@ -1 +1 @@ -!function(a){a(document).ready(function(){var b,c;a(".color-palette").click(function(){a(this).siblings('input[name="admin_color"]').prop("checked",!0)}),b=a("#color-picker"),c=a("#colors-css"),isRtl&&(c=a("#colors-rtl-css")),b.on("click.colorpicker",".color-option",function(){var b,d,e=a(this);if(!e.hasClass("selected")&&(e.siblings(".selected").removeClass("selected"),e.addClass("selected").find('input[type="radio"]').prop("checked",!0),d=e.children(".css_url").val(),isRtl&&(d=d.replace(".min","-rtl.min")),c.attr("href",d),"undefined"!=typeof wp&&wp.svgPainter)){try{b=a.parseJSON(e.children(".icon_colors").val())}catch(f){}b&&(wp.svgPainter.setColors(b),wp.svgPainter.paint())}})})}(jQuery); \ No newline at end of file +!function(a){a(document).ready(function(){var b,c;a(".color-palette").click(function(){a(this).siblings('input[name="admin_color"]').prop("checked",!0)}),b=a("#color-picker"),c=a("#colors-css"),b.on("click.colorpicker",".color-option",function(){var b,d,e=a(this);if(!e.hasClass("selected")){if(e.siblings(".selected").removeClass("selected"),e.addClass("selected").find('input[type="radio"]').prop("checked",!0),d=e.children(".css_url").val(),c.attr("href",d),"undefined"!=typeof wp&&wp.svgPainter){try{b=a.parseJSON(e.children(".icon_colors").val())}catch(f){}b&&(wp.svgPainter.setColors(b),wp.svgPainter.paint())}a.post(ajaxurl,{action:"save-user-color-scheme",color_scheme:e.children('input[name="admin_color"]').val(),nonce:a("#_wpnonce").val()})}})})}(jQuery); \ No newline at end of file