1 | $(function() { |
---|
2 | $('input.pwg-picker') |
---|
3 | .each(function() { |
---|
4 | if ($(this).val() !== undefined) { |
---|
5 | if ($(this).val().indexOf('#',0)==-1) { |
---|
6 | $(this).css('background-color', '#'+$(this).val()); |
---|
7 | } else { |
---|
8 | $(this).css('background-color', $(this).val()); |
---|
9 | } |
---|
10 | } |
---|
11 | }) |
---|
12 | .ColorPicker({ |
---|
13 | onSubmit: function(hsb, hex, rgb, el) { |
---|
14 | $(el).val(hex); |
---|
15 | $(el).ColorPickerHide(); |
---|
16 | $(el).css('background-color', '#'+hex); |
---|
17 | }, |
---|
18 | onBeforeShow: function () { |
---|
19 | $(this).ColorPickerSetColor(this.value); |
---|
20 | } |
---|
21 | }) |
---|
22 | .bind('keyup', function(){ |
---|
23 | $(this).ColorPickerSetColor(this.value); |
---|
24 | }); |
---|
25 | |
---|
26 | if ($('#pwg_cumulus_mode_transparent').is(':checked')) { |
---|
27 | $('#pwg_cumulus_p_bgcolor') |
---|
28 | .css('opacity', '0.3') |
---|
29 | .children().children('input').attr('disabled', 'disabled'); |
---|
30 | } |
---|
31 | $('#pwg_cumulus_mode_transparent') |
---|
32 | .click(function() { |
---|
33 | if ($(this).is(':checked')) { |
---|
34 | $('#pwg_cumulus_p_bgcolor') |
---|
35 | .animate({opacity:'-=0.7'}, 500) |
---|
36 | .children().children('input').attr('disabled', 'disabled'); |
---|
37 | } else { |
---|
38 | $('#pwg_cumulus_p_bgcolor') |
---|
39 | .animate({opacity:'+=0.7'}, 500) |
---|
40 | .children().children('input').removeAttr('disabled'); |
---|
41 | } |
---|
42 | }); |
---|
43 | }); |
---|