1 $(document).ready(function() {
2 function UpdateColors(S) {
4 switch (parseInt(S.id.slice(-1))) {
6 $('body').css({'background-color':C});
9 $('#content').css({'background-color':C});
12 $('#aside_primary').css({'background-color':C});
15 $('body').css({'color':C});
18 $('a').css({'color':C});
23 function UpdateFarbtastic(e) {
28 function UpdateSwatch(e) {
29 $(e).css({"background-color": e.value,
30 "color": f.hsl[2] > 0.5 ? "#000": "#fff"});
33 function SynchColors(e) {
37 if (S && S.value && S.value != C) {
45 $('#settings_design_color').append('<div id="color-picker"></div>');
46 $('#color-picker').hide();
48 f = $.farbtastic('#color-picker', SynchColors);
49 swatches = $('#settings_design_color .swatch');
54 $(this).val($(this).val().toUpperCase());
57 $('#color-picker').show();
58 UpdateFarbtastic(this);
61 UpdateFarbtastic(this);
69 $('#form_settings_design').bind('reset', function(){
70 setTimeout(function(){
71 swatches.each(function(){UpdateColors(this);});
72 $('#color-picker').remove();