From 12a64b39db20f79a52ae9ed1b2ff99b4cbe8ba68 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 6 Feb 2014 22:16:11 +0000 Subject: [PATCH] Fix the conditional enqueueing/printing of colors stylesheets, without breaking dependencies. fixes #18380. see #20729 which should properly fix this. Built from https://develop.svn.wordpress.org/trunk@27111 git-svn-id: http://core.svn.wordpress.org/trunk@26978 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/user-profile.js | 6 +++++- wp-admin/js/user-profile.min.js | 2 +- wp-includes/class.wp-styles.php | 4 ++++ wp-includes/general-template.php | 2 +- wp-includes/script-loader.php | 5 +++++ wp-includes/version.php | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/user-profile.js b/wp-admin/js/user-profile.js index 95847310bf..b107d98779 100644 --- a/wp-admin/js/user-profile.js +++ b/wp-admin/js/user-profile.js @@ -95,7 +95,11 @@ // Set color scheme if ( user_id === current_user_id ) { - // Load the colors stylesheet + // Load the colors stylesheet. + // The default color scheme won't have one, so we'll need to create an element. + if ( 0 === $stylesheet.length ) { + $stylesheet = $( '' ).appendTo( 'head' ); + } $stylesheet.attr( 'href', $this.children( '.css_url' ).val() ); // repaint icons diff --git a/wp-admin/js/user-profile.min.js b/wp-admin/js/user-profile.min.js index 2ecea19760..ed54c6fcd7 100644 --- a/wp-admin/js/user-profile.min.js +++ b/wp-admin/js/user-profile.min.js @@ -1 +1 @@ -!function(a){function b(){var b,c=a("#pass1").val(),d=a("#pass2").val();if(a("#pass-strength-result").removeClass("short bad good strong"),!c)return void a("#pass-strength-result").html(pwsL10n.empty);switch(b=wp.passwordStrength.meter(c,wp.passwordStrength.userInputBlacklist(),d)){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){var c,d,e,f,g=a("#display_name");a("#pass1").val("").keyup(b),a("#pass2").val("").keyup(b),a("#pass-strength-result").show(),a(".color-palette").click(function(){a(this).siblings('input[name="admin_color"]').prop("checked",!0)}),g.length&&a("#first_name, #last_name, #nickname").bind("blur.user_profile",function(){var b=[],c={display_nickname:a("#nickname").val()||"",display_username:a("#user_login").val()||"",display_firstname:a("#first_name").val()||"",display_lastname:a("#last_name").val()||""};c.display_firstname&&c.display_lastname&&(c.display_firstlast=c.display_firstname+" "+c.display_lastname,c.display_lastfirst=c.display_lastname+" "+c.display_firstname),a.each(a("option",g),function(a,c){b.push(c.value)}),a.each(c,function(d,e){if(e){var f=e.replace(/<\/?[a-z][^>]*>/gi,"");c[d].length&&-1===a.inArray(f,b)&&(b.push(f),a("