Ticket #20448: 20448.10.diff
File 20448.10.diff, 1.3 KB (added by , 12 years ago) |
---|
-
wp-admin/js/custom-background.dev.js
2 2 3 3 (function($) { 4 4 5 pickColor = function(color, cleared) { 5 var defaultColor = ''; 6 7 pickColor = function(color) { 6 8 farbtastic.setColor(color); 7 9 $('#background-color').val(color); 8 10 $('#custom-background-image').css('background-color', color); 9 console.log( color ); 10 if ( typeof cleared === 'undefined' ) 11 cleared = ! color || color === '#'; 12 if ( cleared ) 11 // If we have a default color, and they match, then we need to hide the 'Default' link. 12 // Otherwise, we hide the 'Clear' link when it is empty. 13 if ( ( defaultColor && color === defaultColor ) || ( ! defaultColor && ( '' === color || '#' === color ) ) ) 13 14 $('#clearcolor').hide(); 14 15 else 15 16 $('#clearcolor').show(); … … 17 18 18 19 $(document).ready(function() { 19 20 21 defaultColor = $('#defaultcolor').val(); 22 20 23 $('#pickcolor').click(function() { 21 24 $('#colorPickerDiv').show(); 22 25 return false; 23 26 }); 24 27 25 28 $('#clearcolor a').click( function(e) { 26 pickColor( $('#defaultcolor').val(), true);29 pickColor( defaultColor ); 27 30 e.preventDefault(); 28 31 }); 29 32