/[drupal]/contributions/modules/rsvp/rsvp_edit.js
ViewVC logotype

Diff of /contributions/modules/rsvp/rsvp_edit.js

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

revision 1.1, Thu Nov 5 22:36:47 2009 UTC revision 1.1.2.1, Thu Nov 5 22:36:47 2009 UTC
# Line 0  Line 1 
1    // $Id$
2    if (Drupal.jsEnabled) {
3      // Define the selectors of the fields that needs hiding/showing
4      var reply_start_date = new Array("#edit-reply-startdate-wrapper");
5      var reply_end_date = new Array("#edit-reply-enddate-wrapper");
6      $(document).ready(function () {
7    
8        // Show/hide those fields after page load
9        rsvp_switch(reply_start_date, $("#edit-reply-startdate-option").attr("checked") ? 'show' : 'hide');
10        rsvp_switch(reply_end_date, $("#edit-reply-enddate-option").attr("checked") ? 'show' : 'hide');
11    
12        // Attaching action for the "click" event
13        $("#edit-reply-startdate-option").click(function () {
14          rsvp_switch(reply_start_date, 'toggle');
15        });
16        $("#edit-reply-enddate-option").click(function () {
17          rsvp_switch(reply_end_date, 'toggle');
18        });
19      });
20    }
21    
22    /**
23     * Helper function needed for showing/hiding fields
24     */
25    function rsvp_switch(selectors, effect) {
26      $.each(selectors, function() {
27        var code = '$("' + this + '").' + effect + '();';
28        eval(code);
29      });
30    }

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

  ViewVC Help
Powered by ViewVC 1.1.2