Event Calendar
jQuery(document).ready(function($) {
var total_images = 0;
$('#espresso_calendar').fullCalendar({
/** * General Display * http://arshaw.com/fullcalendar/docs/text/ **/ //month, basicWeek, basicDay, agendaWeek, agendaDay defaultView: 'month',
//Defines the buttons and title at the top of the calendar. header: { //Settings: http://arshaw.com/fullcalendar/docs/display/header/ left: 'prev, today', center: 'title', right: 'month,agendaWeek,agendaDay,next' },
/** * Theme Settings * * Once you enable theming with true, you still need to include the CSS file for the theme you want. * For example, if you just downloaded a theme from the jQuery UI Themeroller, you need to put a tag in your page's
. **///jQuery UI Themeroller //Enables/disables use of jQuery UI theming. //Settings: http://arshaw.com/fullcalendar/docs/display/theme/ theme: true, //This option only applies to calendars that have jQuery UI theming enabled with the theme option. /*buttonIcons:{ //Settings: http://arshaw.com/fullcalendar/docs/display/buttonIcons/ prev: 'circle-triangle-w', next: 'circle-triangle-e' },*/
//The day that each week begins. //The value must be a number that represents the day of the week. //Sunday=0, Monday=1, Tuesday=2, etc. firstDay:0, //Settings: http://arshaw.com/fullcalendar/docs/display/firstDay/
//Displays the calendar in right-to-left mode. isRTL: false,
//Whether to include Saturday/Sunday columns in any of the calendar views. weekends: 1,
//Determines the number of weeks displayed in a month view. Also determines each week's height. weekMode:'fixed', //Settings: http://arshaw.com/fullcalendar/docs/display/weekMode/
//Will make the entire calendar (including header) a pixel height. height:650, //Settings: http://arshaw.com/fullcalendar/docs/display/height/
//Will make the calendar's content area a pixel height. //contentHeight: 600, //Settings: http://arshaw.com/fullcalendar/docs/display/contentHeight/
//Determines the width-to-height aspect ratio of the calendar. //aspectRatio: 2, //Settings: http://arshaw.com/fullcalendar/docs/display/aspectRatio/
/** * Agenda Options * http://arshaw.com/fullcalendar/docs/agenda/ * Note: These ptions that apply to the agendaWeek and agendaDay views, and have beft out intentionally. * Please refer to the URL above to add.manage your agenda views. **/
/** * Text/Time Customization Settings * http://arshaw.com/fullcalendar/docs/text/ **/
//Determines the time-text that will be displayed on each event. timeFormat:{ //Settings: http://arshaw.com/fullcalendar/docs/text/timeFormat/ // for agendaWeek and agendaDay agenda: 'h:mm{ - h:mm}', // 5:00 - 6:30
// for all other views '': ''// 7p },
//Changes the colors of the events as seen here: //http://code.google.com/p/fullcalendar/issues/detail?id=6&can=1&q=css&colspec=ID%20Type%20Status%20Milestone%20Summary%20Stars eventRender: function( event, element) {
// set an event category class //alert(event.className); if(event.className){ element.find('a').addClass(event.className); } //This displays the title of the event when hovering //element.attr('title', event.title + " - Event Times: " + event.start + event.end);
// if the user selects show in thickbox we add this element //if(event.in_thickbox_url){ //element.after($('
')); //}
$('a.fc-event').addClass('themeroller ui-state-focus'); $('a.fc-event div').removeClass('fc-event-skin'); $('.fc-view').addClass('ui-widget-content'); $('.expired').removeClass('ui-state-focus').addClass('ui-state-default'); var month_day = event.month + '-' + event.day; element.attr( 'rel', month_day ).attr( 'id', 'EVT_ID-'+event.id );
if(event.event_img_thumb){
total_images = parseInt( total_images ) + 1;
element.addClass('event-has-thumb');
element.find('.fc-event-title').after($(''));
}
if( event.expired ) { element.addClass('expired'); }
if ( event.startTime != '' && event.startTime != undefined ) { event.startTime = '' + event.startTime + ''; } else { event.startTime = false; }
if ( event.startTime != false && event.endTime != '' && event.endTime != undefined ) { event.endTime = '' + event.endTime + ''; } else { event.endTime = ''; }
if ( event.startTime ) { element.find('.fc-event-title').after($('
' + event.startTime + ' - ' + event.endTime + '
')); }
element.qtip({ content: { text: event.description, title: { text: 'Description', }
}, position: { at: 'top right', adjust: { x: 0, y: 30 }, },
style: {//Additional informatio: http://craigsworks.com/projects/qtip2/docs/style/ tip: { corner: 'left top' }, classes: 'ui-tooltip-rounded ui-tooltip-shadow', //Themeroller styles /* * The important part: style.widget property
* This tells qTip to apply the ui-widget classes to * the main, titlebar and content elements of the qTip. * Otherwise they won't be applied and ThemeRoller styles * won't effect this particular tooltip. */ widget: true } });
//These are examples of custom parameters that can be passed /*if (event.eventType == 'meeting') { element.addClass('meeting'); //alert(event.myType ); }*/
//This example basically applies different classes to the event /*switch (event.myType){ case 'meeting' : element.find('.n, .w, .c, .e, .s').css('background-color', '#00cc33'); break; case 'project' : element.find('.n, .w, .c, .e, .s').css('background-color', 'red'); break; default : break; }*/
},
//Determines the text that will be displayed on the calendar's column headings. columnFormat:{ //Settings: http://arshaw.com/fullcalendar/docs/text/columnFormat/ month: 'ddd', week: 'ddd M/d', day: 'dddd M/d' /*month: 'ddd',// Mon week: 'ddd M/d', // Mon 9/7 day: 'dddd M/d'// Monday 9/7*/ },
//For date formatting options, please refer to: http://arshaw.com/fullcalendar/docs/utilities/formatDate/ titleFormat:{ //Settings: http://arshaw.com/fullcalendar/docs/text/columnFormat/ month: 'MMMM yyyy', week: 'MMM dS[ yyyy] - {[ MMM] dS yyyy}', day: 'dddd, MMM dS, yyyy' /*month: 'MMMM yyyy', // September 2009 week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}", // Sep 7 - 13 2009 day: 'dddd, MMM d, yyyy'// Tuesday, Sep 8, 2009*/ },
//Text that will be displayed on buttons of the header. buttonText: { //Settings: http://arshaw.com/fullcalendar/docs/text/buttonText/ prev: ' ◄ ',next: ' ► ',prevYear: ' « ',nextYear: ' » ',today:'today',month:'month',week: 'week',day:'day' /*prev: ' ◄ ',// left triangle next: ' ► ',// right triangle prevYear: ' << ', // << nextYear: ' >> ', // >> today:'today', month:'month', week: 'week', day:'day'*/ },
//Full names of months. monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'/*'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'*/],
//Abbreviated names of months. monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'/*'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'*/],
//Full names of days-of-week. dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'/*'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'*/],
//Abbreviated names of days-of-week. dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'/*'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'*/],
//Load the events into json srrsy events: [{"url":"http:\/\/www.symmetryforhealth.com\/?page_id=1727®event_action=register&event_id=58","id":"58","title":"Symmetry Lunchtime Seminar","description":"
What better way to break up your day than with a free lunch and new information that could help your well-being and\/or your business!\u00a0 Symmetry is a physics-based program that specializes in Postural Alignment Therapy, a patented program that focuses on musculo-skeletal realignment through corrective exercise.\u00a0 If you are a person in chronic pain that has not experienced long-term relief, or if you are a practitioner looking to add a new component of healing to your expertise, then Symmetry is for you!\u00a0 Symmetry is absolutely complementary to your practice by giving your patients the tools to help hold\u00a0 treatments longer, thus resulting in faster healing and more referrals! Please join us in learning how you can increase your end- results both from a healing and a wealth-gaining perspective so that you can maximize your success as both a practitioner and business entrepreneur.<\/p>\n","start":"2013-06-21T13:00:00-07:00","end":"2013-06-21T14:00:00-07:00","day":"21","month":"6","expired":"","today":"2013-06-19","this_month":"06","startTime":"1:00 pm","endTime":"2:00 pm","event_img_thumb":"","className":"","eventType":"","allDay":false},{"url":"http:\/\/www.symmetryforhealth.com\/?page_id=1727®event_action=register&event_id=63","id":"63","title":"Symmetry Lunchtime Seminar","description":"
What better way to break up your day than with a free lunch and new information that could help your well-being and\/or your business!\u00a0 Symmetry is a physics-based program that specializes in Postural Alignment Therapy, a patented program that focuses on musculo-skeletal realignment through corrective exercise.\u00a0 If you are a person in chronic pain that has not experienced long-term relief, or if you are a practitioner looking to add a new component of healing to your expertise, then Symmetry is for you!\u00a0 Symmetry is absolutely complementary to your practice by giving your patients the tools to help hold\u00a0 treatments longer, thus resulting in faster healing and more referrals! Please join us in learning how you can increase your end- results both from a healing and a wealth-gaining perspective so that you can maximize your success as both a practitioner and business entrepreneur.<\/p>\n","start":"2013-06-27T00:45:00-07:00","end":"2013-06-27T14:00:00-07:00","day":"27","month":"6","expired":"","today":"2013-06-19","this_month":"06","startTime":"12:45 am","endTime":"2:00 pm","event_img_thumb":"","className":"","eventType":"","allDay":false,"color":"","textColor":""},{"url":"http:\/\/www.symmetryforhealth.com\/?page_id=1727®event_action=register&event_id=43","id":"43","title":"Symmetry Core Level 1- Northern California","description":"
\u00a0Symmetry Core Level 1: Introduction to Postural Alignment Therapy<\/h3>\n
\u00b7 Two day seminar (1 weekend)<\/p>\n
\u00b7 The Symmetry philosophy and postural evaluation methodology (includes training manual)<\/p>\n
\u00b7 Start-up kit (includes the patented Postural Assessment Tool and accessories)<\/p>\n
\u00b7 CEU Credits (NCBTMB-16 CEUs, The California Acupuncture Board-16 CEU\u2019s)<\/p>\n
\u00b7 Access to patented online software system<\/p>\n
Price $295.00 without Postural Starter Kit<\/p>\n
Price $495.00 with the Postural Starter Kit ($100 Savings)<\/p>\n
\u00a0<\/p>\n","start":"2013-09-21T09:00:00-07:00","end":"2013-09-22T18:00:00-07:00","day":"22","month":"9","expired":"","today":"2013-06-19","this_month":"06","startTime":"9:00 am","endTime":"6:00 pm","event_img_thumb":"","className":"","eventType":"","allDay":false,"color":"","textColor":""},{"url":"http:\/\/www.symmetryforhealth.com\/?page_id=1727®event_action=register&event_id=40","id":"40","title":"Symmetry Core Level 1- Southern California","description":"
\u00a0Symmetry Core Level 1: Introduction to Postural Alignment Therapy<\/h3>\n
\u00b7 Two day seminar (1 weekend)<\/p>\n
\u00b7 The Symmetry philosophy and postural evaluation methodology (includes training manual)<\/p>\n
\u00b7 Start-up kit (includes the patented Postural Assessment Tool and accessories)<\/p>\n
\u00b7 CEU Credits (NCBTMB-16 CEUs, The California Acupuncture Board-16 CEU\u2019s)<\/p>\n
\u00b7 Access to patented online software system<\/p>\n
Price $495.00 with the Postural Starter Kit ($100 savings);\u00a0 $295 Without\u00a0<\/p>\n
\u00a0<\/p>\n
\u00a0<\/p>\n
\u00a0<\/p>\n","start":"2013-09-28T09:00:00-07:00","end":"2013-09-29T18:00:00-07:00","day":"29","month":"9","expired":"","today":"2013-06-19","this_month":"06","startTime":"9:00 am","endTime":"6:00 pm","event_img_thumb":"","className":"","eventType":"","allDay":false,"color":"","textColor":""}],
viewDisplay: function(view) { $('.ui-state-active').each( function() { $(this).removeClass('ui-state-active'); }); $('.fc-today').addClass('ui-state-active').removeClass('ui-state-highlight'); },
// if an event in the array has already happened, it is expired and we'll give it an 'expired' class loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); }
});
var imgTimeout = total_images * 50;
setTimeout( function() {
// establish vars we need to resize calendar cells properly var day = 0; var month = 0; var thisMonth = 0; var thisYear = 0; var prevMonth = 0; var nextMonth = 0; var newTop = 0;
var months = new Object(); var monthNames = new Object(); monthNames= ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; for ( i=0; i<12; i++ ) { months[ monthNames[i] ] = i+1; }
var monthYear = $('.fc-header-title h2').html(); var monthYearArray = monthYear.split(' '); thisMonth = months[ monthYearArray[0] ]; thisYear = monthYearArray[1]; prevMonth = thisMonth - 1; nextMonth = thisMonth +1; // console.log( 'prevMonth = ' + prevMonth + '\n' + 'nextMonth = ' + nextMonth );
$('.fc-view-month .fc-widget-content').each(function(index) { setMonth = thisMonth; if ( $(this).closest('tr').hasClass('fc-first') && $(this).hasClass('fc-other-month') ){ setMonth = prevMonth; } else if ( $(this).hasClass('fc-other-month') ){ setMonth = nextMonth; } setDay =$(this).find('.fc-day-number').html(); setID = 'md-' + setMonth + '-' + setDay; //console.log( 'setID = ' + setID ); $(this).find('.fc-day-content > div').attr( 'id', setID ); });
$('.fc-event').each( function(index){ // determine what month and day this event is on monthDay = $(this).attr( 'rel' ); //console.log( 'monthDay: ' + monthDay ); // find day container in calendar dayCnt = $('#md-'+monthDay); dayCntHTML = dayCnt.html();
if ( dayCntHTML != null && dayCntHTML != undefined ) { if ( dayCntHTML == ' ' ) { dayCntHTML = ''; dayCnt.html( dayCntHTML ); dayCnt.css({ 'height' : 0 }); }
// grab offset for dayCnt dayCntPos = dayCnt.position(); //console.log( 'dayCntPos.top = ' + dayCntPos.top + '\n' + 'dayCntPos.left = ' + dayCntPos.left ); dayCntHgt = dayCnt.css( 'height' ); if ( dayCntHgt == undefined ){ dayCntHgt = '0px'; } dayCntHgt = dayCntHgt.replace( 'px', '' ); dayCntHgt = parseInt( dayCntHgt ); newTop = dayCntPos.top + dayCntHgt; //console.log( 'newTop = ' + newTop + ' = dayCntPos.top ( ' + dayCntPos.top + ' ) + dayCntHgt ( ' + dayCntHgt + ' )' ); $(this).css({ 'top' : newTop }); linkHeight = parseInt( $(this).find('.fc-event-inner').outerHeight() ); //console.log( 'linkHeight = ' + linkHeight ); newHeight = dayCntHgt + linkHeight + 3; dayCnt.height( newHeight ).css({ 'height' : newHeight + 'px' }); //console.log( 'newHeight = ' + newHeight ); var parentHeight = dayCnt.parents('tr').outerHeight(); //console.log( 'parentHeight = ' + parentHeight ); //dayCnt.parents('tr').css({ 'background' : 'pink' }); if( parentHeight < newHeight ) { newHeight = newHeight + 30; dayCnt.parents('tr').height( newHeight ).css({ 'height' : newHeight + 'px' }); }
} });
}, imgTimeout );
});







