diff --git a/calendar/js/app.js b/calendar/js/app.js index 733171cdf3..b860a17c5e 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -3176,7 +3176,7 @@ app.classes.calendar = AppJS.extend( } }); - // Dynamic resize to fill sidebox + // Dynamic resize of sidebox calendar to fill sidebox var preferred_width = $j('#calendar-sidebox_date .ui-datepicker-inline').outerWidth(); var font_ratio = parseFloat($j(this.sidebox_et2.getDOMNode()).css('font-size')) / parseFloat($j('#calendar-sidebox_date .ui-datepicker-inline').css('font-size')); @@ -3187,15 +3187,17 @@ app.classes.calendar = AppJS.extend( .css('font-size',(percent*100)+'%'); // Position today var buttons = $j('#calendar-sidebox_date .ui-datepicker-header a'); - var left = Infinity; var total = 0; buttons.each(function() { total += $j(this).position().left; }); // Why doesn't this work properly? - var today = $j('#calendar-sidebox_header_today') - .position({my: 'center left', at: 'center right',of: buttons}); - today.css('left',(total/buttons.length)/*+(today.width()/2)*/) + var today = $j('#calendar-sidebox_header_today'); + if(today.length) + { + today.position({my: 'center left', at: 'center right',of: buttons}); + today.css('left',(total/buttons.length)); + } }).trigger('resize'); } diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index 331fa306f0..cd59a53fa2 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -134,7 +134,10 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes destroy: function() { // Stop listening to tab changes - $j(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id); + if(framework.getApplicationByName('calendar').tab) + { + $j(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id); + } this._super.apply(this, arguments); @@ -163,13 +166,19 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes this._super.apply(this, arguments); // Listen to tab show to make sure we scroll to the day start, not top - $j(framework.getApplicationByName('calendar').tab.contentDiv) - .on('show.' + this.id, jQuery.proxy( - function() - { - this.scrolling.scrollTop(this._top_time); - },this) - ); + if(framework.getApplicationByName('calendar').tab) + { + $j(framework.getApplicationByName('calendar').tab.contentDiv) + .on('show.' + this.id, jQuery.proxy( + function() + { + if(this.scrolling) + { + this.scrolling.scrollTop(this._top_time); + } + },this) + ); + } // Need to get the correct internal sizing this.resize();