mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-01 16:48:26 +02:00
Custom background color: Show the 'Default' link when the input is empty and there is a default color registered. fixes #20448. see #20734.
git-svn-id: http://core.svn.wordpress.org/trunk@21004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ebea2f218
commit
fff6be1510
@ -2,14 +2,15 @@ var farbtastic, pickColor;
|
|||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
pickColor = function(color, cleared) {
|
var defaultColor = '';
|
||||||
|
|
||||||
|
pickColor = function(color) {
|
||||||
farbtastic.setColor(color);
|
farbtastic.setColor(color);
|
||||||
$('#background-color').val(color);
|
$('#background-color').val(color);
|
||||||
$('#custom-background-image').css('background-color', color);
|
$('#custom-background-image').css('background-color', color);
|
||||||
console.log( color );
|
// If we have a default color, and they match, then we need to hide the 'Default' link.
|
||||||
if ( typeof cleared === 'undefined' )
|
// Otherwise, we hide the 'Clear' link when it is empty.
|
||||||
cleared = ! color || color === '#';
|
if ( ( defaultColor && color === defaultColor ) || ( ! defaultColor && ( '' === color || '#' === color ) ) )
|
||||||
if ( cleared )
|
|
||||||
$('#clearcolor').hide();
|
$('#clearcolor').hide();
|
||||||
else
|
else
|
||||||
$('#clearcolor').show();
|
$('#clearcolor').show();
|
||||||
@ -17,13 +18,15 @@ var farbtastic, pickColor;
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
defaultColor = $('#defaultcolor').val();
|
||||||
|
|
||||||
$('#pickcolor').click(function() {
|
$('#pickcolor').click(function() {
|
||||||
$('#colorPickerDiv').show();
|
$('#colorPickerDiv').show();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#clearcolor a').click( function(e) {
|
$('#clearcolor a').click( function(e) {
|
||||||
pickColor( $('#defaultcolor').val(), true );
|
pickColor( defaultColor );
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user