/[drupal]/contributions/modules/tablemanager/modules/css/misc/tablemanager_css.js
ViewVC logotype

Diff of /contributions/modules/tablemanager/modules/css/misc/tablemanager_css.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Sun Apr 20 17:39:30 2008 UTC revision 1.2, Wed Apr 23 08:25:16 2008 UTC
# Line 20  if (Drupal.jsEnabled) { Line 20  if (Drupal.jsEnabled) {
20      $("input.color_textfield").each(function () {      $("input.color_textfield").each(function () {
21        farb.linkTo(this);        farb.linkTo(this);
22        $(this).click(function () {        $(this).click(function () {
23          farb.linkTo(this);          var field = this.name;
24            farb.linkTo(function () {
25              var name = tablemanager_convert(field);
26              $("input[name='" + field + "']").css('backgroundColor', farb.color);
27              $("input[name='" + field + "']").attr('value', farb.color);
28              $(name[1]).css(tablemanager_normal_field(name[2]), farb.color);
29            });
30        }).filter(':first').click();        }).filter(':first').click();
31      });      });
32    
# Line 42  if (Drupal.jsEnabled) { Line 48  if (Drupal.jsEnabled) {
48        }        }
49      });      });
50    
51      // tablemanager preview table alterations when options are clicked      // tablemanager preview table alterations when options are clicked/ changed
52      $("input[type=radio]").click(function () {      $("input[type=radio]").click(function () {
53        var name = tablemanager_convert(this.name);        var name = tablemanager_convert(this.name);
54        if (this.value == 'custom') {        if (this.value == 'custom') {
# Line 53  if (Drupal.jsEnabled) { Line 59  if (Drupal.jsEnabled) {
59        }        }
60      });      });
61    
62      // converts given name into an array containing the correct object selector and table style      // catch 'custom' textfield changes
63        $("input[type=text]").keyup(function() {
64          $("input[name='" + tablemanager_normal_field(this.name) + "']").click();
65        });
66    
67        /**
68         *  converts given name into an array containing the correct object selector and table style
69         */
70      function tablemanager_convert(name) {      function tablemanager_convert(name) {
71        name = name.split(/(?:tabs)(?:\[)(.+)(?:\]\[)(.+)(?:\])/g);        name = name.split(/(?:tabs)(?:\[)(.+)(?:\]\[)(.+)(?:\])/g);
72        if (name[1] == 'table') {        if (name[1] == 'table') {
# Line 65  if (Drupal.jsEnabled) { Line 78  if (Drupal.jsEnabled) {
78        return name;        return name;
79      }      }
80    
81      // returns the custom colour field for an option which uses farbtastic      /**
82         *  Returns the custom colour field for an option which uses farbtastic
83         */
84      function tablemanager_custom_field(field) {      function tablemanager_custom_field(field) {
85        return field.replace(/\]$/, '-custom]');        return field.replace(/\]$/, '-custom]');
86      }      }
87    
88        /**
89         *  Returns the 'normal' field when passed a custom field id
90         */
91        function tablemanager_normal_field(field) {
92          return field.replace(/\-custom/, '');
93        }
94    
95    });    });
96  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2