1 // $Id: event_node_edit.js,v 1.5 2008/12/25 15:27:07 killes Exp $
2 if (Drupal.jsEnabled) {
3 // Define the selectors of the fields that needs hiding/showing
4 var times = new Array("#edit-event-start-exploded-hour", "#edit-event-start-exploded-minute", "#edit-event-end-exploded-hour", "#edit-event-end-exploded-minute", "#edit-event-start-exploded-ampm", "#edit-event-end-exploded-ampm");
5 var end_date = new Array("#edit-event-end-exploded-wrapper");
6 $(document).ready(function () {
7 // Show/hide those fields after page load
8 event_switch(times, $("#edit-event-has-time").attr("checked") ? 'show' : 'hide');
9 event_switch(end_date, $("#edit-event-has-end-date").attr("checked") ? 'show' : 'hide');
11 // Attaching action for the "click" event
12 $("#edit-event-has-time").click(function () {
13 event_switch(times, 'toggle');
15 $("#edit-event-has-end-date").click(function () {
16 event_switch(end_date, 'toggle');
22 * Helper function needed for showing/hiding fields
24 function event_switch(selectors, effect) {
25 $.each(selectors, function() {
26 var code = '$("' + this + '").' + effect + '();';