CoreFiles by mySites.guru
custom-background.dev.js55 lines, 1,512 bytes, from wordpress-3.2.zip
Raw History Compare with 3.1.4
md5
18c3b57b631f56a0dcb63f0fe5f10305
sha1
a3190dac9df44e2e54a2bef910abc70a1582a5e7
sha256
0ae471dc1dfe721a8c8c922ac3be39ae052af7313e11ffebca9b6f510face50d
var farbtastic;

function pickColor(color) {
	farbtastic.setColor(color);
	jQuery('#background-color').val(color);
	jQuery('#custom-background-image').css('background-color', color);
	if ( color && color !== '#' )
		jQuery('#clearcolor').show();
	else
		jQuery('#clearcolor').hide();
}

jQuery(document).ready(function() {
	jQuery('#pickcolor').click(function() {
		jQuery('#colorPickerDiv').show();
		return false;
	});

	jQuery('#clearcolor a').click( function(e) {
		pickColor('');
		e.preventDefault();
	});

	jQuery('#background-color').keyup(function() {
		var _hex = jQuery('#background-color').val(), hex = _hex;
		if ( hex.charAt(0) != '#' )
			hex = '#' + hex;
		hex = hex.replace(/[^#a-fA-F0-9]+/, '');
		if ( hex != _hex )
			jQuery('#background-color').val(hex);
		if ( hex.length == 4 || hex.length == 7 )
			pickColor( hex );
	});

	jQuery('input[name="background-position-x"]').change(function() {
		jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top');
	});

	jQuery('input[name="background-repeat"]').change(function() {
		jQuery('#custom-background-image').css('background-repeat', jQuery(this).val());
	});

	farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) {
		pickColor(color);
	});
	pickColor(jQuery('#background-color').val());

	jQuery(document).mousedown(function(){
		jQuery('#colorPickerDiv').each(function(){
			var display = jQuery(this).css('display');
			if ( display == 'block' )
				jQuery(this).fadeOut(2);
		});
	});
});

The same content is in 23 releases, WordPress 3.2-beta1 to 3.4-beta4. See them all, or every version of this file.