| 1 |
jQuery( document ).ready( function() { |
| 2 |
jQuery( "select#timed_content_rule_frequency" ).change( function() { |
| 3 |
jQuery( "select#timed_content_rule_frequency option:selected" ).each( function() { |
| 4 |
if ( jQuery( this ).val() == '0' ) |
| 5 |
jQuery( "#timed_content_rule_hourly_num_of_hours_div" ).css( "display", "block" ); |
| 6 |
else |
| 7 |
jQuery( "#timed_content_rule_hourly_num_of_hours_div" ).css( "display", "none" ); |
| 8 |
if ( jQuery( this ).val() == '1' ) |
| 9 |
jQuery( "#timed_content_rule_daily_num_of_days_div" ).css( "display", "block" ); |
| 10 |
else |
| 11 |
jQuery( "#timed_content_rule_daily_num_of_days_div" ).css( "display", "none" ); |
| 12 |
if ( jQuery( this ).val() == '2' ) { |
| 13 |
jQuery( "#timed_content_rule_weekly_num_of_weeks_div" ).css( "display", "block" ); |
| 14 |
jQuery( "#timed_content_rule_weekly_days_of_week_to_repeat_div" ).css( "display", "block" ); |
| 15 |
} else { |
| 16 |
jQuery( "#timed_content_rule_weekly_num_of_weeks_div" ).css( "display", "none" ); |
| 17 |
jQuery( "#timed_content_rule_weekly_days_of_week_to_repeat_div" ).css( "display", "none" ); |
| 18 |
} |
| 19 |
if ( jQuery( this ).val() == '3' ) { |
| 20 |
jQuery( "#timed_content_rule_monthly_num_of_months_div" ).css( "display", "block" ); |
| 21 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_div" ).css( "display", "block" ); |
| 22 |
// Check the 'timed_content_rule_monthly_nth_weekday_of_month' checkbox when first displayed... |
| 23 |
if ( jQuery( "#timed_content_rule_monthly_nth_weekday_of_month" ).prop( "checked" ) ) { |
| 24 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_nth_div" ).css( "display", "block" ); |
| 25 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_weekday_div" ).css( "display", "block" ); |
| 26 |
} else { |
| 27 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_nth_div" ).css( "display", "none" ); |
| 28 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_weekday_div" ).css( "display", "none" ); |
| 29 |
} |
| 30 |
// ...then watch it for changes. |
| 31 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month" ).change( function() { |
| 32 |
if ( jQuery( this ).prop( "checked" ) ) { |
| 33 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_nth_div" ).css( "display", "block" ); |
| 34 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_weekday_div" ).css( "display", "block" ); |
| 35 |
} else { |
| 36 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_nth_div" ).css( "display", "none" ); |
| 37 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_weekday_div" ).css( "display", "none" ); |
| 38 |
} |
| 39 |
}); |
| 40 |
} else { |
| 41 |
jQuery( "#timed_content_rule_monthly_num_of_months_div" ).css( "display", "none" ); |
| 42 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_div" ).css( "display", "none" ); |
| 43 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_nth_div" ).css( "display", "none" ); |
| 44 |
jQuery( "#timed_content_rule_monthly_nth_weekday_of_month_weekday_div" ).css( "display", "none" ); |
| 45 |
} |
| 46 |
if ( jQuery( this ).val() == '4' ) |
| 47 |
jQuery( "#timed_content_rule_yearly_num_of_years_div" ).css( "display", "block" ); |
| 48 |
else |
| 49 |
jQuery( "#timed_content_rule_yearly_num_of_years_div" ).css( "display", "none" ); |
| 50 |
}) |
| 51 |
}).trigger( "change" ); |
| 52 |
jQuery( "input[name=timed_content_rule_recurrence_duration]" ).change( function() { |
| 53 |
if ( jQuery( "input[name=timed_content_rule_recurrence_duration]:checked" ).val() == "recurrence_duration_end_date" ) { |
| 54 |
jQuery( "#timed_content_rule_recurrence_duration_end_date_div" ).css( "display", "block" ); |
| 55 |
jQuery( "#timed_content_rule_recurrence_duration_num_repeat_div" ).css( "display", "none" ); |
| 56 |
} else { |
| 57 |
jQuery( "#timed_content_rule_recurrence_duration_end_date_div" ).css( "display", "none" ); |
| 58 |
jQuery( "#timed_content_rule_recurrence_duration_num_repeat_div" ).css( "display", "block" ); |
| 59 |
} |
| 60 |
}).trigger( "change" ); |
| 61 |
}); |
| 62 |
|