Small code simplification

This commit is contained in:
Aleksander Machniak 2019-05-27 15:12:14 +02:00
parent d42ca55bfc
commit 915035e9ba

View file

@ -3609,25 +3609,19 @@ function rcube_calendar_ui(settings)
}
var id = this.value;
if (me.calendars[id]) { // add or remove event source on click
var action;
if (this.checked) {
action = 'addEventSource';
me.calendars[id].active = true;
}
else {
action = 'removeEventSource';
me.calendars[id].active = false;
}
// add or remove event source on click
if (me.calendars[id]) {
// adjust checked state of original list item
if (calendars_list.is_search()) {
calendars_list.container.find('input[value="'+id+'"]').prop('checked', this.checked);
}
me.calendars[id].active = this.checked;
// add/remove event source
fc.fullCalendar(action, me.calendars[id]);
rcmail.http_post('calendar', { action:'subscribe', c:{ id:id, active:me.calendars[id].active?1:0 } });
fc.fullCalendar(this.checked ? 'addEventSource' : 'removeEventSource', me.calendars[id]);
rcmail.http_post('calendar', {action: 'subscribe', c: {id: id, active: this.checked ? 1 : 0}});
}
})
.on('keypress', 'input[type=checkbox]', function(e) {