mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01: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($) {
|
||||
|
||||
pickColor = function(color, cleared) {
|
||||
var defaultColor = '';
|
||||
|
||||
pickColor = function(color) {
|
||||
farbtastic.setColor(color);
|
||||
$('#background-color').val(color);
|
||||
$('#custom-background-image').css('background-color', color);
|
||||
console.log( color );
|
||||
if ( typeof cleared === 'undefined' )
|
||||
cleared = ! color || color === '#';
|
||||
if ( cleared )
|
||||
// If we have a default color, and they match, then we need to hide the 'Default' link.
|
||||
// Otherwise, we hide the 'Clear' link when it is empty.
|
||||
if ( ( defaultColor && color === defaultColor ) || ( ! defaultColor && ( '' === color || '#' === color ) ) )
|
||||
$('#clearcolor').hide();
|
||||
else
|
||||
$('#clearcolor').show();
|
||||
@ -17,13 +18,15 @@ var farbtastic, pickColor;
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
defaultColor = $('#defaultcolor').val();
|
||||
|
||||
$('#pickcolor').click(function() {
|
||||
$('#colorPickerDiv').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#clearcolor a').click( function(e) {
|
||||
pickColor( $('#defaultcolor').val(), true );
|
||||
pickColor( defaultColor );
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user