2010-05-15 15:47:03 -04:00
|
|
|
var farbtastic;
|
2010-03-21 02:06:18 -04:00
|
|
|
|
|
|
|
function pickColor(color) {
|
|
|
|
farbtastic.setColor(color);
|
2010-05-15 15:47:03 -04:00
|
|
|
jQuery('#background-color').val(color);
|
2010-03-21 02:06:18 -04:00
|
|
|
jQuery('#custom-background-image').css('background-color', color);
|
|
|
|
}
|
|
|
|
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
jQuery('#pickcolor').click(function() {
|
|
|
|
jQuery('#colorPickerDiv').show();
|
2010-05-27 20:01:59 -04:00
|
|
|
return false;
|
2010-03-21 02:06:18 -04:00
|
|
|
});
|
2010-05-15 15:47:03 -04:00
|
|
|
|
2010-03-21 02:06:18 -04:00
|
|
|
jQuery('#background-color').keyup(function() {
|
2010-05-16 01:17:57 -04:00
|
|
|
var _hex = jQuery('#background-color').val(), hex = _hex;
|
2010-10-25 23:42:14 -04:00
|
|
|
if ( hex.charAt(0) != '#' )
|
2010-03-21 02:06:18 -04:00
|
|
|
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 );
|
|
|
|
});
|
2010-05-15 15:47:03 -04:00
|
|
|
|
2010-05-16 01:17:57 -04:00
|
|
|
jQuery('input[name="background-position-x"]').change(function() {
|
|
|
|
jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top');
|
2010-03-21 02:06:18 -04:00
|
|
|
});
|
2010-05-15 15:47:03 -04:00
|
|
|
|
2010-05-31 12:30:02 -04:00
|
|
|
jQuery('input[name="background-repeat"]').change(function() {
|
2010-03-27 22:53:04 -04:00
|
|
|
jQuery('#custom-background-image').css('background-repeat', jQuery(this).val());
|
|
|
|
});
|
2010-05-03 16:26:11 -04:00
|
|
|
|
2010-03-21 02:06:18 -04:00
|
|
|
farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) {
|
|
|
|
pickColor(color);
|
|
|
|
});
|
2010-05-15 15:47:03 -04:00
|
|
|
pickColor(jQuery('#background-color').val());
|
2010-03-21 02:06:18 -04:00
|
|
|
|
2010-05-15 15:47:03 -04:00
|
|
|
jQuery(document).mousedown(function(){
|
|
|
|
jQuery('#colorPickerDiv').each(function(){
|
|
|
|
var display = jQuery(this).css('display');
|
|
|
|
if ( display == 'block' )
|
|
|
|
jQuery(this).fadeOut(2);
|
|
|
|
});
|
2010-03-21 02:06:18 -04:00
|
|
|
});
|
2010-05-15 15:47:03 -04:00
|
|
|
});
|