diff --git a/app/assets/javascripts/calendar_widget.js b/app/assets/javascripts/calendar_widget.js index 99c2c0c..9419fb2 100644 --- a/app/assets/javascripts/calendar_widget.js +++ b/app/assets/javascripts/calendar_widget.js @@ -343,7 +343,7 @@ } events[dt].push(eve) td.addClass("w-calendar-event"); - if(events[dt].length==1){ + if(events[dt] && events[dt].length==1){ td.click(function(){ toggle_event(this,'show') }) @@ -360,7 +360,7 @@ events[dt]=[] } events[dt].push(eve) - if(events[dt].length==1){ + if(events[dt] && events[dt].length==1){ td.click(function(){ toggle_event(this,'show') }) diff --git a/app/assets/javascripts/calendar_widget2.js b/app/assets/javascripts/calendar_widget2.js index b7ae060..4de987b 100644 --- a/app/assets/javascripts/calendar_widget2.js +++ b/app/assets/javascripts/calendar_widget2.js @@ -193,7 +193,7 @@ if (active_flag){ event_temp.addClass('active') } - if (events[date].length>1){ + if (events[date] && events[date].length>1){ var switch_button_wraper = $("
") @@ -482,7 +482,7 @@ } events[dt].push(eve) td.addClass("w-calendar-event"); - if(events[dt].length==1){ + if(events[dt] && events[dt].length==1){ td.click(function(){ toggle_event(this,'show') }) @@ -499,7 +499,7 @@ events[dt]=[] } events[dt].push(eve) - if(events[dt].length==1){ + if(events[dt] && events[dt].length==1){ td.click(function(){ toggle_event(this,'show') })