Base progress
This commit is contained in:
+169
-77
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* FullCalendar v2.2.7 Stylesheet
|
||||
* Docs & License: http://arshaw.com/fullcalendar/
|
||||
* (c) 2013 Adam Shaw
|
||||
* FullCalendar v2.4.0 Stylesheet
|
||||
* Docs & License: http://fullcalendar.io/
|
||||
* (c) 2015 Adam Shaw
|
||||
*/
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ body .fc { /* extra precedence to overcome jqui */
|
||||
|
||||
.fc-unthemed th,
|
||||
.fc-unthemed td,
|
||||
.fc-unthemed hr,
|
||||
.fc-unthemed thead,
|
||||
.fc-unthemed tbody,
|
||||
.fc-unthemed .fc-divider,
|
||||
.fc-unthemed .fc-row,
|
||||
.fc-unthemed .fc-popover {
|
||||
border-color: #ddd;
|
||||
@@ -36,7 +36,7 @@ body .fc { /* extra precedence to overcome jqui */
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.fc-unthemed hr,
|
||||
.fc-unthemed .fc-divider,
|
||||
.fc-unthemed .fc-popover .fc-header {
|
||||
background: #eee;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ body .fc { /* extra precedence to overcome jqui */
|
||||
|
||||
.fc-nonbusiness { /* default look for non-business-hours areas */
|
||||
/* will inherit .fc-bgevent's styles */
|
||||
background: #ccc;
|
||||
background: #d7d7d7;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,32 +72,88 @@ body .fc { /* extra precedence to overcome jqui */
|
||||
|
||||
.fc-icon {
|
||||
display: inline-block;
|
||||
font-size: 2em;
|
||||
line-height: .5em;
|
||||
height: .5em; /* will make the total height 1em */
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
line-height: 1em;
|
||||
font-size: 1em;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
|
||||
/* don't allow browser text-selection */
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Acceptable font-family overrides for individual icons:
|
||||
"Arial", sans-serif
|
||||
"Times New Roman", serif
|
||||
|
||||
NOTE: use percentage font sizes or else old IE chokes
|
||||
*/
|
||||
|
||||
.fc-icon:after {
|
||||
position: relative;
|
||||
margin: 0 -1em; /* ensures character will be centered, regardless of width */
|
||||
}
|
||||
|
||||
.fc-icon-left-single-arrow:after {
|
||||
content: "\02039";
|
||||
font-weight: bold;
|
||||
font-size: 200%;
|
||||
top: -7%;
|
||||
left: 3%;
|
||||
}
|
||||
|
||||
.fc-icon-right-single-arrow:after {
|
||||
content: "\0203A";
|
||||
font-weight: bold;
|
||||
font-size: 200%;
|
||||
top: -7%;
|
||||
left: -3%;
|
||||
}
|
||||
|
||||
.fc-icon-left-double-arrow:after {
|
||||
content: "\000AB";
|
||||
font-size: 160%;
|
||||
top: -7%;
|
||||
}
|
||||
|
||||
.fc-icon-right-double-arrow:after {
|
||||
content: "\000BB";
|
||||
font-size: 160%;
|
||||
top: -7%;
|
||||
}
|
||||
|
||||
.fc-icon-left-triangle:after {
|
||||
content: "\25C4";
|
||||
font-size: 125%;
|
||||
top: 3%;
|
||||
left: -2%;
|
||||
}
|
||||
|
||||
.fc-icon-right-triangle:after {
|
||||
content: "\25BA";
|
||||
font-size: 125%;
|
||||
top: 3%;
|
||||
left: 2%;
|
||||
}
|
||||
|
||||
.fc-icon-down-triangle:after {
|
||||
content: "\25BC";
|
||||
font-size: 125%;
|
||||
top: 2%;
|
||||
}
|
||||
|
||||
.fc-icon-x:after {
|
||||
content: "\000D7";
|
||||
font-size: 200%;
|
||||
top: 6%;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +198,9 @@ body .fc { /* extra precedence to overcome jqui */
|
||||
|
||||
.fc button .fc-icon { /* non-theme */
|
||||
position: relative;
|
||||
top: .05em; /* seems to be a good adjustment across browsers */
|
||||
margin: 0 .1em;
|
||||
top: -0.05em; /* seems to be a good adjustment across browsers */
|
||||
margin: 0 .2em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -230,7 +287,7 @@ previous button's border...
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
.fc-popover .fc-header {
|
||||
.fc-popover .fc-header { /* TODO: be more consistent with fc-head/fc-body */
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
@@ -260,8 +317,8 @@ previous button's border...
|
||||
}
|
||||
|
||||
.fc-unthemed .fc-popover .fc-header .fc-close {
|
||||
font-size: 25px;
|
||||
margin-top: 4px;
|
||||
font-size: .9em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* jqui themed */
|
||||
@@ -274,11 +331,15 @@ previous button's border...
|
||||
/* Misc Reusable Components
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc hr {
|
||||
.fc-divider {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
hr.fc-divider {
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0 0 2px; /* height is unreliable across browsers, so use padding */
|
||||
border-style: solid;
|
||||
border-width: 1px 0;
|
||||
}
|
||||
|
||||
@@ -474,6 +535,79 @@ temporary rendered events).
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.fc-event .fc-bg { /* the generic .fc-bg already does position */
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
opacity: .25;
|
||||
filter: alpha(opacity=25); /* for IE */
|
||||
}
|
||||
|
||||
.fc-event .fc-content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.fc-event .fc-resizer {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
|
||||
/* Horizontal Events
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* events that are continuing to/from another week. kill rounded corners and butt up against edge */
|
||||
|
||||
.fc-ltr .fc-h-event.fc-not-start,
|
||||
.fc-rtl .fc-h-event.fc-not-end {
|
||||
margin-left: 0;
|
||||
border-left-width: 0;
|
||||
padding-left: 1px; /* replace the border with padding */
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.fc-ltr .fc-h-event.fc-not-end,
|
||||
.fc-rtl .fc-h-event.fc-not-start {
|
||||
margin-right: 0;
|
||||
border-right-width: 0;
|
||||
padding-right: 1px; /* replace the border with padding */
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
/* resizer */
|
||||
|
||||
.fc-h-event .fc-resizer { /* positioned it to overcome the event's borders */
|
||||
top: -1px;
|
||||
bottom: -1px;
|
||||
left: -1px;
|
||||
right: -1px;
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
/* left resizer */
|
||||
.fc-ltr .fc-h-event .fc-start-resizer,
|
||||
.fc-ltr .fc-h-event .fc-start-resizer:before,
|
||||
.fc-ltr .fc-h-event .fc-start-resizer:after,
|
||||
.fc-rtl .fc-h-event .fc-end-resizer,
|
||||
.fc-rtl .fc-h-event .fc-end-resizer:before,
|
||||
.fc-rtl .fc-h-event .fc-end-resizer:after {
|
||||
right: auto; /* ignore the right and only use the left */
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
/* right resizer */
|
||||
.fc-ltr .fc-h-event .fc-end-resizer,
|
||||
.fc-ltr .fc-h-event .fc-end-resizer:before,
|
||||
.fc-ltr .fc-h-event .fc-end-resizer:after,
|
||||
.fc-rtl .fc-h-event .fc-start-resizer,
|
||||
.fc-rtl .fc-h-event .fc-start-resizer:before,
|
||||
.fc-rtl .fc-h-event .fc-start-resizer:after {
|
||||
left: auto; /* ignore the left and only use the right */
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
|
||||
/* DayGrid events
|
||||
----------------------------------------------------------------------------------------------------
|
||||
@@ -486,27 +620,8 @@ be a descendant of the grid when it is being dragged.
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
/* events that are continuing to/from another week. kill rounded corners and butt up against edge */
|
||||
|
||||
.fc-ltr .fc-day-grid-event.fc-not-start,
|
||||
.fc-rtl .fc-day-grid-event.fc-not-end {
|
||||
margin-left: 0;
|
||||
border-left-width: 0;
|
||||
padding-left: 1px; /* replace the border with padding */
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.fc-ltr .fc-day-grid-event.fc-not-end,
|
||||
.fc-rtl .fc-day-grid-event.fc-not-start {
|
||||
margin-right: 0;
|
||||
border-right-width: 0;
|
||||
padding-right: 1px; /* replace the border with padding */
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.fc-day-grid-event > .fc-content { /* force events to be one-line tall */
|
||||
.fc-day-grid-event .fc-content { /* force events to be one-line tall */
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -515,23 +630,10 @@ be a descendant of the grid when it is being dragged.
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* resize handle (outside of fc-content, so can go outside of bounds) */
|
||||
|
||||
.fc-day-grid-event .fc-resizer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
.fc-ltr .fc-day-grid-event .fc-resizer {
|
||||
right: -3px;
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.fc-rtl .fc-day-grid-event .fc-resizer {
|
||||
.fc-day-grid-event .fc-resizer { /* enlarge the default hit area */
|
||||
left: -3px;
|
||||
cursor: w-resize;
|
||||
right: -3px;
|
||||
width: 7px;
|
||||
}
|
||||
|
||||
|
||||
@@ -663,7 +765,7 @@ a.fc-more:hover {
|
||||
padding-bottom: 1em; /* ensure a space at bottom of cell for user selecting/clicking */
|
||||
}
|
||||
|
||||
.fc-basic-view tbody .fc-row {
|
||||
.fc-basic-view .fc-body .fc-row {
|
||||
min-height: 4em; /* ensure that all rows are at least this tall */
|
||||
}
|
||||
|
||||
@@ -814,16 +916,16 @@ a.fc-more:hover {
|
||||
/* TimeGrid Slats (lines that run horizontally)
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-slats td {
|
||||
.fc-time-grid .fc-slats td {
|
||||
height: 1.5em;
|
||||
border-bottom: 0; /* each cell is responsible for its top border */
|
||||
}
|
||||
|
||||
.fc-slats .fc-minor td {
|
||||
.fc-time-grid .fc-slats .fc-minor td {
|
||||
border-top-style: dotted;
|
||||
}
|
||||
|
||||
.fc-slats .ui-widget-content { /* for jqui theme */
|
||||
.fc-time-grid .fc-slats .ui-widget-content { /* for jqui theme */
|
||||
background: none; /* see through to fc-bg */
|
||||
}
|
||||
|
||||
@@ -872,13 +974,10 @@ a.fc-more:hover {
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid Event Styling
|
||||
----------------------------------------------------------------------------------------------------
|
||||
We use the full "fc-time-grid-event" class instead of using descendants because the event won't
|
||||
be a descendant of the grid when it is being dragged.
|
||||
*/
|
||||
/* Generic Vertical Event
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-time-grid-event.fc-not-start { /* events that are continuing from another day */
|
||||
.fc-v-event.fc-not-start { /* events that are continuing from another day */
|
||||
/* replace space made by the top border with padding */
|
||||
border-top-width: 0;
|
||||
padding-top: 1px;
|
||||
@@ -888,7 +987,7 @@ be a descendant of the grid when it is being dragged.
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.fc-time-grid-event.fc-not-end {
|
||||
.fc-v-event.fc-not-end {
|
||||
/* replace space made by the top border with padding */
|
||||
border-bottom-width: 0;
|
||||
padding-bottom: 1px;
|
||||
@@ -898,15 +997,17 @@ be a descendant of the grid when it is being dragged.
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid Event Styling
|
||||
----------------------------------------------------------------------------------------------------
|
||||
We use the full "fc-time-grid-event" class instead of using descendants because the event won't
|
||||
be a descendant of the grid when it is being dragged.
|
||||
*/
|
||||
|
||||
.fc-time-grid-event {
|
||||
overflow: hidden; /* don't let the bg flow over rounded corners */
|
||||
}
|
||||
|
||||
.fc-time-grid-event > .fc-content { /* contains the time and title, but no bg and resizer */
|
||||
position: relative;
|
||||
z-index: 2; /* above the bg */
|
||||
}
|
||||
|
||||
.fc-time-grid-event .fc-time,
|
||||
.fc-time-grid-event .fc-title {
|
||||
padding: 0 1px;
|
||||
@@ -917,13 +1018,6 @@ be a descendant of the grid when it is being dragged.
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fc-time-grid-event .fc-bg {
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
opacity: .25;
|
||||
filter: alpha(opacity=25); /* for IE */
|
||||
}
|
||||
|
||||
/* short mode, where time and title are on the same line */
|
||||
|
||||
.fc-time-grid-event.fc-short .fc-content {
|
||||
@@ -958,8 +1052,6 @@ be a descendant of the grid when it is being dragged.
|
||||
/* resizer */
|
||||
|
||||
.fc-time-grid-event .fc-resizer {
|
||||
position: absolute;
|
||||
z-index: 3; /* above content */
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
+2859
-1502
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+202
@@ -0,0 +1,202 @@
|
||||
/*!
|
||||
* FullCalendar v2.4.0 Print Stylesheet
|
||||
* Docs & License: http://fullcalendar.io/
|
||||
* (c) 2015 Adam Shaw
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*/
|
||||
|
||||
.fc {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
/* Global Event Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
.fc-event .fc-resizer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Table & Day-Row Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
th,
|
||||
td,
|
||||
hr,
|
||||
thead,
|
||||
tbody,
|
||||
.fc-row {
|
||||
border-color: #ccc !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
/* kill the overlaid, absolutely-positioned common components */
|
||||
.fc-bg,
|
||||
.fc-bgevent-skeleton,
|
||||
.fc-highlight-skeleton,
|
||||
.fc-helper-skeleton {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't force a min-height on rows (for DayGrid) */
|
||||
.fc tbody .fc-row {
|
||||
height: auto !important; /* undo height that JS set in distributeHeight */
|
||||
min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton {
|
||||
position: static; /* undo .fc-rigid */
|
||||
padding-bottom: 0 !important; /* use a more border-friendly method for this... */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */
|
||||
padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton table {
|
||||
/* provides a min-height for the row, but only effective for IE, which exaggerates this value,
|
||||
making it look more like 3em. for other browers, it will already be this tall */
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
|
||||
/* Undo month-view event limiting. Display all events and hide the "more" links
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-more-cell,
|
||||
.fc-more {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc tr.fc-limited {
|
||||
display: table-row !important;
|
||||
}
|
||||
|
||||
.fc td.fc-limited {
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.fc-popover {
|
||||
display: none; /* never display the "more.." popover in print mode */
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* undo the min-height 100% trick used to fill the container's height */
|
||||
.fc-time-grid {
|
||||
min-height: 0 !important;
|
||||
}
|
||||
|
||||
/* don't display the side axis at all ("all-day" and time cells) */
|
||||
.fc-agenda-view .fc-axis {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't display the horizontal lines */
|
||||
.fc-slats,
|
||||
.fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */
|
||||
display: none !important; /* important overrides inline declaration */
|
||||
}
|
||||
|
||||
/* let the container that holds the events be naturally positioned and create real height */
|
||||
.fc-time-grid .fc-content-skeleton {
|
||||
position: static;
|
||||
}
|
||||
|
||||
/* in case there are no events, we still want some height */
|
||||
.fc-time-grid .fc-content-skeleton table {
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
/* kill the horizontal spacing made by the event container. event margins will be done below */
|
||||
.fc-time-grid .fc-event-container {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid *Event* Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* naturally position events, vertically stacking them */
|
||||
.fc-time-grid .fc-event {
|
||||
position: static !important;
|
||||
margin: 3px 2px !important;
|
||||
}
|
||||
|
||||
/* for events that continue to a future day, give the bottom border back */
|
||||
.fc-time-grid .fc-event.fc-not-end {
|
||||
border-bottom-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event continues via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-end:after {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* for events that are continuations from previous days, give the top border back */
|
||||
.fc-time-grid .fc-event.fc-not-start {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event is a continuation via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-start:before {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* time */
|
||||
|
||||
/* undo a previous declaration and let the time text span to a second line */
|
||||
.fc-time-grid .fc-event .fc-time {
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
/* hide the the time that is normally displayed... */
|
||||
.fc-time-grid .fc-event .fc-time span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */
|
||||
.fc-time-grid .fc-event .fc-time:after {
|
||||
content: attr(data-full);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical Scroller & Containers
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* kill the scrollbars and allow natural height */
|
||||
.fc-scroller,
|
||||
.fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */
|
||||
.fc-time-grid-container { /* */
|
||||
overflow: visible !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* kill the horizontal border/padding used to compensate for scrollbars */
|
||||
.fc-row {
|
||||
border: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* Button Controls
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-button-group,
|
||||
.fc button {
|
||||
display: none; /* don't display any button-related controls */
|
||||
}
|
||||
Vendored
+180
@@ -0,0 +1,180 @@
|
||||
/*!
|
||||
* FullCalendar v2.4.0 Google Calendar Plugin
|
||||
* Docs & License: http://fullcalendar.io/
|
||||
* (c) 2015 Adam Shaw
|
||||
*/
|
||||
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([ 'jquery' ], factory);
|
||||
}
|
||||
else if (typeof exports === 'object') { // Node/CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
}
|
||||
else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($) {
|
||||
|
||||
|
||||
var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
|
||||
var fc = $.fullCalendar;
|
||||
var applyAll = fc.applyAll;
|
||||
|
||||
|
||||
fc.sourceNormalizers.push(function(sourceOptions) {
|
||||
var googleCalendarId = sourceOptions.googleCalendarId;
|
||||
var url = sourceOptions.url;
|
||||
var match;
|
||||
|
||||
// if the Google Calendar ID hasn't been explicitly defined
|
||||
if (!googleCalendarId && url) {
|
||||
|
||||
// detect if the ID was specified as a single string.
|
||||
// will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
|
||||
if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
|
||||
googleCalendarId = url;
|
||||
}
|
||||
// try to scrape it out of a V1 or V3 API feed URL
|
||||
else if (
|
||||
(match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
|
||||
(match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))
|
||||
) {
|
||||
googleCalendarId = decodeURIComponent(match[1]);
|
||||
}
|
||||
|
||||
if (googleCalendarId) {
|
||||
sourceOptions.googleCalendarId = googleCalendarId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (googleCalendarId) { // is this a Google Calendar?
|
||||
|
||||
// make each Google Calendar source uneditable by default
|
||||
if (sourceOptions.editable == null) {
|
||||
sourceOptions.editable = false;
|
||||
}
|
||||
|
||||
// We want removeEventSource to work, but it won't know about the googleCalendarId primitive.
|
||||
// Shoehorn it into the url, which will function as the unique primitive. Won't cause side effects.
|
||||
// This hack is obsolete since 2.2.3, but keep it so this plugin file is compatible with old versions.
|
||||
sourceOptions.url = googleCalendarId;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fc.sourceFetchers.push(function(sourceOptions, start, end, timezone) {
|
||||
if (sourceOptions.googleCalendarId) {
|
||||
return transformOptions(sourceOptions, start, end, timezone, this); // `this` is the calendar
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function transformOptions(sourceOptions, start, end, timezone, calendar) {
|
||||
var url = API_BASE + '/' + encodeURIComponent(sourceOptions.googleCalendarId) + '/events?callback=?'; // jsonp
|
||||
var apiKey = sourceOptions.googleCalendarApiKey || calendar.options.googleCalendarApiKey;
|
||||
var success = sourceOptions.success;
|
||||
var data;
|
||||
var timezoneArg; // populated when a specific timezone. escaped to Google's liking
|
||||
|
||||
function reportError(message, apiErrorObjs) {
|
||||
var errorObjs = apiErrorObjs || [ { message: message } ]; // to be passed into error handlers
|
||||
|
||||
// call error handlers
|
||||
(sourceOptions.googleCalendarError || $.noop).apply(calendar, errorObjs);
|
||||
(calendar.options.googleCalendarError || $.noop).apply(calendar, errorObjs);
|
||||
|
||||
// print error to debug console
|
||||
fc.warn.apply(null, [ message ].concat(apiErrorObjs || []));
|
||||
}
|
||||
|
||||
if (!apiKey) {
|
||||
reportError("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/");
|
||||
return {}; // an empty source to use instead. won't fetch anything.
|
||||
}
|
||||
|
||||
// The API expects an ISO8601 datetime with a time and timezone part.
|
||||
// Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each
|
||||
// side, guaranteeing we will receive all events in the desired range, albeit a superset.
|
||||
// .utc() will set a zone and give it a 00:00:00 time.
|
||||
if (!start.hasZone()) {
|
||||
start = start.clone().utc().add(-1, 'day');
|
||||
}
|
||||
if (!end.hasZone()) {
|
||||
end = end.clone().utc().add(1, 'day');
|
||||
}
|
||||
|
||||
// when sending timezone names to Google, only accepts underscores, not spaces
|
||||
if (timezone && timezone != 'local') {
|
||||
timezoneArg = timezone.replace(' ', '_');
|
||||
}
|
||||
|
||||
data = $.extend({}, sourceOptions.data || {}, {
|
||||
key: apiKey,
|
||||
timeMin: start.format(),
|
||||
timeMax: end.format(),
|
||||
timeZone: timezoneArg,
|
||||
singleEvents: true,
|
||||
maxResults: 9999
|
||||
});
|
||||
|
||||
return $.extend({}, sourceOptions, {
|
||||
googleCalendarId: null, // prevents source-normalizing from happening again
|
||||
url: url,
|
||||
data: data,
|
||||
startParam: false, // `false` omits this parameter. we already included it above
|
||||
endParam: false, // same
|
||||
timezoneParam: false, // same
|
||||
success: function(data) {
|
||||
var events = [];
|
||||
var successArgs;
|
||||
var successRes;
|
||||
|
||||
if (data.error) {
|
||||
reportError('Google Calendar API: ' + data.error.message, data.error.errors);
|
||||
}
|
||||
else if (data.items) {
|
||||
$.each(data.items, function(i, entry) {
|
||||
var url = entry.htmlLink;
|
||||
|
||||
// make the URLs for each event show times in the correct timezone
|
||||
if (timezoneArg) {
|
||||
url = injectQsComponent(url, 'ctz=' + timezoneArg);
|
||||
}
|
||||
|
||||
events.push({
|
||||
id: entry.id,
|
||||
title: entry.summary,
|
||||
start: entry.start.dateTime || entry.start.date, // try timed. will fall back to all-day
|
||||
end: entry.end.dateTime || entry.end.date, // same
|
||||
url: url,
|
||||
location: entry.location,
|
||||
description: entry.description
|
||||
});
|
||||
});
|
||||
|
||||
// call the success handler(s) and allow it to return a new events array
|
||||
successArgs = [ events ].concat(Array.prototype.slice.call(arguments, 1)); // forward other jq args
|
||||
successRes = applyAll(success, this, successArgs);
|
||||
if ($.isArray(successRes)) {
|
||||
return successRes;
|
||||
}
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Injects a string like "arg=value" into the querystring of a URL
|
||||
function injectQsComponent(url, component) {
|
||||
// inject it after the querystring but before the fragment
|
||||
return url.replace(/(\?.*?)?(#|$)/, function(whole, qs, hash) {
|
||||
return (qs ? qs + '&' : '?') + component + hash;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
+4
File diff suppressed because one or more lines are too long
+20
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2015 Adam Shaw
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Reference in New Issue
Block a user