var downloadUrl;var dates;var allDay;var start;var title;var description;var eventLocation;var rrule;$(".button--addCalendarEvent").click(function(){downloadUrl=$(this).data("downloadurl");dates=$(this).data("start-t")+"/"+$(this).data("end-t");allDay=$(this).data("allday");start=$(this).data("start");title=$(this).data("title");description=$(this).data("description");eventLocation=$(this).data("location");rrule=$(this).data("rrule");$('#addToCalendarModal').modal('show');});$(".modal-content").click(function(){$('#addToCalendarModal').modal('hide');});$(".modal-dialog").not(".modal-content").click(function(){$('#addToCalendarModal').modal('hide');});$("#cal_share_apple").click(function(){downloadICS(downloadUrl);});$("#cal_share_outlook").click(function(){downloadICS(downloadUrl);});$("#cal_share_google").click(function(){if(allDay){var startDate=new Date(Date.parse(start));var endDate=addDays(startDate,1);dates=getFormattedDate(startDate)+"/"+getFormattedDate(endDate);} var url="https://calendar.google.com/calendar/u/0/r/eventedit?text="+ title+"&dates="+dates+"&allday="+allDay+"&ctz=America/¹û¶³´«Ãº"+"&details="+description+"&location="+eventLocation;if(rrule){url+="&recur=RRULE:"+rrule;} url+="&sf=true&output=xml";window.open(url,'_blank');});function downloadICS(url){window.location=url;};;