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