Blog2Social: Social Media Auto Post & Scheduler - Version 4.3.1

Version Description

Bugfix: Social meta tags

Download this release

Release Info

Developer Blog2Social
Plugin Icon 128x128 Blog2Social: Social Media Auto Post & Scheduler
Version 4.3.1
Comparing to
See all releases

Code changes from version 4.2.2 to 4.3.1

Files changed (38) hide show
  1. assets/css/b2s/calendar.css +209 -0
  2. assets/css/b2s/settings.css +5 -0
  3. assets/css/b2s/ship.css +16 -2
  4. assets/css/general.css +24 -20
  5. assets/images/portale/16_flat.png +0 -0
  6. assets/js/b2s/calendar.js +348 -0
  7. assets/js/b2s/general.js +18 -3
  8. assets/js/b2s/lib.js +20 -0
  9. assets/js/b2s/post.js +95 -42
  10. assets/js/b2s/settings.js +153 -38
  11. assets/js/b2s/ship.js +451 -129
  12. assets/js/b2s/wp/post-meta-box-auto.js +2 -2
  13. assets/lib/fullcalendar/CHANGELOG.txt +1160 -0
  14. assets/lib/fullcalendar/CONTRIBUTING.txt +127 -0
  15. assets/lib/fullcalendar/LICENSE.txt +20 -0
  16. assets/lib/fullcalendar/fullcalendar.css +1413 -0
  17. assets/lib/fullcalendar/fullcalendar.js +15591 -0
  18. assets/lib/fullcalendar/fullcalendar.min.css +5 -0
  19. assets/lib/fullcalendar/fullcalendar.min.js +10 -0
  20. assets/lib/fullcalendar/fullcalendar.print.css +208 -0
  21. assets/lib/fullcalendar/fullcalendar.print.min.css +5 -0
  22. assets/lib/fullcalendar/gcal.js +180 -0
  23. assets/lib/fullcalendar/gcal.min.js +6 -0
  24. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
  25. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
  26. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
  27. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
  28. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
  29. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
  30. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
  31. assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
  32. assets/lib/fullcalendar/lib/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
  33. assets/lib/fullcalendar/lib/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
  34. assets/lib/fullcalendar/lib/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
  35. assets/lib/fullcalendar/lib/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
  36. assets/lib/fullcalendar/lib/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
  37. assets/lib/fullcalendar/lib/cupertino/jquery-ui.min.css +7 -0
  38. assets/lib/fullcalendar/lib/jquery-ui.min.js +13 -0
assets/css/b2s/calendar.css ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ body .fc-state-default{
3
+ color: #fff;
4
+ background-color: #337ab7;
5
+ border-color: #2e6da4;
6
+ background-image: none;
7
+ text-shadow: none;
8
+ box-shadow: none;
9
+ }
10
+ body .b2s-calendar-header{
11
+ display: flex;
12
+ padding-bottom: 2px;
13
+ }
14
+ body .b2s-calendar-body > img{
15
+ float: right;
16
+ height: 28px;
17
+ width: 28px;
18
+ }
19
+ body .b2s-calendar-header .fc-content{
20
+ padding-left: 2px;
21
+ }
22
+ body .b2s-calendar-body{
23
+ background-color: #fff;
24
+ color: #000;
25
+ margin-bottom: 1px;
26
+ border-radius: 2px;
27
+ padding: 2px;
28
+ }
29
+ body .b2s-calendar-body::after{
30
+ content: "";
31
+ clear:both;
32
+ display: block;
33
+ }
34
+ body .fc-content{
35
+ display: block;
36
+ width: 100%;
37
+ }
38
+ body .fc-time{
39
+ display: block;
40
+ padding-right: 2px;
41
+ text-align: right;
42
+ float:right;
43
+ }
44
+ .network-name{
45
+ font-weight: bold;
46
+ }
47
+ .network-profile{
48
+ margin-bottom: 5px;
49
+ }
50
+ .b2s-post-item-thumb {
51
+ width: 5%;
52
+ margin-right: 8px;
53
+ }
54
+
55
+ .b2s-post-item-thumb img {
56
+ border-radius: 50%;
57
+ width: 48px;
58
+ }
59
+
60
+ .b2s-post-item-details {
61
+ width: 93%;
62
+ }
63
+
64
+ .b2s-post-item-details, .b2s-post-item-thumb {
65
+ float: left;
66
+ }
67
+ .b2s-post-item-details h4 {
68
+ font-size: 16px;
69
+ font-weight: 600;
70
+ text-transform: uppercase;
71
+ margin: 3px 3px 3px 0px;
72
+ }
73
+ .btn-circle {
74
+ width: 30px;
75
+ height: 30px;
76
+ text-align: center;
77
+ padding: 6px 0;
78
+ font-size: 12px;
79
+ line-height: 1.428571429;
80
+ border-radius: 15px;
81
+ }
82
+ .fb-url-image, .xing-url-image, .linkedin-url-image, .tw-url-image, .b2s-image-border {
83
+ margin-right: 10px;
84
+ margin-bottom: 20px;
85
+ border: 1px dashed #bdbfc2;
86
+ box-shadow: none;
87
+ padding: 5px;
88
+ }
89
+ textarea.form-control {
90
+ height: auto;
91
+ }
92
+ .fb-textarea-input, .tw-textarea-input, .xing-textarea-input, .linkedin-textarea-input {
93
+ font-size: 14px;
94
+ font-weight: normal;
95
+ line-height: 1.125;
96
+ width: 100%;
97
+ border: medium none;
98
+ border-radius: 0;
99
+ margin-top: 10px;
100
+ margin-bottom: 10px;
101
+ font-family: helvetica,arial,sans-serif;
102
+ }
103
+ .b2s-post-item-details-item-message-input{
104
+ min-height: 100px;
105
+ }
106
+ .b2s-post-item-details-url-image{
107
+ cursor: pointer;
108
+ }
109
+ .b2s-user-network-settings-post-format-area label > input {
110
+ visibility: hidden;
111
+ position: absolute;
112
+ }
113
+ .b2s-settings-checked + img {
114
+ border: 3px solid #79b232 !important;
115
+ }
116
+ .b2s-image-item {
117
+ background-color: #fff;
118
+ border: 1px solid #ddd;
119
+ display: block;
120
+ float: left;
121
+ height: 200px;
122
+ line-height: 1.42857;
123
+ margin-bottom: 15px;
124
+ margin-left: 15px;
125
+ margin-top: 15px;
126
+ overflow: hidden;
127
+ padding: 4px;
128
+ transition: border 0.2s ease-in-out 0s;
129
+ width: 185px;
130
+ }
131
+ .b2s-image-item-thumb {
132
+ height: 150px;
133
+ }
134
+ .b2s-image-change-all-network,.b2s-upload-image-free-version,.b2s-image-change-this-network{
135
+ margin-right: 5px !important;
136
+ }
137
+ .b2s-image-remove-btn {
138
+ position: absolute;
139
+ top: -5px;
140
+ right: 0px;
141
+ font-weight: 700 !important;
142
+ }
143
+ .b2s-calendar-delete{
144
+ cursor: pointer;
145
+ }
146
+ .b2s-btn-label-premium{
147
+ color: #fff;
148
+ text-decoration: none !important;
149
+ cursor: default !important;
150
+ }
151
+ .b2s-btn-label-premium:hover{
152
+ color: #fff;
153
+ text-decoration: none !important;
154
+ cursor: default !important;
155
+ }
156
+ .b2s-post-item .label-success{
157
+ display: none;
158
+ }
159
+ body .fc-day-grid-event .fc-content{
160
+ white-space: normal;
161
+ }
162
+
163
+ @media(max-width: 425px)
164
+ {
165
+ .b2s-calendar-body{
166
+ display: none;
167
+ }
168
+ }
169
+
170
+ @media(max-width: 350px)
171
+ {
172
+ body .fc-time{
173
+ font-size: 8px;
174
+ }
175
+ }
176
+
177
+ .b2s-loading-area {
178
+ width: 100% !important;
179
+ }
180
+
181
+ .og_title, .og_desc, .card_desc, .card_title, .b2s-post-item-details-item-title-input, .b2s-select{
182
+ margin-bottom: 8px !important;
183
+ }
184
+
185
+ .b2s-post-item-info-area {
186
+ font-size: 11px !important;
187
+ }
188
+
189
+ .b2s-post-ship-item-full-text, .b2s-post-ship-item-message-delete, .b2s-post-ship-item-network-settings, .b2s-post-ship-item-post-format{
190
+ line-height: 1.5 !important;
191
+ padding: 0 1px 3px !important;
192
+ }
193
+
194
+ .b2s-load-info-meta-tag-modal{
195
+ margin-top: 8px !important;
196
+ display: block !important;
197
+ margin-right: auto !important;
198
+ margin-left: auto !important;
199
+ }
200
+
201
+ .b2s-post-item-details-tag-add-div {
202
+ border: 0px !important;
203
+ box-shadow: 0px 0px 0px #000 !important;
204
+ }
205
+
206
+ .b2s-post-item-details-tag-input-elem {
207
+ margin: 2px 4px;
208
+ max-width: 145px !important;
209
+ }
assets/css/b2s/settings.css CHANGED
@@ -72,3 +72,8 @@ hr{
72
  .font-gray{
73
  color: #9B9B9B !important;
74
  }
 
 
 
 
 
72
  .font-gray{
73
  color: #9B9B9B !important;
74
  }
75
+
76
+ .b2s-post-item-network-image{
77
+ height: 16px;
78
+ width: 16px;
79
+ }
assets/css/b2s/ship.css CHANGED
@@ -176,6 +176,10 @@
176
 
177
  /*Network List*/
178
 
 
 
 
 
179
  .active {
180
  background-color: #32373C;
181
  }
@@ -611,6 +615,7 @@ input[type="checkbox"], input[type="radio"] {
611
  .fb-url-desc{
612
  font-size: 12px;
613
  line-height: 16px;
 
614
  }
615
 
616
 
@@ -624,6 +629,7 @@ input[type="checkbox"], input[type="radio"] {
624
  .tw-url-desc{
625
  margin: 5px 0 5px !important;
626
  color: inherit !important;
 
627
  }
628
 
629
  .xing-container{
@@ -763,6 +769,14 @@ input[type="checkbox"], input[type="radio"] {
763
 
764
  .b2s-settings-time-zone-text{
765
  font-size: 13px;
766
- font-style: italic;
767
- color: #adadad;
 
 
 
 
 
 
 
 
768
  }
176
 
177
  /*Network List*/
178
 
179
+ .b2s-network-select-btn{
180
+ text-decoration:none !important;
181
+ }
182
+
183
  .active {
184
  background-color: #32373C;
185
  }
615
  .fb-url-desc{
616
  font-size: 12px;
617
  line-height: 16px;
618
+ margin-bottom: 8px !important;
619
  }
620
 
621
 
629
  .tw-url-desc{
630
  margin: 5px 0 5px !important;
631
  color: inherit !important;
632
+ margin-bottom: 8px !important;
633
  }
634
 
635
  .xing-container{
769
 
770
  .b2s-settings-time-zone-text{
771
  font-size: 13px;
772
+ font-style: italic;
773
+ color: #adadad;
774
+ }
775
+
776
+ .b2s-sidbar-wrapper-nav-li,.b2s-sidbar-network-auth-btn,.btn-toggle-menu{
777
+ cursor: pointer;
778
+ }
779
+
780
+ .b2s-load-info-meta-tag-modal{
781
+ float:right;
782
  }
assets/css/general.css CHANGED
@@ -6952,6 +6952,7 @@ p {
6952
 
6953
  .b2s-select,.b2s-input{
6954
  height: 30px !important;
 
6955
  }
6956
 
6957
  .b2s-logo{
@@ -7104,36 +7105,36 @@ input[type="checkbox"].error + label{
7104
  -webkit-box-shadow: none;
7105
  -moz-box-shadow: none;
7106
  box-shadow: none;
7107
-
7108
  }
7109
  .panel-no-padding{
7110
  padding: 0px;
7111
  }
7112
 
7113
  .btn-circle {
7114
- width: 30px;
7115
- height: 30px;
7116
- text-align: center;
7117
- padding: 6px 0;
7118
- font-size: 12px;
7119
- line-height: 1.428571429;
7120
- border-radius: 15px;
7121
  }
7122
  .btn-circle.btn-lg {
7123
- width: 50px;
7124
- height: 50px;
7125
- padding: 10px 16px;
7126
- font-size: 18px;
7127
- line-height: 1.33;
7128
- border-radius: 25px;
7129
  }
7130
  .btn-circle.btn-xl {
7131
- width: 70px;
7132
- height: 70px;
7133
- padding: 10px 16px;
7134
- font-size: 24px;
7135
- line-height: 1.33;
7136
- border-radius: 35px;
7137
  }
7138
 
7139
  .b2s-info-btn {
@@ -7151,4 +7152,7 @@ input[type="checkbox"].error + label{
7151
 
7152
  .btn-label-premium {
7153
  color: #fff !important;
 
 
 
7154
  }
6952
 
6953
  .b2s-select,.b2s-input{
6954
  height: 30px !important;
6955
+ margin-bottom: 8px !important;
6956
  }
6957
 
6958
  .b2s-logo{
7105
  -webkit-box-shadow: none;
7106
  -moz-box-shadow: none;
7107
  box-shadow: none;
7108
+
7109
  }
7110
  .panel-no-padding{
7111
  padding: 0px;
7112
  }
7113
 
7114
  .btn-circle {
7115
+ width: 30px;
7116
+ height: 30px;
7117
+ text-align: center;
7118
+ padding: 6px 0;
7119
+ font-size: 12px;
7120
+ line-height: 1.428571429;
7121
+ border-radius: 15px;
7122
  }
7123
  .btn-circle.btn-lg {
7124
+ width: 50px;
7125
+ height: 50px;
7126
+ padding: 10px 16px;
7127
+ font-size: 18px;
7128
+ line-height: 1.33;
7129
+ border-radius: 25px;
7130
  }
7131
  .btn-circle.btn-xl {
7132
+ width: 70px;
7133
+ height: 70px;
7134
+ padding: 10px 16px;
7135
+ font-size: 24px;
7136
+ line-height: 1.33;
7137
+ border-radius: 35px;
7138
  }
7139
 
7140
  .b2s-info-btn {
7152
 
7153
  .btn-label-premium {
7154
  color: #fff !important;
7155
+ }
7156
+ .btn-label-premium-xs{
7157
+ font-size: 11px !important;
7158
  }
assets/images/portale/16_flat.png ADDED
Binary file
assets/js/b2s/calendar.js ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.noConflict();
2
+
3
+ jQuery(document).ready(function () {
4
+ jQuery('#b2s_calendar').fullCalendar({
5
+ editable: b2s_has_premium,
6
+ locale: b2s_calendar_locale,
7
+ eventLimit: 2,
8
+ timeFormat: 'H:mm',
9
+ events: ajaxurl + '?action=b2s_get_calendar_events',
10
+ eventRender: function (event, element) {
11
+ $header = jQuery("<div>").addClass("b2s-calendar-header");
12
+ $network_name = jQuery("<span>").text(event.author).addClass("network-name").css("display", "block");
13
+ element.find(".fc-time").after($network_name);
14
+ element.html(element.html());
15
+ $parent = element.parent();
16
+ $header.append(element.find(".fc-content"));
17
+ element.append($header);
18
+ $body = jQuery("<div>").addClass("b2s-calendar-body");
19
+ $body.append(event.avatar);
20
+ $body.append(element.find(".fc-title"));
21
+ $body.append(jQuery("<br>"));
22
+ var $em = jQuery("<em>").css("padding-top", "5px").css("display", "block");
23
+ $em.append("<img src='" + b2s_plugin_url + "assets/images/portale/" + event.network_id + "_flat.png' style='height: 16px;width: 16px;display: inline-block;padding-right: 2px;padding-left: 2px;' />")
24
+ $em.append(event.network_name);
25
+ $em.append(jQuery("<span>").text(": " + event.profile));
26
+ $body.append($em);
27
+
28
+ element.append($body);
29
+ },
30
+ eventDrop: function (event, delta, revertFunc) {
31
+ jQuery.ajax({
32
+ url: ajaxurl,
33
+ type: "POST",
34
+ dataType: "json",
35
+ cache: false,
36
+ data: {
37
+ 'action': 'b2s_calendar_move_post',
38
+ 'b2s_id': event.b2s_id,
39
+ 'user_timezone': event.user_timezone,
40
+ 'sched_date': event.start.format(),
41
+ },
42
+ success: function (data) {
43
+ wp.heartbeat.connectNow();
44
+ }
45
+ });
46
+ },
47
+ eventAllow: function (dropLocation, draggedEvent) {
48
+ return dropLocation.start.isAfter(b2s_calendar_date) && draggedEvent.start.isAfter(b2s_calendar_datetime);
49
+ },
50
+ eventClick: function (calEvent, jsEvent, view) {
51
+
52
+ if (jQuery('#b2s-edit-event-modal-' + calEvent.b2s_id).length == 1)
53
+ {
54
+ jQuery('#b2s-edit-event-modal-' + calEvent.b2s_id).remove();
55
+ }
56
+ b2s_current_post_id = calEvent.post_id;
57
+ var $modal = jQuery("<div>");
58
+
59
+ jQuery.ajax({
60
+ url: ajaxurl,
61
+ type: "POST",
62
+ cache: false,
63
+ async: false,
64
+ data: {
65
+ 'action': 'b2s_get_calendar_edit_modal',
66
+ 'id': calEvent.b2s_id
67
+ },
68
+ success: function (data) {
69
+ $modal = $modal.html(data);
70
+ }
71
+ });
72
+ jQuery("body").append($modal);
73
+
74
+ jQuery('#b2s-edit-event-modal-' + calEvent.b2s_id).modal('show');
75
+ activatePortal(calEvent.network_auth_id);
76
+ initSceditor(calEvent.network_auth_id);
77
+ networkCount(calEvent.network_auth_id);
78
+
79
+ console.log(calEvent.post_format);
80
+
81
+
82
+ if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').length > 0) {
83
+ var postFormatText = b2s_calendar_formats;
84
+
85
+ var isSetPostFormat = false;
86
+ //is set post format => override current condidtions by user settings for this post
87
+ if (calEvent.post_format !== null) {
88
+ jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').val(calEvent.post_format);
89
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + calEvent.network_auth_id + '"]').html(postFormatText[calEvent.post_format]);
90
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + calEvent.network_auth_id + '"]').val(calEvent.post_format);
91
+
92
+ //edit modal select post format
93
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').removeClass('b2s-settings-checked');
94
+ jQuery('.b2s-user-network-settings-post-format[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"][data-post-format="'+calEvent.post_format+'"]').addClass('b2s-settings-checked');
95
+
96
+ } else {
97
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + calEvent.network_auth_id + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').val()]);
98
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + calEvent.network_auth_id + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').val());
99
+ }
100
+
101
+ //if linkpost then show btn meta tags
102
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + calEvent.network_type + '"][data-network-id="' + calEvent.network_id + '"]').val() == "0") {
103
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + calEvent.network_auth_id + '"]').prop("readonly", false);
104
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + calEvent.network_auth_id + '"]').prop("readonly", false);
105
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + calEvent.network_id + '"]').hide();
106
+
107
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + calEvent.network_auth_id + '"]').attr("data-meta-type");
108
+ if (dataMetaType == "og") {
109
+ jQuery('#b2sChangeOgMeta').val("1");
110
+ } else {
111
+ jQuery('#b2sChangeCardMeta').val("1");
112
+ }
113
+
114
+ } else {
115
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + calEvent.network_auth_id + '"]').prop("readonly", true);
116
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + calEvent.network_auth_id + '"]').prop("readonly", true);
117
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + calEvent.network_id + '"]').show();
118
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + calEvent.network_id + '"]').trigger("click");
119
+ }
120
+
121
+
122
+ }
123
+
124
+ jQuery("#b2sPostId").val(calEvent.post_id);
125
+
126
+ var today = new Date();
127
+ var dateFormat = "yyyy-mm-dd";
128
+ var language = "en";
129
+ var showMeridian = true;
130
+ if (jQuery('#b2sUserLang').val() == "de") {
131
+ dateFormat = "dd.mm.yyyy";
132
+ language = "de";
133
+ showMeridian = false;
134
+ }
135
+
136
+ jQuery(".b2s-post-item-details-release-input-date").datepicker({
137
+ format: dateFormat,
138
+ language: language,
139
+ maxViewMode: 2,
140
+ todayHighlight: true,
141
+ startDate: today,
142
+ calendarWeeks: true,
143
+ autoclose: true
144
+ });
145
+ jQuery('.b2s-post-item-details-release-input-time').timepicker({
146
+ minuteStep: 15,
147
+ appendWidgetTo: 'body',
148
+ showSeconds: false,
149
+ showMeridian: showMeridian,
150
+ defaultTime: 'current',
151
+ snapToStep: true
152
+ });
153
+
154
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
155
+ checkSchedDateTime(calEvent.network_auth_id);
156
+ });
157
+ jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
158
+ checkSchedDateTime(calEvent.network_auth_id);
159
+
160
+ });
161
+
162
+ init();
163
+
164
+ if (!b2s_has_premium)
165
+ {
166
+ jQuery('#b2s-edit-event-modal-' + calEvent.b2s_id).find("input, textarea, button").each(function () {
167
+ if (!jQuery(this).hasClass('b2s-modal-close')) {
168
+ jQuery(this).prop("disabled", true);
169
+ }
170
+ });
171
+ }
172
+ }
173
+
174
+ });
175
+
176
+ jQuery(".b2s-loading-area").hide();
177
+
178
+ jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
179
+ jQuery('.b2s-network-select-image-content').html("");
180
+ jQuery.ajax({
181
+ url: ajaxurl,
182
+ type: "POST",
183
+ cache: false,
184
+ async: false,
185
+ data: {
186
+ 'action': 'b2s_get_image_modal',
187
+ 'id': jQuery(this).data('post-id'),
188
+ 'image_url': jQuery(this).data('image-url')
189
+ },
190
+ success: function (data) {
191
+ jQuery(".b2s-network-select-image-content").html(data);
192
+ }
193
+ });
194
+
195
+ var authId = jQuery(this).data('network-auth-id');
196
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
197
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
198
+
199
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
200
+ jQuery('.b2s-selected-network-for-image-info').html(content);
201
+ jQuery('#b2sInsertImageType').val("0");
202
+
203
+ jQuery('.networkImage').each(function () {
204
+ var width = this.naturalWidth;
205
+ var height = this.naturalHeight;
206
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
207
+ });
208
+ jQuery('#b2s-network-select-image').modal('show');
209
+ return false;
210
+ });
211
+
212
+ jQuery(document).on("click", ".b2s-calendar-delete", function () {
213
+ var id = jQuery(this).data("b2s-id");
214
+ var post_id = jQuery(this).data("post-id");
215
+ jQuery.ajax({
216
+ url: ajaxurl,
217
+ type: "POST",
218
+ dataType: "json",
219
+ cache: false,
220
+ data: {
221
+ 'action': 'b2s_calendar_delete',
222
+ 'b2s_id': id,
223
+ 'post_id' : post_id
224
+ },
225
+ success: function (data) {
226
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
227
+
228
+ refreshCalender();
229
+ wp.heartbeat.connectNow();
230
+ }
231
+ });
232
+ });
233
+
234
+ jQuery(document).on("click", ".b2s-calendar-save-all", function (e) {
235
+ jQuery('#save_method').val("apply-all");
236
+ e.preventDefault();
237
+ var id = jQuery(this).data("b2s-id");
238
+ jQuery.ajax({
239
+ url: ajaxurl,
240
+ type: "POST",
241
+ dataType: "json",
242
+ cache: false,
243
+ data: jQuery(this).closest("form").serialize(),
244
+ success: function (data) {
245
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
246
+
247
+ refreshCalender();
248
+ jQuery('#b2s-edit-event-modal-' + id).remove();
249
+ wp.heartbeat.connectNow();
250
+ }
251
+ });
252
+ });
253
+
254
+ jQuery(document).on("click", ".b2s-calendar-save-this", function (e) {
255
+ e.preventDefault();
256
+ jQuery('#save_method').val("apply-this");
257
+ var id = jQuery(this).data("b2s-id");
258
+ jQuery.ajax({
259
+ url: ajaxurl,
260
+ type: "POST",
261
+ dataType: "json",
262
+ cache: false,
263
+ data: jQuery(this).closest("form").serialize(),
264
+ success: function (data) {
265
+ jQuery('#b2s-edit-event-modal-' + id).modal('hide');
266
+ refreshCalender();
267
+ jQuery('#b2s-edit-event-modal-' + id).remove();
268
+ wp.heartbeat.connectNow();
269
+ }
270
+ });
271
+ });
272
+
273
+ jQuery(document).on("click", ".release_locks", function () {
274
+ jQuery.ajax({
275
+ url: ajaxurl,
276
+ type: "POST",
277
+ cache: false,
278
+ async: false,
279
+ data: {
280
+ 'action': 'b2s_get_calendar_release_locks',
281
+ 'post_id' : jQuery('#post_id').val()
282
+ },
283
+ success: function (data) {
284
+ wp.heartbeat.connectNow();
285
+ }
286
+ });
287
+ });
288
+ });
289
+
290
+ function refreshCalender() {
291
+ jQuery('#b2s_calendar').fullCalendar('refetchEvents');
292
+ }
293
+
294
+ jQuery('#b2s-info-meta-tag-modal').on('hidden.bs.modal', function (e) {
295
+ jQuery('body').addClass('modal-open');
296
+ });
297
+
298
+ jQuery('#b2s-network-select-image').on('hidden.bs.modal', function (e) {
299
+ jQuery('body').addClass('modal-open');
300
+ });
301
+
302
+ jQuery('#b2s-post-ship-item-post-format-modal').on('hidden.bs.modal', function (e) {
303
+ jQuery('body').addClass('modal-open');
304
+ });
305
+
306
+
307
+ //jQuery(this).attr('data-network-auth-id')
308
+ function checkSchedDateTime(dataNetworkAuthId) {
309
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
310
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
311
+ var dateStr = jQuery(dateElement).val();
312
+ var minStr = jQuery(timeElement).val();
313
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
314
+
315
+ if (jQuery('#b2sUserLang').val() == 'de') {
316
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
317
+ } else {
318
+ var minParts = minStr.split(' ');
319
+ var minParts2 = minParts[0].split(':');
320
+ if (minParts[1] == 'PM') {
321
+ minParts2[0] = parseInt(minParts2[0]) + 12;
322
+ }
323
+ minStr = minParts2[0] + ':' + minParts2[1];
324
+ }
325
+
326
+ var minParts3 = minStr.split(':');
327
+ if (minParts3[0] < 10) {
328
+ minParts3[0] = '0' + minParts3[0];
329
+ }
330
+ var dateParts = dateStr.split('-');
331
+
332
+ //utc current time
333
+ var now = new Date();
334
+ //offset between utc und user
335
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
336
+ //enter hour to user time
337
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
338
+ //calculate datetime in utc
339
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
340
+ //compare enter date time with allowed user time
341
+ if (enter.getTime() < now.getTime()) {
342
+ //enter set on next 15 minutes and calculate on user timezone
343
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
344
+ jQuery(dateElement).datepicker('update', enter);
345
+ jQuery(timeElement).timepicker('setTime', enter);
346
+ }
347
+ }
348
+
assets/js/b2s/general.js CHANGED
@@ -3,7 +3,7 @@ jQuery(window).on("load", function () {
3
  jQuery('.b2s-heartbeat-fail').show();
4
  } else {
5
  jQuery('.b2s-heartbeat-fail').hide();
6
- }
7
  });
8
 
9
  jQuery(document).on('click', '.b2s-show-feedback-modal', function () {
@@ -138,7 +138,7 @@ jQuery(document).on('click', '.b2s-trail-btn-start', function () {
138
  jQuery('#b2s-trial-modal').modal('hide');
139
  jQuery('.b2s-key-area-success').show();
140
  jQuery('.b2s-trail-tracking').show();
141
- jQuery('#b2s-trail-tracking-src').attr('src','https://www.googleadservices.com/pagead/conversion/1072559458/?label=HB4lCM27oHMQ4uq3_wM&amp;guid=ON&amp;script=0');
142
  jQuery('.b2s-key-area-key-name').html(data.lizenzName);
143
  jQuery('.b2s-key-name').html(data.lizenzName);
144
  jQuery('.b2s-trail-premium-info-area').hide();
@@ -160,7 +160,7 @@ jQuery('#b2sPreFeatureModal').on('show.bs.modal', function (e) {
160
  jQuery('#b2sProFeatureModal').on('show.bs.modal', function (e) {
161
  jQuery(this).find('.modal-title').html(jQuery(e.relatedTarget).attr('data-title'));
162
  jQuery(this).find('.modal-body').hide();
163
- jQuery(this).find('.'+jQuery(e.relatedTarget).attr('data-type')).show();
164
  });
165
 
166
  jQuery(document).on('heartbeat-send', function (e, data) {
@@ -175,7 +175,22 @@ jQuery(document).on('click', '.b2s-modal-close', function () {
175
  return false;
176
  });
177
 
 
 
 
 
 
 
 
 
 
 
 
178
  function isEmail(email) {
179
  var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
180
  return regex.test(email);
181
  }
 
 
 
 
3
  jQuery('.b2s-heartbeat-fail').show();
4
  } else {
5
  jQuery('.b2s-heartbeat-fail').hide();
6
+ }
7
  });
8
 
9
  jQuery(document).on('click', '.b2s-show-feedback-modal', function () {
138
  jQuery('#b2s-trial-modal').modal('hide');
139
  jQuery('.b2s-key-area-success').show();
140
  jQuery('.b2s-trail-tracking').show();
141
+ jQuery('#b2s-trail-tracking-src').attr('src', 'https://www.googleadservices.com/pagead/conversion/1072559458/?label=HB4lCM27oHMQ4uq3_wM&amp;guid=ON&amp;script=0');
142
  jQuery('.b2s-key-area-key-name').html(data.lizenzName);
143
  jQuery('.b2s-key-name').html(data.lizenzName);
144
  jQuery('.b2s-trail-premium-info-area').hide();
160
  jQuery('#b2sProFeatureModal').on('show.bs.modal', function (e) {
161
  jQuery(this).find('.modal-title').html(jQuery(e.relatedTarget).attr('data-title'));
162
  jQuery(this).find('.modal-body').hide();
163
+ jQuery(this).find('.' + jQuery(e.relatedTarget).attr('data-type')).show();
164
  });
165
 
166
  jQuery(document).on('heartbeat-send', function (e, data) {
175
  return false;
176
  });
177
 
178
+
179
+ jQuery(document).on('click', '.b2s-load-info-meta-tag-modal', function () {
180
+ var dataType = jQuery(this).attr('data-meta-type');
181
+ var dataOrigin = jQuery(this).attr('data-meta-origin');
182
+ jQuery('.modal-meta-content').hide();
183
+ jQuery('.meta-body[data-meta-type=' + dataType + '][data-meta-origin=' + dataOrigin + ']').show();
184
+ jQuery('.meta-title[data-meta-origin=' + dataOrigin + ']').show();
185
+ jQuery('#b2s-info-meta-tag-modal').modal('show');
186
+ return false;
187
+ });
188
+
189
  function isEmail(email) {
190
  var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
191
  return regex.test(email);
192
  }
193
+
194
+
195
+
196
+
assets/js/b2s/lib.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ b2s = typeof(b2s) == "undefined" ? {network: {}} : b2s;
2
+
3
+ b2s.network.showImageDialog = function(data){
4
+ var authId = data.network_auth_id;
5
+ jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
6
+ jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
7
+
8
+ var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
9
+ jQuery('.b2s-selected-network-for-image-info').html(content);
10
+ jQuery('#b2sInsertImageType').val("0");
11
+ jQuery('#b2s-network-select-image').modal('show');
12
+
13
+ jQuery('.networkImage').each(function () {
14
+ var width = this.naturalWidth;
15
+ var height = this.naturalHeight;
16
+ jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
17
+ });
18
+
19
+ return false;
20
+ };
assets/js/b2s/post.js CHANGED
@@ -179,7 +179,7 @@ jQuery(document).on('click', '.b2sDetailsSchedPostBtn', function () {
179
  'action': 'b2s_sched_post_data',
180
  'postId': postId,
181
  'showByDate': showByDate,
182
- 'userAuthId' : userAuthId
183
  },
184
  error: function () {
185
  jQuery('.b2s-server-connection-fail').show();
@@ -339,7 +339,7 @@ jQuery(document).on('click', '.b2s-publish-delete-confirm-btn', function () {
339
  var dateFormat = "yyyy-mm-dd";
340
  var language = "en";
341
  var showMeridian = true;
342
- if (jQuery('#b2sLang').val() == "de") {
343
  dateFormat = "dd.mm.yyyy";
344
  language = "de";
345
  showMeridian = false;
@@ -355,24 +355,29 @@ if (jQuery.isFunction(jQuery.fn.datepicker)) {
355
  calendarWeeks: true,
356
  autoclose: true
357
  });
 
358
  jQuery("#b2s-change-date").datepicker().on('changeDate', function (e) {
359
- var element = '#b2s-change-time';
360
- var dateStr = jQuery(this).val();
361
- var minStr = jQuery(element).val()
362
- if (jQuery('#b2sLang').val() == 'de') {
363
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
364
- }
365
- var dateObj = new Date();
366
- dateObj.setTime(jQuery('#b2s-data-blog-sched-date').val());
367
- if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
368
- //date in past
369
- if (dateObj.getUTCMinutes() >= 30) {
370
- jQuery(element).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
371
- } else {
372
- jQuery(element).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
373
- }
374
- }
375
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  }
377
 
378
 
@@ -386,30 +391,35 @@ if (jQuery.isFunction(jQuery.fn.timepicker)) {
386
  defaultTime: 'current',
387
  snapToStep: true
388
  });
 
389
  jQuery('#b2s-change-time').timepicker().on('changeTime.timepicker', function (e) {
390
- var dateStr = jQuery('#b2s-change-date').val();
391
- var minStr = jQuery(this).val();
392
- if (jQuery('#b2sLang').val() == 'de') {
393
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
394
- } else {
395
- var minParts = minStr.split(' ');
396
- var minParts2 = minParts[0].split(':');
397
- if (minParts[1] == 'PM') {
398
- minParts2[0] = parseInt(minParts2[0]) + 12;
399
- }
400
- minStr = minParts2[0] + ':' + minParts2[1];
401
- }
402
- var dateObj = new Date();
403
- dateObj.setTime(jQuery('#b2s-data-blog-sched-date').val());
404
- if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
405
- //date in past
406
- if (dateObj.getUTCMinutes() >= 30) {
407
- jQuery(this).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
408
- } else {
409
- jQuery(this).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
410
- }
411
- }
412
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  }
414
 
415
  jQuery(document).on('click', '.b2s-post-sched-area-edittime-btn', function () {
@@ -483,7 +493,7 @@ function showFilter(typ) {
483
  function getB2SSchedDatepicker() {
484
 
485
  var language = "en";
486
- if (jQuery('#b2sLang').val() == "de") {
487
  language = "de";
488
  }
489
  var sched_dates = JSON.parse(jQuery('#b2sCalendarSchedDates').val());
@@ -522,4 +532,47 @@ function getB2SSchedDatepicker() {
522
 
523
  function padDate(n) {
524
  return ("0" + n).slice(-2);
525
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  'action': 'b2s_sched_post_data',
180
  'postId': postId,
181
  'showByDate': showByDate,
182
+ 'userAuthId': userAuthId
183
  },
184
  error: function () {
185
  jQuery('.b2s-server-connection-fail').show();
339
  var dateFormat = "yyyy-mm-dd";
340
  var language = "en";
341
  var showMeridian = true;
342
+ if (jQuery('#b2sUserLang').val() == "de") {
343
  dateFormat = "dd.mm.yyyy";
344
  language = "de";
345
  showMeridian = false;
355
  calendarWeeks: true,
356
  autoclose: true
357
  });
358
+
359
  jQuery("#b2s-change-date").datepicker().on('changeDate', function (e) {
360
+ checkSchedDateTime();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  });
362
+
363
+ /*jQuery("#b2s-change-date").datepicker().on('changeDate', function (e) {
364
+ var element = '#b2s-change-time';
365
+ var dateStr = jQuery(this).val();
366
+ var minStr = jQuery(element).val()
367
+ if (jQuery('#b2sUserLang').val() == 'de') {
368
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
369
+ }
370
+ var dateObj = new Date();
371
+ dateObj.setTime(jQuery('#b2s-data-blog-sched-date').val());
372
+ if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
373
+ //date in past
374
+ if (dateObj.getUTCMinutes() >= 30) {
375
+ jQuery(element).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
376
+ } else {
377
+ jQuery(element).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
378
+ }
379
+ }
380
+ });*/
381
  }
382
 
383
 
391
  defaultTime: 'current',
392
  snapToStep: true
393
  });
394
+
395
  jQuery('#b2s-change-time').timepicker().on('changeTime.timepicker', function (e) {
396
+ checkSchedDateTime();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  });
398
+
399
+ /*jQuery('#b2s-change-time').timepicker().on('changeTime.timepicker', function (e) {
400
+ var dateStr = jQuery('#b2s-change-date').val();
401
+ var minStr = jQuery(this).val();
402
+ if (jQuery('#b2sUserLang').val() == 'de') {
403
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
404
+ } else {
405
+ var minParts = minStr.split(' ');
406
+ var minParts2 = minParts[0].split(':');
407
+ if (minParts[1] == 'PM') {
408
+ minParts2[0] = parseInt(minParts2[0]) + 12;
409
+ }
410
+ minStr = minParts2[0] + ':' + minParts2[1];
411
+ }
412
+ var dateObj = new Date();
413
+ dateObj.setTime(jQuery('#b2s-data-blog-sched-date').val());
414
+ if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
415
+ //date in past
416
+ if (dateObj.getUTCMinutes() >= 30) {
417
+ jQuery(this).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
418
+ } else {
419
+ jQuery(this).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
420
+ }
421
+ }
422
+ });*/
423
  }
424
 
425
  jQuery(document).on('click', '.b2s-post-sched-area-edittime-btn', function () {
493
  function getB2SSchedDatepicker() {
494
 
495
  var language = "en";
496
+ if (jQuery('#b2sUserLang').val() == "de") {
497
  language = "de";
498
  }
499
  var sched_dates = JSON.parse(jQuery('#b2sCalendarSchedDates').val());
532
 
533
  function padDate(n) {
534
  return ("0" + n).slice(-2);
535
+ }
536
+
537
+
538
+ function checkSchedDateTime() {
539
+ var dateElement = '#b2s-change-date';
540
+ var timeElement = '#b2s-change-time';
541
+ var dateStr = jQuery(dateElement).val();
542
+ var minStr = jQuery(timeElement).val();
543
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
544
+
545
+ if (jQuery('#b2sUserLang').val() == 'de') {
546
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
547
+ } else {
548
+ var minParts = minStr.split(' ');
549
+ var minParts2 = minParts[0].split(':');
550
+ if (minParts[1] == 'PM') {
551
+ minParts2[0] = parseInt(minParts2[0]) + 12;
552
+ }
553
+ minStr = minParts2[0] + ':' + minParts2[1];
554
+ }
555
+
556
+ var minParts3 = minStr.split(':');
557
+ if (minParts3[0] < 10) {
558
+ minParts3[0] = '0' + minParts3[0];
559
+ }
560
+ var dateParts = dateStr.split('-');
561
+
562
+ //utc current time
563
+ var now = new Date();
564
+ //offset between utc und user
565
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
566
+ //enter hour to user time
567
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
568
+ //calculate datetime in utc
569
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
570
+ //compare enter date time with allowed user time
571
+ if (enter.getTime() < now.getTime()) {
572
+ //enter set on next 15 minutes and calculate on user timezone
573
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
574
+ jQuery(dateElement).datepicker('update', enter);
575
+ jQuery(timeElement).timepicker('setTime', enter);
576
+ }
577
+ }
578
+
assets/js/b2s/settings.js CHANGED
@@ -2,7 +2,7 @@ jQuery.noConflict();
2
  jQuery(window).on("load", function () {
3
 
4
  var showMeridian = true;
5
- if (jQuery('#b2sLang').val() == 'de') {
6
  showMeridian = false;
7
  }
8
  jQuery('.b2s-settings-sched-item-input-time').timepicker({
@@ -18,6 +18,121 @@ jQuery(window).on("load", function () {
18
  }
19
 
20
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
22
  return false;
23
  });
@@ -146,7 +261,7 @@ jQuery(document).on('click', '.b2s-post-type-select-btn', function () {
146
 
147
 
148
  jQuery(document).on('change', '#b2s-user-time-zone', function () {
149
- var curUserTime = calcCurrentExternTimeByOffset(jQuery('option:selected', this).attr('data-offset'), jQuery('#b2sLang').val());
150
  jQuery('#b2s-user-time').text(curUserTime);
151
 
152
  jQuery('.b2s-settings-user-success').hide();
@@ -297,42 +412,42 @@ jQuery('.b2sSaveUserSettingsPostFormatTw').validate({
297
 
298
 
299
  /*jQuery(document).on('change', '.b2s-user-network-settings-post-format', function () {
300
- jQuery('.b2s-settings-user-success').hide();
301
- jQuery('.b2s-settings-user-error').hide();
302
- jQuery('.b2s-server-connection-fail').hide();
303
- jQuery(".b2s-loading-area").show();
304
- jQuery(".b2s-user-settings-area").hide();
305
-
306
- var networkId = jQuery(this).attr("data-network-id");
307
- jQuery('.b2s-user-network-settings-post-format[data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
308
- jQuery(this).addClass('b2s-settings-checked');
309
-
310
- jQuery.ajax({
311
- url: ajaxurl,
312
- type: "POST",
313
- dataType: "json",
314
- cache: false,
315
- data: {
316
- 'action': 'b2s_user_network_settings',
317
- 'post_format': jQuery(this).val(),
318
- 'network_id': networkId
319
- },
320
- error: function () {
321
- jQuery('.b2s-server-connection-fail').show();
322
- return false;
323
- },
324
- success: function (data) {
325
- jQuery(".b2s-loading-area").hide();
326
- jQuery(".b2s-user-settings-area").show();
327
- if (data.result == true) {
328
- jQuery('.b2s-settings-user-success').show();
329
- } else {
330
- jQuery('.b2s-settings-user-error').show();
331
- }
332
- }
333
- });
334
- return false;
335
- });*/
336
 
337
  jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
338
  jQuery('.b2s-server-connection-fail').hide();
2
  jQuery(window).on("load", function () {
3
 
4
  var showMeridian = true;
5
+ if (jQuery('#b2sUserLang').val() == 'de') {
6
  showMeridian = false;
7
  }
8
  jQuery('.b2s-settings-sched-item-input-time').timepicker({
18
  }
19
 
20
  });
21
+
22
+
23
+ jQuery('.b2sSaveSocialMetaTagsSettings').validate({
24
+ ignore: "",
25
+ errorPlacement: function () {
26
+ return false;
27
+ },
28
+ submitHandler: function (form) {
29
+ jQuery('.b2s-settings-user-success').hide();
30
+ jQuery('.b2s-settings-user-error').hide();
31
+ jQuery(".b2s-loading-area").show();
32
+ jQuery(".b2s-user-settings-area").hide();
33
+ jQuery('.b2s-server-connection-fail').hide();
34
+ jQuery('.b2s-meta-tags-success').hide();
35
+ jQuery('.b2s-meta-tags-danger').hide();
36
+ jQuery.ajax({
37
+ processData: false,
38
+ url: ajaxurl,
39
+ type: "POST",
40
+ dataType: "json",
41
+ cache: false,
42
+ data: jQuery(form).serialize(),
43
+ error: function () {
44
+ jQuery('.b2s-server-connection-fail').show();
45
+ return false;
46
+ },
47
+ success: function (data) {
48
+ jQuery(".b2s-loading-area").hide();
49
+ jQuery(".b2s-user-settings-area").show();
50
+ if (data.result == true) {
51
+ jQuery('.b2s-settings-user-success').show();
52
+ if (data.b2s == true) {
53
+ if (data.yoast == true) {
54
+ jQuery('.b2s-meta-tags-yoast').show();
55
+ }
56
+ if (data.aioseop) {
57
+ jQuery('.b2s-meta-tags-aioseop').show();
58
+ }
59
+ if (data.webdados) {
60
+ jQuery('.b2s-meta-tags-webdados').show();
61
+ }
62
+ }
63
+ } else {
64
+ jQuery('.b2s-settings-user-error').show();
65
+ }
66
+ }
67
+ });
68
+ return false;
69
+ }
70
+ });
71
+
72
+
73
+ jQuery(document).on('click', '.b2sClearSocialMetaTags', function () {
74
+
75
+ jQuery('.b2s-settings-user-success').hide();
76
+ jQuery('.b2s-settings-user-error').hide();
77
+ jQuery('.b2s-clear-meta-tags').hide();
78
+ jQuery(".b2s-loading-area").show();
79
+ jQuery(".b2s-user-settings-area").hide();
80
+ jQuery('.b2s-server-connection-fail').hide();
81
+ jQuery.ajax({
82
+ url: ajaxurl,
83
+ type: "POST",
84
+ dataType: "json",
85
+ cache: false,
86
+ data: {
87
+ 'action': 'b2s_reset_social_meta_tags',
88
+ },
89
+ error: function () {
90
+ jQuery('.b2s-server-connection-fail').show();
91
+ return false;
92
+ },
93
+ success: function (data) {
94
+ jQuery(".b2s-loading-area").hide();
95
+ jQuery(".b2s-user-settings-area").show();
96
+ if (data.result == true) {
97
+ jQuery('.b2s-clear-meta-tags-success').show();
98
+ } else {
99
+ jQuery('.b2s-clear-meta-tags-error').show();
100
+ }
101
+ }
102
+ });
103
+ return false;
104
+ });
105
+
106
+
107
+
108
+ jQuery(document).on('click', '.b2s-upload-image', function () {
109
+ var targetId = jQuery(this).attr('data-id');
110
+ if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
111
+ wpMedia = wp.media({
112
+ title: jQuery('#b2s_wp_media_headline').val(),
113
+ button: {
114
+ text: jQuery('#b2s_wp_media_btn').val(),
115
+ },
116
+ multiple: false,
117
+ library: {type: 'image'}
118
+ });
119
+ wpMedia.open();
120
+
121
+ wpMedia.on('select', function () {
122
+ var validExtensions = ['jpg', 'jpeg', 'png'];
123
+ var attachment = wpMedia.state().get('selection').first().toJSON();
124
+
125
+ jQuery('#' + targetId).val(attachment.url);
126
+ });
127
+ } else {
128
+ jQuery('.b2s-upload-image-no-permission').show();
129
+ }
130
+ return false;
131
+ });
132
+
133
+
134
+
135
+
136
  jQuery(document).on('click', '.b2s-save-settings-pro-info', function () {
137
  return false;
138
  });
261
 
262
 
263
  jQuery(document).on('change', '#b2s-user-time-zone', function () {
264
+ var curUserTime = calcCurrentExternTimeByOffset(jQuery('option:selected', this).attr('data-offset'), jQuery('#b2sUserLang').val());
265
  jQuery('#b2s-user-time').text(curUserTime);
266
 
267
  jQuery('.b2s-settings-user-success').hide();
412
 
413
 
414
  /*jQuery(document).on('change', '.b2s-user-network-settings-post-format', function () {
415
+ jQuery('.b2s-settings-user-success').hide();
416
+ jQuery('.b2s-settings-user-error').hide();
417
+ jQuery('.b2s-server-connection-fail').hide();
418
+ jQuery(".b2s-loading-area").show();
419
+ jQuery(".b2s-user-settings-area").hide();
420
+
421
+ var networkId = jQuery(this).attr("data-network-id");
422
+ jQuery('.b2s-user-network-settings-post-format[data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
423
+ jQuery(this).addClass('b2s-settings-checked');
424
+
425
+ jQuery.ajax({
426
+ url: ajaxurl,
427
+ type: "POST",
428
+ dataType: "json",
429
+ cache: false,
430
+ data: {
431
+ 'action': 'b2s_user_network_settings',
432
+ 'post_format': jQuery(this).val(),
433
+ 'network_id': networkId
434
+ },
435
+ error: function () {
436
+ jQuery('.b2s-server-connection-fail').show();
437
+ return false;
438
+ },
439
+ success: function (data) {
440
+ jQuery(".b2s-loading-area").hide();
441
+ jQuery(".b2s-user-settings-area").show();
442
+ if (data.result == true) {
443
+ jQuery('.b2s-settings-user-success').show();
444
+ } else {
445
+ jQuery('.b2s-settings-user-error').show();
446
+ }
447
+ }
448
+ });
449
+ return false;
450
+ });*/
451
 
452
  jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function () {
453
  jQuery('.b2s-server-connection-fail').hide();
assets/js/b2s/ship.js CHANGED
@@ -54,6 +54,25 @@ jQuery.sceditor.command.set(
54
  jQuery.sceditor.command.set(
55
  "custom-image", {
56
  exec: function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
58
  jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
59
  jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
@@ -62,6 +81,7 @@ jQuery.sceditor.command.set(
62
  jQuery('#b2s-network-select-image').modal('show');
63
  jQuery('#b2sInsertImageType').val("1");
64
  imageSize();
 
65
  },
66
  txtExec: function () {
67
  var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
@@ -108,7 +128,7 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function ()
108
  var todayDate = ("0" + today.getDate()).slice(-2);
109
  var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
110
 
111
- var lang = jQuery('#b2sLang').val();
112
  if (lang == "de") {
113
  dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
114
  dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
@@ -121,7 +141,7 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function ()
121
  jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val('1').trigger("change");
122
  jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
123
  var hours = network_type_time.substring(0, 2);
124
- if (lang != 'de') {
125
  var timeparts = network_type_time.split(' ');
126
  hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
127
  }
@@ -141,6 +161,41 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-default', function ()
141
  return false;
142
  });
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
145
  jQuery('.b2s-server-connection-fail').hide();
146
  jQuery.ajax({
@@ -175,7 +230,7 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
175
  var todayDate = ("0" + today.getDate()).slice(-2);
176
  var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
177
 
178
- var lang = jQuery('#b2sLang').val();
179
  if (lang == "de") {
180
  dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
181
  dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
@@ -188,7 +243,7 @@ jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
188
  jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val('1').trigger("change");
189
  jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
190
  var hours = network_type_time.substring(0, 2);
191
- if (lang != 'de') {
192
  var timeparts = network_type_time.split(' ');
193
  hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
194
  }
@@ -255,11 +310,11 @@ jQuery(document).on('click', '.b2s-post-item-details-release-area-sched-for-all'
255
  if (dataNetworkCount == 2) {
256
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
257
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
258
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"').hide();
259
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"').show();
260
  } else if (dataNetworkCount == 1) {
261
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
262
- jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"').show();
263
  }
264
  }
265
 
@@ -275,38 +330,85 @@ jQuery(document).on("click", ".b2s-user-network-settings-post-format", function
275
  var networkId = jQuery(this).attr("data-network-id");
276
  var networkType = jQuery(this).attr("data-network-type");
277
  var postFormat = jQuery(this).val();
 
278
 
279
  jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
280
  //PostFormat
281
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
282
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
283
  if (jQuery('#user_version').val() >= 2) {
284
- jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').html(postFormatText[postFormat]);
285
- jQuery('.b2s-post-item-details-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
 
 
 
 
 
 
 
286
  } else {
287
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormat]);
288
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
289
  }
290
  }
291
- //Change View For Twitter
292
- if (postFormat == '0' && networkId == '2') {
293
- jQuery('.b2s-image-remove-btn[data-network-id="' + networkId + '"]').hide();
294
- jQuery('.b2s-select-image-modal-open[data-network-id="' + networkId + '"]').hide();
295
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + networkId + '"]').trigger("click");
296
- }
297
- if (postFormat == '1' && networkId == '2') {
298
- jQuery('.b2s-image-remove-btn[data-network-id="' + networkId + '"]').show();
299
- jQuery('.b2s-select-image-modal-open[data-network-id="' + networkId + '"]').show();
300
- if (jQuery('#b2s_blog_default_image').val() != "") {
301
- jQuery('.b2s-post-item-details-url-image[data-network-id="' + networkId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
302
- jQuery('.b2s-image-url-hidden-field[data-network-id="' + networkId + '"]').val(jQuery('#b2s_blog_default_image').val());
303
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
307
  jQuery(this).addClass('b2s-settings-checked');
308
  jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
309
-
310
  return false;
311
  });
312
 
@@ -363,8 +465,53 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
363
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
364
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
365
  if (jQuery('#user_version').val() >= 2) {
366
- jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
367
- jQuery('.b2s-post-item-details-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  } else {
369
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
370
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
@@ -437,7 +584,7 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
437
  var dateFormat = "yyyy-mm-dd";
438
  var language = "en";
439
  var showMeridian = true;
440
- if (jQuery('#b2sLang').val() == "de") {
441
  dateFormat = "dd.mm.yyyy";
442
  language = "de";
443
  showMeridian = false;
@@ -464,65 +611,76 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
464
  snapToStep: true
465
  });
466
 
467
- jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
468
- var element = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
469
- var dateStr = jQuery(this).val();
470
- var minStr = jQuery(element).val();
471
- if (jQuery('#b2sLang').val() == 'de') {
472
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
473
- } else {
474
- var minParts = minStr.split(' ');
475
- var minParts2 = minParts[0].split(':');
476
- if (minParts[1] == 'PM') {
477
- minParts2[0] = parseInt(minParts2[0]) + 12;
478
- }
479
- minStr = minParts2[0] + ':' + minParts2[1];
480
- }
481
- var dateObj = new Date();
482
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
483
- dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
484
- }
485
 
486
- if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
487
- //date in past
488
- if (dateObj.getUTCMinutes() >= 30) {
489
- jQuery(element).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
490
- } else {
491
- jQuery(element).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
492
- }
493
- }
494
  });
495
-
496
  jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
497
- var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
498
- if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() == "1") {
499
- var dateStr = jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
500
- var minStr = jQuery(this).val();
501
- if (jQuery('#b2sLang').val() == 'de') {
502
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
503
- } else {
504
- var minParts = minStr.split(' ');
505
- var minParts2 = minParts[0].split(':');
506
- if (minParts[1] == 'PM') {
507
- minParts2[0] = parseInt(minParts2[0]) + 12;
508
- }
509
- minStr = minParts2[0] + ':' + minParts2[1];
510
- }
511
- var dateObj = new Date();
512
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
513
- dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
514
- }
515
 
516
- if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
517
- //date in past
518
- if (dateObj.getUTCMinutes() >= 30) {
519
- jQuery(this).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
520
- } else {
521
- jQuery(this).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
522
- }
523
- }
524
- }
525
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  //Check Text Limit
527
  var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
528
  if (textLimit != "0") {
@@ -548,18 +706,64 @@ jQuery(document).on("click", ".b2s-network-select-btn", function () {
548
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0) {
549
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
550
  if (jQuery('#user_version').val() >= 2) {
551
- jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
552
- jQuery('.b2s-post-item-details-post-format[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  } else {
554
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
555
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
556
  }
557
  //Change View For Twitter
558
- if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-id="' + data.networkId + '"]').val() == '0' && data.networkId == '2') {
559
- jQuery('.b2s-image-remove-btn[data-network-id="' + data.networkId + '"]').hide();
560
- jQuery('.b2s-select-image-modal-open[data-network-id="' + data.networkId + '"]').hide();
561
- jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + data.networkId + '"]').trigger("click");
562
- }
 
563
  }
564
  }
565
  }
@@ -595,6 +799,7 @@ jQuery(document).on('click', '.b2s-post-ship-item-post-format', function () {
595
  jQuery('.b2s-post-format-settings-info').hide();
596
  jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
597
  jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
 
598
  } else {
599
  jQuery('#b2sInfoFormatModal').modal('show');
600
  }
@@ -652,33 +857,35 @@ jQuery(document).on('change', '.b2s-post-item-details-release-input-date-select'
652
  jQuery('#b2s-sched-post-modal').modal('show');
653
  return false;
654
  } else {
 
 
655
  //Überprüfen ob Zeit in der Vergangenheit
656
- var dateStr = jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
657
- var minStr = jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
658
- if (dateStr !== undefined && minStr !== undefined) {
659
- if (jQuery('#b2sLang').val() == 'de') {
660
- dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
661
- } else {
662
- var minParts = minStr.split(' ');
663
- var minParts2 = minParts[0].split(':');
664
- if (minParts[1] == 'PM') {
665
- minParts2[0] = parseInt(minParts2[0]) + 12;
666
- }
667
- minStr = minParts2[0] + ':' + minParts2[1];
668
- }
669
- var dateObj = new Date();
670
- if (jQuery('#b2sBlogPostSchedDate').length > 0) {
671
- dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
672
- }
673
- if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
674
- //date in past
675
- if (dateObj.getUTCMinutes() >= 30) {
676
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
677
- } else {
678
- jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').timepicker('setTime', (dateObj.getUTCHours()) + ':30');
679
- }
680
- }
681
- }
682
  }
683
  }
684
  releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
@@ -799,8 +1006,14 @@ jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', functi
799
  success: function (data) {
800
  jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
801
  if (data.result == true) {
802
- jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').html(data.title);
803
- jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').html(data.description);
 
 
 
 
 
 
804
  if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
805
  jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
806
  }
@@ -822,41 +1035,96 @@ jQuery(document).on('click', '.b2s-post-item-details-preview-url-reload', functi
822
  });
823
 
824
  jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
 
825
  var authId = jQuery(this).attr('data-network-auth-id');
826
  jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
827
  jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
828
  var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
829
  jQuery('.b2s-selected-network-for-image-info').html(content);
830
  jQuery('#b2sInsertImageType').val("0");
 
 
 
 
 
 
 
831
  jQuery('#b2s-network-select-image').modal('show');
832
  imageSize();
833
  return false;
834
  });
835
 
836
  jQuery(document).on('click', '.b2s-image-remove-btn', function () {
837
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', jQuery('#b2sDefaultNoImage').val());
838
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
839
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
840
  return false;
841
  });
842
 
843
  jQuery(document).on('click', '.b2s-image-change-this-network', function () {
844
-
 
845
  if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
846
- var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').sceditor('instance');
847
- sceditor.insert("<br /><img src='" + jQuery('input[name=image_url]:checked').val() + "'/><br />");
848
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(jQuery('input[name=image_url]:checked').val()); //Torial
849
 
850
  } else {
851
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', jQuery('input[name=image_url]:checked').val());
852
- jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
853
- jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(jQuery('input[name=image_url]:checked').val());
854
- jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
855
  }
856
  jQuery('.b2s-upload-image-invalid-extension').hide();
857
  jQuery('.b2s-upload-image-no-permission').hide();
858
  jQuery('.b2s-upload-image-free-version-info').hide();
859
  jQuery('#b2s-network-select-image').modal('hide');
 
860
  });
861
 
862
  jQuery(document).on('click', '.b2s-image-change-all-network', function () {
@@ -878,7 +1146,12 @@ jQuery(document).on('click', '.b2s-image-change-all-network', function () {
878
  jQuery('.b2s-upload-image-invalid-extension').hide();
879
  jQuery('.b2s-upload-image-no-permission').hide();
880
  jQuery('.b2s-upload-image-free-version-info').hide();
 
 
 
 
881
  jQuery('#b2s-network-select-image').modal('hide');
 
882
  });
883
 
884
  jQuery(document).on('click', '.b2s-upload-image', function () {
@@ -1101,7 +1374,7 @@ jQuery('#b2s-network-list-modal').on('show.bs.modal', function (e) {
1101
 
1102
  jQuery(window).on("load", function () {
1103
  var showMeridian = true;
1104
- if (jQuery('#b2sLang').val() == 'de') {
1105
  showMeridian = false;
1106
  }
1107
  jQuery('.b2s-settings-sched-item-input-time').timepicker({
@@ -1275,7 +1548,7 @@ function init(firstrun) {
1275
  var dateFormat = "yyyy-mm-dd";
1276
  var language = "en";
1277
  var showMeridian = true;
1278
- if (jQuery('#b2sLang').val() == "de") {
1279
  dateFormat = "dd.mm.yyyy";
1280
  language = "de";
1281
  showMeridian = false;
@@ -1361,6 +1634,13 @@ function imageSize() {
1361
  var width = this.naturalWidth;
1362
  var height = this.naturalHeight;
1363
  jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
 
 
 
 
 
 
 
1364
  });
1365
  }
1366
 
@@ -1545,7 +1825,7 @@ function releaseChoose(choose, dataNetworkAuthId, dataNetworkCount) {
1545
  }
1546
 
1547
  var showMeridian = true;
1548
- if (jQuery('#b2sLang').val() == 'de') {
1549
  showMeridian = false;
1550
  }
1551
 
@@ -1764,4 +2044,46 @@ function loginSuccess(networkId, networkType, displayName, networkAuthId, mandan
1764
  jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
1765
  jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
1766
  }
1767
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  jQuery.sceditor.command.set(
55
  "custom-image", {
56
  exec: function () {
57
+ var me = this;
58
+ if (typeof (b2s_is_calendar) != "undefined" && b2s_is_calendar)
59
+ {
60
+ jQuery('.b2s-network-select-image-content').html("");
61
+ jQuery.ajax({
62
+ url: ajaxurl,
63
+ type: "POST",
64
+ cache: false,
65
+ async: false,
66
+ data: {
67
+ 'action': 'b2s_get_image_modal',
68
+ 'id': b2s_current_post_id,
69
+ 'image_url': ''
70
+ },
71
+ success: function (data) {
72
+ jQuery(".b2s-network-select-image-content").html(data);
73
+ }
74
+ });
75
+ }
76
  var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
77
  jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', networkAuthId);
78
  jQuery('.b2s-upload-image').attr('data-network-auth-id', networkAuthId);
81
  jQuery('#b2s-network-select-image').modal('show');
82
  jQuery('#b2sInsertImageType').val("1");
83
  imageSize();
84
+
85
  },
86
  txtExec: function () {
87
  var networkAuthId = jQuery(this.getContentAreaContainer()).parents('.b2s-post-item-details').find('.b2s-post-item-details-network-display-name').attr('data-network-auth-id');
128
  var todayDate = ("0" + today.getDate()).slice(-2);
129
  var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
130
 
131
+ var lang = jQuery('#b2sUserLang').val();
132
  if (lang == "de") {
133
  dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
134
  dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
141
  jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val('1').trigger("change");
142
  jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
143
  var hours = network_type_time.substring(0, 2);
144
+ if (lang == "de") {
145
  var timeparts = network_type_time.split(' ');
146
  hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
147
  }
161
  return false;
162
  });
163
 
164
+
165
+ jQuery(document).on('click', '.b2s-sidbar-network-auth-btn', function () {
166
+ jQuery('#b2s-network-list-modal').modal('show');
167
+ return false;
168
+ });
169
+
170
+ jQuery(document).on('click', '.change-meta-tag', function () {
171
+ var attr = jQuery(this).attr('readonly');
172
+ if (typeof attr !== typeof undefined && attr !== false) {
173
+ jQuery('#b2s-info-change-meta-tag-modal').modal('show');
174
+ }
175
+ return false;
176
+ });
177
+
178
+ // Linkpost change Meta Tags title + desc
179
+ jQuery(document).on('keyup', '.change-meta-tag', function () {
180
+ var currentText = jQuery(this).val();
181
+ var metaTag = jQuery(this).attr('data-meta');
182
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
183
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
184
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
185
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
186
+ if (postFormat == "0") { //if linkpost
187
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
188
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
189
+ //override this content with current content by keyup
190
+ jQuery('.' + metaTag + '[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').val(currentText);
191
+ }
192
+ });
193
+ }
194
+ }
195
+ return false;
196
+ });
197
+
198
+
199
  jQuery(document).on('click', '.b2s-get-settings-sched-time-user', function () {
200
  jQuery('.b2s-server-connection-fail').hide();
201
  jQuery.ajax({
230
  var todayDate = ("0" + today.getDate()).slice(-2);
231
  var dateToday = today.getFullYear() + "-" + todayMonth + "-" + todayDate;
232
 
233
+ var lang = jQuery('#b2sUserLang').val();
234
  if (lang == "de") {
235
  dateTomorrow = tomorrowDate + "." + tomorrowMonth + "." + tomorrow.getFullYear();
236
  dateToday = todayDate + "." + todayMonth + "." + today.getFullYear();
243
  jQuery('.b2s-post-item-details-release-input-date-select[data-network-id="' + network_id + '"][data-network-type="' + count + '"]').val('1').trigger("change");
244
  jQuery('.b2s-post-item-details-release-input-time[data-network-id="' + network_id + '"][data-network-type="' + count + '"][data-network-count="0"]').val(network_type_time);
245
  var hours = network_type_time.substring(0, 2);
246
+ if (lang == "de") {
247
  var timeparts = network_type_time.split(' ');
248
  hours = (timeparts[1] == 'AM') ? hours : (parseInt(hours) + 12);
249
  }
310
  if (dataNetworkCount == 2) {
311
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
312
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="1"]').hide();
313
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').hide();
314
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="2"]').show();
315
  } else if (dataNetworkCount == 1) {
316
  jQuery('.b2s-post-item-details-release-input-add[data-network-count="0"]').hide();
317
+ jQuery('.b2s-post-item-details-release-input-hide[data-network-count="1"]').show();
318
  }
319
  }
320
 
330
  var networkId = jQuery(this).attr("data-network-id");
331
  var networkType = jQuery(this).attr("data-network-type");
332
  var postFormat = jQuery(this).val();
333
+ var networkAuthId = jQuery(this).attr("data-network-auth-id");
334
 
335
  jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
336
  //PostFormat
337
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
338
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
339
  if (jQuery('#user_version').val() >= 2) {
340
+
341
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[postFormat]);
342
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(postFormat);
343
+
344
+ /*
345
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').html(postFormatText[postFormat]);
346
+ jQuery('.b2s-post-item-details-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(postFormat);
347
+ */
348
+
349
  } else {
350
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[postFormat]);
351
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(postFormat);
352
  }
353
  }
354
+
355
+ //Edit Meta Tags
356
+ if (postFormat == '0' && jQuery('#user_version').val() > 0) { //If linkpost
357
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
358
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
359
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
360
+ if (dataMetaType == "og") {
361
+ jQuery('#b2sChangeOgMeta').val("1");
362
+ } else {
363
+ jQuery('#b2sChangeCardMeta').val("1");
 
 
364
  }
365
+
366
+ //Copy from further item meta tags by same network
367
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
368
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
369
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
370
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
371
+
372
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
373
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
374
+
375
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
376
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
377
+ } else {
378
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
379
+ }
380
+
381
+ return true;
382
+ }
383
+ });
384
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
385
+
386
+
387
+ } else {
388
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
389
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
390
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
391
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
392
  }
393
 
394
+ //Change View For Twitter
395
+ //if (postFormat == '0' && networkId == '2') {
396
+ //jQuery('.b2s-image-remove-btn[data-network-id="' + networkId + '"]').hide();
397
+ //jQuery('.b2s-select-image-modal-open[data-network-id="' + networkId + '"]').hide();
398
+ //jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + networkId + '"]').trigger("click");
399
+ //}
400
+ /*if (postFormat == '1' && networkId == '2') {
401
+ jQuery('.b2s-image-remove-btn[data-network-id="' + networkId + '"]').show();
402
+ jQuery('.b2s-select-image-modal-open[data-network-id="' + networkId + '"]').show();
403
+ if (jQuery('#b2s_blog_default_image').val() != "") {
404
+ jQuery('.b2s-post-item-details-url-image[data-network-id="' + networkId + '"]').attr('src', jQuery('#b2s_blog_default_image').val());
405
+ jQuery('.b2s-image-url-hidden-field[data-network-id="' + networkId + '"]').val(jQuery('#b2s_blog_default_image').val());
406
+ }
407
+ }*/
408
+
409
  jQuery('.b2s-user-network-settings-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').removeClass('b2s-settings-checked');
410
  jQuery(this).addClass('b2s-settings-checked');
411
  jQuery('#b2s-post-ship-item-post-format-modal').modal('hide');
 
412
  return false;
413
  });
414
 
465
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').length > 0) {
466
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
467
  if (jQuery('#user_version').val() >= 2) {
468
+
469
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + networkAuthId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
470
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
471
+
472
+ /*
473
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
474
+ jQuery('.b2s-post-item-details-post-format[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
475
+ */
476
+ //if linkpost then show btn meta tags
477
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val() == "0" && jQuery('#user_version').val() > 0) {
478
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
479
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", false);
480
+
481
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').attr("data-meta-type");
482
+ if (dataMetaType == "og") {
483
+ jQuery('#b2sChangeOgMeta').val("1");
484
+ } else {
485
+ jQuery('#b2sChangeCardMeta').val("1");
486
+ }
487
+
488
+ //Copy from further item meta tags by same network
489
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
490
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
491
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
492
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
493
+
494
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
495
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
496
+
497
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
498
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
499
+ } else {
500
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
501
+ }
502
+
503
+ return true;
504
+ }
505
+ });
506
+
507
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
508
+
509
+ } else {
510
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
511
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + networkAuthId + '"]').prop("readonly", true);
512
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
513
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
514
+ }
515
  } else {
516
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val()]);
517
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + networkType + '"][data-network-id="' + networkId + '"]').val());
584
  var dateFormat = "yyyy-mm-dd";
585
  var language = "en";
586
  var showMeridian = true;
587
+ if (jQuery('#b2sUserLang').val() == "de") {
588
  dateFormat = "dd.mm.yyyy";
589
  language = "de";
590
  showMeridian = false;
611
  snapToStep: true
612
  });
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
 
615
+ jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
616
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
 
 
 
 
 
 
617
  });
 
618
  jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
619
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
 
 
 
 
 
 
 
 
 
 
621
  });
622
+
623
+ /*jQuery(".b2s-post-item-details-release-input-date").datepicker().on('changeDate', function (e) {
624
+ var element = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]';
625
+ var dateStr = jQuery(this).val();
626
+ var minStr = jQuery(element).val();
627
+ if (jQuery('#b2sUserLang').val() == 'de') {
628
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
629
+ } else {
630
+ var minParts = minStr.split(' ');
631
+ var minParts2 = minParts[0].split(':');
632
+ if (minParts[1] == 'PM') {
633
+ minParts2[0] = parseInt(minParts2[0]) + 12;
634
+ }
635
+ minStr = minParts2[0] + ':' + minParts2[1];
636
+ }
637
+ var dateObj = new Date();
638
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
639
+ dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
640
+ }
641
+
642
+ if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
643
+ //date in past
644
+ if (dateObj.getUTCMinutes() >= 30) {
645
+ jQuery(element).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
646
+ } else {
647
+ jQuery(element).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
648
+ }
649
+ }
650
+ });*/
651
+
652
+ /*jQuery('.b2s-post-item-details-release-input-time').timepicker().on('changeTime.timepicker', function (e) {
653
+ var dataNetworkAuthId = jQuery(this).attr('data-network-auth-id');
654
+ if (jQuery('.b2s-post-item-details-release-input-date-select[data-network-auth-id="' + dataNetworkAuthId + '"]').val() == "1") {
655
+ var dateStr = jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
656
+ var minStr = jQuery(this).val();
657
+ var timeZone = jQuery('#user_timezone').val();
658
+ if (jQuery('#b2sUserLang').val() == 'de') {
659
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
660
+ } else {
661
+ var minParts = minStr.split(' ');
662
+ var minParts2 = minParts[0].split(':');
663
+ if (minParts[1] == 'PM') {
664
+ minParts2[0] = parseInt(minParts2[0]) + 12;
665
+ }
666
+ minStr = minParts2[0] + ':' + minParts2[1];
667
+ }
668
+ var dateObj = new Date();
669
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
670
+ dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
671
+ }
672
+
673
+ if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
674
+ //date in past
675
+ if (dateObj.getUTCMinutes() >= 30) {
676
+ jQuery(this).timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
677
+ } else {
678
+ jQuery(this).timepicker('setTime', (dateObj.getUTCHours()) + ':30');
679
+ }
680
+ }
681
+ }
682
+ });*/
683
+
684
  //Check Text Limit
685
  var textLimit = jQuery('.b2s-post-item-details-item-message-input[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-text-limit');
686
  if (textLimit != "0") {
706
  if (jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').length > 0) {
707
  var postFormatText = JSON.parse(jQuery('.b2sNetworkSettingsPostFormatText').val());
708
  if (jQuery('#user_version').val() >= 2) {
709
+
710
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-auth-id="' + data.networkAuthId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
711
+ jQuery('.b2s-post-item-details-post-format[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
712
+
713
+ /*
714
+ jQuery('.b2s-post-ship-item-post-format-text[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
715
+ jQuery('.b2s-post-item-details-post-format[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
716
+ */
717
+
718
+ //if linkpost then show btn meta tags
719
+ if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val() == "0") {
720
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
721
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", false);
722
+ var dataMetaType = jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').attr("data-meta-type");
723
+ if (dataMetaType == "og") {
724
+ jQuery('#b2sChangeOgMeta').val("1");
725
+ } else {
726
+ jQuery('#b2sChangeCardMeta').val("1");
727
+ }
728
+
729
+ //Copy from further item meta tags by same network
730
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + data.networkId + ']').each(function () {
731
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != data.networkAuthId) { //other Linkpost by same network
732
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
733
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
734
+
735
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src'));
736
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + data.networkAuthId + '"]').val(jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val());
737
+
738
+ if (jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').is(":visible")) {
739
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').show();
740
+ } else {
741
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + data.networkAuthId + '"]').hide();
742
+ }
743
+
744
+ return true;
745
+ }
746
+ });
747
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').hide();
748
+
749
+ } else {
750
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
751
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').prop("readonly", true);
752
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').show();
753
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + networkAuthId + '"]').trigger("click");
754
+ }
755
+
756
  } else {
757
  jQuery('.b2s-post-ship-item-post-format-text[data-network-id="' + data.networkId + '"]').html(postFormatText[jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val()]);
758
  jQuery('.b2s-post-item-details-post-format[data-network-id="' + data.networkId + '"]').val(jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-type="' + data.networkType + '"][data-network-id="' + data.networkId + '"]').val());
759
  }
760
  //Change View For Twitter
761
+ /*if (jQuery('.b2sNetworkSettingsPostFormatCurrent[data-network-id="' + data.networkId + '"]').val() == '0' && data.networkId == '2') {
762
+ jQuery('.b2s-image-remove-btn[data-network-id="' + data.networkId + '"]').hide();
763
+ jQuery('.b2s-select-image-modal-open[data-network-id="' + data.networkId + '"]').hide();
764
+ jQuery('.b2s-post-item-details-preview-url-reload[data-network-id="' + data.networkId + '"]').trigger("click");
765
+ }*/
766
+
767
  }
768
  }
769
  }
799
  jQuery('.b2s-post-format-settings-info').hide();
800
  jQuery('.b2s-post-format-settings-info[data-network-id="' + jQuery(this).attr('data-network-id') + '"]').show();
801
  jQuery('#b2s-post-ship-item-post-format-modal').modal('show');
802
+ jQuery('.b2s-user-network-settings-post-format').attr('data-network-auth-id', jQuery(this).attr('data-network-auth-id'));
803
  } else {
804
  jQuery('#b2sInfoFormatModal').modal('show');
805
  }
857
  jQuery('#b2s-sched-post-modal').modal('show');
858
  return false;
859
  } else {
860
+ checkSchedDateTime(jQuery(this).attr('data-network-auth-id'));
861
+
862
  //Überprüfen ob Zeit in der Vergangenheit
863
+ /*var dateStr = jQuery('.b2s-post-item-details-release-input-date[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
864
+ var minStr = jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val();
865
+ if (dateStr !== undefined && minStr !== undefined) {
866
+ if (jQuery('#b2sUserLang').val() == 'de') {
867
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
868
+ } else {
869
+ var minParts = minStr.split(' ');
870
+ var minParts2 = minParts[0].split(':');
871
+ if (minParts[1] == 'PM') {
872
+ minParts2[0] = parseInt(minParts2[0]) + 12;
873
+ }
874
+ minStr = minParts2[0] + ':' + minParts2[1];
875
+ }
876
+ var dateObj = new Date();
877
+ if (jQuery('#b2sBlogPostSchedDate').length > 0) {
878
+ dateObj.setTime(jQuery('#b2sBlogPostSchedDate').val());
879
+ }
880
+ if (Date.parse(dateStr + ' ' + minStr + ':00') <= Date.parse(dateObj.getUTCFullYear() + '-' + (dateObj.getUTCMonth() + 1) + '-' + dateObj.getUTCDate() + ' ' + dateObj.getUTCHours() + ':' + dateObj.getUTCMinutes() + ':00')) {
881
+ //date in past
882
+ if (dateObj.getUTCMinutes() >= 30) {
883
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').timepicker('setTime', (dateObj.getUTCHours() + 1) + ':00');
884
+ } else {
885
+ jQuery('.b2s-post-item-details-release-input-time[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').timepicker('setTime', (dateObj.getUTCHours()) + ':30');
886
+ }
887
+ }
888
+ }*/
889
  }
890
  }
891
  releaseChoose(jQuery(this).val(), jQuery(this).attr('data-network-auth-id'), dataNetworkCount);
1006
  success: function (data) {
1007
  jQuery('.b2s-post-item-details-preview-url-reload[data-network-auth-id="' + data.networkAuthId + '"]').removeClass('glyphicon-refresh-animate');
1008
  if (data.result == true) {
1009
+ if (data.networkId == 1 || data.networkId == 2) {
1010
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').val(data.title);
1011
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').val(data.description);
1012
+ } else {
1013
+ jQuery('.b2s-post-item-details-preview-title[data-network-auth-id="' + data.networkAuthId + '"]').html(data.title);
1014
+ jQuery('.b2s-post-item-details-preview-desc[data-network-auth-id="' + data.networkAuthId + '"]').html(data.description);
1015
+ }
1016
+
1017
  if (jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('data-network-image-change') == '0') {
1018
  jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + data.networkAuthId + '"]').attr('src', data.image);
1019
  }
1035
  });
1036
 
1037
  jQuery(document).on('click', '.b2s-select-image-modal-open', function () {
1038
+ var metaType = jQuery(this).attr('data-meta-type');
1039
  var authId = jQuery(this).attr('data-network-auth-id');
1040
  jQuery('.b2s-image-change-this-network').attr('data-network-auth-id', authId);
1041
  jQuery('.b2s-upload-image').attr('data-network-auth-id', authId);
1042
  var content = "<img class='b2s-post-item-network-image-selected-account' height='22px' src='" + jQuery('.b2s-post-item-network-image[data-network-auth-id="' + authId + '"]').attr('src') + "' /> " + jQuery('.b2s-post-item-details-network-display-name[data-network-auth-id="' + authId + '"]').html();
1043
  jQuery('.b2s-selected-network-for-image-info').html(content);
1044
  jQuery('#b2sInsertImageType').val("0");
1045
+
1046
+ if (typeof metaType !== 'undefined') {
1047
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', metaType);
1048
+ } else {
1049
+ jQuery('.b2s-image-change-this-network').attr('data-meta-type', "");
1050
+ }
1051
+
1052
  jQuery('#b2s-network-select-image').modal('show');
1053
  imageSize();
1054
  return false;
1055
  });
1056
 
1057
  jQuery(document).on('click', '.b2s-image-remove-btn', function () {
1058
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1059
+ var defaultImage = jQuery('#b2sDefaultNoImage').val();
1060
+
1061
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', defaultImage);
1062
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val("");
1063
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').hide();
1064
+
1065
+ //add check linkpost change meta tag image for this network
1066
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1067
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1068
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1069
+ if (postFormat == "0") { //if linkpost
1070
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1071
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1072
+ //override this image with current image
1073
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', defaultImage);
1074
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val("");
1075
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').hide();
1076
+ }
1077
+ })
1078
+ }
1079
+ }
1080
+
1081
  return false;
1082
  });
1083
 
1084
  jQuery(document).on('click', '.b2s-image-change-this-network', function () {
1085
+ var networkAuthId = jQuery(this).attr('data-network-auth-id');
1086
+ var currentImage = jQuery('input[name=image_url]:checked').val();
1087
  if (jQuery('#b2sInsertImageType').val() == '1') { //HTML-Network
1088
+ var sceditor = jQuery('.b2s-post-item-details-item-message-input-allow-html[data-network-auth-id="' + networkAuthId + '"]').sceditor('instance');
1089
+ sceditor.insert("<br /><img src='" + currentImage + "'/><br />");
1090
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage); //Torial
1091
 
1092
  } else {
1093
+
1094
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').attr('src', currentImage);
1095
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + networkAuthId + '"]').removeClass('b2s-img-required');
1096
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + networkAuthId + '"]').val(currentImage);
1097
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + networkAuthId + '"]').show();
1098
+
1099
+ if (jQuery(this).attr('data-meta-type') == "og") {
1100
+ jQuery('#b2sChangeOgMeta').val("1");
1101
+ }
1102
+ if (jQuery(this).attr('data-meta-type') == "card") {
1103
+ jQuery('#b2sChangeCardMeta').val("1");
1104
+ }
1105
+
1106
+ //add check linkpost change meta tag image for this network
1107
+ var postFormat = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').val();
1108
+ var networkId = jQuery('.b2s-post-item-details-post-format[data-network-auth-id=' + networkAuthId + ']').attr('data-network-id');
1109
+ if (typeof postFormat !== typeof undefined && postFormat !== false) {
1110
+ if (postFormat == "0") { //if linkpost
1111
+ jQuery('.b2s-post-item-details-post-format[data-network-id=' + networkId + ']').each(function () {
1112
+ if (jQuery(this).val() == "0" && jQuery('.b2s-post-ship-item-post-format[data-network-auth-id=' + jQuery(this).attr('data-network-auth-id') + ']').is(":visible") && jQuery(this).attr('data-network-auth-id') != networkAuthId) { //other Linkpost by same network
1113
+ //override this image with current image
1114
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').attr('src', currentImage);
1115
+ jQuery('.b2s-post-item-details-url-image[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').removeClass('b2s-img-required');
1116
+ jQuery('.b2s-image-url-hidden-field[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').val(currentImage);
1117
+ jQuery('.b2s-image-remove-btn[data-network-auth-id="' + jQuery(this).attr('data-network-auth-id') + '"]').show();
1118
+ }
1119
+ });
1120
+ }
1121
+ }
1122
  }
1123
  jQuery('.b2s-upload-image-invalid-extension').hide();
1124
  jQuery('.b2s-upload-image-no-permission').hide();
1125
  jQuery('.b2s-upload-image-free-version-info').hide();
1126
  jQuery('#b2s-network-select-image').modal('hide');
1127
+ return false;
1128
  });
1129
 
1130
  jQuery(document).on('click', '.b2s-image-change-all-network', function () {
1146
  jQuery('.b2s-upload-image-invalid-extension').hide();
1147
  jQuery('.b2s-upload-image-no-permission').hide();
1148
  jQuery('.b2s-upload-image-free-version-info').hide();
1149
+
1150
+ jQuery('.b2sChangeOgMeta').val("1");
1151
+ jQuery('.b2sChangeCardMeta').val("1");
1152
+
1153
  jQuery('#b2s-network-select-image').modal('hide');
1154
+ return false;
1155
  });
1156
 
1157
  jQuery(document).on('click', '.b2s-upload-image', function () {
1374
 
1375
  jQuery(window).on("load", function () {
1376
  var showMeridian = true;
1377
+ if (jQuery('#b2sUserLang').val() == 'de') {
1378
  showMeridian = false;
1379
  }
1380
  jQuery('.b2s-settings-sched-item-input-time').timepicker({
1548
  var dateFormat = "yyyy-mm-dd";
1549
  var language = "en";
1550
  var showMeridian = true;
1551
+ if (jQuery('#b2sUserLang').val() == "de") {
1552
  dateFormat = "dd.mm.yyyy";
1553
  language = "de";
1554
  showMeridian = false;
1634
  var width = this.naturalWidth;
1635
  var height = this.naturalHeight;
1636
  jQuery(this).parents('.b2s-image-item').find('.b2s-image-item-caption-resolution').html(width + 'x' + height);
1637
+
1638
+ if (width == 0)
1639
+ {
1640
+ setTimeout(function () {
1641
+ imageSize();
1642
+ }, 50);
1643
+ }
1644
  });
1645
  }
1646
 
1825
  }
1826
 
1827
  var showMeridian = true;
1828
+ if (jQuery('#b2sUserLang').val() == 'de') {
1829
  showMeridian = false;
1830
  }
1831
 
2044
  jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').removeAttr('onclick');
2045
  jQuery('.b2s-network-select-btn[data-network-auth-id="' + networkAuthId + '"]').trigger('click');
2046
  }
2047
+ }
2048
+
2049
+ //jQuery(this).attr('data-network-auth-id')
2050
+ function checkSchedDateTime(dataNetworkAuthId) {
2051
+ var dateElement = '.b2s-post-item-details-release-input-date[data-network-auth-id="' + dataNetworkAuthId + '"]';
2052
+ var timeElement = '.b2s-post-item-details-release-input-time[data-network-auth-id="' + dataNetworkAuthId + '"]';
2053
+ var dateStr = jQuery(dateElement).val();
2054
+ var minStr = jQuery(timeElement).val();
2055
+ var timeZone = parseInt(jQuery('#user_timezone').val()) * (-1);
2056
+
2057
+ if (jQuery('#b2sUserLang').val() == 'de') {
2058
+ dateStr = dateStr.substring(6, 10) + '-' + dateStr.substring(3, 5) + '-' + dateStr.substring(0, 2);
2059
+ } else {
2060
+ var minParts = minStr.split(' ');
2061
+ var minParts2 = minParts[0].split(':');
2062
+ if (minParts[1] == 'PM') {
2063
+ minParts2[0] = parseInt(minParts2[0]) + 12;
2064
+ }
2065
+ minStr = minParts2[0] + ':' + minParts2[1];
2066
+ }
2067
+
2068
+ var minParts3 = minStr.split(':');
2069
+ if (minParts3[0] < 10) {
2070
+ minParts3[0] = '0' + minParts3[0];
2071
+ }
2072
+ var dateParts = dateStr.split('-');
2073
+
2074
+ //utc current time
2075
+ var now = new Date();
2076
+ //offset between utc und user
2077
+ var offset = (parseInt(now.getTimezoneOffset()) / 60) * (-1);
2078
+ //enter hour to user time
2079
+ var hour = parseInt(minParts3[0]) + timeZone + offset;
2080
+ //calculate datetime in utc
2081
+ var enter = new Date(dateParts[0], dateParts[1] - 1, dateParts[2], hour, minParts3[1]);
2082
+ //compare enter date time with allowed user time
2083
+ if (enter.getTime() < now.getTime()) {
2084
+ //enter set on next 15 minutes and calculate on user timezone
2085
+ enter.setTime(now.getTime() + (900000 - (now.getTime() % 900000)) - (3600000 * (timeZone + offset)));
2086
+ jQuery(dateElement).datepicker('update', enter);
2087
+ jQuery(timeElement).timepicker('setTime', enter);
2088
+ }
2089
+ }
assets/js/b2s/wp/post-meta-box-auto.js CHANGED
@@ -46,7 +46,7 @@ jQuery(window).on("load", function () {
46
  today.setMinutes(30);
47
  }
48
  var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
49
- if (jQuery('#b2sLang').val() == 'de') {
50
  setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
51
  }
52
  jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
@@ -101,7 +101,7 @@ jQuery(document).on('click', '#b2s-post-meta-box-time-dropdown-publish', functio
101
  today.setMinutes(30);
102
  }
103
  var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
104
- if (jQuery('#b2sLang').val() == 'de') {
105
  setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
106
  }
107
  jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
46
  today.setMinutes(30);
47
  }
48
  var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
49
+ if (jQuery('#b2sUserLang').val() == 'de') {
50
  setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
51
  }
52
  jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
101
  today.setMinutes(30);
102
  }
103
  var setTodayDate = today.getFullYear() + '-' + (padDate(today.getMonth() + 1)) + '-' + padDate(today.getDate()) + ' ' + formatAMPM(today);
104
+ if (jQuery('#b2sUserLang').val() == 'de') {
105
  setTodayDate = padDate(today.getDate()) + '.' + (padDate(today.getMonth() + 1)) + '.' + today.getFullYear() + ' ' + padDate(today.getHours()) + ':' + padDate(today.getMinutes());
106
  }
107
  jQuery('#b2s-post-meta-box-sched-date-picker').val(setTodayDate);
assets/lib/fullcalendar/CHANGELOG.txt ADDED
@@ -0,0 +1,1160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ v3.4.0 (2017-04-27)
3
+ -------------------
4
+
5
+ - composer.js for Composer (PHP package manager) (#3617)
6
+ - fix toISOString for locales with non-trivial postformatting (#3619)
7
+ - fix for nested inverse-background events (#3609)
8
+ - Estonian locale (#3600)
9
+ - fixed Latvian localization (#3525)
10
+ - internal refactor of async systems
11
+
12
+
13
+ v3.3.1 (2017-04-01)
14
+ -------------------
15
+
16
+ Bugfixes:
17
+ - stale calendar title when navigate away from then back to the a view (#3604)
18
+ - js error when gotoDate immediately after calendar initialization (#3598)
19
+ - agenda view scrollbars causes misalignment in jquery 3.2.1 (#3612)
20
+ - navigation bug when trying to navigate to a day of another week (#3610)
21
+ - dateIncrement not working when duration and dateIncrement have different units
22
+
23
+
24
+ v3.3.0 (2017-03-23)
25
+ -------------------
26
+
27
+ Features:
28
+ - `visibleRange` - complete control over view's date range (#2847, #3105, #3245)
29
+ - `validRange` - restrict date range (#429)
30
+ - `changeView` - pass in a date or visibleRange as second param (#3366)
31
+ - `dateIncrement` - customize prev/next jump (#2710)
32
+ - `dateAlignment` - custom view alignment, like start-of-week (#3113)
33
+ - `dayCount` - force a fixed number-of-days, even with hiddenDays (#2753)
34
+ - `showNonCurrentDates` - option to hide day cells for prev/next months (#437)
35
+ - can define a defaultView with a duration/visibleRange/dayCount with needing
36
+ to create a custom view in the `views` object. Known as a "Generic View".
37
+
38
+ Behavior Changes:
39
+ - when custom view is specified with duration `{days:7}`,
40
+ it will no longer align with the start of the week. (#2847)
41
+ - when `gotoDate` is called on a custom view with a duration of multiple days,
42
+ the view will always shift to begin with the given date. (#3515)
43
+
44
+ Bugfixes:
45
+ - event rendering when excessive `minTime`/`maxTime` (#2530)
46
+ - event dragging not shown when excessive `minTime`/`maxTime` (#3055)
47
+ - excessive `minTime`/`maxTime` not reflected in event fetching (#3514)
48
+ - when minTime is negative, or maxTime beyond 24 hours, when event data is requested
49
+ via a function or a feed, the given data params will have time parts.
50
+ - external event dragging via touchpunch broken (#3544)
51
+ - can't make an immediate new selection after existing selection, with mouse.
52
+ introduced in v3.2.0 (#3558)
53
+
54
+
55
+ v3.2.0 (2017-02-14)
56
+ -------------------
57
+
58
+ Features:
59
+ - `selectMinDistance`, threshold before a mouse selection begins (#2428)
60
+
61
+ Bugfixes:
62
+ - iOS 10, unwanted scrolling while dragging events/selection (#3403)
63
+ - dayClick triggered when swiping on touch devices (#3332)
64
+ - dayClick not functioning on Firefix mobile (#3450)
65
+ - title computed incorrectly for views with no weekends (#2884)
66
+ - unwanted scrollbars in month-view when non-integer width (#3453, #3444)
67
+ - incorrect date formatting for locales with non-standlone month/day names (#3478)
68
+ - date formatting, incorrect omission of trailing period for certain locales (#2504, #3486)
69
+ - formatRange should collapse same week numbers (#3467)
70
+ - Taiwanese locale updated (#3426)
71
+ - Finnish noEventsMessage updated (#3476)
72
+ - Croatian (hr) buttonText is blank (#3270)
73
+ - JSON feed PHP example, date range math bug (#3485)
74
+
75
+
76
+ v3.1.0 (2016-12-05)
77
+ -------------------
78
+
79
+ - experimental support for implicitly batched ("debounced") event rendering (#2938)
80
+ - `eventRenderWait` (off by default)
81
+ - new `footer` option, similar to header toolbar (#654, #3299)
82
+ - event rendering batch methods (#3351):
83
+ - `renderEvents`
84
+ - `updateEvents`
85
+ - more granular touch settings (#3377):
86
+ - `eventLongPressDelay`
87
+ - `selectLongPressDelay`
88
+ - eventDestroy not called when removing the popover (#3416, #3419)
89
+ - print stylesheet and gcal extension now offered as minified (#3415)
90
+ - fc-today in agenda header cells (#3361, #3365)
91
+ - height-related options in tandem with other options (#3327, #3384)
92
+ - Kazakh locale (#3394)
93
+ - Afrikaans locale (#3390)
94
+ - internal refactor related to timing of rendering and firing handlers.
95
+ calls to rerender the current date-range and events from within handlers
96
+ might not execute immediately. instead, will execute after handler finishes.
97
+
98
+
99
+ v3.0.1 (2016-09-26)
100
+ -------------------
101
+
102
+ Bugfixes:
103
+ - list view rendering event times incorrectly (#3334)
104
+ - list view rendering events/days out of order (#3347)
105
+ - events with no title rendering as "undefined"
106
+ - add .fc scope to table print styles (#3343)
107
+ - "display no events" text fix for German (#3354)
108
+
109
+
110
+ v3.0.0 (2016-09-04)
111
+ -------------------
112
+
113
+ Features:
114
+ - List View (#560)
115
+ - new views: `listDay`, `listWeek`, `listMonth`, `listYear`, and simply `list`
116
+ - `listDayFormat`
117
+ - `listDayAltFormat`
118
+ - `noEventsMessage`
119
+ - Clickable day/week numbers for easier navigation (#424)
120
+ - `navLinks`
121
+ - `navLinkDayClick`
122
+ - `navLinkWeekClick`
123
+ - Programmatically allow/disallow user interactions:
124
+ - `eventAllow` (#2740)
125
+ - `selectAllow` (#2511)
126
+ - Option to display week numbers in cells (#3024)
127
+ - `weekNumbersWithinDays` (set to `true` to activate)
128
+ - When week calc is ISO, default first day-of-week to Monday (#3255)
129
+ - Macedonian locale (#2739)
130
+ - Malay locale
131
+
132
+ Breaking Changes:
133
+ - IE8 support dropped
134
+ - jQuery: minimum support raised to v2.0.0
135
+ - MomentJS: minimum support raised to v2.9.0
136
+ - `lang` option renamed to `locale`
137
+ - dist files have been renamed to be more consistent with MomentJS:
138
+ - `lang/` -> `locale/`
139
+ - `lang-all.js` -> `locale-all.js`
140
+ - behavior of moment methods no longer affected by ambiguousness:
141
+ - `isSame`
142
+ - `isBefore`
143
+ - `isAfter`
144
+ - View-Option-Hashes no longer supported (deprecated in 2.2.4)
145
+ - removed `weekMode` setting
146
+ - removed `axisFormat` setting
147
+ - DOM structure of month/basic-view day cell numbers changed
148
+
149
+ Bugfixes:
150
+ - `$.fullCalendar.version` incorrect (#3292)
151
+
152
+ Build System:
153
+ - using gulp instead of grunt (faster)
154
+ - using npm internally for dependencies instead of bower
155
+ - changed repo directory structure
156
+
157
+
158
+ v2.9.1 (2016-07-31)
159
+ -------------------
160
+
161
+ - multiple definitions for businessHours (#2686)
162
+ - businessHours for single day doesn't display weekends (#2944)
163
+ - height/contentHeight can accept a function or 'parent' for dynamic value (#3271)
164
+ - fix +more popover clipped by overflow (#3232)
165
+ - fix +more popover positioned incorrectly when scrolled (#3137)
166
+ - Norwegian Nynorsk translation (#3246)
167
+ - fix isAnimating JS error (#3285)
168
+
169
+
170
+ v2.9.0 (2016-07-10)
171
+ -------------------
172
+
173
+ - Setters for (almost) all options (#564).
174
+ See [docs](http://fullcalendar.io/docs/utilities/dynamic_options/) for more info.
175
+ - Travis CI improvements (#3266)
176
+
177
+
178
+ v2.8.0 (2016-06-19)
179
+ -------------------
180
+
181
+ - getEventSources method (#3103, #2433)
182
+ - getEventSourceById method (#3223)
183
+ - refetchEventSources method (#3103, #1328, #254)
184
+ - removeEventSources method (#3165, #948)
185
+ - prevent flicker when refetchEvents is called (#3123, #2558)
186
+ - fix for removing event sources that share same URL (#3209)
187
+ - jQuery 3 support (#3197, #3124)
188
+ - Travis CI integration (#3218)
189
+ - EditorConfig for promoting consistent code style (#141)
190
+ - use en dash when formatting ranges (#3077)
191
+ - height:auto always shows scrollbars in month view on FF (#3202)
192
+ - new languages:
193
+ - Basque (#2992)
194
+ - Galician (#194)
195
+ - Luxembourgish (#2979)
196
+
197
+
198
+ v2.7.3 (2016-06-02)
199
+ -------------------
200
+
201
+ internal enhancements that plugins can benefit from:
202
+ - EventEmitter not correctly working with stopListeningTo
203
+ - normalizeEvent hook for manipulating event data
204
+
205
+
206
+ v2.7.2 (2016-05-20)
207
+ -------------------
208
+
209
+ - fixed desktops/laptops with touch support not accepting mouse events for
210
+ dayClick/dragging/resizing (#3154, #3149)
211
+ - fixed dayClick incorrectly triggered on touch scroll (#3152)
212
+ - fixed touch event dragging wrongfully beginning upon scrolling document (#3160)
213
+ - fixed minified JS still contained comments
214
+ - UI change: mouse users must hover over an event to reveal its resizers
215
+
216
+
217
+ v2.7.1 (2016-05-01)
218
+ -------------------
219
+
220
+ - dayClick not firing on touch devices (#3138)
221
+ - icons for prev/next not working in MS Edge (#2852)
222
+ - fix bad languages troubles with firewalls (#3133, #3132)
223
+ - update all dev dependencies (#3145, #3010, #2901, #251)
224
+ - git-ignore npm debug logs (#3011)
225
+ - misc automated test updates (#3139, #3147)
226
+ - Google Calendar htmlLink not always defined (#2844)
227
+
228
+
229
+ v2.7.0 (2016-04-23)
230
+ -------------------
231
+
232
+ touch device support (#994):
233
+ - smoother scrolling
234
+ - interactions initiated via "long press":
235
+ - event drag-n-drop
236
+ - event resize
237
+ - time-range selecting
238
+ - `longPressDelay`
239
+
240
+
241
+ v2.6.1 (2016-02-17)
242
+ -------------------
243
+
244
+ - make `nowIndicator` positioning refresh on window resize
245
+
246
+
247
+ v2.6.0 (2016-01-07)
248
+ -------------------
249
+
250
+ - current time indicator (#414)
251
+ - bundled with most recent version of moment (2.11.0)
252
+ - UMD wrapper around lang files now handles commonjs (#2918)
253
+ - fix bug where external event dragging would not respect eventOverlap
254
+ - fix bug where external event dropping would not render the whole-day highlight
255
+
256
+
257
+ v2.5.0 (2015-11-30)
258
+ -------------------
259
+
260
+ - internal timezone refactor. fixes #2396, #2900, #2945, #2711
261
+ - internal "grid" system refactor. improved API for plugins.
262
+
263
+
264
+ v2.4.0 (2015-08-16)
265
+ -------------------
266
+
267
+ - add new buttons to the header via `customButtons` ([225])
268
+ - control stacking order of events via `eventOrder` ([364])
269
+ - control frequency of slot text via `slotLabelInterval` ([946])
270
+ - `displayEventTime` ([1904])
271
+ - `on` and `off` methods ([1910])
272
+ - renamed `axisFormat` to `slotLabelFormat`
273
+
274
+ [225]: https://code.google.com/p/fullcalendar/issues/detail?id=225
275
+ [364]: https://code.google.com/p/fullcalendar/issues/detail?id=364
276
+ [946]: https://code.google.com/p/fullcalendar/issues/detail?id=946
277
+ [1904]: https://code.google.com/p/fullcalendar/issues/detail?id=1904
278
+ [1910]: https://code.google.com/p/fullcalendar/issues/detail?id=1910
279
+
280
+
281
+ v2.3.2 (2015-06-14)
282
+ -------------------
283
+
284
+ - minor code adjustment in preparation for plugins
285
+
286
+
287
+ v2.3.1 (2015-03-08)
288
+ -------------------
289
+
290
+ - Fix week view column title for en-gb ([PR220])
291
+ - Publish to NPM ([2447])
292
+ - Detangle bower from npm package ([PR179])
293
+
294
+ [PR220]: https://github.com/arshaw/fullcalendar/pull/220
295
+ [2447]: https://code.google.com/p/fullcalendar/issues/detail?id=2447
296
+ [PR179]: https://github.com/arshaw/fullcalendar/pull/179
297
+
298
+
299
+ v2.3.0 (2015-02-21)
300
+ -------------------
301
+
302
+ - internal refactoring in preparation for other views
303
+ - businessHours now renders on whole-days in addition to timed areas
304
+ - events in "more" popover not sorted by time ([2385])
305
+ - avoid using moment's deprecated zone method ([2443])
306
+ - destroying the calendar sometimes causes all window resize handlers to be unbound ([2432])
307
+ - multiple calendars on one page, can't accept external elements after navigating ([2433])
308
+ - accept external events from jqui sortable ([1698])
309
+ - external jqui drop processed before reverting ([1661])
310
+ - IE8 fix: month view renders incorrectly ([2428])
311
+ - IE8 fix: eventLimit:true wouldn't activate "more" link ([2330])
312
+ - IE8 fix: dragging an event with an href
313
+ - IE8 fix: invisible element while dragging agenda view events
314
+ - IE8 fix: erratic external element dragging
315
+
316
+ [2385]: https://code.google.com/p/fullcalendar/issues/detail?id=2385
317
+ [2443]: https://code.google.com/p/fullcalendar/issues/detail?id=2443
318
+ [2432]: https://code.google.com/p/fullcalendar/issues/detail?id=2432
319
+ [2433]: https://code.google.com/p/fullcalendar/issues/detail?id=2433
320
+ [1698]: https://code.google.com/p/fullcalendar/issues/detail?id=1698
321
+ [1661]: https://code.google.com/p/fullcalendar/issues/detail?id=1661
322
+ [2428]: https://code.google.com/p/fullcalendar/issues/detail?id=2428
323
+ [2330]: https://code.google.com/p/fullcalendar/issues/detail?id=2330
324
+
325
+
326
+ v2.2.7 (2015-02-10)
327
+ -------------------
328
+
329
+ - view.title wasn't defined in viewRender callback ([2407])
330
+ - FullCalendar versions >= 2.2.5 brokenness with Moment versions <= 2.8.3 ([2417])
331
+ - Support Bokmal Norwegian language specifically ([2427])
332
+
333
+ [2407]: https://code.google.com/p/fullcalendar/issues/detail?id=2407
334
+ [2417]: https://code.google.com/p/fullcalendar/issues/detail?id=2417
335
+ [2427]: https://code.google.com/p/fullcalendar/issues/detail?id=2427
336
+
337
+
338
+ v2.2.6 (2015-01-11)
339
+ -------------------
340
+
341
+ - Compatibility with Moment v2.9. Was breaking GCal plugin ([2408])
342
+ - View object's `title` property mistakenly omitted ([2407])
343
+ - Single-day views with hiddens days could cause prev/next misbehavior ([2406])
344
+ - Don't let the current date ever be a hidden day (solves [2395])
345
+ - Hebrew locale ([2157])
346
+
347
+ [2408]: https://code.google.com/p/fullcalendar/issues/detail?id=2408
348
+ [2407]: https://code.google.com/p/fullcalendar/issues/detail?id=2407
349
+ [2406]: https://code.google.com/p/fullcalendar/issues/detail?id=2406
350
+ [2395]: https://code.google.com/p/fullcalendar/issues/detail?id=2395
351
+ [2157]: https://code.google.com/p/fullcalendar/issues/detail?id=2157
352
+
353
+
354
+ v2.2.5 (2014-12-30)
355
+ -------------------
356
+
357
+ - `buttonText` specified for custom views via the `views` option
358
+ - bugfix: wrong default value, couldn't override default
359
+ - feature: default value taken from locale
360
+
361
+
362
+ v2.2.4 (2014-12-29)
363
+ -------------------
364
+
365
+ - Arbitrary durations for basic/agenda views with the `views` option ([692])
366
+ - Specify view-specific options using the `views` option. fixes [2283]
367
+ - Deprecate view-option-hashes
368
+ - Formalize and expose View API ([1055])
369
+ - updateEvent method, more intuitive behavior. fixes [2194]
370
+
371
+ [692]: https://code.google.com/p/fullcalendar/issues/detail?id=692
372
+ [2283]: https://code.google.com/p/fullcalendar/issues/detail?id=2283
373
+ [1055]: https://code.google.com/p/fullcalendar/issues/detail?id=1055
374
+ [2194]: https://code.google.com/p/fullcalendar/issues/detail?id=2194
375
+
376
+
377
+ v2.2.3 (2014-11-26)
378
+ -------------------
379
+
380
+ - removeEventSource with Google Calendar object source, would not remove ([2368])
381
+ - Events with invalid end dates are still accepted and rendered ([2350], [2237], [2296])
382
+ - Bug when rendering business hours and navigating away from original view ([2365])
383
+ - Links to Google Calendar events will use current timezone ([2122])
384
+ - Google Calendar plugin works with timezone names that have spaces
385
+ - Google Calendar plugin accepts person email addresses as calendar IDs
386
+ - Internally use numeric sort instead of alphanumeric sort ([2370])
387
+
388
+ [2368]: https://code.google.com/p/fullcalendar/issues/detail?id=2368
389
+ [2350]: https://code.google.com/p/fullcalendar/issues/detail?id=2350
390
+ [2237]: https://code.google.com/p/fullcalendar/issues/detail?id=2237
391
+ [2296]: https://code.google.com/p/fullcalendar/issues/detail?id=2296
392
+ [2365]: https://code.google.com/p/fullcalendar/issues/detail?id=2365
393
+ [2122]: https://code.google.com/p/fullcalendar/issues/detail?id=2122
394
+ [2370]: https://code.google.com/p/fullcalendar/issues/detail?id=2370
395
+
396
+
397
+ v2.2.2 (2014-11-19)
398
+ -------------------
399
+
400
+ - Fixes to Google Calendar API V3 code
401
+ - wouldn't recognize a lone-string Google Calendar ID if periods before the @ symbol
402
+ - removeEventSource wouldn't work when given a Google Calendar ID
403
+
404
+
405
+ v2.2.1 (2014-11-19)
406
+ -------------------
407
+
408
+ - Migrate Google Calendar plugin to use V3 of the API ([1526])
409
+
410
+ [1526]: https://code.google.com/p/fullcalendar/issues/detail?id=1526
411
+
412
+
413
+ v2.2.0 (2014-11-14)
414
+ -------------------
415
+
416
+ - Background events. Event object's `rendering` property ([144], [1286])
417
+ - `businessHours` option ([144])
418
+ - Controlling where events can be dragged/resized and selections can go ([396], [1286], [2253])
419
+ - `eventOverlap`, `selectOverlap`, and similar
420
+ - `eventConstraint`, `selectConstraint`, and similar
421
+ - Improvements to dragging and dropping external events ([2004])
422
+ - Associating with real event data. used with `eventReceive`
423
+ - Associating a `duration`
424
+ - Performance boost for moment creation
425
+ - Be aware, FullCalendar-specific methods now attached directly to global moment.fn
426
+ - Helps with [issue 2259][2259]
427
+ - Reintroduced forgotten `dropAccept` option ([2312])
428
+
429
+ [144]: https://code.google.com/p/fullcalendar/issues/detail?id=144
430
+ [396]: https://code.google.com/p/fullcalendar/issues/detail?id=396
431
+ [1286]: https://code.google.com/p/fullcalendar/issues/detail?id=1286
432
+ [2004]: https://code.google.com/p/fullcalendar/issues/detail?id=2004
433
+ [2253]: https://code.google.com/p/fullcalendar/issues/detail?id=2253
434
+ [2259]: https://code.google.com/p/fullcalendar/issues/detail?id=2259
435
+ [2312]: https://code.google.com/p/fullcalendar/issues/detail?id=2312
436
+
437
+
438
+ v2.1.1 (2014-08-29)
439
+ -------------------
440
+
441
+ - removeEventSource not working with array ([2203])
442
+ - mouseout not triggered after mouseover+updateEvent ([829])
443
+ - agenda event's render with no <a> href, not clickable ([2263])
444
+
445
+ [2203]: https://code.google.com/p/fullcalendar/issues/detail?id=2203
446
+ [829]: https://code.google.com/p/fullcalendar/issues/detail?id=829
447
+ [2263]: https://code.google.com/p/fullcalendar/issues/detail?id=2263
448
+
449
+
450
+ v2.1.0 (2014-08-25)
451
+ -------------------
452
+
453
+ Large code refactor with better OOP, better code reuse, and more comments.
454
+ **No more reliance on jQuery UI** for event dragging, resizing, or anything else.
455
+
456
+ Significant changes to HTML/CSS skeleton:
457
+ - Leverages tables for liquid rendering of days and events. No costly manual repositioning ([809])
458
+ - **Backwards-incompatibilities**:
459
+ - **Many classNames have changed. Custom CSS will likely need to be adjusted.**
460
+ - IE7 definitely not supported anymore
461
+ - In `eventRender` callback, `element` will not be attached to DOM yet
462
+ - Events are styled to be one line by default ([1992]). Can be undone through custom CSS,
463
+ but not recommended (might get gaps [like this][111] in certain situations).
464
+
465
+ A "more..." link when there are too many events on a day ([304]). Works with month and basic views
466
+ as well as the all-day section of the agenda views. New options:
467
+ - `eventLimit`. a number or `true`
468
+ - `eventLimitClick`. the `"popover`" value will reveal all events in a raised panel (the default)
469
+ - `eventLimitText`
470
+ - `dayPopoverFormat`
471
+
472
+ Changes related to height and scrollbars:
473
+ - `aspectRatio`/`height`/`contentHeight` values will be honored *no matter what*
474
+ - If too many events causing too much vertical space, scrollbars will be used ([728]).
475
+ This is default behavior for month view (**backwards-incompatibility**)
476
+ - If too few slots in agenda view, view will stretch to be the correct height ([2196])
477
+ - `'auto'` value for `height`/`contentHeight` options. If content is too tall, the view will
478
+ vertically stretch to accomodate and no scrollbars will be used ([521]).
479
+ - Tall weeks in month view will borrow height from other weeks ([243])
480
+ - Automatically scroll the view then dragging/resizing an event ([1025], [2078])
481
+ - New `fixedWeekCount` option to determines the number of weeks in month view
482
+ - Supersedes `weekMode` (**deprecated**). Instead, use a combination of `fixedWeekCount` and
483
+ one of the height options, possibly with an `'auto'` value
484
+
485
+ Much nicer, glitch-free rendering of calendar *for printers* ([35]). Things you might not expect:
486
+ - Buttons will become hidden
487
+ - Agenda views display a flat list of events where the time slots would be
488
+
489
+ Other issues resolved along the way:
490
+ - Space on right side of agenda events configurable through CSS ([204])
491
+ - Problem with window resize ([259])
492
+ - Events sorting stays consistent across weeks ([510])
493
+ - Agenda's columns misaligned on wide screens ([511])
494
+ - Run `selectHelper` through `eventRender` callbacks ([629])
495
+ - Keyboard access, tabbing ([637])
496
+ - Run resizing events through `eventRender` ([714])
497
+ - Resize an event to a different day in agenda views ([736])
498
+ - Allow selection across days in agenda views ([778])
499
+ - Mouseenter delegated event not working on event elements ([936])
500
+ - Agenda event dragging, snapping to different columns is erratic ([1101])
501
+ - Android browser cuts off Day view at 8 PM with no scroll bar ([1203])
502
+ - Don't fire `eventMouseover`/`eventMouseout` while dragging/resizing ([1297])
503
+ - Customize the resize handle text ("=") ([1326])
504
+ - If agenda event is too short, don't overwrite `.fc-event-time` ([1700])
505
+ - Zooming calendar causes events to misalign ([1996])
506
+ - Event destroy callback on event removal ([2017])
507
+ - Agenda views, when RTL, should have axis on right ([2132])
508
+ - Make header buttons more accessibile ([2151])
509
+ - daySelectionMousedown should interpret OSX ctrl+click as a right mouse click ([2169])
510
+ - Best way to display time text on multi-day events *with times* ([2172])
511
+ - Eliminate table use for header layout ([2186])
512
+ - Event delegation used for event-related callbacks (like `eventClick`). Speedier.
513
+
514
+ [35]: https://code.google.com/p/fullcalendar/issues/detail?id=35
515
+ [204]: https://code.google.com/p/fullcalendar/issues/detail?id=204
516
+ [243]: https://code.google.com/p/fullcalendar/issues/detail?id=243
517
+ [259]: https://code.google.com/p/fullcalendar/issues/detail?id=259
518
+ [304]: https://code.google.com/p/fullcalendar/issues/detail?id=304
519
+ [510]: https://code.google.com/p/fullcalendar/issues/detail?id=510
520
+ [511]: https://code.google.com/p/fullcalendar/issues/detail?id=511
521
+ [521]: https://code.google.com/p/fullcalendar/issues/detail?id=521
522
+ [629]: https://code.google.com/p/fullcalendar/issues/detail?id=629
523
+ [637]: https://code.google.com/p/fullcalendar/issues/detail?id=637
524
+ [714]: https://code.google.com/p/fullcalendar/issues/detail?id=714
525
+ [728]: https://code.google.com/p/fullcalendar/issues/detail?id=728
526
+ [736]: https://code.google.com/p/fullcalendar/issues/detail?id=736
527
+ [778]: https://code.google.com/p/fullcalendar/issues/detail?id=778
528
+ [809]: https://code.google.com/p/fullcalendar/issues/detail?id=809
529
+ [936]: https://code.google.com/p/fullcalendar/issues/detail?id=936
530
+ [1025]: https://code.google.com/p/fullcalendar/issues/detail?id=1025
531
+ [1101]: https://code.google.com/p/fullcalendar/issues/detail?id=1101
532
+ [1203]: https://code.google.com/p/fullcalendar/issues/detail?id=1203
533
+ [1297]: https://code.google.com/p/fullcalendar/issues/detail?id=1297
534
+ [1326]: https://code.google.com/p/fullcalendar/issues/detail?id=1326
535
+ [1700]: https://code.google.com/p/fullcalendar/issues/detail?id=1700
536
+ [1992]: https://code.google.com/p/fullcalendar/issues/detail?id=1992
537
+ [1996]: https://code.google.com/p/fullcalendar/issues/detail?id=1996
538
+ [2017]: https://code.google.com/p/fullcalendar/issues/detail?id=2017
539
+ [2078]: https://code.google.com/p/fullcalendar/issues/detail?id=2078
540
+ [2132]: https://code.google.com/p/fullcalendar/issues/detail?id=2132
541
+ [2151]: https://code.google.com/p/fullcalendar/issues/detail?id=2151
542
+ [2169]: https://code.google.com/p/fullcalendar/issues/detail?id=2169
543
+ [2172]: https://code.google.com/p/fullcalendar/issues/detail?id=2172
544
+ [2186]: https://code.google.com/p/fullcalendar/issues/detail?id=2186
545
+ [2196]: https://code.google.com/p/fullcalendar/issues/detail?id=2196
546
+ [111]: https://code.google.com/p/fullcalendar/issues/detail?id=111
547
+
548
+
549
+ v2.0.3 (2014-08-15)
550
+ -------------------
551
+
552
+ - moment-2.8.1 compatibility ([2221])
553
+ - relative path in bower.json ([PR 117])
554
+ - upgraded jquery-ui and misc dev dependencies
555
+
556
+ [2221]: https://code.google.com/p/fullcalendar/issues/detail?id=2221
557
+ [PR 117]: https://github.com/arshaw/fullcalendar/pull/177
558
+
559
+
560
+ v2.0.2 (2014-06-24)
561
+ -------------------
562
+
563
+ - bug with persisting addEventSource calls ([2191])
564
+ - bug with persisting removeEvents calls with an array source ([2187])
565
+ - bug with removeEvents method when called with 0 removes all events ([2082])
566
+
567
+ [2191]: https://code.google.com/p/fullcalendar/issues/detail?id=2191
568
+ [2187]: https://code.google.com/p/fullcalendar/issues/detail?id=2187
569
+ [2082]: https://code.google.com/p/fullcalendar/issues/detail?id=2082
570
+
571
+
572
+ v2.0.1 (2014-06-15)
573
+ -------------------
574
+
575
+ - `delta` parameters reintroduced in `eventDrop` and `eventResize` handlers ([2156])
576
+ - **Note**: this changes the argument order for `revertFunc`
577
+ - wrongfully triggering a windowResize when resizing an agenda view event ([1116])
578
+ - `this` values in event drag-n-drop/resize handlers consistently the DOM node ([1177])
579
+ - `displayEventEnd` - v2 workaround to force display of an end time ([2090])
580
+ - don't modify passed-in eventSource items ([954])
581
+ - destroy method now removes fc-ltr class ([2033])
582
+ - weeks of last/next month still visible when weekends are hidden ([2095])
583
+ - fixed memory leak when destroying calendar with selectable/droppable ([2137])
584
+ - Icelandic language ([2180])
585
+ - Bahasa Indonesia language ([PR 172])
586
+
587
+ [1116]: https://code.google.com/p/fullcalendar/issues/detail?id=1116
588
+ [1177]: https://code.google.com/p/fullcalendar/issues/detail?id=1177
589
+ [2090]: https://code.google.com/p/fullcalendar/issues/detail?id=2090
590
+ [954]: https://code.google.com/p/fullcalendar/issues/detail?id=954
591
+ [2033]: https://code.google.com/p/fullcalendar/issues/detail?id=2033
592
+ [2095]: https://code.google.com/p/fullcalendar/issues/detail?id=2095
593
+ [2137]: https://code.google.com/p/fullcalendar/issues/detail?id=2137
594
+ [2156]: https://code.google.com/p/fullcalendar/issues/detail?id=2156
595
+ [2180]: https://code.google.com/p/fullcalendar/issues/detail?id=2180
596
+ [PR 172]: https://github.com/arshaw/fullcalendar/pull/172
597
+
598
+
599
+ v2.0.0 (2014-06-01)
600
+ -------------------
601
+
602
+ Internationalization support, timezone support, and [MomentJS] integration. Extensive changes, many
603
+ of which are backwards incompatible.
604
+
605
+ [Full list of changes][Upgrading-to-v2] | [Affected Issues][Date-Milestone]
606
+
607
+ An automated testing framework has been set up ([Karma] + [Jasmine]) and tests have been written
608
+ which cover about half of FullCalendar's functionality. Special thanks to @incre-d, @vidbina, and
609
+ @sirrocco for the help.
610
+
611
+ In addition, the main development repo has been repurposed to also include the built distributable
612
+ JS/CSS for the project and will serve as the new [Bower] endpoint.
613
+
614
+ [MomentJS]: http://momentjs.com/
615
+ [Upgrading-to-v2]: http://arshaw.com/fullcalendar/wiki/Upgrading-to-v2/
616
+ [Date-Milestone]: https://code.google.com/p/fullcalendar/issues/list?can=1&q=milestone%3Ddate
617
+ [Karma]: http://karma-runner.github.io/
618
+ [Jasmine]: http://jasmine.github.io/
619
+ [Bower]: http://bower.io/
620
+
621
+
622
+ v1.6.4 (2013-09-01)
623
+ -------------------
624
+
625
+ - better algorithm for positioning timed agenda events ([1115])
626
+ - `slotEventOverlap` option to tweak timed agenda event overlapping ([218])
627
+ - selection bug when slot height is customized ([1035])
628
+ - supply view argument in `loading` callback ([1018])
629
+ - fixed week number not displaying in agenda views ([1951])
630
+ - fixed fullCalendar not initializing with no options ([1356])
631
+ - NPM's `package.json`, no more warnings or errors ([1762])
632
+ - building the bower component should output `bower.json` instead of `component.json` ([PR 125])
633
+ - use bower internally for fetching new versions of jQuery and jQuery UI
634
+
635
+ [1115]: https://code.google.com/p/fullcalendar/issues/detail?id=1115
636
+ [218]: https://code.google.com/p/fullcalendar/issues/detail?id=218
637
+ [1035]: https://code.google.com/p/fullcalendar/issues/detail?id=1035
638
+ [1018]: https://code.google.com/p/fullcalendar/issues/detail?id=1018
639
+ [1951]: https://code.google.com/p/fullcalendar/issues/detail?id=1951
640
+ [1356]: https://code.google.com/p/fullcalendar/issues/detail?id=1356
641
+ [1762]: https://code.google.com/p/fullcalendar/issues/detail?id=1762
642
+ [PR 125]: https://github.com/arshaw/fullcalendar/pull/125
643
+
644
+
645
+ v1.6.3 (2013-08-10)
646
+ -------------------
647
+
648
+ - `viewRender` callback ([PR 15])
649
+ - `viewDestroy` callback ([PR 15])
650
+ - `eventDestroy` callback ([PR 111])
651
+ - `handleWindowResize` option ([PR 54])
652
+ - `eventStartEditable`/`startEditable` options ([PR 49])
653
+ - `eventDurationEditable`/`durationEditable` options ([PR 49])
654
+ - specify function for `$.ajax` `data` parameter for JSON event sources ([PR 59])
655
+ - fixed bug with agenda event dropping in wrong column ([PR 55])
656
+ - easier event element z-index customization ([PR 58])
657
+ - classNames on past/future days ([PR 88])
658
+ - allow `null`/`undefined` event titles ([PR 84])
659
+ - small optimize for agenda event rendering ([PR 56])
660
+ - deprecated:
661
+ - `viewDisplay`
662
+ - `disableDragging`
663
+ - `disableResizing`
664
+ - bundled with latest jQuery (1.10.2) and jQuery UI (1.10.3)
665
+
666
+ [PR 15]: https://github.com/arshaw/fullcalendar/pull/15
667
+ [PR 111]: https://github.com/arshaw/fullcalendar/pull/111
668
+ [PR 54]: https://github.com/arshaw/fullcalendar/pull/54
669
+ [PR 49]: https://github.com/arshaw/fullcalendar/pull/49
670
+ [PR 59]: https://github.com/arshaw/fullcalendar/pull/59
671
+ [PR 55]: https://github.com/arshaw/fullcalendar/pull/55
672
+ [PR 58]: https://github.com/arshaw/fullcalendar/pull/58
673
+ [PR 88]: https://github.com/arshaw/fullcalendar/pull/88
674
+ [PR 84]: https://github.com/arshaw/fullcalendar/pull/84
675
+ [PR 56]: https://github.com/arshaw/fullcalendar/pull/56
676
+
677
+
678
+ v1.6.2 (2013-07-18)
679
+ -------------------
680
+
681
+ - `hiddenDays` option ([686])
682
+ - bugfix: when `eventRender` returns `false`, incorrect stacking of events ([762])
683
+ - bugfix: couldn't change `event.backgroundImage` when calling `updateEvent` (thx @stephenharris)
684
+
685
+ [686]: https://code.google.com/p/fullcalendar/issues/detail?id=686
686
+ [762]: https://code.google.com/p/fullcalendar/issues/detail?id=762
687
+
688
+
689
+ v1.6.1 (2013-04-14)
690
+ -------------------
691
+
692
+ - fixed event inner content overflow bug ([1783])
693
+ - fixed table header className bug [1772]
694
+ - removed text-shadow on events (better for general use, thx @tkrotoff)
695
+
696
+ [1783]: https://code.google.com/p/fullcalendar/issues/detail?id=1783
697
+ [1772]: https://code.google.com/p/fullcalendar/issues/detail?id=1772
698
+
699
+
700
+ v1.6.0 (2013-03-18)
701
+ -------------------
702
+
703
+ - visual facelift, with bootstrap-inspired buttons and colors
704
+ - simplified HTML/CSS for events and buttons
705
+ - `dayRender`, for modifying a day cell ([191], thx @althaus)
706
+ - week numbers on side of calendar ([295])
707
+ - `weekNumber`
708
+ - `weekNumberCalculation`
709
+ - `weekNumberTitle`
710
+ - `W` formatting variable
711
+ - finer snapping granularity for agenda view events ([495], thx @ms-doodle-com)
712
+ - `eventAfterAllRender` ([753], thx @pdrakeweb)
713
+ - `eventDataTransform` (thx @joeyspo)
714
+ - `data-date` attributes on cells (thx @Jae)
715
+ - expose `$.fullCalendar.dateFormatters`
716
+ - when clicking fast on buttons, prevent text selection
717
+ - bundled with latest jQuery (1.9.1) and jQuery UI (1.10.2)
718
+ - Grunt/Lumbar build system for internal development
719
+ - build for Bower package manager
720
+ - build for jQuery plugin site
721
+
722
+ [191]: https://code.google.com/p/fullcalendar/issues/detail?id=191
723
+ [295]: https://code.google.com/p/fullcalendar/issues/detail?id=295
724
+ [495]: https://code.google.com/p/fullcalendar/issues/detail?id=495
725
+ [753]: https://code.google.com/p/fullcalendar/issues/detail?id=753
726
+
727
+
728
+ v1.5.4 (2012-09-05)
729
+ -------------------
730
+
731
+ - made compatible with jQuery 1.8.* (thx @archaeron)
732
+ - bundled with jQuery 1.8.1 and jQuery UI 1.8.23
733
+
734
+
735
+ v1.5.3 (2012-02-06)
736
+ -------------------
737
+
738
+ - fixed dragging issue with jQuery UI 1.8.16 ([1168])
739
+ - bundled with jQuery 1.7.1 and jQuery UI 1.8.17
740
+
741
+ [1168]: https://code.google.com/p/fullcalendar/issues/detail?id=1168
742
+
743
+
744
+ v1.5.2 (2011-08-21)
745
+ -------------------
746
+
747
+ - correctly process UTC "Z" ISO8601 date strings ([750])
748
+
749
+ [750]: https://code.google.com/p/fullcalendar/issues/detail?id=750
750
+
751
+
752
+ v1.5.1 (2011-04-09)
753
+ -------------------
754
+
755
+ - more flexible ISO8601 date parsing ([814])
756
+ - more flexible parsing of UNIX timestamps ([826])
757
+ - FullCalendar now buildable from source on a Mac ([795])
758
+ - FullCalendar QA'd in FF4 ([883])
759
+ - upgraded to jQuery 1.5.2 (which supports IE9) and jQuery UI 1.8.11
760
+
761
+ [814]: https://code.google.com/p/fullcalendar/issues/detail?id=814
762
+ [826]: https://code.google.com/p/fullcalendar/issues/detail?id=826
763
+ [795]: https://code.google.com/p/fullcalendar/issues/detail?id=795
764
+ [883]: https://code.google.com/p/fullcalendar/issues/detail?id=883
765
+
766
+
767
+ v1.5 (2011-03-19)
768
+ -----------------
769
+
770
+ - slicker default styling for buttons
771
+ - reworked a lot of the calendar's HTML and accompanying CSS (solves [327] and [395])
772
+ - more printer-friendly (fullcalendar-print.css)
773
+ - fullcalendar now inherits styles from jquery-ui themes differently.
774
+ styles for buttons are distinct from styles for calendar cells.
775
+ (solves [299])
776
+ - can now color events through FullCalendar options and Event-Object properties ([117])
777
+ THIS IS NOW THE PREFERRED METHOD OF COLORING EVENTS (as opposed to using className and CSS)
778
+ - FullCalendar options:
779
+ - eventColor (changes both background and border)
780
+ - eventBackgroundColor
781
+ - eventBorderColor
782
+ - eventTextColor
783
+ - Event-Object options:
784
+ - color (changes both background and border)
785
+ - backgroundColor
786
+ - borderColor
787
+ - textColor
788
+ - can now specify an event source as an *object* with a `url` property (json feed) or
789
+ an `events` property (function or array) with additional properties that will
790
+ be applied to the entire event source:
791
+ - color (changes both background and border)
792
+ - backgroudColor
793
+ - borderColor
794
+ - textColor
795
+ - className
796
+ - editable
797
+ - allDayDefault
798
+ - ignoreTimezone
799
+ - startParam (for a feed)
800
+ - endParam (for a feed)
801
+ - ANY OF THE JQUERY $.ajax OPTIONS
802
+ allows for easily changing from GET to POST and sending additional parameters ([386])
803
+ allows for easily attaching ajax handlers such as `error` ([754])
804
+ allows for turning caching on ([355])
805
+ - Google Calendar feeds are now specified differently:
806
+ - specify a simple string of your feed's URL
807
+ - specify an *object* with a `url` property of your feed's URL.
808
+ you can include any of the new Event-Source options in this object.
809
+ - the old `$.fullCalendar.gcalFeed` method still works
810
+ - no more IE7 SSL popup ([504])
811
+ - remove `cacheParam` - use json event source `cache` option instead
812
+ - latest jquery/jquery-ui
813
+
814
+ [327]: https://code.google.com/p/fullcalendar/issues/detail?id=327
815
+ [395]: https://code.google.com/p/fullcalendar/issues/detail?id=395
816
+ [299]: https://code.google.com/p/fullcalendar/issues/detail?id=299
817
+ [117]: https://code.google.com/p/fullcalendar/issues/detail?id=117
818
+ [386]: https://code.google.com/p/fullcalendar/issues/detail?id=386
819
+ [754]: https://code.google.com/p/fullcalendar/issues/detail?id=754
820
+ [355]: https://code.google.com/p/fullcalendar/issues/detail?id=355
821
+ [504]: https://code.google.com/p/fullcalendar/issues/detail?id=504
822
+
823
+
824
+ v1.4.11 (2011-02-22)
825
+ --------------------
826
+
827
+ - fixed rerenderEvents bug ([790])
828
+ - fixed bug with faulty dragging of events from all-day slot in agenda views
829
+ - bundled with jquery 1.5 and jquery-ui 1.8.9
830
+
831
+ [790]: https://code.google.com/p/fullcalendar/issues/detail?id=790
832
+
833
+
834
+ v1.4.10 (2011-01-02)
835
+ --------------------
836
+
837
+ - fixed bug with resizing event to different week in 5-day month view ([740])
838
+ - fixed bug with events not sticking after a removeEvents call ([757])
839
+ - fixed bug with underlying parseTime method, and other uses of parseInt ([688])
840
+
841
+ [740]: https://code.google.com/p/fullcalendar/issues/detail?id=740
842
+ [757]: https://code.google.com/p/fullcalendar/issues/detail?id=757
843
+ [688]: https://code.google.com/p/fullcalendar/issues/detail?id=688
844
+
845
+
846
+ v1.4.9 (2010-11-16)
847
+ -------------------
848
+
849
+ - new algorithm for vertically stacking events ([111])
850
+ - resizing an event to a different week ([306])
851
+ - bug: some events not rendered with consecutive calls to addEventSource ([679])
852
+
853
+ [111]: https://code.google.com/p/fullcalendar/issues/detail?id=111
854
+ [306]: https://code.google.com/p/fullcalendar/issues/detail?id=306
855
+ [679]: https://code.google.com/p/fullcalendar/issues/detail?id=679
856
+
857
+
858
+ v1.4.8 (2010-10-16)
859
+ -------------------
860
+
861
+ - ignoreTimezone option (set to `false` to process UTC offsets in ISO8601 dates)
862
+ - bugfixes
863
+ - event refetching not being called under certain conditions ([417], [554])
864
+ - event refetching being called multiple times under certain conditions ([586], [616])
865
+ - selection cannot be triggered by right mouse button ([558])
866
+ - agenda view left axis sized incorrectly ([465])
867
+ - IE js error when calendar is too narrow ([517])
868
+ - agenda view looks strange when no scrollbars ([235])
869
+ - improved parsing of ISO8601 dates with UTC offsets
870
+ - $.fullCalendar.version
871
+ - an internal refactor of the code, for easier future development and modularity
872
+
873
+ [417]: https://code.google.com/p/fullcalendar/issues/detail?id=417
874
+ [554]: https://code.google.com/p/fullcalendar/issues/detail?id=554
875
+ [586]: https://code.google.com/p/fullcalendar/issues/detail?id=586
876
+ [616]: https://code.google.com/p/fullcalendar/issues/detail?id=616
877
+ [558]: https://code.google.com/p/fullcalendar/issues/detail?id=558
878
+ [465]: https://code.google.com/p/fullcalendar/issues/detail?id=465
879
+ [517]: https://code.google.com/p/fullcalendar/issues/detail?id=517
880
+ [235]: https://code.google.com/p/fullcalendar/issues/detail?id=235
881
+
882
+
883
+ v1.4.7 (2010-07-05)
884
+ -------------------
885
+
886
+ - "dropping" external objects onto the calendar
887
+ - droppable (boolean, to turn on/off)
888
+ - dropAccept (to filter which events the calendar will accept)
889
+ - drop (trigger)
890
+ - selectable options can now be specified with a View Option Hash
891
+ - bugfixes
892
+ - dragged & reverted events having wrong time text ([406])
893
+ - bug rendering events that have an endtime with seconds, but no hours/minutes ([477])
894
+ - gotoDate date overflow bug ([429])
895
+ - wrong date reported when clicking on edge of last column in agenda views [412]
896
+ - support newlines in event titles
897
+ - select/unselect callbacks now passes native js event
898
+
899
+ [406]: https://code.google.com/p/fullcalendar/issues/detail?id=406
900
+ [477]: https://code.google.com/p/fullcalendar/issues/detail?id=477
901
+ [429]: https://code.google.com/p/fullcalendar/issues/detail?id=429
902
+ [412]: https://code.google.com/p/fullcalendar/issues/detail?id=412
903
+
904
+
905
+ v1.4.6 (2010-05-31)
906
+ -------------------
907
+
908
+ - "selecting" days or timeslots
909
+ - options: selectable, selectHelper, unselectAuto, unselectCancel
910
+ - callbacks: select, unselect
911
+ - methods: select, unselect
912
+ - when dragging an event, the highlighting reflects the duration of the event
913
+ - code compressing by Google Closure Compiler
914
+ - bundled with jQuery 1.4.2 and jQuery UI 1.8.1
915
+
916
+
917
+ v1.4.5 (2010-02-21)
918
+ -------------------
919
+
920
+ - lazyFetching option, which can force the calendar to fetch events on every view/date change
921
+ - scroll state of agenda views are preserved when switching back to view
922
+ - bugfixes
923
+ - calling methods on an uninitialized fullcalendar throws error
924
+ - IE6/7 bug where an entire view becomes invisible ([320])
925
+ - error when rendering a hidden calendar (in jquery ui tabs for example) in IE ([340])
926
+ - interconnected bugs related to calendar resizing and scrollbars
927
+ - when switching views or clicking prev/next, calendar would "blink" ([333])
928
+ - liquid-width calendar's events shifted (depending on initial height of browser) ([341])
929
+ - more robust underlying algorithm for calendar resizing
930
+
931
+ [320]: https://code.google.com/p/fullcalendar/issues/detail?id=320
932
+ [340]: https://code.google.com/p/fullcalendar/issues/detail?id=340
933
+ [333]: https://code.google.com/p/fullcalendar/issues/detail?id=333
934
+ [341]: https://code.google.com/p/fullcalendar/issues/detail?id=341
935
+
936
+
937
+ v1.4.4 (2010-02-03)
938
+ -------------------
939
+
940
+ - optimized event rendering in all views (events render in 1/10 the time)
941
+ - gotoDate() does not force the calendar to unnecessarily rerender
942
+ - render() method now correctly readjusts height
943
+
944
+
945
+ v1.4.3 (2009-12-22)
946
+ -------------------
947
+
948
+ - added destroy method
949
+ - Google Calendar event pages respect currentTimezone
950
+ - caching now handled by jQuery's ajax
951
+ - protection from setting aspectRatio to zero
952
+ - bugfixes
953
+ - parseISO8601 and DST caused certain events to display day before
954
+ - button positioning problem in IE6
955
+ - ajax event source removed after recently being added, events still displayed
956
+ - event not displayed when end is an empty string
957
+ - dynamically setting calendar height when no events have been fetched, throws error
958
+
959
+
960
+ v1.4.2 (2009-12-02)
961
+ -------------------
962
+
963
+ - eventAfterRender trigger
964
+ - getDate & getView methods
965
+ - height & contentHeight options (explicitly sets the pixel height)
966
+ - minTime & maxTime options (restricts shown hours in agenda view)
967
+ - getters [for all options] and setters [for height, contentHeight, and aspectRatio ONLY! stay tuned..]
968
+ - render method now readjusts calendar's size
969
+ - bugfixes
970
+ - lightbox scripts that use iframes (like fancybox)
971
+ - day-of-week classNames were off when firstDay=1
972
+ - guaranteed space on right side of agenda events (even when stacked)
973
+ - accepts ISO8601 dates with a space (instead of 'T')
974
+
975
+
976
+ v1.4.1 (2009-10-31)
977
+ -------------------
978
+
979
+ - can exclude weekends with new 'weekends' option
980
+ - gcal feed 'currentTimezone' option
981
+ - bugfixes
982
+ - year/month/date option sometimes wouldn't set correctly (depending on current date)
983
+ - daylight savings issue caused agenda views to start at 1am (for BST users)
984
+ - cleanup of gcal.js code
985
+
986
+
987
+ v1.4 (2009-10-19)
988
+ -----------------
989
+
990
+ - agendaWeek and agendaDay views
991
+ - added some options for agenda views:
992
+ - allDaySlot
993
+ - allDayText
994
+ - firstHour
995
+ - slotMinutes
996
+ - defaultEventMinutes
997
+ - axisFormat
998
+ - modified some existing options/triggers to work with agenda views:
999
+ - dragOpacity and timeFormat can now accept a "View Hash" (a new concept)
1000
+ - dayClick now has an allDay parameter
1001
+ - eventDrop now has an an allDay parameter
1002
+ (this will affect those who use revertFunc, adjust parameter list)
1003
+ - added 'prevYear' and 'nextYear' for buttons in header
1004
+ - minor change for theme users, ui-state-hover not applied to active/inactive buttons
1005
+ - added event-color-changing example in docs
1006
+ - better defaults for right-to-left themed button icons
1007
+
1008
+
1009
+ v1.3.2 (2009-10-13)
1010
+ -------------------
1011
+
1012
+ - Bugfixes (please upgrade from 1.3.1!)
1013
+ - squashed potential infinite loop when addMonths and addDays
1014
+ is called with an invalid date
1015
+ - $.fullCalendar.parseDate() now correctly parses IETF format
1016
+ - when switching views, the 'today' button sticks inactive, fixed
1017
+ - gotoDate now can accept a single Date argument
1018
+ - documentation for changes in 1.3.1 and 1.3.2 now on website
1019
+
1020
+
1021
+ v1.3.1 (2009-09-30)
1022
+ -------------------
1023
+
1024
+ - Important Bugfixes (please upgrade from 1.3!)
1025
+ - When current date was late in the month, for long months, and prev/next buttons
1026
+ were clicked in month-view, some months would be skipped/repeated
1027
+ - In certain time zones, daylight savings time would cause certain days
1028
+ to be misnumbered in month-view
1029
+ - Subtle change in way week interval is chosen when switching from month to basicWeek/basicDay view
1030
+ - Added 'allDayDefault' option
1031
+ - Added 'changeView' and 'render' methods
1032
+
1033
+
1034
+ v1.3 (2009-09-21)
1035
+ -----------------
1036
+
1037
+ - different 'views': month/basicWeek/basicDay
1038
+ - more flexible 'header' system for buttons
1039
+ - themable by jQuery UI themes
1040
+ - resizable events (require jQuery UI resizable plugin)
1041
+ - rescoped & rewritten CSS, enhanced default look
1042
+ - cleaner css & rendering techniques for right-to-left
1043
+ - reworked options & API to support multiple views / be consistent with jQuery UI
1044
+ - refactoring of entire codebase
1045
+ - broken into different JS & CSS files, assembled w/ build scripts
1046
+ - new test suite for new features, uses firebug-lite
1047
+ - refactored docs
1048
+ - Options
1049
+ - + date
1050
+ - + defaultView
1051
+ - + aspectRatio
1052
+ - + disableResizing
1053
+ - + monthNames (use instead of $.fullCalendar.monthNames)
1054
+ - + monthNamesShort (use instead of $.fullCalendar.monthAbbrevs)
1055
+ - + dayNames (use instead of $.fullCalendar.dayNames)
1056
+ - + dayNamesShort (use instead of $.fullCalendar.dayAbbrevs)
1057
+ - + theme
1058
+ - + buttonText
1059
+ - + buttonIcons
1060
+ - x draggable -> editable/disableDragging
1061
+ - x fixedWeeks -> weekMode
1062
+ - x abbrevDayHeadings -> columnFormat
1063
+ - x buttons/title -> header
1064
+ - x eventDragOpacity -> dragOpacity
1065
+ - x eventRevertDuration -> dragRevertDuration
1066
+ - x weekStart -> firstDay
1067
+ - x rightToLeft -> isRTL
1068
+ - x showTime (use 'allDay' CalEvent property instead)
1069
+ - Triggered Actions
1070
+ - + eventResizeStart
1071
+ - + eventResizeStop
1072
+ - + eventResize
1073
+ - x monthDisplay -> viewDisplay
1074
+ - x resize -> windowResize
1075
+ - 'eventDrop' params changed, can revert if ajax cuts out
1076
+ - CalEvent Properties
1077
+ - x showTime -> allDay
1078
+ - x draggable -> editable
1079
+ - 'end' is now INCLUSIVE when allDay=true
1080
+ - 'url' now produces a real <a> tag, more native clicking/tab behavior
1081
+ - Methods:
1082
+ - + renderEvent
1083
+ - x prevMonth -> prev
1084
+ - x nextMonth -> next
1085
+ - x prevYear/nextYear -> moveDate
1086
+ - x refresh -> rerenderEvents/refetchEvents
1087
+ - x removeEvent -> removeEvents
1088
+ - x getEventsByID -> clientEvents
1089
+ - Utilities:
1090
+ - 'formatDate' format string completely changed (inspired by jQuery UI datepicker + datejs)
1091
+ - 'formatDates' added to support date-ranges
1092
+ - Google Calendar Options:
1093
+ - x draggable -> editable
1094
+ - Bugfixes
1095
+ - gcal extension fetched 25 results max, now fetches all
1096
+
1097
+
1098
+ v1.2.1 (2009-06-29)
1099
+ -------------------
1100
+
1101
+ - bugfixes
1102
+ - allows and corrects invalid end dates for events
1103
+ - doesn't throw an error in IE while rendering when display:none
1104
+ - fixed 'loading' callback when used w/ multiple addEventSource calls
1105
+ - gcal className can now be an array
1106
+
1107
+
1108
+ v1.2 (2009-05-31)
1109
+ -----------------
1110
+
1111
+ - expanded API
1112
+ - 'className' CalEvent attribute
1113
+ - 'source' CalEvent attribute
1114
+ - dynamically get/add/remove/update events of current month
1115
+ - locale improvements: change month/day name text
1116
+ - better date formatting ($.fullCalendar.formatDate)
1117
+ - multiple 'event sources' allowed
1118
+ - dynamically add/remove event sources
1119
+ - options for prevYear and nextYear buttons
1120
+ - docs have been reworked (include addition of Google Calendar docs)
1121
+ - changed behavior of parseDate for number strings
1122
+ (now interpets as unix timestamp, not MS times)
1123
+ - bugfixes
1124
+ - rightToLeft month start bug
1125
+ - off-by-one errors with month formatting commands
1126
+ - events from previous months sticking when clicking prev/next quickly
1127
+ - Google Calendar API changed to work w/ multiple event sources
1128
+ - can also provide 'className' and 'draggable' options
1129
+ - date utilties moved from $ to $.fullCalendar
1130
+ - more documentation in source code
1131
+ - minified version of fullcalendar.js
1132
+ - test suit (available from svn)
1133
+ - top buttons now use `<button>` w/ an inner `<span>` for better css cusomization
1134
+ - thus CSS has changed. IF UPGRADING FROM PREVIOUS VERSIONS,
1135
+ UPGRADE YOUR FULLCALENDAR.CSS FILE
1136
+
1137
+
1138
+ v1.1 (2009-05-10)
1139
+ -----------------
1140
+
1141
+ - Added the following options:
1142
+ - weekStart
1143
+ - rightToLeft
1144
+ - titleFormat
1145
+ - timeFormat
1146
+ - cacheParam
1147
+ - resize
1148
+ - Fixed rendering bugs
1149
+ - Opera 9.25 (events placement & window resizing)
1150
+ - IE6 (window resizing)
1151
+ - Optimized window resizing for ALL browsers
1152
+ - Events on same day now sorted by start time (but first by timespan)
1153
+ - Correct z-index when dragging
1154
+ - Dragging contained in overflow DIV for IE6
1155
+ - Modified fullcalendar.css
1156
+ - for right-to-left support
1157
+ - for variable start-of-week
1158
+ - for IE6 resizing bug
1159
+ - for THEAD and TBODY (in 1.0, just used TBODY, restructured in 1.1)
1160
+ - IF UPGRADING FROM FULLCALENDAR 1.0, YOU MUST UPGRADE FULLCALENDAR.CSS
assets/lib/fullcalendar/CONTRIBUTING.txt ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Reporting Bugs
3
+
4
+ Each bug report MUST have a [JSFiddle/JSBin] recreation before any work can begin. [further instructions &raquo;](http://fullcalendar.io/wiki/Reporting-Bugs/)
5
+
6
+
7
+ ## Requesting Features
8
+
9
+ Please search the [Issue Tracker] to see if your feature has already been requested, and if so, subscribe to it. Otherwise, read these [further instructions &raquo;](http://fullcalendar.io/wiki/Requesting-Features/)
10
+
11
+
12
+ ## Contributing Features
13
+
14
+ The FullCalendar project welcomes [Pull Requests][Using Pull Requests] for new features, but because there are so many feature requests (over 100), and because every new feature requires refinement and maintenance, each PR will be prioritized against the project's other demands and might take a while to make it to an official release.
15
+
16
+ Furthermore, each new feature should be designed as robustly as possible and be useful beyond the immediate usecase it was initially designed for. Feel free to start a ticket discussing the feature's specs before coding.
17
+
18
+
19
+ ## Contributing Bugfixes
20
+
21
+ In the description of your [Pull Request][Using Pull Requests], please include recreation steps for the bug as well as a [JSFiddle/JSBin] demo. Communicating the buggy behavior is a requirement before a merge can happen.
22
+
23
+
24
+ ## Contributing Locales
25
+
26
+ Please edit the original files in the `locale/` directory. DO NOT edit anything in the `dist/` directory. The build system will responsible for merging FullCalendar's `locale/` data with the [MomentJS locale data].
27
+
28
+
29
+ ## Other Ways to Contribute
30
+
31
+ [Read about other ways to contribute &raquo;](http://fullcalendar.io/wiki/Contributing/)
32
+
33
+
34
+ ## Getting Set Up
35
+
36
+ You will need [Git][git], [Node][node], and NPM installed. For clarification, please view the [jQuery readme][jq-readme], which requires a similar setup.
37
+
38
+ Also, you will need the [gulp-cli][gulp-cli] package installed globally (`-g`) on your system:
39
+
40
+ npm install -g gulp-cli
41
+
42
+ Then, clone FullCalendar's git repo:
43
+
44
+ git clone git://github.com/fullcalendar/fullcalendar.git
45
+
46
+ Enter the directory and install FullCalendar's dependencies:
47
+
48
+ cd fullcalendar
49
+ npm install
50
+
51
+
52
+ ## What to edit
53
+
54
+ When modifying files, please do not edit the generated or minified files in the `dist/` directory. Please edit the original `src/` files.
55
+
56
+
57
+ ## Development Workflow
58
+
59
+ After you make code changes, you'll want to compile the JS/CSS so that it can be previewed from the tests and demos. You can either manually rebuild each time you make a change:
60
+
61
+ gulp dev
62
+
63
+ Or, you can run a script that automatically rebuilds whenever you save a source file:
64
+
65
+ gulp watch
66
+
67
+ When you are finished, run the following command to write the distributable files into the `./dist/` directory:
68
+
69
+ gulp dist
70
+
71
+ If you want to clean up the generated files, run:
72
+
73
+ gulp clean
74
+
75
+
76
+ ## Style Guide
77
+
78
+ Please follow the [Google JavaScript Style Guide] as closely as possible. With the following exceptions:
79
+
80
+ ```js
81
+ if (true) {
82
+ }
83
+ else { // please put else, else if, and catch on a separate line
84
+ }
85
+
86
+ // please write one-line array literals with a one-space padding inside
87
+ var a = [ 1, 2, 3 ];
88
+
89
+ // please write one-line object literals with a one-space padding inside
90
+ var o = { a: 1, b: 2, c: 3 };
91
+ ```
92
+
93
+ Other exceptions:
94
+
95
+ - please ignore anything about Google Closure Compiler or the `goog` library
96
+ - please do not write JSDoc comments
97
+
98
+ Notes about whitespace:
99
+
100
+ - **use *tabs* instead of spaces**
101
+ - separate functions with *2* blank lines
102
+ - separate logical blocks within functions with *1* blank line
103
+
104
+ Run the command line tool to automatically check your style:
105
+
106
+ gulp lint
107
+
108
+
109
+ ## Before Submitting your Code
110
+
111
+ If you have edited code (including **tests** and **translations**) and would like to submit a pull request, please make sure you have done the following:
112
+
113
+ 1. Conformed to the style guide (successfully run `gulp lint`)
114
+
115
+ 2. Written automated tests. View the [Automated Test Readme]
116
+
117
+
118
+ [JSFiddle/JSBin]: http://fullcalendar.io/wiki/Reporting-Bugs/
119
+ [Issue Tracker]: https://github.com/fullcalendar/fullcalendar/issues
120
+ [Using Pull Requests]: https://help.github.com/articles/using-pull-requests/
121
+ [MomentJS locale data]: https://github.com/moment/moment/tree/develop/locale
122
+ [git]: http://git-scm.com/
123
+ [node]: http://nodejs.org/
124
+ [gulp-cli]: https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md
125
+ [jq-readme]: https://github.com/jquery/jquery/blob/master/README.md#what-you-need-to-build-your-own-jquery
126
+ [Google JavaScript Style Guide]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
127
+ [Automated Test Readme]: https://github.com/fullcalendar/fullcalendar/wiki/Automated-Tests
assets/lib/fullcalendar/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2015 Adam Shaw
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
assets/lib/fullcalendar/fullcalendar.css ADDED
@@ -0,0 +1,1413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Stylesheet
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+
7
+
8
+ .fc {
9
+ direction: ltr;
10
+ text-align: left;
11
+ }
12
+
13
+ .fc-rtl {
14
+ text-align: right;
15
+ }
16
+
17
+ body .fc { /* extra precedence to overcome jqui */
18
+ font-size: 1em;
19
+ }
20
+
21
+
22
+ /* Colors
23
+ --------------------------------------------------------------------------------------------------*/
24
+
25
+ .fc-unthemed th,
26
+ .fc-unthemed td,
27
+ .fc-unthemed thead,
28
+ .fc-unthemed tbody,
29
+ .fc-unthemed .fc-divider,
30
+ .fc-unthemed .fc-row,
31
+ .fc-unthemed .fc-content, /* for gutter border */
32
+ .fc-unthemed .fc-popover,
33
+ .fc-unthemed .fc-list-view,
34
+ .fc-unthemed .fc-list-heading td {
35
+ border-color: #ddd;
36
+ }
37
+
38
+ .fc-unthemed .fc-popover {
39
+ background-color: #fff;
40
+ }
41
+
42
+ .fc-unthemed .fc-divider,
43
+ .fc-unthemed .fc-popover .fc-header,
44
+ .fc-unthemed .fc-list-heading td {
45
+ background: #eee;
46
+ }
47
+
48
+ .fc-unthemed .fc-popover .fc-header .fc-close {
49
+ color: #666;
50
+ }
51
+
52
+ .fc-unthemed td.fc-today {
53
+ background: #fcf8e3;
54
+ }
55
+
56
+ .fc-highlight { /* when user is selecting cells */
57
+ background: #bce8f1;
58
+ opacity: .3;
59
+ }
60
+
61
+ .fc-bgevent { /* default look for background events */
62
+ background: rgb(143, 223, 130);
63
+ opacity: .3;
64
+ }
65
+
66
+ .fc-nonbusiness { /* default look for non-business-hours areas */
67
+ /* will inherit .fc-bgevent's styles */
68
+ background: #d7d7d7;
69
+ }
70
+
71
+ .fc-unthemed .fc-disabled-day {
72
+ background: #d7d7d7;
73
+ opacity: .3;
74
+ }
75
+
76
+ .ui-widget .fc-disabled-day { /* themed */
77
+ background-image: none;
78
+ }
79
+
80
+
81
+ /* Icons (inline elements with styled text that mock arrow icons)
82
+ --------------------------------------------------------------------------------------------------*/
83
+
84
+ .fc-icon {
85
+ display: inline-block;
86
+ height: 1em;
87
+ line-height: 1em;
88
+ font-size: 1em;
89
+ text-align: center;
90
+ overflow: hidden;
91
+ font-family: "Courier New", Courier, monospace;
92
+
93
+ /* don't allow browser text-selection */
94
+ -webkit-touch-callout: none;
95
+ -webkit-user-select: none;
96
+ -khtml-user-select: none;
97
+ -moz-user-select: none;
98
+ -ms-user-select: none;
99
+ user-select: none;
100
+ }
101
+
102
+ /*
103
+ Acceptable font-family overrides for individual icons:
104
+ "Arial", sans-serif
105
+ "Times New Roman", serif
106
+
107
+ NOTE: use percentage font sizes or else old IE chokes
108
+ */
109
+
110
+ .fc-icon:after {
111
+ position: relative;
112
+ }
113
+
114
+ .fc-icon-left-single-arrow:after {
115
+ content: "\02039";
116
+ font-weight: bold;
117
+ font-size: 200%;
118
+ top: -7%;
119
+ }
120
+
121
+ .fc-icon-right-single-arrow:after {
122
+ content: "\0203A";
123
+ font-weight: bold;
124
+ font-size: 200%;
125
+ top: -7%;
126
+ }
127
+
128
+ .fc-icon-left-double-arrow:after {
129
+ content: "\000AB";
130
+ font-size: 160%;
131
+ top: -7%;
132
+ }
133
+
134
+ .fc-icon-right-double-arrow:after {
135
+ content: "\000BB";
136
+ font-size: 160%;
137
+ top: -7%;
138
+ }
139
+
140
+ .fc-icon-left-triangle:after {
141
+ content: "\25C4";
142
+ font-size: 125%;
143
+ top: 3%;
144
+ }
145
+
146
+ .fc-icon-right-triangle:after {
147
+ content: "\25BA";
148
+ font-size: 125%;
149
+ top: 3%;
150
+ }
151
+
152
+ .fc-icon-down-triangle:after {
153
+ content: "\25BC";
154
+ font-size: 125%;
155
+ top: 2%;
156
+ }
157
+
158
+ .fc-icon-x:after {
159
+ content: "\000D7";
160
+ font-size: 200%;
161
+ top: 6%;
162
+ }
163
+
164
+
165
+ /* Buttons (styled <button> tags, normalized to work cross-browser)
166
+ --------------------------------------------------------------------------------------------------*/
167
+
168
+ .fc button {
169
+ /* force height to include the border and padding */
170
+ -moz-box-sizing: border-box;
171
+ -webkit-box-sizing: border-box;
172
+ box-sizing: border-box;
173
+
174
+ /* dimensions */
175
+ margin: 0;
176
+ height: 2.1em;
177
+ padding: 0 .6em;
178
+
179
+ /* text & cursor */
180
+ font-size: 1em; /* normalize */
181
+ white-space: nowrap;
182
+ cursor: pointer;
183
+ }
184
+
185
+ /* Firefox has an annoying inner border */
186
+ .fc button::-moz-focus-inner { margin: 0; padding: 0; }
187
+
188
+ .fc-state-default { /* non-theme */
189
+ border: 1px solid;
190
+ }
191
+
192
+ .fc-state-default.fc-corner-left { /* non-theme */
193
+ border-top-left-radius: 4px;
194
+ border-bottom-left-radius: 4px;
195
+ }
196
+
197
+ .fc-state-default.fc-corner-right { /* non-theme */
198
+ border-top-right-radius: 4px;
199
+ border-bottom-right-radius: 4px;
200
+ }
201
+
202
+ /* icons in buttons */
203
+
204
+ .fc button .fc-icon { /* non-theme */
205
+ position: relative;
206
+ top: -0.05em; /* seems to be a good adjustment across browsers */
207
+ margin: 0 .2em;
208
+ vertical-align: middle;
209
+ }
210
+
211
+ /*
212
+ button states
213
+ borrowed from twitter bootstrap (http://twitter.github.com/bootstrap/)
214
+ */
215
+
216
+ .fc-state-default {
217
+ background-color: #f5f5f5;
218
+ background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
219
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
220
+ background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
221
+ background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
222
+ background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
223
+ background-repeat: repeat-x;
224
+ border-color: #e6e6e6 #e6e6e6 #bfbfbf;
225
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
226
+ color: #333;
227
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
228
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
229
+ }
230
+
231
+ .fc-state-hover,
232
+ .fc-state-down,
233
+ .fc-state-active,
234
+ .fc-state-disabled {
235
+ color: #333333;
236
+ background-color: #e6e6e6;
237
+ }
238
+
239
+ .fc-state-hover {
240
+ color: #333333;
241
+ text-decoration: none;
242
+ background-position: 0 -15px;
243
+ -webkit-transition: background-position 0.1s linear;
244
+ -moz-transition: background-position 0.1s linear;
245
+ -o-transition: background-position 0.1s linear;
246
+ transition: background-position 0.1s linear;
247
+ }
248
+
249
+ .fc-state-down,
250
+ .fc-state-active {
251
+ background-color: #cccccc;
252
+ background-image: none;
253
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
254
+ }
255
+
256
+ .fc-state-disabled {
257
+ cursor: default;
258
+ background-image: none;
259
+ opacity: 0.65;
260
+ box-shadow: none;
261
+ }
262
+
263
+
264
+ /* Buttons Groups
265
+ --------------------------------------------------------------------------------------------------*/
266
+
267
+ .fc-button-group {
268
+ display: inline-block;
269
+ }
270
+
271
+ /*
272
+ every button that is not first in a button group should scootch over one pixel and cover the
273
+ previous button's border...
274
+ */
275
+
276
+ .fc .fc-button-group > * { /* extra precedence b/c buttons have margin set to zero */
277
+ float: left;
278
+ margin: 0 0 0 -1px;
279
+ }
280
+
281
+ .fc .fc-button-group > :first-child { /* same */
282
+ margin-left: 0;
283
+ }
284
+
285
+
286
+ /* Popover
287
+ --------------------------------------------------------------------------------------------------*/
288
+
289
+ .fc-popover {
290
+ position: absolute;
291
+ box-shadow: 0 2px 6px rgba(0,0,0,.15);
292
+ }
293
+
294
+ .fc-popover .fc-header { /* TODO: be more consistent with fc-head/fc-body */
295
+ padding: 2px 4px;
296
+ }
297
+
298
+ .fc-popover .fc-header .fc-title {
299
+ margin: 0 2px;
300
+ }
301
+
302
+ .fc-popover .fc-header .fc-close {
303
+ cursor: pointer;
304
+ }
305
+
306
+ .fc-ltr .fc-popover .fc-header .fc-title,
307
+ .fc-rtl .fc-popover .fc-header .fc-close {
308
+ float: left;
309
+ }
310
+
311
+ .fc-rtl .fc-popover .fc-header .fc-title,
312
+ .fc-ltr .fc-popover .fc-header .fc-close {
313
+ float: right;
314
+ }
315
+
316
+ /* unthemed */
317
+
318
+ .fc-unthemed .fc-popover {
319
+ border-width: 1px;
320
+ border-style: solid;
321
+ }
322
+
323
+ .fc-unthemed .fc-popover .fc-header .fc-close {
324
+ font-size: .9em;
325
+ margin-top: 2px;
326
+ }
327
+
328
+ /* jqui themed */
329
+
330
+ .fc-popover > .ui-widget-header + .ui-widget-content {
331
+ border-top: 0; /* where they meet, let the header have the border */
332
+ }
333
+
334
+
335
+ /* Misc Reusable Components
336
+ --------------------------------------------------------------------------------------------------*/
337
+
338
+ .fc-divider {
339
+ border-style: solid;
340
+ border-width: 1px;
341
+ }
342
+
343
+ hr.fc-divider {
344
+ height: 0;
345
+ margin: 0;
346
+ padding: 0 0 2px; /* height is unreliable across browsers, so use padding */
347
+ border-width: 1px 0;
348
+ }
349
+
350
+ .fc-clear {
351
+ clear: both;
352
+ }
353
+
354
+ .fc-bg,
355
+ .fc-bgevent-skeleton,
356
+ .fc-highlight-skeleton,
357
+ .fc-helper-skeleton {
358
+ /* these element should always cling to top-left/right corners */
359
+ position: absolute;
360
+ top: 0;
361
+ left: 0;
362
+ right: 0;
363
+ }
364
+
365
+ .fc-bg {
366
+ bottom: 0; /* strech bg to bottom edge */
367
+ }
368
+
369
+ .fc-bg table {
370
+ height: 100%; /* strech bg to bottom edge */
371
+ }
372
+
373
+
374
+ /* Tables
375
+ --------------------------------------------------------------------------------------------------*/
376
+
377
+ .fc table {
378
+ width: 100%;
379
+ box-sizing: border-box; /* fix scrollbar issue in firefox */
380
+ table-layout: fixed;
381
+ border-collapse: collapse;
382
+ border-spacing: 0;
383
+ font-size: 1em; /* normalize cross-browser */
384
+ }
385
+
386
+ .fc th {
387
+ text-align: center;
388
+ }
389
+
390
+ .fc th,
391
+ .fc td {
392
+ border-style: solid;
393
+ border-width: 1px;
394
+ padding: 0;
395
+ vertical-align: top;
396
+ }
397
+
398
+ .fc td.fc-today {
399
+ border-style: double; /* overcome neighboring borders */
400
+ }
401
+
402
+
403
+ /* Internal Nav Links
404
+ --------------------------------------------------------------------------------------------------*/
405
+
406
+ a[data-goto] {
407
+ cursor: pointer;
408
+ }
409
+
410
+ a[data-goto]:hover {
411
+ text-decoration: underline;
412
+ }
413
+
414
+
415
+ /* Fake Table Rows
416
+ --------------------------------------------------------------------------------------------------*/
417
+
418
+ .fc .fc-row { /* extra precedence to overcome themes w/ .ui-widget-content forcing a 1px border */
419
+ /* no visible border by default. but make available if need be (scrollbar width compensation) */
420
+ border-style: solid;
421
+ border-width: 0;
422
+ }
423
+
424
+ .fc-row table {
425
+ /* don't put left/right border on anything within a fake row.
426
+ the outer tbody will worry about this */
427
+ border-left: 0 hidden transparent;
428
+ border-right: 0 hidden transparent;
429
+
430
+ /* no bottom borders on rows */
431
+ border-bottom: 0 hidden transparent;
432
+ }
433
+
434
+ .fc-row:first-child table {
435
+ border-top: 0 hidden transparent; /* no top border on first row */
436
+ }
437
+
438
+
439
+ /* Day Row (used within the header and the DayGrid)
440
+ --------------------------------------------------------------------------------------------------*/
441
+
442
+ .fc-row {
443
+ position: relative;
444
+ }
445
+
446
+ .fc-row .fc-bg {
447
+ z-index: 1;
448
+ }
449
+
450
+ /* highlighting cells & background event skeleton */
451
+
452
+ .fc-row .fc-bgevent-skeleton,
453
+ .fc-row .fc-highlight-skeleton {
454
+ bottom: 0; /* stretch skeleton to bottom of row */
455
+ }
456
+
457
+ .fc-row .fc-bgevent-skeleton table,
458
+ .fc-row .fc-highlight-skeleton table {
459
+ height: 100%; /* stretch skeleton to bottom of row */
460
+ }
461
+
462
+ .fc-row .fc-highlight-skeleton td,
463
+ .fc-row .fc-bgevent-skeleton td {
464
+ border-color: transparent;
465
+ }
466
+
467
+ .fc-row .fc-bgevent-skeleton {
468
+ z-index: 2;
469
+
470
+ }
471
+
472
+ .fc-row .fc-highlight-skeleton {
473
+ z-index: 3;
474
+ }
475
+
476
+ /*
477
+ row content (which contains day/week numbers and events) as well as "helper" (which contains
478
+ temporary rendered events).
479
+ */
480
+
481
+ .fc-row .fc-content-skeleton {
482
+ position: relative;
483
+ z-index: 4;
484
+ padding-bottom: 2px; /* matches the space above the events */
485
+ }
486
+
487
+ .fc-row .fc-helper-skeleton {
488
+ z-index: 5;
489
+ }
490
+
491
+ .fc-row .fc-content-skeleton td,
492
+ .fc-row .fc-helper-skeleton td {
493
+ /* see-through to the background below */
494
+ background: none; /* in case <td>s are globally styled */
495
+ border-color: transparent;
496
+
497
+ /* don't put a border between events and/or the day number */
498
+ border-bottom: 0;
499
+ }
500
+
501
+ .fc-row .fc-content-skeleton tbody td, /* cells with events inside (so NOT the day number cell) */
502
+ .fc-row .fc-helper-skeleton tbody td {
503
+ /* don't put a border between event cells */
504
+ border-top: 0;
505
+ }
506
+
507
+
508
+ /* Scrolling Container
509
+ --------------------------------------------------------------------------------------------------*/
510
+
511
+ .fc-scroller {
512
+ -webkit-overflow-scrolling: touch;
513
+ }
514
+
515
+ /* TODO: move to agenda/basic */
516
+ .fc-scroller > .fc-day-grid,
517
+ .fc-scroller > .fc-time-grid {
518
+ position: relative; /* re-scope all positions */
519
+ width: 100%; /* hack to force re-sizing this inner element when scrollbars appear/disappear */
520
+ }
521
+
522
+
523
+ /* Global Event Styles
524
+ --------------------------------------------------------------------------------------------------*/
525
+
526
+ .fc-event {
527
+ position: relative; /* for resize handle and other inner positioning */
528
+ display: block; /* make the <a> tag block */
529
+ font-size: .85em;
530
+ line-height: 1.3;
531
+ border-radius: 3px;
532
+ border: 1px solid #3a87ad; /* default BORDER color */
533
+ font-weight: normal; /* undo jqui's ui-widget-header bold */
534
+ }
535
+
536
+ .fc-event,
537
+ .fc-event-dot {
538
+ background-color: #3a87ad; /* default BACKGROUND color */
539
+ }
540
+
541
+ /* overpower some of bootstrap's and jqui's styles on <a> tags */
542
+ .fc-event,
543
+ .fc-event:hover,
544
+ .ui-widget .fc-event {
545
+ color: #fff; /* default TEXT color */
546
+ text-decoration: none; /* if <a> has an href */
547
+ }
548
+
549
+ .fc-event[href],
550
+ .fc-event.fc-draggable {
551
+ cursor: pointer; /* give events with links and draggable events a hand mouse pointer */
552
+ }
553
+
554
+ .fc-not-allowed, /* causes a "warning" cursor. applied on body */
555
+ .fc-not-allowed .fc-event { /* to override an event's custom cursor */
556
+ cursor: not-allowed;
557
+ }
558
+
559
+ .fc-event .fc-bg { /* the generic .fc-bg already does position */
560
+ z-index: 1;
561
+ background: #fff;
562
+ opacity: .25;
563
+ }
564
+
565
+ .fc-event .fc-content {
566
+ position: relative;
567
+ z-index: 2;
568
+ }
569
+
570
+ /* resizer (cursor AND touch devices) */
571
+
572
+ .fc-event .fc-resizer {
573
+ position: absolute;
574
+ z-index: 4;
575
+ }
576
+
577
+ /* resizer (touch devices) */
578
+
579
+ .fc-event .fc-resizer {
580
+ display: none;
581
+ }
582
+
583
+ .fc-event.fc-allow-mouse-resize .fc-resizer,
584
+ .fc-event.fc-selected .fc-resizer {
585
+ /* only show when hovering or selected (with touch) */
586
+ display: block;
587
+ }
588
+
589
+ /* hit area */
590
+
591
+ .fc-event.fc-selected .fc-resizer:before {
592
+ /* 40x40 touch area */
593
+ content: "";
594
+ position: absolute;
595
+ z-index: 9999; /* user of this util can scope within a lower z-index */
596
+ top: 50%;
597
+ left: 50%;
598
+ width: 40px;
599
+ height: 40px;
600
+ margin-left: -20px;
601
+ margin-top: -20px;
602
+ }
603
+
604
+
605
+ /* Event Selection (only for touch devices)
606
+ --------------------------------------------------------------------------------------------------*/
607
+
608
+ .fc-event.fc-selected {
609
+ z-index: 9999 !important; /* overcomes inline z-index */
610
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
611
+ }
612
+
613
+ .fc-event.fc-selected.fc-dragging {
614
+ box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3);
615
+ }
616
+
617
+
618
+ /* Horizontal Events
619
+ --------------------------------------------------------------------------------------------------*/
620
+
621
+ /* bigger touch area when selected */
622
+ .fc-h-event.fc-selected:before {
623
+ content: "";
624
+ position: absolute;
625
+ z-index: 3; /* below resizers */
626
+ top: -10px;
627
+ bottom: -10px;
628
+ left: 0;
629
+ right: 0;
630
+ }
631
+
632
+ /* events that are continuing to/from another week. kill rounded corners and butt up against edge */
633
+
634
+ .fc-ltr .fc-h-event.fc-not-start,
635
+ .fc-rtl .fc-h-event.fc-not-end {
636
+ margin-left: 0;
637
+ border-left-width: 0;
638
+ padding-left: 1px; /* replace the border with padding */
639
+ border-top-left-radius: 0;
640
+ border-bottom-left-radius: 0;
641
+ }
642
+
643
+ .fc-ltr .fc-h-event.fc-not-end,
644
+ .fc-rtl .fc-h-event.fc-not-start {
645
+ margin-right: 0;
646
+ border-right-width: 0;
647
+ padding-right: 1px; /* replace the border with padding */
648
+ border-top-right-radius: 0;
649
+ border-bottom-right-radius: 0;
650
+ }
651
+
652
+ /* resizer (cursor AND touch devices) */
653
+
654
+ /* left resizer */
655
+ .fc-ltr .fc-h-event .fc-start-resizer,
656
+ .fc-rtl .fc-h-event .fc-end-resizer {
657
+ cursor: w-resize;
658
+ left: -1px; /* overcome border */
659
+ }
660
+
661
+ /* right resizer */
662
+ .fc-ltr .fc-h-event .fc-end-resizer,
663
+ .fc-rtl .fc-h-event .fc-start-resizer {
664
+ cursor: e-resize;
665
+ right: -1px; /* overcome border */
666
+ }
667
+
668
+ /* resizer (mouse devices) */
669
+
670
+ .fc-h-event.fc-allow-mouse-resize .fc-resizer {
671
+ width: 7px;
672
+ top: -1px; /* overcome top border */
673
+ bottom: -1px; /* overcome bottom border */
674
+ }
675
+
676
+ /* resizer (touch devices) */
677
+
678
+ .fc-h-event.fc-selected .fc-resizer {
679
+ /* 8x8 little dot */
680
+ border-radius: 4px;
681
+ border-width: 1px;
682
+ width: 6px;
683
+ height: 6px;
684
+ border-style: solid;
685
+ border-color: inherit;
686
+ background: #fff;
687
+ /* vertically center */
688
+ top: 50%;
689
+ margin-top: -4px;
690
+ }
691
+
692
+ /* left resizer */
693
+ .fc-ltr .fc-h-event.fc-selected .fc-start-resizer,
694
+ .fc-rtl .fc-h-event.fc-selected .fc-end-resizer {
695
+ margin-left: -4px; /* centers the 8x8 dot on the left edge */
696
+ }
697
+
698
+ /* right resizer */
699
+ .fc-ltr .fc-h-event.fc-selected .fc-end-resizer,
700
+ .fc-rtl .fc-h-event.fc-selected .fc-start-resizer {
701
+ margin-right: -4px; /* centers the 8x8 dot on the right edge */
702
+ }
703
+
704
+
705
+ /* DayGrid events
706
+ ----------------------------------------------------------------------------------------------------
707
+ We use the full "fc-day-grid-event" class instead of using descendants because the event won't
708
+ be a descendant of the grid when it is being dragged.
709
+ */
710
+
711
+ .fc-day-grid-event {
712
+ margin: 1px 2px 0; /* spacing between events and edges */
713
+ padding: 0 1px;
714
+ }
715
+
716
+ tr:first-child > td > .fc-day-grid-event {
717
+ margin-top: 2px; /* a little bit more space before the first event */
718
+ }
719
+
720
+ .fc-day-grid-event.fc-selected:after {
721
+ content: "";
722
+ position: absolute;
723
+ z-index: 1; /* same z-index as fc-bg, behind text */
724
+ /* overcome the borders */
725
+ top: -1px;
726
+ right: -1px;
727
+ bottom: -1px;
728
+ left: -1px;
729
+ /* darkening effect */
730
+ background: #000;
731
+ opacity: .25;
732
+ }
733
+
734
+ .fc-day-grid-event .fc-content { /* force events to be one-line tall */
735
+ white-space: nowrap;
736
+ overflow: hidden;
737
+ }
738
+
739
+ .fc-day-grid-event .fc-time {
740
+ font-weight: bold;
741
+ }
742
+
743
+ /* resizer (cursor devices) */
744
+
745
+ /* left resizer */
746
+ .fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer,
747
+ .fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer {
748
+ margin-left: -2px; /* to the day cell's edge */
749
+ }
750
+
751
+ /* right resizer */
752
+ .fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer,
753
+ .fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer {
754
+ margin-right: -2px; /* to the day cell's edge */
755
+ }
756
+
757
+
758
+ /* Event Limiting
759
+ --------------------------------------------------------------------------------------------------*/
760
+
761
+ /* "more" link that represents hidden events */
762
+
763
+ a.fc-more {
764
+ margin: 1px 3px;
765
+ font-size: .85em;
766
+ cursor: pointer;
767
+ text-decoration: none;
768
+ }
769
+
770
+ a.fc-more:hover {
771
+ text-decoration: underline;
772
+ }
773
+
774
+ .fc-limited { /* rows and cells that are hidden because of a "more" link */
775
+ display: none;
776
+ }
777
+
778
+ /* popover that appears when "more" link is clicked */
779
+
780
+ .fc-day-grid .fc-row {
781
+ z-index: 1; /* make the "more" popover one higher than this */
782
+ }
783
+
784
+ .fc-more-popover {
785
+ z-index: 2;
786
+ width: 220px;
787
+ }
788
+
789
+ .fc-more-popover .fc-event-container {
790
+ padding: 10px;
791
+ }
792
+
793
+
794
+ /* Now Indicator
795
+ --------------------------------------------------------------------------------------------------*/
796
+
797
+ .fc-now-indicator {
798
+ position: absolute;
799
+ border: 0 solid red;
800
+ }
801
+
802
+
803
+ /* Utilities
804
+ --------------------------------------------------------------------------------------------------*/
805
+
806
+ .fc-unselectable {
807
+ -webkit-user-select: none;
808
+ -khtml-user-select: none;
809
+ -moz-user-select: none;
810
+ -ms-user-select: none;
811
+ user-select: none;
812
+ -webkit-touch-callout: none;
813
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
814
+ }
815
+
816
+
817
+
818
+ /* Toolbar
819
+ --------------------------------------------------------------------------------------------------*/
820
+
821
+ .fc-toolbar {
822
+ text-align: center;
823
+ }
824
+
825
+ .fc-toolbar.fc-header-toolbar {
826
+ margin-bottom: 1em;
827
+ }
828
+
829
+ .fc-toolbar.fc-footer-toolbar {
830
+ margin-top: 1em;
831
+ }
832
+
833
+ .fc-toolbar .fc-left {
834
+ float: left;
835
+ }
836
+
837
+ .fc-toolbar .fc-right {
838
+ float: right;
839
+ }
840
+
841
+ .fc-toolbar .fc-center {
842
+ display: inline-block;
843
+ }
844
+
845
+ /* the things within each left/right/center section */
846
+ .fc .fc-toolbar > * > * { /* extra precedence to override button border margins */
847
+ float: left;
848
+ margin-left: .75em;
849
+ }
850
+
851
+ /* the first thing within each left/center/right section */
852
+ .fc .fc-toolbar > * > :first-child { /* extra precedence to override button border margins */
853
+ margin-left: 0;
854
+ }
855
+
856
+ /* title text */
857
+
858
+ .fc-toolbar h2 {
859
+ margin: 0;
860
+ }
861
+
862
+ /* button layering (for border precedence) */
863
+
864
+ .fc-toolbar button {
865
+ position: relative;
866
+ }
867
+
868
+ .fc-toolbar .fc-state-hover,
869
+ .fc-toolbar .ui-state-hover {
870
+ z-index: 2;
871
+ }
872
+
873
+ .fc-toolbar .fc-state-down {
874
+ z-index: 3;
875
+ }
876
+
877
+ .fc-toolbar .fc-state-active,
878
+ .fc-toolbar .ui-state-active {
879
+ z-index: 4;
880
+ }
881
+
882
+ .fc-toolbar button:focus {
883
+ z-index: 5;
884
+ }
885
+
886
+
887
+ /* View Structure
888
+ --------------------------------------------------------------------------------------------------*/
889
+
890
+ /* undo twitter bootstrap's box-sizing rules. normalizes positioning techniques */
891
+ /* don't do this for the toolbar because we'll want bootstrap to style those buttons as some pt */
892
+ .fc-view-container *,
893
+ .fc-view-container *:before,
894
+ .fc-view-container *:after {
895
+ -webkit-box-sizing: content-box;
896
+ -moz-box-sizing: content-box;
897
+ box-sizing: content-box;
898
+ }
899
+
900
+ .fc-view, /* scope positioning and z-index's for everything within the view */
901
+ .fc-view > table { /* so dragged elements can be above the view's main element */
902
+ position: relative;
903
+ z-index: 1;
904
+ }
905
+
906
+
907
+
908
+ /* BasicView
909
+ --------------------------------------------------------------------------------------------------*/
910
+
911
+ /* day row structure */
912
+
913
+ .fc-basicWeek-view .fc-content-skeleton,
914
+ .fc-basicDay-view .fc-content-skeleton {
915
+ /* there may be week numbers in these views, so no padding-top */
916
+ padding-bottom: 1em; /* ensure a space at bottom of cell for user selecting/clicking */
917
+ }
918
+
919
+ .fc-basic-view .fc-body .fc-row {
920
+ min-height: 4em; /* ensure that all rows are at least this tall */
921
+ }
922
+
923
+ /* a "rigid" row will take up a constant amount of height because content-skeleton is absolute */
924
+
925
+ .fc-row.fc-rigid {
926
+ overflow: hidden;
927
+ }
928
+
929
+ .fc-row.fc-rigid .fc-content-skeleton {
930
+ position: absolute;
931
+ top: 0;
932
+ left: 0;
933
+ right: 0;
934
+ }
935
+
936
+ /* week and day number styling */
937
+
938
+ .fc-day-top.fc-other-month {
939
+ opacity: 0.3;
940
+ }
941
+
942
+ .fc-basic-view .fc-week-number,
943
+ .fc-basic-view .fc-day-number {
944
+ padding: 2px;
945
+ }
946
+
947
+ .fc-basic-view th.fc-week-number,
948
+ .fc-basic-view th.fc-day-number {
949
+ padding: 0 2px; /* column headers can't have as much v space */
950
+ }
951
+
952
+ .fc-ltr .fc-basic-view .fc-day-top .fc-day-number { float: right; }
953
+ .fc-rtl .fc-basic-view .fc-day-top .fc-day-number { float: left; }
954
+
955
+ .fc-ltr .fc-basic-view .fc-day-top .fc-week-number { float: left; border-radius: 0 0 3px 0; }
956
+ .fc-rtl .fc-basic-view .fc-day-top .fc-week-number { float: right; border-radius: 0 0 0 3px; }
957
+
958
+ .fc-basic-view .fc-day-top .fc-week-number {
959
+ min-width: 1.5em;
960
+ text-align: center;
961
+ background-color: #f2f2f2;
962
+ color: #808080;
963
+ }
964
+
965
+ /* when week/day number have own column */
966
+
967
+ .fc-basic-view td.fc-week-number {
968
+ text-align: center;
969
+ }
970
+
971
+ .fc-basic-view td.fc-week-number > * {
972
+ /* work around the way we do column resizing and ensure a minimum width */
973
+ display: inline-block;
974
+ min-width: 1.25em;
975
+ }
976
+
977
+
978
+ /* AgendaView all-day area
979
+ --------------------------------------------------------------------------------------------------*/
980
+
981
+ .fc-agenda-view .fc-day-grid {
982
+ position: relative;
983
+ z-index: 2; /* so the "more.." popover will be over the time grid */
984
+ }
985
+
986
+ .fc-agenda-view .fc-day-grid .fc-row {
987
+ min-height: 3em; /* all-day section will never get shorter than this */
988
+ }
989
+
990
+ .fc-agenda-view .fc-day-grid .fc-row .fc-content-skeleton {
991
+ padding-bottom: 1em; /* give space underneath events for clicking/selecting days */
992
+ }
993
+
994
+
995
+ /* TimeGrid axis running down the side (for both the all-day area and the slot area)
996
+ --------------------------------------------------------------------------------------------------*/
997
+
998
+ .fc .fc-axis { /* .fc to overcome default cell styles */
999
+ vertical-align: middle;
1000
+ padding: 0 4px;
1001
+ white-space: nowrap;
1002
+ }
1003
+
1004
+ .fc-ltr .fc-axis {
1005
+ text-align: right;
1006
+ }
1007
+
1008
+ .fc-rtl .fc-axis {
1009
+ text-align: left;
1010
+ }
1011
+
1012
+ .ui-widget td.fc-axis {
1013
+ font-weight: normal; /* overcome jqui theme making it bold */
1014
+ }
1015
+
1016
+
1017
+ /* TimeGrid Structure
1018
+ --------------------------------------------------------------------------------------------------*/
1019
+
1020
+ .fc-time-grid-container, /* so scroll container's z-index is below all-day */
1021
+ .fc-time-grid { /* so slats/bg/content/etc positions get scoped within here */
1022
+ position: relative;
1023
+ z-index: 1;
1024
+ }
1025
+
1026
+ .fc-time-grid {
1027
+ min-height: 100%; /* so if height setting is 'auto', .fc-bg stretches to fill height */
1028
+ }
1029
+
1030
+ .fc-time-grid table { /* don't put outer borders on slats/bg/content/etc */
1031
+ border: 0 hidden transparent;
1032
+ }
1033
+
1034
+ .fc-time-grid > .fc-bg {
1035
+ z-index: 1;
1036
+ }
1037
+
1038
+ .fc-time-grid .fc-slats,
1039
+ .fc-time-grid > hr { /* the <hr> AgendaView injects when grid is shorter than scroller */
1040
+ position: relative;
1041
+ z-index: 2;
1042
+ }
1043
+
1044
+ .fc-time-grid .fc-content-col {
1045
+ position: relative; /* because now-indicator lives directly inside */
1046
+ }
1047
+
1048
+ .fc-time-grid .fc-content-skeleton {
1049
+ position: absolute;
1050
+ z-index: 3;
1051
+ top: 0;
1052
+ left: 0;
1053
+ right: 0;
1054
+ }
1055
+
1056
+ /* divs within a cell within the fc-content-skeleton */
1057
+
1058
+ .fc-time-grid .fc-business-container {
1059
+ position: relative;
1060
+ z-index: 1;
1061
+ }
1062
+
1063
+ .fc-time-grid .fc-bgevent-container {
1064
+ position: relative;
1065
+ z-index: 2;
1066
+ }
1067
+
1068
+ .fc-time-grid .fc-highlight-container {
1069
+ position: relative;
1070
+ z-index: 3;
1071
+ }
1072
+
1073
+ .fc-time-grid .fc-event-container {
1074
+ position: relative;
1075
+ z-index: 4;
1076
+ }
1077
+
1078
+ .fc-time-grid .fc-now-indicator-line {
1079
+ z-index: 5;
1080
+ }
1081
+
1082
+ .fc-time-grid .fc-helper-container { /* also is fc-event-container */
1083
+ position: relative;
1084
+ z-index: 6;
1085
+ }
1086
+
1087
+
1088
+ /* TimeGrid Slats (lines that run horizontally)
1089
+ --------------------------------------------------------------------------------------------------*/
1090
+
1091
+ .fc-time-grid .fc-slats td {
1092
+ height: 1.5em;
1093
+ border-bottom: 0; /* each cell is responsible for its top border */
1094
+ }
1095
+
1096
+ .fc-time-grid .fc-slats .fc-minor td {
1097
+ border-top-style: dotted;
1098
+ }
1099
+
1100
+ .fc-time-grid .fc-slats .ui-widget-content { /* for jqui theme */
1101
+ background: none; /* see through to fc-bg */
1102
+ }
1103
+
1104
+
1105
+ /* TimeGrid Highlighting Slots
1106
+ --------------------------------------------------------------------------------------------------*/
1107
+
1108
+ .fc-time-grid .fc-highlight-container { /* a div within a cell within the fc-highlight-skeleton */
1109
+ position: relative; /* scopes the left/right of the fc-highlight to be in the column */
1110
+ }
1111
+
1112
+ .fc-time-grid .fc-highlight {
1113
+ position: absolute;
1114
+ left: 0;
1115
+ right: 0;
1116
+ /* top and bottom will be in by JS */
1117
+ }
1118
+
1119
+
1120
+ /* TimeGrid Event Containment
1121
+ --------------------------------------------------------------------------------------------------*/
1122
+
1123
+ .fc-ltr .fc-time-grid .fc-event-container { /* space on the sides of events for LTR (default) */
1124
+ margin: 0 2.5% 0 2px;
1125
+ }
1126
+
1127
+ .fc-rtl .fc-time-grid .fc-event-container { /* space on the sides of events for RTL */
1128
+ margin: 0 2px 0 2.5%;
1129
+ }
1130
+
1131
+ .fc-time-grid .fc-event,
1132
+ .fc-time-grid .fc-bgevent {
1133
+ position: absolute;
1134
+ z-index: 1; /* scope inner z-index's */
1135
+ }
1136
+
1137
+ .fc-time-grid .fc-bgevent {
1138
+ /* background events always span full width */
1139
+ left: 0;
1140
+ right: 0;
1141
+ }
1142
+
1143
+
1144
+ /* Generic Vertical Event
1145
+ --------------------------------------------------------------------------------------------------*/
1146
+
1147
+ .fc-v-event.fc-not-start { /* events that are continuing from another day */
1148
+ /* replace space made by the top border with padding */
1149
+ border-top-width: 0;
1150
+ padding-top: 1px;
1151
+
1152
+ /* remove top rounded corners */
1153
+ border-top-left-radius: 0;
1154
+ border-top-right-radius: 0;
1155
+ }
1156
+
1157
+ .fc-v-event.fc-not-end {
1158
+ /* replace space made by the top border with padding */
1159
+ border-bottom-width: 0;
1160
+ padding-bottom: 1px;
1161
+
1162
+ /* remove bottom rounded corners */
1163
+ border-bottom-left-radius: 0;
1164
+ border-bottom-right-radius: 0;
1165
+ }
1166
+
1167
+
1168
+ /* TimeGrid Event Styling
1169
+ ----------------------------------------------------------------------------------------------------
1170
+ We use the full "fc-time-grid-event" class instead of using descendants because the event won't
1171
+ be a descendant of the grid when it is being dragged.
1172
+ */
1173
+
1174
+ .fc-time-grid-event {
1175
+ overflow: hidden; /* don't let the bg flow over rounded corners */
1176
+ }
1177
+
1178
+ .fc-time-grid-event.fc-selected {
1179
+ /* need to allow touch resizers to extend outside event's bounding box */
1180
+ /* common fc-selected styles hide the fc-bg, so don't need this anyway */
1181
+ overflow: visible;
1182
+ }
1183
+
1184
+ .fc-time-grid-event.fc-selected .fc-bg {
1185
+ display: none; /* hide semi-white background, to appear darker */
1186
+ }
1187
+
1188
+ .fc-time-grid-event .fc-content {
1189
+ overflow: hidden; /* for when .fc-selected */
1190
+ }
1191
+
1192
+ .fc-time-grid-event .fc-time,
1193
+ .fc-time-grid-event .fc-title {
1194
+ padding: 0 1px;
1195
+ }
1196
+
1197
+ .fc-time-grid-event .fc-time {
1198
+ font-size: .85em;
1199
+ white-space: nowrap;
1200
+ }
1201
+
1202
+ /* short mode, where time and title are on the same line */
1203
+
1204
+ .fc-time-grid-event.fc-short .fc-content {
1205
+ /* don't wrap to second line (now that contents will be inline) */
1206
+ white-space: nowrap;
1207
+ }
1208
+
1209
+ .fc-time-grid-event.fc-short .fc-time,
1210
+ .fc-time-grid-event.fc-short .fc-title {
1211
+ /* put the time and title on the same line */
1212
+ display: inline-block;
1213
+ vertical-align: top;
1214
+ }
1215
+
1216
+ .fc-time-grid-event.fc-short .fc-time span {
1217
+ display: none; /* don't display the full time text... */
1218
+ }
1219
+
1220
+ .fc-time-grid-event.fc-short .fc-time:before {
1221
+ content: attr(data-start); /* ...instead, display only the start time */
1222
+ }
1223
+
1224
+ .fc-time-grid-event.fc-short .fc-time:after {
1225
+ content: "\000A0-\000A0"; /* seperate with a dash, wrapped in nbsp's */
1226
+ }
1227
+
1228
+ .fc-time-grid-event.fc-short .fc-title {
1229
+ font-size: .85em; /* make the title text the same size as the time */
1230
+ padding: 0; /* undo padding from above */
1231
+ }
1232
+
1233
+ /* resizer (cursor device) */
1234
+
1235
+ .fc-time-grid-event.fc-allow-mouse-resize .fc-resizer {
1236
+ left: 0;
1237
+ right: 0;
1238
+ bottom: 0;
1239
+ height: 8px;
1240
+ overflow: hidden;
1241
+ line-height: 8px;
1242
+ font-size: 11px;
1243
+ font-family: monospace;
1244
+ text-align: center;
1245
+ cursor: s-resize;
1246
+ }
1247
+
1248
+ .fc-time-grid-event.fc-allow-mouse-resize .fc-resizer:after {
1249
+ content: "=";
1250
+ }
1251
+
1252
+ /* resizer (touch device) */
1253
+
1254
+ .fc-time-grid-event.fc-selected .fc-resizer {
1255
+ /* 10x10 dot */
1256
+ border-radius: 5px;
1257
+ border-width: 1px;
1258
+ width: 8px;
1259
+ height: 8px;
1260
+ border-style: solid;
1261
+ border-color: inherit;
1262
+ background: #fff;
1263
+ /* horizontally center */
1264
+ left: 50%;
1265
+ margin-left: -5px;
1266
+ /* center on the bottom edge */
1267
+ bottom: -5px;
1268
+ }
1269
+
1270
+
1271
+ /* Now Indicator
1272
+ --------------------------------------------------------------------------------------------------*/
1273
+
1274
+ .fc-time-grid .fc-now-indicator-line {
1275
+ border-top-width: 1px;
1276
+ left: 0;
1277
+ right: 0;
1278
+ }
1279
+
1280
+ /* arrow on axis */
1281
+
1282
+ .fc-time-grid .fc-now-indicator-arrow {
1283
+ margin-top: -5px; /* vertically center on top coordinate */
1284
+ }
1285
+
1286
+ .fc-ltr .fc-time-grid .fc-now-indicator-arrow {
1287
+ left: 0;
1288
+ /* triangle pointing right... */
1289
+ border-width: 5px 0 5px 6px;
1290
+ border-top-color: transparent;
1291
+ border-bottom-color: transparent;
1292
+ }
1293
+
1294
+ .fc-rtl .fc-time-grid .fc-now-indicator-arrow {
1295
+ right: 0;
1296
+ /* triangle pointing left... */
1297
+ border-width: 5px 6px 5px 0;
1298
+ border-top-color: transparent;
1299
+ border-bottom-color: transparent;
1300
+ }
1301
+
1302
+
1303
+
1304
+ /* List View
1305
+ --------------------------------------------------------------------------------------------------*/
1306
+
1307
+ /* possibly reusable */
1308
+
1309
+ .fc-event-dot {
1310
+ display: inline-block;
1311
+ width: 10px;
1312
+ height: 10px;
1313
+ border-radius: 5px;
1314
+ }
1315
+
1316
+ /* view wrapper */
1317
+
1318
+ .fc-rtl .fc-list-view {
1319
+ direction: rtl; /* unlike core views, leverage browser RTL */
1320
+ }
1321
+
1322
+ .fc-list-view {
1323
+ border-width: 1px;
1324
+ border-style: solid;
1325
+ }
1326
+
1327
+ /* table resets */
1328
+
1329
+ .fc .fc-list-table {
1330
+ table-layout: auto; /* for shrinkwrapping cell content */
1331
+ }
1332
+
1333
+ .fc-list-table td {
1334
+ border-width: 1px 0 0;
1335
+ padding: 8px 14px;
1336
+ }
1337
+
1338
+ .fc-list-table tr:first-child td {
1339
+ border-top-width: 0;
1340
+ }
1341
+
1342
+ /* day headings with the list */
1343
+
1344
+ .fc-list-heading {
1345
+ border-bottom-width: 1px;
1346
+ }
1347
+
1348
+ .fc-list-heading td {
1349
+ font-weight: bold;
1350
+ }
1351
+
1352
+ .fc-ltr .fc-list-heading-main { float: left; }
1353
+ .fc-ltr .fc-list-heading-alt { float: right; }
1354
+
1355
+ .fc-rtl .fc-list-heading-main { float: right; }
1356
+ .fc-rtl .fc-list-heading-alt { float: left; }
1357
+
1358
+ /* event list items */
1359
+
1360
+ .fc-list-item.fc-has-url {
1361
+ cursor: pointer; /* whole row will be clickable */
1362
+ }
1363
+
1364
+ .fc-list-item:hover td {
1365
+ background-color: #f5f5f5;
1366
+ }
1367
+
1368
+ .fc-list-item-marker,
1369
+ .fc-list-item-time {
1370
+ white-space: nowrap;
1371
+ width: 1px;
1372
+ }
1373
+
1374
+ /* make the dot closer to the event title */
1375
+ .fc-ltr .fc-list-item-marker { padding-right: 0; }
1376
+ .fc-rtl .fc-list-item-marker { padding-left: 0; }
1377
+
1378
+ .fc-list-item-title a {
1379
+ /* every event title cell has an <a> tag */
1380
+ text-decoration: none;
1381
+ color: inherit;
1382
+ }
1383
+
1384
+ .fc-list-item-title a[href]:hover {
1385
+ /* hover effect only on titles with hrefs */
1386
+ text-decoration: underline;
1387
+ }
1388
+
1389
+ /* message when no events */
1390
+
1391
+ .fc-list-empty-wrap2 {
1392
+ position: absolute;
1393
+ top: 0;
1394
+ left: 0;
1395
+ right: 0;
1396
+ bottom: 0;
1397
+ }
1398
+
1399
+ .fc-list-empty-wrap1 {
1400
+ width: 100%;
1401
+ height: 100%;
1402
+ display: table;
1403
+ }
1404
+
1405
+ .fc-list-empty {
1406
+ display: table-cell;
1407
+ vertical-align: middle;
1408
+ text-align: center;
1409
+ }
1410
+
1411
+ .fc-unthemed .fc-list-empty { /* theme will provide own background */
1412
+ background-color: #eee;
1413
+ }
assets/lib/fullcalendar/fullcalendar.js ADDED
@@ -0,0 +1,15591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+
7
+ (function(factory) {
8
+ if (typeof define === 'function' && define.amd) {
9
+ define([ 'jquery', 'moment' ], factory);
10
+ }
11
+ else if (typeof exports === 'object') { // Node/CommonJS
12
+ module.exports = factory(require('jquery'), require('moment'));
13
+ }
14
+ else {
15
+ factory(jQuery, moment);
16
+ }
17
+ })(function($, moment) {
18
+
19
+ ;;
20
+
21
+ var FC = $.fullCalendar = {
22
+ version: "3.4.0",
23
+ // When introducing internal API incompatibilities (where fullcalendar plugins would break),
24
+ // the minor version of the calendar should be upped (ex: 2.7.2 -> 2.8.0)
25
+ // and the below integer should be incremented.
26
+ internalApiVersion: 9
27
+ };
28
+ var fcViews = FC.views = {};
29
+
30
+
31
+ $.fn.fullCalendar = function(options) {
32
+ var args = Array.prototype.slice.call(arguments, 1); // for a possible method call
33
+ var res = this; // what this function will return (this jQuery object by default)
34
+
35
+ this.each(function(i, _element) { // loop each DOM element involved
36
+ var element = $(_element);
37
+ var calendar = element.data('fullCalendar'); // get the existing calendar object (if any)
38
+ var singleRes; // the returned value of this single method call
39
+
40
+ // a method call
41
+ if (typeof options === 'string') {
42
+ if (calendar && $.isFunction(calendar[options])) {
43
+ singleRes = calendar[options].apply(calendar, args);
44
+ if (!i) {
45
+ res = singleRes; // record the first method call result
46
+ }
47
+ if (options === 'destroy') { // for the destroy method, must remove Calendar object data
48
+ element.removeData('fullCalendar');
49
+ }
50
+ }
51
+ }
52
+ // a new calendar initialization
53
+ else if (!calendar) { // don't initialize twice
54
+ calendar = new Calendar(element, options);
55
+ element.data('fullCalendar', calendar);
56
+ calendar.render();
57
+ }
58
+ });
59
+
60
+ return res;
61
+ };
62
+
63
+
64
+ var complexOptions = [ // names of options that are objects whose properties should be combined
65
+ 'header',
66
+ 'footer',
67
+ 'buttonText',
68
+ 'buttonIcons',
69
+ 'themeButtonIcons'
70
+ ];
71
+
72
+
73
+ // Merges an array of option objects into a single object
74
+ function mergeOptions(optionObjs) {
75
+ return mergeProps(optionObjs, complexOptions);
76
+ }
77
+
78
+ ;;
79
+
80
+ // exports
81
+ FC.intersectRanges = intersectRanges;
82
+ FC.applyAll = applyAll;
83
+ FC.debounce = debounce;
84
+ FC.isInt = isInt;
85
+ FC.htmlEscape = htmlEscape;
86
+ FC.cssToStr = cssToStr;
87
+ FC.proxy = proxy;
88
+ FC.capitaliseFirstLetter = capitaliseFirstLetter;
89
+
90
+
91
+ /* FullCalendar-specific DOM Utilities
92
+ ----------------------------------------------------------------------------------------------------------------------*/
93
+
94
+
95
+ // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left
96
+ // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that.
97
+ function compensateScroll(rowEls, scrollbarWidths) {
98
+ if (scrollbarWidths.left) {
99
+ rowEls.css({
100
+ 'border-left-width': 1,
101
+ 'margin-left': scrollbarWidths.left - 1
102
+ });
103
+ }
104
+ if (scrollbarWidths.right) {
105
+ rowEls.css({
106
+ 'border-right-width': 1,
107
+ 'margin-right': scrollbarWidths.right - 1
108
+ });
109
+ }
110
+ }
111
+
112
+
113
+ // Undoes compensateScroll and restores all borders/margins
114
+ function uncompensateScroll(rowEls) {
115
+ rowEls.css({
116
+ 'margin-left': '',
117
+ 'margin-right': '',
118
+ 'border-left-width': '',
119
+ 'border-right-width': ''
120
+ });
121
+ }
122
+
123
+
124
+ // Make the mouse cursor express that an event is not allowed in the current area
125
+ function disableCursor() {
126
+ $('body').addClass('fc-not-allowed');
127
+ }
128
+
129
+
130
+ // Returns the mouse cursor to its original look
131
+ function enableCursor() {
132
+ $('body').removeClass('fc-not-allowed');
133
+ }
134
+
135
+
136
+ // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
137
+ // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
138
+ // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and
139
+ // reduces the available height.
140
+ function distributeHeight(els, availableHeight, shouldRedistribute) {
141
+
142
+ // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions,
143
+ // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars.
144
+
145
+ var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element
146
+ var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE*
147
+ var flexEls = []; // elements that are allowed to expand. array of DOM nodes
148
+ var flexOffsets = []; // amount of vertical space it takes up
149
+ var flexHeights = []; // actual css height
150
+ var usedHeight = 0;
151
+
152
+ undistributeHeight(els); // give all elements their natural height
153
+
154
+ // find elements that are below the recommended height (expandable).
155
+ // important to query for heights in a single first pass (to avoid reflow oscillation).
156
+ els.each(function(i, el) {
157
+ var minOffset = i === els.length - 1 ? minOffset2 : minOffset1;
158
+ var naturalOffset = $(el).outerHeight(true);
159
+
160
+ if (naturalOffset < minOffset) {
161
+ flexEls.push(el);
162
+ flexOffsets.push(naturalOffset);
163
+ flexHeights.push($(el).height());
164
+ }
165
+ else {
166
+ // this element stretches past recommended height (non-expandable). mark the space as occupied.
167
+ usedHeight += naturalOffset;
168
+ }
169
+ });
170
+
171
+ // readjust the recommended height to only consider the height available to non-maxed-out rows.
172
+ if (shouldRedistribute) {
173
+ availableHeight -= usedHeight;
174
+ minOffset1 = Math.floor(availableHeight / flexEls.length);
175
+ minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE*
176
+ }
177
+
178
+ // assign heights to all expandable elements
179
+ $(flexEls).each(function(i, el) {
180
+ var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1;
181
+ var naturalOffset = flexOffsets[i];
182
+ var naturalHeight = flexHeights[i];
183
+ var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding
184
+
185
+ if (naturalOffset < minOffset) { // we check this again because redistribution might have changed things
186
+ $(el).height(newHeight);
187
+ }
188
+ });
189
+ }
190
+
191
+
192
+ // Undoes distrubuteHeight, restoring all els to their natural height
193
+ function undistributeHeight(els) {
194
+ els.height('');
195
+ }
196
+
197
+
198
+ // Given `els`, a jQuery set of <td> cells, find the cell with the largest natural width and set the widths of all the
199
+ // cells to be that width.
200
+ // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline
201
+ function matchCellWidths(els) {
202
+ var maxInnerWidth = 0;
203
+
204
+ els.find('> *').each(function(i, innerEl) {
205
+ var innerWidth = $(innerEl).outerWidth();
206
+ if (innerWidth > maxInnerWidth) {
207
+ maxInnerWidth = innerWidth;
208
+ }
209
+ });
210
+
211
+ maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance
212
+
213
+ els.width(maxInnerWidth);
214
+
215
+ return maxInnerWidth;
216
+ }
217
+
218
+
219
+ // Given one element that resides inside another,
220
+ // Subtracts the height of the inner element from the outer element.
221
+ function subtractInnerElHeight(outerEl, innerEl) {
222
+ var both = outerEl.add(innerEl);
223
+ var diff;
224
+
225
+ // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
226
+ both.css({
227
+ position: 'relative', // cause a reflow, which will force fresh dimension recalculation
228
+ left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
229
+ });
230
+ diff = outerEl.outerHeight() - innerEl.outerHeight(); // grab the dimensions
231
+ both.css({ position: '', left: '' }); // undo hack
232
+
233
+ return diff;
234
+ }
235
+
236
+
237
+ /* Element Geom Utilities
238
+ ----------------------------------------------------------------------------------------------------------------------*/
239
+
240
+ FC.getOuterRect = getOuterRect;
241
+ FC.getClientRect = getClientRect;
242
+ FC.getContentRect = getContentRect;
243
+ FC.getScrollbarWidths = getScrollbarWidths;
244
+
245
+
246
+ // borrowed from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/core.js#L51
247
+ function getScrollParent(el) {
248
+ var position = el.css('position'),
249
+ scrollParent = el.parents().filter(function() {
250
+ var parent = $(this);
251
+ return (/(auto|scroll)/).test(
252
+ parent.css('overflow') + parent.css('overflow-y') + parent.css('overflow-x')
253
+ );
254
+ }).eq(0);
255
+
256
+ return position === 'fixed' || !scrollParent.length ? $(el[0].ownerDocument || document) : scrollParent;
257
+ }
258
+
259
+
260
+ // Queries the outer bounding area of a jQuery element.
261
+ // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
262
+ // Origin is optional.
263
+ function getOuterRect(el, origin) {
264
+ var offset = el.offset();
265
+ var left = offset.left - (origin ? origin.left : 0);
266
+ var top = offset.top - (origin ? origin.top : 0);
267
+
268
+ return {
269
+ left: left,
270
+ right: left + el.outerWidth(),
271
+ top: top,
272
+ bottom: top + el.outerHeight()
273
+ };
274
+ }
275
+
276
+
277
+ // Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding.
278
+ // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
279
+ // Origin is optional.
280
+ // WARNING: given element can't have borders
281
+ // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
282
+ function getClientRect(el, origin) {
283
+ var offset = el.offset();
284
+ var scrollbarWidths = getScrollbarWidths(el);
285
+ var left = offset.left + getCssFloat(el, 'border-left-width') + scrollbarWidths.left - (origin ? origin.left : 0);
286
+ var top = offset.top + getCssFloat(el, 'border-top-width') + scrollbarWidths.top - (origin ? origin.top : 0);
287
+
288
+ return {
289
+ left: left,
290
+ right: left + el[0].clientWidth, // clientWidth includes padding but NOT scrollbars
291
+ top: top,
292
+ bottom: top + el[0].clientHeight // clientHeight includes padding but NOT scrollbars
293
+ };
294
+ }
295
+
296
+
297
+ // Queries the area within the margin/border/padding of a jQuery element. Assumed not to have scrollbars.
298
+ // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
299
+ // Origin is optional.
300
+ function getContentRect(el, origin) {
301
+ var offset = el.offset(); // just outside of border, margin not included
302
+ var left = offset.left + getCssFloat(el, 'border-left-width') + getCssFloat(el, 'padding-left') -
303
+ (origin ? origin.left : 0);
304
+ var top = offset.top + getCssFloat(el, 'border-top-width') + getCssFloat(el, 'padding-top') -
305
+ (origin ? origin.top : 0);
306
+
307
+ return {
308
+ left: left,
309
+ right: left + el.width(),
310
+ top: top,
311
+ bottom: top + el.height()
312
+ };
313
+ }
314
+
315
+
316
+ // Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element.
317
+ // WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger).
318
+ // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
319
+ function getScrollbarWidths(el) {
320
+ var leftRightWidth = el[0].offsetWidth - el[0].clientWidth;
321
+ var bottomWidth = el[0].offsetHeight - el[0].clientHeight;
322
+ var widths;
323
+
324
+ leftRightWidth = sanitizeScrollbarWidth(leftRightWidth);
325
+ bottomWidth = sanitizeScrollbarWidth(bottomWidth);
326
+
327
+ widths = { left: 0, right: 0, top: 0, bottom: bottomWidth };
328
+
329
+ if (getIsLeftRtlScrollbars() && el.css('direction') == 'rtl') { // is the scrollbar on the left side?
330
+ widths.left = leftRightWidth;
331
+ }
332
+ else {
333
+ widths.right = leftRightWidth;
334
+ }
335
+
336
+ return widths;
337
+ }
338
+
339
+
340
+ // The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to
341
+ // retina displays, rounding, and IE11. Massage them into a usable value.
342
+ function sanitizeScrollbarWidth(width) {
343
+ width = Math.max(0, width); // no negatives
344
+ width = Math.round(width);
345
+ return width;
346
+ }
347
+
348
+
349
+ // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
350
+
351
+ var _isLeftRtlScrollbars = null;
352
+
353
+ function getIsLeftRtlScrollbars() { // responsible for caching the computation
354
+ if (_isLeftRtlScrollbars === null) {
355
+ _isLeftRtlScrollbars = computeIsLeftRtlScrollbars();
356
+ }
357
+ return _isLeftRtlScrollbars;
358
+ }
359
+
360
+ function computeIsLeftRtlScrollbars() { // creates an offscreen test element, then removes it
361
+ var el = $('<div><div/></div>')
362
+ .css({
363
+ position: 'absolute',
364
+ top: -1000,
365
+ left: 0,
366
+ border: 0,
367
+ padding: 0,
368
+ overflow: 'scroll',
369
+ direction: 'rtl'
370
+ })
371
+ .appendTo('body');
372
+ var innerEl = el.children();
373
+ var res = innerEl.offset().left > el.offset().left; // is the inner div shifted to accommodate a left scrollbar?
374
+ el.remove();
375
+ return res;
376
+ }
377
+
378
+
379
+ // Retrieves a jQuery element's computed CSS value as a floating-point number.
380
+ // If the queried value is non-numeric (ex: IE can return "medium" for border width), will just return zero.
381
+ function getCssFloat(el, prop) {
382
+ return parseFloat(el.css(prop)) || 0;
383
+ }
384
+
385
+
386
+ /* Mouse / Touch Utilities
387
+ ----------------------------------------------------------------------------------------------------------------------*/
388
+
389
+ FC.preventDefault = preventDefault;
390
+
391
+
392
+ // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
393
+ function isPrimaryMouseButton(ev) {
394
+ return ev.which == 1 && !ev.ctrlKey;
395
+ }
396
+
397
+
398
+ function getEvX(ev) {
399
+ var touches = ev.originalEvent.touches;
400
+
401
+ // on mobile FF, pageX for touch events is present, but incorrect,
402
+ // so, look at touch coordinates first.
403
+ if (touches && touches.length) {
404
+ return touches[0].pageX;
405
+ }
406
+
407
+ return ev.pageX;
408
+ }
409
+
410
+
411
+ function getEvY(ev) {
412
+ var touches = ev.originalEvent.touches;
413
+
414
+ // on mobile FF, pageX for touch events is present, but incorrect,
415
+ // so, look at touch coordinates first.
416
+ if (touches && touches.length) {
417
+ return touches[0].pageY;
418
+ }
419
+
420
+ return ev.pageY;
421
+ }
422
+
423
+
424
+ function getEvIsTouch(ev) {
425
+ return /^touch/.test(ev.type);
426
+ }
427
+
428
+
429
+ function preventSelection(el) {
430
+ el.addClass('fc-unselectable')
431
+ .on('selectstart', preventDefault);
432
+ }
433
+
434
+
435
+ function allowSelection(el) {
436
+ el.removeClass('fc-unselectable')
437
+ .off('selectstart', preventDefault);
438
+ }
439
+
440
+
441
+ // Stops a mouse/touch event from doing it's native browser action
442
+ function preventDefault(ev) {
443
+ ev.preventDefault();
444
+ }
445
+
446
+
447
+ /* General Geometry Utils
448
+ ----------------------------------------------------------------------------------------------------------------------*/
449
+
450
+ FC.intersectRects = intersectRects;
451
+
452
+ // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false
453
+ function intersectRects(rect1, rect2) {
454
+ var res = {
455
+ left: Math.max(rect1.left, rect2.left),
456
+ right: Math.min(rect1.right, rect2.right),
457
+ top: Math.max(rect1.top, rect2.top),
458
+ bottom: Math.min(rect1.bottom, rect2.bottom)
459
+ };
460
+
461
+ if (res.left < res.right && res.top < res.bottom) {
462
+ return res;
463
+ }
464
+ return false;
465
+ }
466
+
467
+
468
+ // Returns a new point that will have been moved to reside within the given rectangle
469
+ function constrainPoint(point, rect) {
470
+ return {
471
+ left: Math.min(Math.max(point.left, rect.left), rect.right),
472
+ top: Math.min(Math.max(point.top, rect.top), rect.bottom)
473
+ };
474
+ }
475
+
476
+
477
+ // Returns a point that is the center of the given rectangle
478
+ function getRectCenter(rect) {
479
+ return {
480
+ left: (rect.left + rect.right) / 2,
481
+ top: (rect.top + rect.bottom) / 2
482
+ };
483
+ }
484
+
485
+
486
+ // Subtracts point2's coordinates from point1's coordinates, returning a delta
487
+ function diffPoints(point1, point2) {
488
+ return {
489
+ left: point1.left - point2.left,
490
+ top: point1.top - point2.top
491
+ };
492
+ }
493
+
494
+
495
+ /* Object Ordering by Field
496
+ ----------------------------------------------------------------------------------------------------------------------*/
497
+
498
+ FC.parseFieldSpecs = parseFieldSpecs;
499
+ FC.compareByFieldSpecs = compareByFieldSpecs;
500
+ FC.compareByFieldSpec = compareByFieldSpec;
501
+ FC.flexibleCompare = flexibleCompare;
502
+
503
+
504
+ function parseFieldSpecs(input) {
505
+ var specs = [];
506
+ var tokens = [];
507
+ var i, token;
508
+
509
+ if (typeof input === 'string') {
510
+ tokens = input.split(/\s*,\s*/);
511
+ }
512
+ else if (typeof input === 'function') {
513
+ tokens = [ input ];
514
+ }
515
+ else if ($.isArray(input)) {
516
+ tokens = input;
517
+ }
518
+
519
+ for (i = 0; i < tokens.length; i++) {
520
+ token = tokens[i];
521
+
522
+ if (typeof token === 'string') {
523
+ specs.push(
524
+ token.charAt(0) == '-' ?
525
+ { field: token.substring(1), order: -1 } :
526
+ { field: token, order: 1 }
527
+ );
528
+ }
529
+ else if (typeof token === 'function') {
530
+ specs.push({ func: token });
531
+ }
532
+ }
533
+
534
+ return specs;
535
+ }
536
+
537
+
538
+ function compareByFieldSpecs(obj1, obj2, fieldSpecs) {
539
+ var i;
540
+ var cmp;
541
+
542
+ for (i = 0; i < fieldSpecs.length; i++) {
543
+ cmp = compareByFieldSpec(obj1, obj2, fieldSpecs[i]);
544
+ if (cmp) {
545
+ return cmp;
546
+ }
547
+ }
548
+
549
+ return 0;
550
+ }
551
+
552
+
553
+ function compareByFieldSpec(obj1, obj2, fieldSpec) {
554
+ if (fieldSpec.func) {
555
+ return fieldSpec.func(obj1, obj2);
556
+ }
557
+ return flexibleCompare(obj1[fieldSpec.field], obj2[fieldSpec.field]) *
558
+ (fieldSpec.order || 1);
559
+ }
560
+
561
+
562
+ function flexibleCompare(a, b) {
563
+ if (!a && !b) {
564
+ return 0;
565
+ }
566
+ if (b == null) {
567
+ return -1;
568
+ }
569
+ if (a == null) {
570
+ return 1;
571
+ }
572
+ if ($.type(a) === 'string' || $.type(b) === 'string') {
573
+ return String(a).localeCompare(String(b));
574
+ }
575
+ return a - b;
576
+ }
577
+
578
+
579
+ /* FullCalendar-specific Misc Utilities
580
+ ----------------------------------------------------------------------------------------------------------------------*/
581
+
582
+
583
+ // Computes the intersection of the two ranges. Will return fresh date clones in a range.
584
+ // Returns undefined if no intersection.
585
+ // Expects all dates to be normalized to the same timezone beforehand.
586
+ // TODO: move to date section?
587
+ function intersectRanges(subjectRange, constraintRange) {
588
+ var subjectStart = subjectRange.start;
589
+ var subjectEnd = subjectRange.end;
590
+ var constraintStart = constraintRange.start;
591
+ var constraintEnd = constraintRange.end;
592
+ var segStart, segEnd;
593
+ var isStart, isEnd;
594
+
595
+ if (subjectEnd > constraintStart && subjectStart < constraintEnd) { // in bounds at all?
596
+
597
+ if (subjectStart >= constraintStart) {
598
+ segStart = subjectStart.clone();
599
+ isStart = true;
600
+ }
601
+ else {
602
+ segStart = constraintStart.clone();
603
+ isStart = false;
604
+ }
605
+
606
+ if (subjectEnd <= constraintEnd) {
607
+ segEnd = subjectEnd.clone();
608
+ isEnd = true;
609
+ }
610
+ else {
611
+ segEnd = constraintEnd.clone();
612
+ isEnd = false;
613
+ }
614
+
615
+ return {
616
+ start: segStart,
617
+ end: segEnd,
618
+ isStart: isStart,
619
+ isEnd: isEnd
620
+ };
621
+ }
622
+ }
623
+
624
+
625
+ /* Date Utilities
626
+ ----------------------------------------------------------------------------------------------------------------------*/
627
+
628
+ FC.computeGreatestUnit = computeGreatestUnit;
629
+ FC.divideRangeByDuration = divideRangeByDuration;
630
+ FC.divideDurationByDuration = divideDurationByDuration;
631
+ FC.multiplyDuration = multiplyDuration;
632
+ FC.durationHasTime = durationHasTime;
633
+
634
+ var dayIDs = [ 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ];
635
+ var unitsDesc = [ 'year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond' ]; // descending
636
+
637
+
638
+ // Diffs the two moments into a Duration where full-days are recorded first, then the remaining time.
639
+ // Moments will have their timezones normalized.
640
+ function diffDayTime(a, b) {
641
+ return moment.duration({
642
+ days: a.clone().stripTime().diff(b.clone().stripTime(), 'days'),
643
+ ms: a.time() - b.time() // time-of-day from day start. disregards timezone
644
+ });
645
+ }
646
+
647
+
648
+ // Diffs the two moments via their start-of-day (regardless of timezone). Produces whole-day durations.
649
+ function diffDay(a, b) {
650
+ return moment.duration({
651
+ days: a.clone().stripTime().diff(b.clone().stripTime(), 'days')
652
+ });
653
+ }
654
+
655
+
656
+ // Diffs two moments, producing a duration, made of a whole-unit-increment of the given unit. Uses rounding.
657
+ function diffByUnit(a, b, unit) {
658
+ return moment.duration(
659
+ Math.round(a.diff(b, unit, true)), // returnFloat=true
660
+ unit
661
+ );
662
+ }
663
+
664
+
665
+ // Computes the unit name of the largest whole-unit period of time.
666
+ // For example, 48 hours will be "days" whereas 49 hours will be "hours".
667
+ // Accepts start/end, a range object, or an original duration object.
668
+ function computeGreatestUnit(start, end) {
669
+ var i, unit;
670
+ var val;
671
+
672
+ for (i = 0; i < unitsDesc.length; i++) {
673
+ unit = unitsDesc[i];
674
+ val = computeRangeAs(unit, start, end);
675
+
676
+ if (val >= 1 && isInt(val)) {
677
+ break;
678
+ }
679
+ }
680
+
681
+ return unit; // will be "milliseconds" if nothing else matches
682
+ }
683
+
684
+
685
+ // like computeGreatestUnit, but has special abilities to interpret the source input for clues
686
+ function computeDurationGreatestUnit(duration, durationInput) {
687
+ var unit = computeGreatestUnit(duration);
688
+
689
+ // prevent days:7 from being interpreted as a week
690
+ if (unit === 'week' && typeof durationInput === 'object' && durationInput.days) {
691
+ unit = 'day';
692
+ }
693
+
694
+ return unit;
695
+ }
696
+
697
+
698
+ // Computes the number of units (like "hours") in the given range.
699
+ // Range can be a {start,end} object, separate start/end args, or a Duration.
700
+ // Results are based on Moment's .as() and .diff() methods, so results can depend on internal handling
701
+ // of month-diffing logic (which tends to vary from version to version).
702
+ function computeRangeAs(unit, start, end) {
703
+
704
+ if (end != null) { // given start, end
705
+ return end.diff(start, unit, true);
706
+ }
707
+ else if (moment.isDuration(start)) { // given duration
708
+ return start.as(unit);
709
+ }
710
+ else { // given { start, end } range object
711
+ return start.end.diff(start.start, unit, true);
712
+ }
713
+ }
714
+
715
+
716
+ // Intelligently divides a range (specified by a start/end params) by a duration
717
+ function divideRangeByDuration(start, end, dur) {
718
+ var months;
719
+
720
+ if (durationHasTime(dur)) {
721
+ return (end - start) / dur;
722
+ }
723
+ months = dur.asMonths();
724
+ if (Math.abs(months) >= 1 && isInt(months)) {
725
+ return end.diff(start, 'months', true) / months;
726
+ }
727
+ return end.diff(start, 'days', true) / dur.asDays();
728
+ }
729
+
730
+
731
+ // Intelligently divides one duration by another
732
+ function divideDurationByDuration(dur1, dur2) {
733
+ var months1, months2;
734
+
735
+ if (durationHasTime(dur1) || durationHasTime(dur2)) {
736
+ return dur1 / dur2;
737
+ }
738
+ months1 = dur1.asMonths();
739
+ months2 = dur2.asMonths();
740
+ if (
741
+ Math.abs(months1) >= 1 && isInt(months1) &&
742
+ Math.abs(months2) >= 1 && isInt(months2)
743
+ ) {
744
+ return months1 / months2;
745
+ }
746
+ return dur1.asDays() / dur2.asDays();
747
+ }
748
+
749
+
750
+ // Intelligently multiplies a duration by a number
751
+ function multiplyDuration(dur, n) {
752
+ var months;
753
+
754
+ if (durationHasTime(dur)) {
755
+ return moment.duration(dur * n);
756
+ }
757
+ months = dur.asMonths();
758
+ if (Math.abs(months) >= 1 && isInt(months)) {
759
+ return moment.duration({ months: months * n });
760
+ }
761
+ return moment.duration({ days: dur.asDays() * n });
762
+ }
763
+
764
+
765
+ function cloneRange(range) {
766
+ return {
767
+ start: range.start.clone(),
768
+ end: range.end.clone()
769
+ };
770
+ }
771
+
772
+
773
+ // Trims the beginning and end of inner range to be completely within outerRange.
774
+ // Returns a new range object.
775
+ function constrainRange(innerRange, outerRange) {
776
+ innerRange = cloneRange(innerRange);
777
+
778
+ if (outerRange.start) {
779
+ // needs to be inclusively before outerRange's end
780
+ innerRange.start = constrainDate(innerRange.start, outerRange);
781
+ }
782
+
783
+ if (outerRange.end) {
784
+ innerRange.end = minMoment(innerRange.end, outerRange.end);
785
+ }
786
+
787
+ return innerRange;
788
+ }
789
+
790
+
791
+ // If the given date is not within the given range, move it inside.
792
+ // (If it's past the end, make it one millisecond before the end).
793
+ // Always returns a new moment.
794
+ function constrainDate(date, range) {
795
+ date = date.clone();
796
+
797
+ if (range.start) {
798
+ date = maxMoment(date, range.start);
799
+ }
800
+
801
+ if (range.end && date >= range.end) {
802
+ date = range.end.clone().subtract(1);
803
+ }
804
+
805
+ return date;
806
+ }
807
+
808
+
809
+ function isDateWithinRange(date, range) {
810
+ return (!range.start || date >= range.start) &&
811
+ (!range.end || date < range.end);
812
+ }
813
+
814
+
815
+ // TODO: deal with repeat code in intersectRanges
816
+ // constraintRange can have unspecified start/end, an open-ended range.
817
+ function doRangesIntersect(subjectRange, constraintRange) {
818
+ return (!constraintRange.start || subjectRange.end >= constraintRange.start) &&
819
+ (!constraintRange.end || subjectRange.start < constraintRange.end);
820
+ }
821
+
822
+
823
+ function isRangeWithinRange(innerRange, outerRange) {
824
+ return (!outerRange.start || innerRange.start >= outerRange.start) &&
825
+ (!outerRange.end || innerRange.end <= outerRange.end);
826
+ }
827
+
828
+
829
+ function isRangesEqual(range0, range1) {
830
+ return ((range0.start && range1.start && range0.start.isSame(range1.start)) || (!range0.start && !range1.start)) &&
831
+ ((range0.end && range1.end && range0.end.isSame(range1.end)) || (!range0.end && !range1.end));
832
+ }
833
+
834
+
835
+ // Returns the moment that's earlier in time. Always a copy.
836
+ function minMoment(mom1, mom2) {
837
+ return (mom1.isBefore(mom2) ? mom1 : mom2).clone();
838
+ }
839
+
840
+
841
+ // Returns the moment that's later in time. Always a copy.
842
+ function maxMoment(mom1, mom2) {
843
+ return (mom1.isAfter(mom2) ? mom1 : mom2).clone();
844
+ }
845
+
846
+
847
+ // Returns a boolean about whether the given duration has any time parts (hours/minutes/seconds/ms)
848
+ function durationHasTime(dur) {
849
+ return Boolean(dur.hours() || dur.minutes() || dur.seconds() || dur.milliseconds());
850
+ }
851
+
852
+
853
+ function isNativeDate(input) {
854
+ return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date;
855
+ }
856
+
857
+
858
+ // Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00"
859
+ function isTimeString(str) {
860
+ return /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str);
861
+ }
862
+
863
+
864
+ /* Logging and Debug
865
+ ----------------------------------------------------------------------------------------------------------------------*/
866
+
867
+ FC.log = function() {
868
+ var console = window.console;
869
+
870
+ if (console && console.log) {
871
+ return console.log.apply(console, arguments);
872
+ }
873
+ };
874
+
875
+ FC.warn = function() {
876
+ var console = window.console;
877
+
878
+ if (console && console.warn) {
879
+ return console.warn.apply(console, arguments);
880
+ }
881
+ else {
882
+ return FC.log.apply(FC, arguments);
883
+ }
884
+ };
885
+
886
+
887
+ /* General Utilities
888
+ ----------------------------------------------------------------------------------------------------------------------*/
889
+
890
+ var hasOwnPropMethod = {}.hasOwnProperty;
891
+
892
+
893
+ // Merges an array of objects into a single object.
894
+ // The second argument allows for an array of property names who's object values will be merged together.
895
+ function mergeProps(propObjs, complexProps) {
896
+ var dest = {};
897
+ var i, name;
898
+ var complexObjs;
899
+ var j, val;
900
+ var props;
901
+
902
+ if (complexProps) {
903
+ for (i = 0; i < complexProps.length; i++) {
904
+ name = complexProps[i];
905
+ complexObjs = [];
906
+
907
+ // collect the trailing object values, stopping when a non-object is discovered
908
+ for (j = propObjs.length - 1; j >= 0; j--) {
909
+ val = propObjs[j][name];
910
+
911
+ if (typeof val === 'object') {
912
+ complexObjs.unshift(val);
913
+ }
914
+ else if (val !== undefined) {
915
+ dest[name] = val; // if there were no objects, this value will be used
916
+ break;
917
+ }
918
+ }
919
+
920
+ // if the trailing values were objects, use the merged value
921
+ if (complexObjs.length) {
922
+ dest[name] = mergeProps(complexObjs);
923
+ }
924
+ }
925
+ }
926
+
927
+ // copy values into the destination, going from last to first
928
+ for (i = propObjs.length - 1; i >= 0; i--) {
929
+ props = propObjs[i];
930
+
931
+ for (name in props) {
932
+ if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
933
+ dest[name] = props[name];
934
+ }
935
+ }
936
+ }
937
+
938
+ return dest;
939
+ }
940
+
941
+
942
+ // Create an object that has the given prototype. Just like Object.create
943
+ function createObject(proto) {
944
+ var f = function() {};
945
+ f.prototype = proto;
946
+ return new f();
947
+ }
948
+ FC.createObject = createObject;
949
+
950
+
951
+ function copyOwnProps(src, dest) {
952
+ for (var name in src) {
953
+ if (hasOwnProp(src, name)) {
954
+ dest[name] = src[name];
955
+ }
956
+ }
957
+ }
958
+
959
+
960
+ function hasOwnProp(obj, name) {
961
+ return hasOwnPropMethod.call(obj, name);
962
+ }
963
+
964
+
965
+ // Is the given value a non-object non-function value?
966
+ function isAtomic(val) {
967
+ return /undefined|null|boolean|number|string/.test($.type(val));
968
+ }
969
+
970
+
971
+ function applyAll(functions, thisObj, args) {
972
+ if ($.isFunction(functions)) {
973
+ functions = [ functions ];
974
+ }
975
+ if (functions) {
976
+ var i;
977
+ var ret;
978
+ for (i=0; i<functions.length; i++) {
979
+ ret = functions[i].apply(thisObj, args) || ret;
980
+ }
981
+ return ret;
982
+ }
983
+ }
984
+
985
+
986
+ function firstDefined() {
987
+ for (var i=0; i<arguments.length; i++) {
988
+ if (arguments[i] !== undefined) {
989
+ return arguments[i];
990
+ }
991
+ }
992
+ }
993
+
994
+
995
+ function htmlEscape(s) {
996
+ return (s + '').replace(/&/g, '&amp;')
997
+ .replace(/</g, '&lt;')
998
+ .replace(/>/g, '&gt;')
999
+ .replace(/'/g, '&#039;')
1000
+ .replace(/"/g, '&quot;')
1001
+ .replace(/\n/g, '<br />');
1002
+ }
1003
+
1004
+
1005
+ function stripHtmlEntities(text) {
1006
+ return text.replace(/&.*?;/g, '');
1007
+ }
1008
+
1009
+
1010
+ // Given a hash of CSS properties, returns a string of CSS.
1011
+ // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values.
1012
+ function cssToStr(cssProps) {
1013
+ var statements = [];
1014
+
1015
+ $.each(cssProps, function(name, val) {
1016
+ if (val != null) {
1017
+ statements.push(name + ':' + val);
1018
+ }
1019
+ });
1020
+
1021
+ return statements.join(';');
1022
+ }
1023
+
1024
+
1025
+ // Given an object hash of HTML attribute names to values,
1026
+ // generates a string that can be injected between < > in HTML
1027
+ function attrsToStr(attrs) {
1028
+ var parts = [];
1029
+
1030
+ $.each(attrs, function(name, val) {
1031
+ if (val != null) {
1032
+ parts.push(name + '="' + htmlEscape(val) + '"');
1033
+ }
1034
+ });
1035
+
1036
+ return parts.join(' ');
1037
+ }
1038
+
1039
+
1040
+ function capitaliseFirstLetter(str) {
1041
+ return str.charAt(0).toUpperCase() + str.slice(1);
1042
+ }
1043
+
1044
+
1045
+ function compareNumbers(a, b) { // for .sort()
1046
+ return a - b;
1047
+ }
1048
+
1049
+
1050
+ function isInt(n) {
1051
+ return n % 1 === 0;
1052
+ }
1053
+
1054
+
1055
+ // Returns a method bound to the given object context.
1056
+ // Just like one of the jQuery.proxy signatures, but without the undesired behavior of treating the same method with
1057
+ // different contexts as identical when binding/unbinding events.
1058
+ function proxy(obj, methodName) {
1059
+ var method = obj[methodName];
1060
+
1061
+ return function() {
1062
+ return method.apply(obj, arguments);
1063
+ };
1064
+ }
1065
+
1066
+
1067
+ // Returns a function, that, as long as it continues to be invoked, will not
1068
+ // be triggered. The function will be called after it stops being called for
1069
+ // N milliseconds. If `immediate` is passed, trigger the function on the
1070
+ // leading edge, instead of the trailing.
1071
+ // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714
1072
+ function debounce(func, wait, immediate) {
1073
+ var timeout, args, context, timestamp, result;
1074
+
1075
+ var later = function() {
1076
+ var last = +new Date() - timestamp;
1077
+ if (last < wait) {
1078
+ timeout = setTimeout(later, wait - last);
1079
+ }
1080
+ else {
1081
+ timeout = null;
1082
+ if (!immediate) {
1083
+ result = func.apply(context, args);
1084
+ context = args = null;
1085
+ }
1086
+ }
1087
+ };
1088
+
1089
+ return function() {
1090
+ context = this;
1091
+ args = arguments;
1092
+ timestamp = +new Date();
1093
+ var callNow = immediate && !timeout;
1094
+ if (!timeout) {
1095
+ timeout = setTimeout(later, wait);
1096
+ }
1097
+ if (callNow) {
1098
+ result = func.apply(context, args);
1099
+ context = args = null;
1100
+ }
1101
+ return result;
1102
+ };
1103
+ }
1104
+
1105
+ ;;
1106
+
1107
+ /*
1108
+ GENERAL NOTE on moments throughout the *entire rest* of the codebase:
1109
+ All moments are assumed to be ambiguously-zoned unless otherwise noted,
1110
+ with the NOTABLE EXCEOPTION of start/end dates that live on *Event Objects*.
1111
+ Ambiguously-TIMED moments are assumed to be ambiguously-zoned by nature.
1112
+ */
1113
+
1114
+ var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/;
1115
+ var ambigTimeOrZoneRegex =
1116
+ /^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/;
1117
+ var newMomentProto = moment.fn; // where we will attach our new methods
1118
+ var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods
1119
+
1120
+ // tell momentjs to transfer these properties upon clone
1121
+ var momentProperties = moment.momentProperties;
1122
+ momentProperties.push('_fullCalendar');
1123
+ momentProperties.push('_ambigTime');
1124
+ momentProperties.push('_ambigZone');
1125
+
1126
+
1127
+ // Creating
1128
+ // -------------------------------------------------------------------------------------------------
1129
+
1130
+ // Creates a new moment, similar to the vanilla moment(...) constructor, but with
1131
+ // extra features (ambiguous time, enhanced formatting). When given an existing moment,
1132
+ // it will function as a clone (and retain the zone of the moment). Anything else will
1133
+ // result in a moment in the local zone.
1134
+ FC.moment = function() {
1135
+ return makeMoment(arguments);
1136
+ };
1137
+
1138
+ // Sames as FC.moment, but forces the resulting moment to be in the UTC timezone.
1139
+ FC.moment.utc = function() {
1140
+ var mom = makeMoment(arguments, true);
1141
+
1142
+ // Force it into UTC because makeMoment doesn't guarantee it
1143
+ // (if given a pre-existing moment for example)
1144
+ if (mom.hasTime()) { // don't give ambiguously-timed moments a UTC zone
1145
+ mom.utc();
1146
+ }
1147
+
1148
+ return mom;
1149
+ };
1150
+
1151
+ // Same as FC.moment, but when given an ISO8601 string, the timezone offset is preserved.
1152
+ // ISO8601 strings with no timezone offset will become ambiguously zoned.
1153
+ FC.moment.parseZone = function() {
1154
+ return makeMoment(arguments, true, true);
1155
+ };
1156
+
1157
+ // Builds an enhanced moment from args. When given an existing moment, it clones. When given a
1158
+ // native Date, or called with no arguments (the current time), the resulting moment will be local.
1159
+ // Anything else needs to be "parsed" (a string or an array), and will be affected by:
1160
+ // parseAsUTC - if there is no zone information, should we parse the input in UTC?
1161
+ // parseZone - if there is zone information, should we force the zone of the moment?
1162
+ function makeMoment(args, parseAsUTC, parseZone) {
1163
+ var input = args[0];
1164
+ var isSingleString = args.length == 1 && typeof input === 'string';
1165
+ var isAmbigTime;
1166
+ var isAmbigZone;
1167
+ var ambigMatch;
1168
+ var mom;
1169
+
1170
+ if (moment.isMoment(input) || isNativeDate(input) || input === undefined) {
1171
+ mom = moment.apply(null, args);
1172
+ }
1173
+ else { // "parsing" is required
1174
+ isAmbigTime = false;
1175
+ isAmbigZone = false;
1176
+
1177
+ if (isSingleString) {
1178
+ if (ambigDateOfMonthRegex.test(input)) {
1179
+ // accept strings like '2014-05', but convert to the first of the month
1180
+ input += '-01';
1181
+ args = [ input ]; // for when we pass it on to moment's constructor
1182
+ isAmbigTime = true;
1183
+ isAmbigZone = true;
1184
+ }
1185
+ else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) {
1186
+ isAmbigTime = !ambigMatch[5]; // no time part?
1187
+ isAmbigZone = true;
1188
+ }
1189
+ }
1190
+ else if ($.isArray(input)) {
1191
+ // arrays have no timezone information, so assume ambiguous zone
1192
+ isAmbigZone = true;
1193
+ }
1194
+ // otherwise, probably a string with a format
1195
+
1196
+ if (parseAsUTC || isAmbigTime) {
1197
+ mom = moment.utc.apply(moment, args);
1198
+ }
1199
+ else {
1200
+ mom = moment.apply(null, args);
1201
+ }
1202
+
1203
+ if (isAmbigTime) {
1204
+ mom._ambigTime = true;
1205
+ mom._ambigZone = true; // ambiguous time always means ambiguous zone
1206
+ }
1207
+ else if (parseZone) { // let's record the inputted zone somehow
1208
+ if (isAmbigZone) {
1209
+ mom._ambigZone = true;
1210
+ }
1211
+ else if (isSingleString) {
1212
+ mom.utcOffset(input); // if not a valid zone, will assign UTC
1213
+ }
1214
+ }
1215
+ }
1216
+
1217
+ mom._fullCalendar = true; // flag for extended functionality
1218
+
1219
+ return mom;
1220
+ }
1221
+
1222
+
1223
+ // Week Number
1224
+ // -------------------------------------------------------------------------------------------------
1225
+
1226
+
1227
+ // Returns the week number, considering the locale's custom week number calcuation
1228
+ // `weeks` is an alias for `week`
1229
+ newMomentProto.week = newMomentProto.weeks = function(input) {
1230
+ var weekCalc = this._locale._fullCalendar_weekCalc;
1231
+
1232
+ if (input == null && typeof weekCalc === 'function') { // custom function only works for getter
1233
+ return weekCalc(this);
1234
+ }
1235
+ else if (weekCalc === 'ISO') {
1236
+ return oldMomentProto.isoWeek.apply(this, arguments); // ISO getter/setter
1237
+ }
1238
+
1239
+ return oldMomentProto.week.apply(this, arguments); // local getter/setter
1240
+ };
1241
+
1242
+
1243
+ // Time-of-day
1244
+ // -------------------------------------------------------------------------------------------------
1245
+
1246
+ // GETTER
1247
+ // Returns a Duration with the hours/minutes/seconds/ms values of the moment.
1248
+ // If the moment has an ambiguous time, a duration of 00:00 will be returned.
1249
+ //
1250
+ // SETTER
1251
+ // You can supply a Duration, a Moment, or a Duration-like argument.
1252
+ // When setting the time, and the moment has an ambiguous time, it then becomes unambiguous.
1253
+ newMomentProto.time = function(time) {
1254
+
1255
+ // Fallback to the original method (if there is one) if this moment wasn't created via FullCalendar.
1256
+ // `time` is a generic enough method name where this precaution is necessary to avoid collisions w/ other plugins.
1257
+ if (!this._fullCalendar) {
1258
+ return oldMomentProto.time.apply(this, arguments);
1259
+ }
1260
+
1261
+ if (time == null) { // getter
1262
+ return moment.duration({
1263
+ hours: this.hours(),
1264
+ minutes: this.minutes(),
1265
+ seconds: this.seconds(),
1266
+ milliseconds: this.milliseconds()
1267
+ });
1268
+ }
1269
+ else { // setter
1270
+
1271
+ this._ambigTime = false; // mark that the moment now has a time
1272
+
1273
+ if (!moment.isDuration(time) && !moment.isMoment(time)) {
1274
+ time = moment.duration(time);
1275
+ }
1276
+
1277
+ // The day value should cause overflow (so 24 hours becomes 00:00:00 of next day).
1278
+ // Only for Duration times, not Moment times.
1279
+ var dayHours = 0;
1280
+ if (moment.isDuration(time)) {
1281
+ dayHours = Math.floor(time.asDays()) * 24;
1282
+ }
1283
+
1284
+ // We need to set the individual fields.
1285
+ // Can't use startOf('day') then add duration. In case of DST at start of day.
1286
+ return this.hours(dayHours + time.hours())
1287
+ .minutes(time.minutes())
1288
+ .seconds(time.seconds())
1289
+ .milliseconds(time.milliseconds());
1290
+ }
1291
+ };
1292
+
1293
+ // Converts the moment to UTC, stripping out its time-of-day and timezone offset,
1294
+ // but preserving its YMD. A moment with a stripped time will display no time
1295
+ // nor timezone offset when .format() is called.
1296
+ newMomentProto.stripTime = function() {
1297
+
1298
+ if (!this._ambigTime) {
1299
+
1300
+ this.utc(true); // keepLocalTime=true (for keeping *date* value)
1301
+
1302
+ // set time to zero
1303
+ this.set({
1304
+ hours: 0,
1305
+ minutes: 0,
1306
+ seconds: 0,
1307
+ ms: 0
1308
+ });
1309
+
1310
+ // Mark the time as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
1311
+ // which clears all ambig flags.
1312
+ this._ambigTime = true;
1313
+ this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset
1314
+ }
1315
+
1316
+ return this; // for chaining
1317
+ };
1318
+
1319
+ // Returns if the moment has a non-ambiguous time (boolean)
1320
+ newMomentProto.hasTime = function() {
1321
+ return !this._ambigTime;
1322
+ };
1323
+
1324
+
1325
+ // Timezone
1326
+ // -------------------------------------------------------------------------------------------------
1327
+
1328
+ // Converts the moment to UTC, stripping out its timezone offset, but preserving its
1329
+ // YMD and time-of-day. A moment with a stripped timezone offset will display no
1330
+ // timezone offset when .format() is called.
1331
+ newMomentProto.stripZone = function() {
1332
+ var wasAmbigTime;
1333
+
1334
+ if (!this._ambigZone) {
1335
+
1336
+ wasAmbigTime = this._ambigTime;
1337
+
1338
+ this.utc(true); // keepLocalTime=true (for keeping date and time values)
1339
+
1340
+ // the above call to .utc()/.utcOffset() unfortunately might clear the ambig flags, so restore
1341
+ this._ambigTime = wasAmbigTime || false;
1342
+
1343
+ // Mark the zone as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
1344
+ // which clears the ambig flags.
1345
+ this._ambigZone = true;
1346
+ }
1347
+
1348
+ return this; // for chaining
1349
+ };
1350
+
1351
+ // Returns of the moment has a non-ambiguous timezone offset (boolean)
1352
+ newMomentProto.hasZone = function() {
1353
+ return !this._ambigZone;
1354
+ };
1355
+
1356
+
1357
+ // implicitly marks a zone
1358
+ newMomentProto.local = function(keepLocalTime) {
1359
+
1360
+ // for when converting from ambiguously-zoned to local,
1361
+ // keep the time values when converting from UTC -> local
1362
+ oldMomentProto.local.call(this, this._ambigZone || keepLocalTime);
1363
+
1364
+ // ensure non-ambiguous
1365
+ // this probably already happened via local() -> utcOffset(), but don't rely on Moment's internals
1366
+ this._ambigTime = false;
1367
+ this._ambigZone = false;
1368
+
1369
+ return this; // for chaining
1370
+ };
1371
+
1372
+
1373
+ // implicitly marks a zone
1374
+ newMomentProto.utc = function(keepLocalTime) {
1375
+
1376
+ oldMomentProto.utc.call(this, keepLocalTime);
1377
+
1378
+ // ensure non-ambiguous
1379
+ // this probably already happened via utc() -> utcOffset(), but don't rely on Moment's internals
1380
+ this._ambigTime = false;
1381
+ this._ambigZone = false;
1382
+
1383
+ return this;
1384
+ };
1385
+
1386
+
1387
+ // implicitly marks a zone (will probably get called upon .utc() and .local())
1388
+ newMomentProto.utcOffset = function(tzo) {
1389
+
1390
+ if (tzo != null) { // setter
1391
+ // these assignments needs to happen before the original zone method is called.
1392
+ // I forget why, something to do with a browser crash.
1393
+ this._ambigTime = false;
1394
+ this._ambigZone = false;
1395
+ }
1396
+
1397
+ return oldMomentProto.utcOffset.apply(this, arguments);
1398
+ };
1399
+
1400
+
1401
+ // Formatting
1402
+ // -------------------------------------------------------------------------------------------------
1403
+
1404
+ newMomentProto.format = function() {
1405
+
1406
+ if (this._fullCalendar && arguments[0]) { // an enhanced moment? and a format string provided?
1407
+ return formatDate(this, arguments[0]); // our extended formatting
1408
+ }
1409
+ if (this._ambigTime) {
1410
+ return oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
1411
+ }
1412
+ if (this._ambigZone) {
1413
+ return oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
1414
+ }
1415
+ if (this._fullCalendar) { // enhanced non-ambig moment?
1416
+ // moment.format() doesn't ensure english, but we want to.
1417
+ return oldMomentFormat(englishMoment(this));
1418
+ }
1419
+
1420
+ return oldMomentProto.format.apply(this, arguments);
1421
+ };
1422
+
1423
+ newMomentProto.toISOString = function() {
1424
+
1425
+ if (this._ambigTime) {
1426
+ return oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
1427
+ }
1428
+ if (this._ambigZone) {
1429
+ return oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
1430
+ }
1431
+ if (this._fullCalendar) { // enhanced non-ambig moment?
1432
+ // depending on browser, moment might not output english. ensure english.
1433
+ // https://github.com/moment/moment/blob/2.18.1/src/lib/moment/format.js#L22
1434
+ return oldMomentProto.toISOString.apply(englishMoment(this), arguments);
1435
+ }
1436
+
1437
+ return oldMomentProto.toISOString.apply(this, arguments);
1438
+ };
1439
+
1440
+ function englishMoment(mom) {
1441
+ if (mom.locale() !== 'en') {
1442
+ return mom.clone().locale('en');
1443
+ }
1444
+ return mom;
1445
+ }
1446
+
1447
+ ;;
1448
+ (function() {
1449
+
1450
+ // exports
1451
+ FC.formatDate = formatDate;
1452
+ FC.formatRange = formatRange;
1453
+ FC.oldMomentFormat = oldMomentFormat;
1454
+ FC.queryMostGranularFormatUnit = queryMostGranularFormatUnit;
1455
+
1456
+
1457
+ // Config
1458
+ // ---------------------------------------------------------------------------------------------------------------------
1459
+
1460
+ /*
1461
+ Inserted between chunks in the fake ("intermediate") formatting string.
1462
+ Important that it passes as whitespace (\s) because moment often identifies non-standalone months
1463
+ via a regexp with an \s.
1464
+ */
1465
+ var PART_SEPARATOR = '\u000b'; // vertical tab
1466
+
1467
+ /*
1468
+ Inserted as the first character of a literal-text chunk to indicate that the literal text is not actually literal text,
1469
+ but rather, a "special" token that has custom rendering (see specialTokens map).
1470
+ */
1471
+ var SPECIAL_TOKEN_MARKER = '\u001f'; // information separator 1
1472
+
1473
+ /*
1474
+ Inserted at the beginning and end of a span of text that must have non-zero numeric characters.
1475
+ Handling of these markers is done in a post-processing step at the very end of text rendering.
1476
+ */
1477
+ var MAYBE_MARKER = '\u001e'; // information separator 2
1478
+ var MAYBE_REGEXP = new RegExp(MAYBE_MARKER + '([^' + MAYBE_MARKER + ']*)' + MAYBE_MARKER, 'g'); // must be global
1479
+
1480
+ /*
1481
+ Addition formatting tokens we want recognized
1482
+ */
1483
+ var specialTokens = {
1484
+ t: function(date) { // "a" or "p"
1485
+ return oldMomentFormat(date, 'a').charAt(0);
1486
+ },
1487
+ T: function(date) { // "A" or "P"
1488
+ return oldMomentFormat(date, 'A').charAt(0);
1489
+ }
1490
+ };
1491
+
1492
+ /*
1493
+ The first characters of formatting tokens for units that are 1 day or larger.
1494
+ `value` is for ranking relative size (lower means bigger).
1495
+ `unit` is a normalized unit, used for comparing moments.
1496
+ */
1497
+ var largeTokenMap = {
1498
+ Y: { value: 1, unit: 'year' },
1499
+ M: { value: 2, unit: 'month' },
1500
+ W: { value: 3, unit: 'week' }, // ISO week
1501
+ w: { value: 3, unit: 'week' }, // local week
1502
+ D: { value: 4, unit: 'day' }, // day of month
1503
+ d: { value: 4, unit: 'day' } // day of week
1504
+ };
1505
+
1506
+
1507
+ // Single Date Formatting
1508
+ // ---------------------------------------------------------------------------------------------------------------------
1509
+
1510
+ /*
1511
+ Formats `date` with a Moment formatting string, but allow our non-zero areas and special token
1512
+ */
1513
+ function formatDate(date, formatStr) {
1514
+ return renderFakeFormatString(
1515
+ getParsedFormatString(formatStr).fakeFormatString,
1516
+ date
1517
+ );
1518
+ }
1519
+
1520
+ /*
1521
+ Call this if you want Moment's original format method to be used
1522
+ */
1523
+ function oldMomentFormat(mom, formatStr) {
1524
+ return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js
1525
+ }
1526
+
1527
+
1528
+ // Date Range Formatting
1529
+ // -------------------------------------------------------------------------------------------------
1530
+ // TODO: make it work with timezone offset
1531
+
1532
+ /*
1533
+ Using a formatting string meant for a single date, generate a range string, like
1534
+ "Sep 2 - 9 2013", that intelligently inserts a separator where the dates differ.
1535
+ If the dates are the same as far as the format string is concerned, just return a single
1536
+ rendering of one date, without any separator.
1537
+ */
1538
+ function formatRange(date1, date2, formatStr, separator, isRTL) {
1539
+ var localeData;
1540
+
1541
+ date1 = FC.moment.parseZone(date1);
1542
+ date2 = FC.moment.parseZone(date2);
1543
+
1544
+ localeData = date1.localeData();
1545
+
1546
+ // Expand localized format strings, like "LL" -> "MMMM D YYYY".
1547
+ // BTW, this is not important for `formatDate` because it is impossible to put custom tokens
1548
+ // or non-zero areas in Moment's localized format strings.
1549
+ formatStr = localeData.longDateFormat(formatStr) || formatStr;
1550
+
1551
+ return renderParsedFormat(
1552
+ getParsedFormatString(formatStr),
1553
+ date1,
1554
+ date2,
1555
+ separator || ' - ',
1556
+ isRTL
1557
+ );
1558
+ }
1559
+
1560
+ /*
1561
+ Renders a range with an already-parsed format string.
1562
+ */
1563
+ function renderParsedFormat(parsedFormat, date1, date2, separator, isRTL) {
1564
+ var sameUnits = parsedFormat.sameUnits;
1565
+ var unzonedDate1 = date1.clone().stripZone(); // for same-unit comparisons
1566
+ var unzonedDate2 = date2.clone().stripZone(); // "
1567
+
1568
+ var renderedParts1 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date1);
1569
+ var renderedParts2 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date2);
1570
+
1571
+ var leftI;
1572
+ var leftStr = '';
1573
+ var rightI;
1574
+ var rightStr = '';
1575
+ var middleI;
1576
+ var middleStr1 = '';
1577
+ var middleStr2 = '';
1578
+ var middleStr = '';
1579
+
1580
+ // Start at the leftmost side of the formatting string and continue until you hit a token
1581
+ // that is not the same between dates.
1582
+ for (
1583
+ leftI = 0;
1584
+ leftI < sameUnits.length && (!sameUnits[leftI] || unzonedDate1.isSame(unzonedDate2, sameUnits[leftI]));
1585
+ leftI++
1586
+ ) {
1587
+ leftStr += renderedParts1[leftI];
1588
+ }
1589
+
1590
+ // Similarly, start at the rightmost side of the formatting string and move left
1591
+ for (
1592
+ rightI = sameUnits.length - 1;
1593
+ rightI > leftI && (!sameUnits[rightI] || unzonedDate1.isSame(unzonedDate2, sameUnits[rightI]));
1594
+ rightI--
1595
+ ) {
1596
+ // If current chunk is on the boundary of unique date-content, and is a special-case
1597
+ // date-formatting postfix character, then don't consume it. Consider it unique date-content.
1598
+ // TODO: make configurable
1599
+ if (rightI - 1 === leftI && renderedParts1[rightI] === '.') {
1600
+ break;
1601
+ }
1602
+
1603
+ rightStr = renderedParts1[rightI] + rightStr;
1604
+ }
1605
+
1606
+ // The area in the middle is different for both of the dates.
1607
+ // Collect them distinctly so we can jam them together later.
1608
+ for (middleI = leftI; middleI <= rightI; middleI++) {
1609
+ middleStr1 += renderedParts1[middleI];
1610
+ middleStr2 += renderedParts2[middleI];
1611
+ }
1612
+
1613
+ if (middleStr1 || middleStr2) {
1614
+ if (isRTL) {
1615
+ middleStr = middleStr2 + separator + middleStr1;
1616
+ }
1617
+ else {
1618
+ middleStr = middleStr1 + separator + middleStr2;
1619
+ }
1620
+ }
1621
+
1622
+ return processMaybeMarkers(
1623
+ leftStr + middleStr + rightStr
1624
+ );
1625
+ }
1626
+
1627
+
1628
+ // Format String Parsing
1629
+ // ---------------------------------------------------------------------------------------------------------------------
1630
+
1631
+ var parsedFormatStrCache = {};
1632
+
1633
+ /*
1634
+ Returns a parsed format string, leveraging a cache.
1635
+ */
1636
+ function getParsedFormatString(formatStr) {
1637
+ return parsedFormatStrCache[formatStr] ||
1638
+ (parsedFormatStrCache[formatStr] = parseFormatString(formatStr));
1639
+ }
1640
+
1641
+ /*
1642
+ Parses a format string into the following:
1643
+ - fakeFormatString: a momentJS formatting string, littered with special control characters that get post-processed.
1644
+ - sameUnits: for every part in fakeFormatString, if the part is a token, the value will be a unit string (like "day"),
1645
+ that indicates how similar a range's start & end must be in order to share the same formatted text.
1646
+ If not a token, then the value is null.
1647
+ Always a flat array (not nested liked "chunks").
1648
+ */
1649
+ function parseFormatString(formatStr) {
1650
+ var chunks = chunkFormatString(formatStr);
1651
+
1652
+ return {
1653
+ fakeFormatString: buildFakeFormatString(chunks),
1654
+ sameUnits: buildSameUnits(chunks)
1655
+ };
1656
+ }
1657
+
1658
+ /*
1659
+ Break the formatting string into an array of chunks.
1660
+ A 'maybe' chunk will have nested chunks.
1661
+ */
1662
+ function chunkFormatString(formatStr) {
1663
+ var chunks = [];
1664
+ var match;
1665
+
1666
+ // TODO: more descrimination
1667
+ // \4 is a backreference to the first character of a multi-character set.
1668
+ var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;
1669
+
1670
+ while ((match = chunker.exec(formatStr))) {
1671
+ if (match[1]) { // a literal string inside [ ... ]
1672
+ chunks.push.apply(chunks, // append
1673
+ splitStringLiteral(match[1])
1674
+ );
1675
+ }
1676
+ else if (match[2]) { // non-zero formatting inside ( ... )
1677
+ chunks.push({ maybe: chunkFormatString(match[2]) });
1678
+ }
1679
+ else if (match[3]) { // a formatting token
1680
+ chunks.push({ token: match[3] });
1681
+ }
1682
+ else if (match[5]) { // an unenclosed literal string
1683
+ chunks.push.apply(chunks, // append
1684
+ splitStringLiteral(match[5])
1685
+ );
1686
+ }
1687
+ }
1688
+
1689
+ return chunks;
1690
+ }
1691
+
1692
+ /*
1693
+ Potentially splits a literal-text string into multiple parts. For special cases.
1694
+ */
1695
+ function splitStringLiteral(s) {
1696
+ if (s === '. ') {
1697
+ return [ '.', ' ' ]; // for locales with periods bound to the end of each year/month/date
1698
+ }
1699
+ else {
1700
+ return [ s ];
1701
+ }
1702
+ }
1703
+
1704
+ /*
1705
+ Given chunks parsed from a real format string, generate a fake (aka "intermediate") format string with special control
1706
+ characters that will eventually be given to moment for formatting, and then post-processed.
1707
+ */
1708
+ function buildFakeFormatString(chunks) {
1709
+ var parts = [];
1710
+ var i, chunk;
1711
+
1712
+ for (i = 0; i < chunks.length; i++) {
1713
+ chunk = chunks[i];
1714
+
1715
+ if (typeof chunk === 'string') {
1716
+ parts.push('[' + chunk + ']');
1717
+ }
1718
+ else if (chunk.token) {
1719
+ if (chunk.token in specialTokens) {
1720
+ parts.push(
1721
+ SPECIAL_TOKEN_MARKER + // useful during post-processing
1722
+ '[' + chunk.token + ']' // preserve as literal text
1723
+ );
1724
+ }
1725
+ else {
1726
+ parts.push(chunk.token); // unprotected text implies a format string
1727
+ }
1728
+ }
1729
+ else if (chunk.maybe) {
1730
+ parts.push(
1731
+ MAYBE_MARKER + // useful during post-processing
1732
+ buildFakeFormatString(chunk.maybe) +
1733
+ MAYBE_MARKER
1734
+ );
1735
+ }
1736
+ }
1737
+
1738
+ return parts.join(PART_SEPARATOR);
1739
+ }
1740
+
1741
+ /*
1742
+ Given parsed chunks from a real formatting string, generates an array of unit strings (like "day") that indicate
1743
+ in which regard two dates must be similar in order to share range formatting text.
1744
+ The `chunks` can be nested (because of "maybe" chunks), however, the returned array will be flat.
1745
+ */
1746
+ function buildSameUnits(chunks) {
1747
+ var units = [];
1748
+ var i, chunk;
1749
+ var tokenInfo;
1750
+
1751
+ for (i = 0; i < chunks.length; i++) {
1752
+ chunk = chunks[i];
1753
+
1754
+ if (chunk.token) {
1755
+ tokenInfo = largeTokenMap[chunk.token.charAt(0)];
1756
+ units.push(tokenInfo ? tokenInfo.unit : 'second'); // default to a very strict same-second
1757
+ }
1758
+ else if (chunk.maybe) {
1759
+ units.push.apply(units, // append
1760
+ buildSameUnits(chunk.maybe)
1761
+ );
1762
+ }
1763
+ else {
1764
+ units.push(null);
1765
+ }
1766
+ }
1767
+
1768
+ return units;
1769
+ }
1770
+
1771
+
1772
+ // Rendering to text
1773
+ // ---------------------------------------------------------------------------------------------------------------------
1774
+
1775
+ /*
1776
+ Formats a date with a fake format string, post-processes the control characters, then returns.
1777
+ */
1778
+ function renderFakeFormatString(fakeFormatString, date) {
1779
+ return processMaybeMarkers(
1780
+ renderFakeFormatStringParts(fakeFormatString, date).join('')
1781
+ );
1782
+ }
1783
+
1784
+ /*
1785
+ Formats a date into parts that will have been post-processed, EXCEPT for the "maybe" markers.
1786
+ */
1787
+ function renderFakeFormatStringParts(fakeFormatString, date) {
1788
+ var parts = [];
1789
+ var fakeRender = oldMomentFormat(date, fakeFormatString);
1790
+ var fakeParts = fakeRender.split(PART_SEPARATOR);
1791
+ var i, fakePart;
1792
+
1793
+ for (i = 0; i < fakeParts.length; i++) {
1794
+ fakePart = fakeParts[i];
1795
+
1796
+ if (fakePart.charAt(0) === SPECIAL_TOKEN_MARKER) {
1797
+ parts.push(
1798
+ // the literal string IS the token's name.
1799
+ // call special token's registered function.
1800
+ specialTokens[fakePart.substring(1)](date)
1801
+ );
1802
+ }
1803
+ else {
1804
+ parts.push(fakePart);
1805
+ }
1806
+ }
1807
+
1808
+ return parts;
1809
+ }
1810
+
1811
+ /*
1812
+ Accepts an almost-finally-formatted string and processes the "maybe" control characters, returning a new string.
1813
+ */
1814
+ function processMaybeMarkers(s) {
1815
+ return s.replace(MAYBE_REGEXP, function(m0, m1) { // regex assumed to have 'g' flag
1816
+ if (m1.match(/[1-9]/)) { // any non-zero numeric characters?
1817
+ return m1;
1818
+ }
1819
+ else {
1820
+ return '';
1821
+ }
1822
+ });
1823
+ }
1824
+
1825
+
1826
+ // Misc Utils
1827
+ // -------------------------------------------------------------------------------------------------
1828
+
1829
+ /*
1830
+ Returns a unit string, either 'year', 'month', 'day', or null for the most granular formatting token in the string.
1831
+ */
1832
+ function queryMostGranularFormatUnit(formatStr) {
1833
+ var chunks = chunkFormatString(formatStr);
1834
+ var i, chunk;
1835
+ var candidate;
1836
+ var best;
1837
+
1838
+ for (i = 0; i < chunks.length; i++) {
1839
+ chunk = chunks[i];
1840
+
1841
+ if (chunk.token) {
1842
+ candidate = largeTokenMap[chunk.token.charAt(0)];
1843
+ if (candidate) {
1844
+ if (!best || candidate.value > best.value) {
1845
+ best = candidate;
1846
+ }
1847
+ }
1848
+ }
1849
+ }
1850
+
1851
+ if (best) {
1852
+ return best.unit;
1853
+ }
1854
+
1855
+ return null;
1856
+ };
1857
+
1858
+ })();
1859
+
1860
+ // quick local references
1861
+ var formatDate = FC.formatDate;
1862
+ var formatRange = FC.formatRange;
1863
+ var oldMomentFormat = FC.oldMomentFormat;
1864
+
1865
+ ;;
1866
+
1867
+ FC.Class = Class; // export
1868
+
1869
+ // Class that all other classes will inherit from
1870
+ function Class() { }
1871
+
1872
+
1873
+ // Called on a class to create a subclass.
1874
+ // Last argument contains instance methods. Any argument before the last are considered mixins.
1875
+ Class.extend = function() {
1876
+ var len = arguments.length;
1877
+ var i;
1878
+ var members;
1879
+
1880
+ for (i = 0; i < len; i++) {
1881
+ members = arguments[i];
1882
+ if (i < len - 1) { // not the last argument?
1883
+ mixIntoClass(this, members);
1884
+ }
1885
+ }
1886
+
1887
+ return extendClass(this, members || {}); // members will be undefined if no arguments
1888
+ };
1889
+
1890
+
1891
+ // Adds new member variables/methods to the class's prototype.
1892
+ // Can be called with another class, or a plain object hash containing new members.
1893
+ Class.mixin = function(members) {
1894
+ mixIntoClass(this, members);
1895
+ };
1896
+
1897
+
1898
+ function extendClass(superClass, members) {
1899
+ var subClass;
1900
+
1901
+ // ensure a constructor for the subclass, forwarding all arguments to the super-constructor if it doesn't exist
1902
+ if (hasOwnProp(members, 'constructor')) {
1903
+ subClass = members.constructor;
1904
+ }
1905
+ if (typeof subClass !== 'function') {
1906
+ subClass = members.constructor = function() {
1907
+ superClass.apply(this, arguments);
1908
+ };
1909
+ }
1910
+
1911
+ // build the base prototype for the subclass, which is an new object chained to the superclass's prototype
1912
+ subClass.prototype = createObject(superClass.prototype);
1913
+
1914
+ // copy each member variable/method onto the the subclass's prototype
1915
+ copyOwnProps(members, subClass.prototype);
1916
+
1917
+ // copy over all class variables/methods to the subclass, such as `extend` and `mixin`
1918
+ copyOwnProps(superClass, subClass);
1919
+
1920
+ return subClass;
1921
+ }
1922
+
1923
+
1924
+ function mixIntoClass(theClass, members) {
1925
+ copyOwnProps(members, theClass.prototype);
1926
+ }
1927
+ ;;
1928
+
1929
+ var Model = Class.extend(EmitterMixin, ListenerMixin, {
1930
+
1931
+ _props: null,
1932
+ _watchers: null,
1933
+ _globalWatchArgs: null,
1934
+
1935
+ constructor: function() {
1936
+ this._watchers = {};
1937
+ this._props = {};
1938
+ this.applyGlobalWatchers();
1939
+ },
1940
+
1941
+ applyGlobalWatchers: function() {
1942
+ var argSets = this._globalWatchArgs || [];
1943
+ var i;
1944
+
1945
+ for (i = 0; i < argSets.length; i++) {
1946
+ this.watch.apply(this, argSets[i]);
1947
+ }
1948
+ },
1949
+
1950
+ has: function(name) {
1951
+ return name in this._props;
1952
+ },
1953
+
1954
+ get: function(name) {
1955
+ if (name === undefined) {
1956
+ return this._props;
1957
+ }
1958
+
1959
+ return this._props[name];
1960
+ },
1961
+
1962
+ set: function(name, val) {
1963
+ var newProps;
1964
+
1965
+ if (typeof name === 'string') {
1966
+ newProps = {};
1967
+ newProps[name] = val === undefined ? null : val;
1968
+ }
1969
+ else {
1970
+ newProps = name;
1971
+ }
1972
+
1973
+ this.setProps(newProps);
1974
+ },
1975
+
1976
+ reset: function(newProps) {
1977
+ var oldProps = this._props;
1978
+ var changeset = {}; // will have undefined's to signal unsets
1979
+ var name;
1980
+
1981
+ for (name in oldProps) {
1982
+ changeset[name] = undefined;
1983
+ }
1984
+
1985
+ for (name in newProps) {
1986
+ changeset[name] = newProps[name];
1987
+ }
1988
+
1989
+ this.setProps(changeset);
1990
+ },
1991
+
1992
+ unset: function(name) { // accepts a string or array of strings
1993
+ var newProps = {};
1994
+ var names;
1995
+ var i;
1996
+
1997
+ if (typeof name === 'string') {
1998
+ names = [ name ];
1999
+ }
2000
+ else {
2001
+ names = name;
2002
+ }
2003
+
2004
+ for (i = 0; i < names.length; i++) {
2005
+ newProps[names[i]] = undefined;
2006
+ }
2007
+
2008
+ this.setProps(newProps);
2009
+ },
2010
+
2011
+ setProps: function(newProps) {
2012
+ var changedProps = {};
2013
+ var changedCnt = 0;
2014
+ var name, val;
2015
+
2016
+ for (name in newProps) {
2017
+ val = newProps[name];
2018
+
2019
+ // a change in value?
2020
+ // if an object, don't check equality, because might have been mutated internally.
2021
+ // TODO: eventually enforce immutability.
2022
+ if (
2023
+ typeof val === 'object' ||
2024
+ val !== this._props[name]
2025
+ ) {
2026
+ changedProps[name] = val;
2027
+ changedCnt++;
2028
+ }
2029
+ }
2030
+
2031
+ if (changedCnt) {
2032
+
2033
+ this.trigger('before:batchChange', changedProps);
2034
+
2035
+ for (name in changedProps) {
2036
+ val = changedProps[name];
2037
+
2038
+ this.trigger('before:change', name, val);
2039
+ this.trigger('before:change:' + name, val);
2040
+ }
2041
+
2042
+ for (name in changedProps) {
2043
+ val = changedProps[name];
2044
+
2045
+ if (val === undefined) {
2046
+ delete this._props[name];
2047
+ }
2048
+ else {
2049
+ this._props[name] = val;
2050
+ }
2051
+
2052
+ this.trigger('change:' + name, val);
2053
+ this.trigger('change', name, val);
2054
+ }
2055
+
2056
+ this.trigger('batchChange', changedProps);
2057
+ }
2058
+ },
2059
+
2060
+ watch: function(name, depList, startFunc, stopFunc) {
2061
+ var _this = this;
2062
+
2063
+ this.unwatch(name);
2064
+
2065
+ this._watchers[name] = this._watchDeps(depList, function(deps) {
2066
+ var res = startFunc.call(_this, deps);
2067
+
2068
+ if (res && res.then) {
2069
+ _this.unset(name); // put in an unset state while resolving
2070
+ res.then(function(val) {
2071
+ _this.set(name, val);
2072
+ });
2073
+ }
2074
+ else {
2075
+ _this.set(name, res);
2076
+ }
2077
+ }, function() {
2078
+ _this.unset(name);
2079
+
2080
+ if (stopFunc) {
2081
+ stopFunc.call(_this);
2082
+ }
2083
+ });
2084
+ },
2085
+
2086
+ unwatch: function(name) {
2087
+ var watcher = this._watchers[name];
2088
+
2089
+ if (watcher) {
2090
+ delete this._watchers[name];
2091
+ watcher.teardown();
2092
+ }
2093
+ },
2094
+
2095
+ _watchDeps: function(depList, startFunc, stopFunc) {
2096
+ var _this = this;
2097
+ var queuedChangeCnt = 0;
2098
+ var depCnt = depList.length;
2099
+ var satisfyCnt = 0;
2100
+ var values = {}; // what's passed as the `deps` arguments
2101
+ var bindTuples = []; // array of [ eventName, handlerFunc ] arrays
2102
+ var isCallingStop = false;
2103
+
2104
+ function onBeforeDepChange(depName, val, isOptional) {
2105
+ queuedChangeCnt++;
2106
+ if (queuedChangeCnt === 1) { // first change to cause a "stop" ?
2107
+ if (satisfyCnt === depCnt) { // all deps previously satisfied?
2108
+ isCallingStop = true;
2109
+ stopFunc();
2110
+ isCallingStop = false;
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ function onDepChange(depName, val, isOptional) {
2116
+
2117
+ if (val === undefined) { // unsetting a value?
2118
+
2119
+ // required dependency that was previously set?
2120
+ if (!isOptional && values[depName] !== undefined) {
2121
+ satisfyCnt--;
2122
+ }
2123
+
2124
+ delete values[depName];
2125
+ }
2126
+ else { // setting a value?
2127
+
2128
+ // required dependency that was previously unset?
2129
+ if (!isOptional && values[depName] === undefined) {
2130
+ satisfyCnt++;
2131
+ }
2132
+
2133
+ values[depName] = val;
2134
+ }
2135
+
2136
+ queuedChangeCnt--;
2137
+ if (!queuedChangeCnt) { // last change to cause a "start"?
2138
+
2139
+ // now finally satisfied or satisfied all along?
2140
+ if (satisfyCnt === depCnt) {
2141
+
2142
+ // if the stopFunc initiated another value change, ignore it.
2143
+ // it will be processed by another change event anyway.
2144
+ if (!isCallingStop) {
2145
+ startFunc(values);
2146
+ }
2147
+ }
2148
+ }
2149
+ }
2150
+
2151
+ // intercept for .on() that remembers handlers
2152
+ function bind(eventName, handler) {
2153
+ _this.on(eventName, handler);
2154
+ bindTuples.push([ eventName, handler ]);
2155
+ }
2156
+
2157
+ // listen to dependency changes
2158
+ depList.forEach(function(depName) {
2159
+ var isOptional = false;
2160
+
2161
+ if (depName.charAt(0) === '?') { // TODO: more DRY
2162
+ depName = depName.substring(1);
2163
+ isOptional = true;
2164
+ }
2165
+
2166
+ bind('before:change:' + depName, function(val) {
2167
+ onBeforeDepChange(depName, val, isOptional);
2168
+ });
2169
+
2170
+ bind('change:' + depName, function(val) {
2171
+ onDepChange(depName, val, isOptional);
2172
+ });
2173
+ });
2174
+
2175
+ // process current dependency values
2176
+ depList.forEach(function(depName) {
2177
+ var isOptional = false;
2178
+
2179
+ if (depName.charAt(0) === '?') { // TODO: more DRY
2180
+ depName = depName.substring(1);
2181
+ isOptional = true;
2182
+ }
2183
+
2184
+ if (_this.has(depName)) {
2185
+ values[depName] = _this.get(depName);
2186
+ satisfyCnt++;
2187
+ }
2188
+ else if (isOptional) {
2189
+ satisfyCnt++;
2190
+ }
2191
+ });
2192
+
2193
+ // initially satisfied
2194
+ if (satisfyCnt === depCnt) {
2195
+ startFunc(values);
2196
+ }
2197
+
2198
+ return {
2199
+ teardown: function() {
2200
+ // remove all handlers
2201
+ for (var i = 0; i < bindTuples.length; i++) {
2202
+ _this.off(bindTuples[i][0], bindTuples[i][1]);
2203
+ }
2204
+ bindTuples = null;
2205
+
2206
+ // was satisfied, so call stopFunc
2207
+ if (satisfyCnt === depCnt) {
2208
+ stopFunc();
2209
+ }
2210
+ },
2211
+ flash: function() {
2212
+ if (satisfyCnt === depCnt) {
2213
+ stopFunc();
2214
+ startFunc(values);
2215
+ }
2216
+ }
2217
+ };
2218
+ },
2219
+
2220
+ flash: function(name) {
2221
+ var watcher = this._watchers[name];
2222
+
2223
+ if (watcher) {
2224
+ watcher.flash();
2225
+ }
2226
+ }
2227
+
2228
+ });
2229
+
2230
+
2231
+ Model.watch = function(/* same arguments as this.watch() */) {
2232
+ var proto = this.prototype;
2233
+
2234
+ if (!proto._globalWatchArgs) {
2235
+ proto._globalWatchArgs = [];
2236
+ }
2237
+
2238
+ proto._globalWatchArgs.push(arguments);
2239
+ };
2240
+
2241
+
2242
+ FC.Model = Model;
2243
+
2244
+
2245
+ ;;
2246
+
2247
+ var Promise = {
2248
+
2249
+ construct: function(executor) {
2250
+ var deferred = $.Deferred();
2251
+ var promise = deferred.promise();
2252
+
2253
+ if (typeof executor === 'function') {
2254
+ executor(
2255
+ function(val) { // resolve
2256
+ deferred.resolve(val);
2257
+ attachImmediatelyResolvingThen(promise, val);
2258
+ },
2259
+ function() { // reject
2260
+ deferred.reject();
2261
+ attachImmediatelyRejectingThen(promise);
2262
+ }
2263
+ );
2264
+ }
2265
+
2266
+ return promise;
2267
+ },
2268
+
2269
+ resolve: function(val) {
2270
+ var deferred = $.Deferred().resolve(val);
2271
+ var promise = deferred.promise();
2272
+
2273
+ attachImmediatelyResolvingThen(promise, val);
2274
+
2275
+ return promise;
2276
+ },
2277
+
2278
+ reject: function() {
2279
+ var deferred = $.Deferred().reject();
2280
+ var promise = deferred.promise();
2281
+
2282
+ attachImmediatelyRejectingThen(promise);
2283
+
2284
+ return promise;
2285
+ }
2286
+
2287
+ };
2288
+
2289
+
2290
+ function attachImmediatelyResolvingThen(promise, val) {
2291
+ promise.then = function(onResolve) {
2292
+ if (typeof onResolve === 'function') {
2293
+ onResolve(val);
2294
+ }
2295
+ return promise; // for chaining
2296
+ };
2297
+ }
2298
+
2299
+
2300
+ function attachImmediatelyRejectingThen(promise) {
2301
+ promise.then = function(onResolve, onReject) {
2302
+ if (typeof onReject === 'function') {
2303
+ onReject();
2304
+ }
2305
+ return promise; // for chaining
2306
+ };
2307
+ }
2308
+
2309
+
2310
+ FC.Promise = Promise;
2311
+
2312
+ ;;
2313
+
2314
+ var TaskQueue = Class.extend(EmitterMixin, {
2315
+
2316
+ q: null,
2317
+ isPaused: false,
2318
+ isRunning: false,
2319
+
2320
+
2321
+ constructor: function() {
2322
+ this.q = [];
2323
+ },
2324
+
2325
+
2326
+ queue: function(/* taskFunc, taskFunc... */) {
2327
+ this.q.push.apply(this.q, arguments); // append
2328
+ this.tryStart();
2329
+ },
2330
+
2331
+
2332
+ pause: function() {
2333
+ this.isPaused = true;
2334
+ },
2335
+
2336
+
2337
+ resume: function() {
2338
+ this.isPaused = false;
2339
+ this.tryStart();
2340
+ },
2341
+
2342
+
2343
+ tryStart: function() {
2344
+ if (!this.isRunning && this.canRunNext()) {
2345
+ this.isRunning = true;
2346
+ this.trigger('start');
2347
+ this.runNext();
2348
+ }
2349
+ },
2350
+
2351
+
2352
+ canRunNext: function() {
2353
+ return !this.isPaused && this.q.length;
2354
+ },
2355
+
2356
+
2357
+ runNext: function() { // does not check canRunNext
2358
+ this.runTask(this.q.shift());
2359
+ },
2360
+
2361
+
2362
+ runTask: function(task) {
2363
+ this.runTaskFunc(task);
2364
+ },
2365
+
2366
+
2367
+ runTaskFunc: function(taskFunc) {
2368
+ var _this = this;
2369
+ var res = taskFunc();
2370
+
2371
+ if (res && res.then) {
2372
+ res.then(done);
2373
+ }
2374
+ else {
2375
+ done();
2376
+ }
2377
+
2378
+ function done() {
2379
+ if (_this.canRunNext()) {
2380
+ _this.runNext();
2381
+ }
2382
+ else {
2383
+ _this.isRunning = false;
2384
+ _this.trigger('stop');
2385
+ }
2386
+ }
2387
+ }
2388
+
2389
+ });
2390
+
2391
+ FC.TaskQueue = TaskQueue;
2392
+
2393
+ ;;
2394
+
2395
+ var RenderQueue = TaskQueue.extend({
2396
+
2397
+ waitsByNamespace: null,
2398
+ waitNamespace: null,
2399
+ waitId: null,
2400
+
2401
+
2402
+ constructor: function(waitsByNamespace) {
2403
+ TaskQueue.call(this); // super-constructor
2404
+
2405
+ this.waitsByNamespace = waitsByNamespace || {};
2406
+ },
2407
+
2408
+
2409
+ queue: function(taskFunc, namespace, type) {
2410
+ var task = {
2411
+ func: taskFunc,
2412
+ namespace: namespace,
2413
+ type: type
2414
+ };
2415
+ var waitMs;
2416
+
2417
+ if (namespace) {
2418
+ waitMs = this.waitsByNamespace[namespace];
2419
+ }
2420
+
2421
+ if (this.waitNamespace) {
2422
+ if (namespace === this.waitNamespace && waitMs != null) {
2423
+ this.delayWait(waitMs);
2424
+ }
2425
+ else {
2426
+ this.clearWait();
2427
+ this.tryStart();
2428
+ }
2429
+ }
2430
+
2431
+ if (this.compoundTask(task)) { // appended to queue?
2432
+
2433
+ if (!this.waitNamespace && waitMs != null) {
2434
+ this.startWait(namespace, waitMs);
2435
+ }
2436
+ else {
2437
+ this.tryStart();
2438
+ }
2439
+ }
2440
+ },
2441
+
2442
+
2443
+ startWait: function(namespace, waitMs) {
2444
+ this.waitNamespace = namespace;
2445
+ this.spawnWait(waitMs);
2446
+ },
2447
+
2448
+
2449
+ delayWait: function(waitMs) {
2450
+ clearTimeout(this.waitId);
2451
+ this.spawnWait(waitMs);
2452
+ },
2453
+
2454
+
2455
+ spawnWait: function(waitMs) {
2456
+ var _this = this;
2457
+
2458
+ this.waitId = setTimeout(function() {
2459
+ _this.waitNamespace = null;
2460
+ _this.tryStart();
2461
+ }, waitMs);
2462
+ },
2463
+
2464
+
2465
+ clearWait: function() {
2466
+ if (this.waitNamespace) {
2467
+ clearTimeout(this.waitId);
2468
+ this.waitId = null;
2469
+ this.waitNamespace = null;
2470
+ }
2471
+ },
2472
+
2473
+
2474
+ canRunNext: function() {
2475
+ if (!TaskQueue.prototype.canRunNext.apply(this, arguments)) {
2476
+ return false;
2477
+ }
2478
+
2479
+ // waiting for a certain namespace to stop receiving tasks?
2480
+ if (this.waitNamespace) {
2481
+
2482
+ // if there was a different namespace task in the meantime,
2483
+ // that forces all previously-waiting tasks to suddenly execute.
2484
+ // TODO: find a way to do this in constant time.
2485
+ for (var q = this.q, i = 0; i < q.length; i++) {
2486
+ if (q[i].namespace !== this.waitNamespace) {
2487
+ return true; // allow execution
2488
+ }
2489
+ }
2490
+
2491
+ return false;
2492
+ }
2493
+
2494
+ return true;
2495
+ },
2496
+
2497
+
2498
+ runTask: function(task) {
2499
+ this.runTaskFunc(task.func);
2500
+ },
2501
+
2502
+
2503
+ compoundTask: function(newTask) {
2504
+ var q = this.q;
2505
+ var shouldAppend = true;
2506
+ var i, task;
2507
+
2508
+ if (newTask.namespace) {
2509
+
2510
+ if (newTask.type === 'destroy' || newTask.type === 'init') {
2511
+
2512
+ // remove all add/remove ops with same namespace, regardless of order
2513
+ for (i = q.length - 1; i >= 0; i--) {
2514
+ task = q[i];
2515
+
2516
+ if (
2517
+ task.namespace === newTask.namespace &&
2518
+ (task.type === 'add' || task.type === 'remove')
2519
+ ) {
2520
+ q.splice(i, 1); // remove task
2521
+ }
2522
+ }
2523
+
2524
+ if (newTask.type === 'destroy') {
2525
+ // eat away final init/destroy operation
2526
+ if (q.length) {
2527
+ task = q[q.length - 1]; // last task
2528
+
2529
+ if (task.namespace === newTask.namespace) {
2530
+
2531
+ // the init and our destroy cancel each other out
2532
+ if (task.type === 'init') {
2533
+ shouldAppend = false;
2534
+ q.pop();
2535
+ }
2536
+ // prefer to use the destroy operation that's already present
2537
+ else if (task.type === 'destroy') {
2538
+ shouldAppend = false;
2539
+ }
2540
+ }
2541
+ }
2542
+ }
2543
+ else if (newTask.type === 'init') {
2544
+ // eat away final init operation
2545
+ if (q.length) {
2546
+ task = q[q.length - 1]; // last task
2547
+
2548
+ if (
2549
+ task.namespace === newTask.namespace &&
2550
+ task.type === 'init'
2551
+ ) {
2552
+ // our init operation takes precedence
2553
+ q.pop();
2554
+ }
2555
+ }
2556
+ }
2557
+ }
2558
+ }
2559
+
2560
+ if (shouldAppend) {
2561
+ q.push(newTask);
2562
+ }
2563
+
2564
+ return shouldAppend;
2565
+ }
2566
+
2567
+ });
2568
+
2569
+ FC.RenderQueue = RenderQueue;
2570
+
2571
+ ;;
2572
+
2573
+ var EmitterMixin = FC.EmitterMixin = {
2574
+
2575
+ // jQuery-ification via $(this) allows a non-DOM object to have
2576
+ // the same event handling capabilities (including namespaces).
2577
+
2578
+
2579
+ on: function(types, handler) {
2580
+ $(this).on(types, this._prepareIntercept(handler));
2581
+ return this; // for chaining
2582
+ },
2583
+
2584
+
2585
+ one: function(types, handler) {
2586
+ $(this).one(types, this._prepareIntercept(handler));
2587
+ return this; // for chaining
2588
+ },
2589
+
2590
+
2591
+ _prepareIntercept: function(handler) {
2592
+ // handlers are always called with an "event" object as their first param.
2593
+ // sneak the `this` context and arguments into the extra parameter object
2594
+ // and forward them on to the original handler.
2595
+ var intercept = function(ev, extra) {
2596
+ return handler.apply(
2597
+ extra.context || this,
2598
+ extra.args || []
2599
+ );
2600
+ };
2601
+
2602
+ // mimick jQuery's internal "proxy" system (risky, I know)
2603
+ // causing all functions with the same .guid to appear to be the same.
2604
+ // https://github.com/jquery/jquery/blob/2.2.4/src/core.js#L448
2605
+ // this is needed for calling .off with the original non-intercept handler.
2606
+ if (!handler.guid) {
2607
+ handler.guid = $.guid++;
2608
+ }
2609
+ intercept.guid = handler.guid;
2610
+
2611
+ return intercept;
2612
+ },
2613
+
2614
+
2615
+ off: function(types, handler) {
2616
+ $(this).off(types, handler);
2617
+
2618
+ return this; // for chaining
2619
+ },
2620
+
2621
+
2622
+ trigger: function(types) {
2623
+ var args = Array.prototype.slice.call(arguments, 1); // arguments after the first
2624
+
2625
+ // pass in "extra" info to the intercept
2626
+ $(this).triggerHandler(types, { args: args });
2627
+
2628
+ return this; // for chaining
2629
+ },
2630
+
2631
+
2632
+ triggerWith: function(types, context, args) {
2633
+
2634
+ // `triggerHandler` is less reliant on the DOM compared to `trigger`.
2635
+ // pass in "extra" info to the intercept.
2636
+ $(this).triggerHandler(types, { context: context, args: args });
2637
+
2638
+ return this; // for chaining
2639
+ }
2640
+
2641
+ };
2642
+
2643
+ ;;
2644
+
2645
+ /*
2646
+ Utility methods for easily listening to events on another object,
2647
+ and more importantly, easily unlistening from them.
2648
+ */
2649
+ var ListenerMixin = FC.ListenerMixin = (function() {
2650
+ var guid = 0;
2651
+ var ListenerMixin = {
2652
+
2653
+ listenerId: null,
2654
+
2655
+ /*
2656
+ Given an `other` object that has on/off methods, bind the given `callback` to an event by the given name.
2657
+ The `callback` will be called with the `this` context of the object that .listenTo is being called on.
2658
+ Can be called:
2659
+ .listenTo(other, eventName, callback)
2660
+ OR
2661
+ .listenTo(other, {
2662
+ eventName1: callback1,
2663
+ eventName2: callback2
2664
+ })
2665
+ */
2666
+ listenTo: function(other, arg, callback) {
2667
+ if (typeof arg === 'object') { // given dictionary of callbacks
2668
+ for (var eventName in arg) {
2669
+ if (arg.hasOwnProperty(eventName)) {
2670
+ this.listenTo(other, eventName, arg[eventName]);
2671
+ }
2672
+ }
2673
+ }
2674
+ else if (typeof arg === 'string') {
2675
+ other.on(
2676
+ arg + '.' + this.getListenerNamespace(), // use event namespacing to identify this object
2677
+ $.proxy(callback, this) // always use `this` context
2678
+ // the usually-undesired jQuery guid behavior doesn't matter,
2679
+ // because we always unbind via namespace
2680
+ );
2681
+ }
2682
+ },
2683
+
2684
+ /*
2685
+ Causes the current object to stop listening to events on the `other` object.
2686
+ `eventName` is optional. If omitted, will stop listening to ALL events on `other`.
2687
+ */
2688
+ stopListeningTo: function(other, eventName) {
2689
+ other.off((eventName || '') + '.' + this.getListenerNamespace());
2690
+ },
2691
+
2692
+ /*
2693
+ Returns a string, unique to this object, to be used for event namespacing
2694
+ */
2695
+ getListenerNamespace: function() {
2696
+ if (this.listenerId == null) {
2697
+ this.listenerId = guid++;
2698
+ }
2699
+ return '_listener' + this.listenerId;
2700
+ }
2701
+
2702
+ };
2703
+ return ListenerMixin;
2704
+ })();
2705
+ ;;
2706
+
2707
+ /* A rectangular panel that is absolutely positioned over other content
2708
+ ------------------------------------------------------------------------------------------------------------------------
2709
+ Options:
2710
+ - className (string)
2711
+ - content (HTML string or jQuery element set)
2712
+ - parentEl
2713
+ - top
2714
+ - left
2715
+ - right (the x coord of where the right edge should be. not a "CSS" right)
2716
+ - autoHide (boolean)
2717
+ - show (callback)
2718
+ - hide (callback)
2719
+ */
2720
+
2721
+ var Popover = Class.extend(ListenerMixin, {
2722
+
2723
+ isHidden: true,
2724
+ options: null,
2725
+ el: null, // the container element for the popover. generated by this object
2726
+ margin: 10, // the space required between the popover and the edges of the scroll container
2727
+
2728
+
2729
+ constructor: function(options) {
2730
+ this.options = options || {};
2731
+ },
2732
+
2733
+
2734
+ // Shows the popover on the specified position. Renders it if not already
2735
+ show: function() {
2736
+ if (this.isHidden) {
2737
+ if (!this.el) {
2738
+ this.render();
2739
+ }
2740
+ this.el.show();
2741
+ this.position();
2742
+ this.isHidden = false;
2743
+ this.trigger('show');
2744
+ }
2745
+ },
2746
+
2747
+
2748
+ // Hides the popover, through CSS, but does not remove it from the DOM
2749
+ hide: function() {
2750
+ if (!this.isHidden) {
2751
+ this.el.hide();
2752
+ this.isHidden = true;
2753
+ this.trigger('hide');
2754
+ }
2755
+ },
2756
+
2757
+
2758
+ // Creates `this.el` and renders content inside of it
2759
+ render: function() {
2760
+ var _this = this;
2761
+ var options = this.options;
2762
+
2763
+ this.el = $('<div class="fc-popover"/>')
2764
+ .addClass(options.className || '')
2765
+ .css({
2766
+ // position initially to the top left to avoid creating scrollbars
2767
+ top: 0,
2768
+ left: 0
2769
+ })
2770
+ .append(options.content)
2771
+ .appendTo(options.parentEl);
2772
+
2773
+ // when a click happens on anything inside with a 'fc-close' className, hide the popover
2774
+ this.el.on('click', '.fc-close', function() {
2775
+ _this.hide();
2776
+ });
2777
+
2778
+ if (options.autoHide) {
2779
+ this.listenTo($(document), 'mousedown', this.documentMousedown);
2780
+ }
2781
+ },
2782
+
2783
+
2784
+ // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
2785
+ documentMousedown: function(ev) {
2786
+ // only hide the popover if the click happened outside the popover
2787
+ if (this.el && !$(ev.target).closest(this.el).length) {
2788
+ this.hide();
2789
+ }
2790
+ },
2791
+
2792
+
2793
+ // Hides and unregisters any handlers
2794
+ removeElement: function() {
2795
+ this.hide();
2796
+
2797
+ if (this.el) {
2798
+ this.el.remove();
2799
+ this.el = null;
2800
+ }
2801
+
2802
+ this.stopListeningTo($(document), 'mousedown');
2803
+ },
2804
+
2805
+
2806
+ // Positions the popover optimally, using the top/left/right options
2807
+ position: function() {
2808
+ var options = this.options;
2809
+ var origin = this.el.offsetParent().offset();
2810
+ var width = this.el.outerWidth();
2811
+ var height = this.el.outerHeight();
2812
+ var windowEl = $(window);
2813
+ var viewportEl = getScrollParent(this.el);
2814
+ var viewportTop;
2815
+ var viewportLeft;
2816
+ var viewportOffset;
2817
+ var top; // the "position" (not "offset") values for the popover
2818
+ var left; //
2819
+
2820
+ // compute top and left
2821
+ top = options.top || 0;
2822
+ if (options.left !== undefined) {
2823
+ left = options.left;
2824
+ }
2825
+ else if (options.right !== undefined) {
2826
+ left = options.right - width; // derive the left value from the right value
2827
+ }
2828
+ else {
2829
+ left = 0;
2830
+ }
2831
+
2832
+ if (viewportEl.is(window) || viewportEl.is(document)) { // normalize getScrollParent's result
2833
+ viewportEl = windowEl;
2834
+ viewportTop = 0; // the window is always at the top left
2835
+ viewportLeft = 0; // (and .offset() won't work if called here)
2836
+ }
2837
+ else {
2838
+ viewportOffset = viewportEl.offset();
2839
+ viewportTop = viewportOffset.top;
2840
+ viewportLeft = viewportOffset.left;
2841
+ }
2842
+
2843
+ // if the window is scrolled, it causes the visible area to be further down
2844
+ viewportTop += windowEl.scrollTop();
2845
+ viewportLeft += windowEl.scrollLeft();
2846
+
2847
+ // constrain to the view port. if constrained by two edges, give precedence to top/left
2848
+ if (options.viewportConstrain !== false) {
2849
+ top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
2850
+ top = Math.max(top, viewportTop + this.margin);
2851
+ left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
2852
+ left = Math.max(left, viewportLeft + this.margin);
2853
+ }
2854
+
2855
+ this.el.css({
2856
+ top: top - origin.top,
2857
+ left: left - origin.left
2858
+ });
2859
+ },
2860
+
2861
+
2862
+ // Triggers a callback. Calls a function in the option hash of the same name.
2863
+ // Arguments beyond the first `name` are forwarded on.
2864
+ // TODO: better code reuse for this. Repeat code
2865
+ trigger: function(name) {
2866
+ if (this.options[name]) {
2867
+ this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
2868
+ }
2869
+ }
2870
+
2871
+ });
2872
+
2873
+ ;;
2874
+
2875
+ /*
2876
+ A cache for the left/right/top/bottom/width/height values for one or more elements.
2877
+ Works with both offset (from topleft document) and position (from offsetParent).
2878
+
2879
+ options:
2880
+ - els
2881
+ - isHorizontal
2882
+ - isVertical
2883
+ */
2884
+ var CoordCache = FC.CoordCache = Class.extend({
2885
+
2886
+ els: null, // jQuery set (assumed to be siblings)
2887
+ forcedOffsetParentEl: null, // options can override the natural offsetParent
2888
+ origin: null, // {left,top} position of offsetParent of els
2889
+ boundingRect: null, // constrain cordinates to this rectangle. {left,right,top,bottom} or null
2890
+ isHorizontal: false, // whether to query for left/right/width
2891
+ isVertical: false, // whether to query for top/bottom/height
2892
+
2893
+ // arrays of coordinates (offsets from topleft of document)
2894
+ lefts: null,
2895
+ rights: null,
2896
+ tops: null,
2897
+ bottoms: null,
2898
+
2899
+
2900
+ constructor: function(options) {
2901
+ this.els = $(options.els);
2902
+ this.isHorizontal = options.isHorizontal;
2903
+ this.isVertical = options.isVertical;
2904
+ this.forcedOffsetParentEl = options.offsetParent ? $(options.offsetParent) : null;
2905
+ },
2906
+
2907
+
2908
+ // Queries the els for coordinates and stores them.
2909
+ // Call this method before using and of the get* methods below.
2910
+ build: function() {
2911
+ var offsetParentEl = this.forcedOffsetParentEl;
2912
+ if (!offsetParentEl && this.els.length > 0) {
2913
+ offsetParentEl = this.els.eq(0).offsetParent();
2914
+ }
2915
+
2916
+ this.origin = offsetParentEl ?
2917
+ offsetParentEl.offset() :
2918
+ null;
2919
+
2920
+ this.boundingRect = this.queryBoundingRect();
2921
+
2922
+ if (this.isHorizontal) {
2923
+ this.buildElHorizontals();
2924
+ }
2925
+ if (this.isVertical) {
2926
+ this.buildElVerticals();
2927
+ }
2928
+ },
2929
+
2930
+
2931
+ // Destroys all internal data about coordinates, freeing memory
2932
+ clear: function() {
2933
+ this.origin = null;
2934
+ this.boundingRect = null;
2935
+ this.lefts = null;
2936
+ this.rights = null;
2937
+ this.tops = null;
2938
+ this.bottoms = null;
2939
+ },
2940
+
2941
+
2942
+ // When called, if coord caches aren't built, builds them
2943
+ ensureBuilt: function() {
2944
+ if (!this.origin) {
2945
+ this.build();
2946
+ }
2947
+ },
2948
+
2949
+
2950
+ // Populates the left/right internal coordinate arrays
2951
+ buildElHorizontals: function() {
2952
+ var lefts = [];
2953
+ var rights = [];
2954
+
2955
+ this.els.each(function(i, node) {
2956
+ var el = $(node);
2957
+ var left = el.offset().left;
2958
+ var width = el.outerWidth();
2959
+
2960
+ lefts.push(left);
2961
+ rights.push(left + width);
2962
+ });
2963
+
2964
+ this.lefts = lefts;
2965
+ this.rights = rights;
2966
+ },
2967
+
2968
+
2969
+ // Populates the top/bottom internal coordinate arrays
2970
+ buildElVerticals: function() {
2971
+ var tops = [];
2972
+ var bottoms = [];
2973
+
2974
+ this.els.each(function(i, node) {
2975
+ var el = $(node);
2976
+ var top = el.offset().top;
2977
+ var height = el.outerHeight();
2978
+
2979
+ tops.push(top);
2980
+ bottoms.push(top + height);
2981
+ });
2982
+
2983
+ this.tops = tops;
2984
+ this.bottoms = bottoms;
2985
+ },
2986
+
2987
+
2988
+ // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
2989
+ // If no intersection is made, returns undefined.
2990
+ getHorizontalIndex: function(leftOffset) {
2991
+ this.ensureBuilt();
2992
+
2993
+ var lefts = this.lefts;
2994
+ var rights = this.rights;
2995
+ var len = lefts.length;
2996
+ var i;
2997
+
2998
+ for (i = 0; i < len; i++) {
2999
+ if (leftOffset >= lefts[i] && leftOffset < rights[i]) {
3000
+ return i;
3001
+ }
3002
+ }
3003
+ },
3004
+
3005
+
3006
+ // Given a top offset (from document top), returns the index of the el that it vertically intersects.
3007
+ // If no intersection is made, returns undefined.
3008
+ getVerticalIndex: function(topOffset) {
3009
+ this.ensureBuilt();
3010
+
3011
+ var tops = this.tops;
3012
+ var bottoms = this.bottoms;
3013
+ var len = tops.length;
3014
+ var i;
3015
+
3016
+ for (i = 0; i < len; i++) {
3017
+ if (topOffset >= tops[i] && topOffset < bottoms[i]) {
3018
+ return i;
3019
+ }
3020
+ }
3021
+ },
3022
+
3023
+
3024
+ // Gets the left offset (from document left) of the element at the given index
3025
+ getLeftOffset: function(leftIndex) {
3026
+ this.ensureBuilt();
3027
+ return this.lefts[leftIndex];
3028
+ },
3029
+
3030
+
3031
+ // Gets the left position (from offsetParent left) of the element at the given index
3032
+ getLeftPosition: function(leftIndex) {
3033
+ this.ensureBuilt();
3034
+ return this.lefts[leftIndex] - this.origin.left;
3035
+ },
3036
+
3037
+
3038
+ // Gets the right offset (from document left) of the element at the given index.
3039
+ // This value is NOT relative to the document's right edge, like the CSS concept of "right" would be.
3040
+ getRightOffset: function(leftIndex) {
3041
+ this.ensureBuilt();
3042
+ return this.rights[leftIndex];
3043
+ },
3044
+
3045
+
3046
+ // Gets the right position (from offsetParent left) of the element at the given index.
3047
+ // This value is NOT relative to the offsetParent's right edge, like the CSS concept of "right" would be.
3048
+ getRightPosition: function(leftIndex) {
3049
+ this.ensureBuilt();
3050
+ return this.rights[leftIndex] - this.origin.left;
3051
+ },
3052
+
3053
+
3054
+ // Gets the width of the element at the given index
3055
+ getWidth: function(leftIndex) {
3056
+ this.ensureBuilt();
3057
+ return this.rights[leftIndex] - this.lefts[leftIndex];
3058
+ },
3059
+
3060
+
3061
+ // Gets the top offset (from document top) of the element at the given index
3062
+ getTopOffset: function(topIndex) {
3063
+ this.ensureBuilt();
3064
+ return this.tops[topIndex];
3065
+ },
3066
+
3067
+
3068
+ // Gets the top position (from offsetParent top) of the element at the given position
3069
+ getTopPosition: function(topIndex) {
3070
+ this.ensureBuilt();
3071
+ return this.tops[topIndex] - this.origin.top;
3072
+ },
3073
+
3074
+ // Gets the bottom offset (from the document top) of the element at the given index.
3075
+ // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
3076
+ getBottomOffset: function(topIndex) {
3077
+ this.ensureBuilt();
3078
+ return this.bottoms[topIndex];
3079
+ },
3080
+
3081
+
3082
+ // Gets the bottom position (from the offsetParent top) of the element at the given index.
3083
+ // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
3084
+ getBottomPosition: function(topIndex) {
3085
+ this.ensureBuilt();
3086
+ return this.bottoms[topIndex] - this.origin.top;
3087
+ },
3088
+
3089
+
3090
+ // Gets the height of the element at the given index
3091
+ getHeight: function(topIndex) {
3092
+ this.ensureBuilt();
3093
+ return this.bottoms[topIndex] - this.tops[topIndex];
3094
+ },
3095
+
3096
+
3097
+ // Bounding Rect
3098
+ // TODO: decouple this from CoordCache
3099
+
3100
+ // Compute and return what the elements' bounding rectangle is, from the user's perspective.
3101
+ // Right now, only returns a rectangle if constrained by an overflow:scroll element.
3102
+ // Returns null if there are no elements
3103
+ queryBoundingRect: function() {
3104
+ var scrollParentEl;
3105
+
3106
+ if (this.els.length > 0) {
3107
+ scrollParentEl = getScrollParent(this.els.eq(0));
3108
+
3109
+ if (!scrollParentEl.is(document)) {
3110
+ return getClientRect(scrollParentEl);
3111
+ }
3112
+ }
3113
+
3114
+ return null;
3115
+ },
3116
+
3117
+ isPointInBounds: function(leftOffset, topOffset) {
3118
+ return this.isLeftInBounds(leftOffset) && this.isTopInBounds(topOffset);
3119
+ },
3120
+
3121
+ isLeftInBounds: function(leftOffset) {
3122
+ return !this.boundingRect || (leftOffset >= this.boundingRect.left && leftOffset < this.boundingRect.right);
3123
+ },
3124
+
3125
+ isTopInBounds: function(topOffset) {
3126
+ return !this.boundingRect || (topOffset >= this.boundingRect.top && topOffset < this.boundingRect.bottom);
3127
+ }
3128
+
3129
+ });
3130
+
3131
+ ;;
3132
+
3133
+ /* Tracks a drag's mouse movement, firing various handlers
3134
+ ----------------------------------------------------------------------------------------------------------------------*/
3135
+ // TODO: use Emitter
3136
+
3137
+ var DragListener = FC.DragListener = Class.extend(ListenerMixin, {
3138
+
3139
+ options: null,
3140
+ subjectEl: null,
3141
+
3142
+ // coordinates of the initial mousedown
3143
+ originX: null,
3144
+ originY: null,
3145
+
3146
+ // the wrapping element that scrolls, or MIGHT scroll if there's overflow.
3147
+ // TODO: do this for wrappers that have overflow:hidden as well.
3148
+ scrollEl: null,
3149
+
3150
+ isInteracting: false,
3151
+ isDistanceSurpassed: false,
3152
+ isDelayEnded: false,
3153
+ isDragging: false,
3154
+ isTouch: false,
3155
+ isGeneric: false, // initiated by 'dragstart' (jqui)
3156
+
3157
+ delay: null,
3158
+ delayTimeoutId: null,
3159
+ minDistance: null,
3160
+
3161
+ shouldCancelTouchScroll: true,
3162
+ scrollAlwaysKills: false,
3163
+
3164
+
3165
+ constructor: function(options) {
3166
+ this.options = options || {};
3167
+ },
3168
+
3169
+
3170
+ // Interaction (high-level)
3171
+ // -----------------------------------------------------------------------------------------------------------------
3172
+
3173
+
3174
+ startInteraction: function(ev, extraOptions) {
3175
+
3176
+ if (ev.type === 'mousedown') {
3177
+ if (GlobalEmitter.get().shouldIgnoreMouse()) {
3178
+ return;
3179
+ }
3180
+ else if (!isPrimaryMouseButton(ev)) {
3181
+ return;
3182
+ }
3183
+ else {
3184
+ ev.preventDefault(); // prevents native selection in most browsers
3185
+ }
3186
+ }
3187
+
3188
+ if (!this.isInteracting) {
3189
+
3190
+ // process options
3191
+ extraOptions = extraOptions || {};
3192
+ this.delay = firstDefined(extraOptions.delay, this.options.delay, 0);
3193
+ this.minDistance = firstDefined(extraOptions.distance, this.options.distance, 0);
3194
+ this.subjectEl = this.options.subjectEl;
3195
+
3196
+ preventSelection($('body'));
3197
+
3198
+ this.isInteracting = true;
3199
+ this.isTouch = getEvIsTouch(ev);
3200
+ this.isGeneric = ev.type === 'dragstart';
3201
+ this.isDelayEnded = false;
3202
+ this.isDistanceSurpassed = false;
3203
+
3204
+ this.originX = getEvX(ev);
3205
+ this.originY = getEvY(ev);
3206
+ this.scrollEl = getScrollParent($(ev.target));
3207
+
3208
+ this.bindHandlers();
3209
+ this.initAutoScroll();
3210
+ this.handleInteractionStart(ev);
3211
+ this.startDelay(ev);
3212
+
3213
+ if (!this.minDistance) {
3214
+ this.handleDistanceSurpassed(ev);
3215
+ }
3216
+ }
3217
+ },
3218
+
3219
+
3220
+ handleInteractionStart: function(ev) {
3221
+ this.trigger('interactionStart', ev);
3222
+ },
3223
+
3224
+
3225
+ endInteraction: function(ev, isCancelled) {
3226
+ if (this.isInteracting) {
3227
+ this.endDrag(ev);
3228
+
3229
+ if (this.delayTimeoutId) {
3230
+ clearTimeout(this.delayTimeoutId);
3231
+ this.delayTimeoutId = null;
3232
+ }
3233
+
3234
+ this.destroyAutoScroll();
3235
+ this.unbindHandlers();
3236
+
3237
+ this.isInteracting = false;
3238
+ this.handleInteractionEnd(ev, isCancelled);
3239
+
3240
+ allowSelection($('body'));
3241
+ }
3242
+ },
3243
+
3244
+
3245
+ handleInteractionEnd: function(ev, isCancelled) {
3246
+ this.trigger('interactionEnd', ev, isCancelled || false);
3247
+ },
3248
+
3249
+
3250
+ // Binding To DOM
3251
+ // -----------------------------------------------------------------------------------------------------------------
3252
+
3253
+
3254
+ bindHandlers: function() {
3255
+ // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart,
3256
+ // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly.
3257
+ var globalEmitter = GlobalEmitter.get();
3258
+
3259
+ if (this.isGeneric) {
3260
+ this.listenTo($(document), { // might only work on iOS because of GlobalEmitter's bind :(
3261
+ drag: this.handleMove,
3262
+ dragstop: this.endInteraction
3263
+ });
3264
+ }
3265
+ else if (this.isTouch) {
3266
+ this.listenTo(globalEmitter, {
3267
+ touchmove: this.handleTouchMove,
3268
+ touchend: this.endInteraction,
3269
+ scroll: this.handleTouchScroll
3270
+ });
3271
+ }
3272
+ else {
3273
+ this.listenTo(globalEmitter, {
3274
+ mousemove: this.handleMouseMove,
3275
+ mouseup: this.endInteraction
3276
+ });
3277
+ }
3278
+
3279
+ this.listenTo(globalEmitter, {
3280
+ selectstart: preventDefault, // don't allow selection while dragging
3281
+ contextmenu: preventDefault // long taps would open menu on Chrome dev tools
3282
+ });
3283
+ },
3284
+
3285
+
3286
+ unbindHandlers: function() {
3287
+ this.stopListeningTo(GlobalEmitter.get());
3288
+ this.stopListeningTo($(document)); // for isGeneric
3289
+ },
3290
+
3291
+
3292
+ // Drag (high-level)
3293
+ // -----------------------------------------------------------------------------------------------------------------
3294
+
3295
+
3296
+ // extraOptions ignored if drag already started
3297
+ startDrag: function(ev, extraOptions) {
3298
+ this.startInteraction(ev, extraOptions); // ensure interaction began
3299
+
3300
+ if (!this.isDragging) {
3301
+ this.isDragging = true;
3302
+ this.handleDragStart(ev);
3303
+ }
3304
+ },
3305
+
3306
+
3307
+ handleDragStart: function(ev) {
3308
+ this.trigger('dragStart', ev);
3309
+ },
3310
+
3311
+
3312
+ handleMove: function(ev) {
3313
+ var dx = getEvX(ev) - this.originX;
3314
+ var dy = getEvY(ev) - this.originY;
3315
+ var minDistance = this.minDistance;
3316
+ var distanceSq; // current distance from the origin, squared
3317
+
3318
+ if (!this.isDistanceSurpassed) {
3319
+ distanceSq = dx * dx + dy * dy;
3320
+ if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem
3321
+ this.handleDistanceSurpassed(ev);
3322
+ }
3323
+ }
3324
+
3325
+ if (this.isDragging) {
3326
+ this.handleDrag(dx, dy, ev);
3327
+ }
3328
+ },
3329
+
3330
+
3331
+ // Called while the mouse is being moved and when we know a legitimate drag is taking place
3332
+ handleDrag: function(dx, dy, ev) {
3333
+ this.trigger('drag', dx, dy, ev);
3334
+ this.updateAutoScroll(ev); // will possibly cause scrolling
3335
+ },
3336
+
3337
+
3338
+ endDrag: function(ev) {
3339
+ if (this.isDragging) {
3340
+ this.isDragging = false;
3341
+ this.handleDragEnd(ev);
3342
+ }
3343
+ },
3344
+
3345
+
3346
+ handleDragEnd: function(ev) {
3347
+ this.trigger('dragEnd', ev);
3348
+ },
3349
+
3350
+
3351
+ // Delay
3352
+ // -----------------------------------------------------------------------------------------------------------------
3353
+
3354
+
3355
+ startDelay: function(initialEv) {
3356
+ var _this = this;
3357
+
3358
+ if (this.delay) {
3359
+ this.delayTimeoutId = setTimeout(function() {
3360
+ _this.handleDelayEnd(initialEv);
3361
+ }, this.delay);
3362
+ }
3363
+ else {
3364
+ this.handleDelayEnd(initialEv);
3365
+ }
3366
+ },
3367
+
3368
+
3369
+ handleDelayEnd: function(initialEv) {
3370
+ this.isDelayEnded = true;
3371
+
3372
+ if (this.isDistanceSurpassed) {
3373
+ this.startDrag(initialEv);
3374
+ }
3375
+ },
3376
+
3377
+
3378
+ // Distance
3379
+ // -----------------------------------------------------------------------------------------------------------------
3380
+
3381
+
3382
+ handleDistanceSurpassed: function(ev) {
3383
+ this.isDistanceSurpassed = true;
3384
+
3385
+ if (this.isDelayEnded) {
3386
+ this.startDrag(ev);
3387
+ }
3388
+ },
3389
+
3390
+
3391
+ // Mouse / Touch
3392
+ // -----------------------------------------------------------------------------------------------------------------
3393
+
3394
+
3395
+ handleTouchMove: function(ev) {
3396
+
3397
+ // prevent inertia and touchmove-scrolling while dragging
3398
+ if (this.isDragging && this.shouldCancelTouchScroll) {
3399
+ ev.preventDefault();
3400
+ }
3401
+
3402
+ this.handleMove(ev);
3403
+ },
3404
+
3405
+
3406
+ handleMouseMove: function(ev) {
3407
+ this.handleMove(ev);
3408
+ },
3409
+
3410
+
3411
+ // Scrolling (unrelated to auto-scroll)
3412
+ // -----------------------------------------------------------------------------------------------------------------
3413
+
3414
+
3415
+ handleTouchScroll: function(ev) {
3416
+ // if the drag is being initiated by touch, but a scroll happens before
3417
+ // the drag-initiating delay is over, cancel the drag
3418
+ if (!this.isDragging || this.scrollAlwaysKills) {
3419
+ this.endInteraction(ev, true); // isCancelled=true
3420
+ }
3421
+ },
3422
+
3423
+
3424
+ // Utils
3425
+ // -----------------------------------------------------------------------------------------------------------------
3426
+
3427
+
3428
+ // Triggers a callback. Calls a function in the option hash of the same name.
3429
+ // Arguments beyond the first `name` are forwarded on.
3430
+ trigger: function(name) {
3431
+ if (this.options[name]) {
3432
+ this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
3433
+ }
3434
+ // makes _methods callable by event name. TODO: kill this
3435
+ if (this['_' + name]) {
3436
+ this['_' + name].apply(this, Array.prototype.slice.call(arguments, 1));
3437
+ }
3438
+ }
3439
+
3440
+
3441
+ });
3442
+
3443
+ ;;
3444
+ /*
3445
+ this.scrollEl is set in DragListener
3446
+ */
3447
+ DragListener.mixin({
3448
+
3449
+ isAutoScroll: false,
3450
+
3451
+ scrollBounds: null, // { top, bottom, left, right }
3452
+ scrollTopVel: null, // pixels per second
3453
+ scrollLeftVel: null, // pixels per second
3454
+ scrollIntervalId: null, // ID of setTimeout for scrolling animation loop
3455
+
3456
+ // defaults
3457
+ scrollSensitivity: 30, // pixels from edge for scrolling to start
3458
+ scrollSpeed: 200, // pixels per second, at maximum speed
3459
+ scrollIntervalMs: 50, // millisecond wait between scroll increment
3460
+
3461
+
3462
+ initAutoScroll: function() {
3463
+ var scrollEl = this.scrollEl;
3464
+
3465
+ this.isAutoScroll =
3466
+ this.options.scroll &&
3467
+ scrollEl &&
3468
+ !scrollEl.is(window) &&
3469
+ !scrollEl.is(document);
3470
+
3471
+ if (this.isAutoScroll) {
3472
+ // debounce makes sure rapid calls don't happen
3473
+ this.listenTo(scrollEl, 'scroll', debounce(this.handleDebouncedScroll, 100));
3474
+ }
3475
+ },
3476
+
3477
+
3478
+ destroyAutoScroll: function() {
3479
+ this.endAutoScroll(); // kill any animation loop
3480
+
3481
+ // remove the scroll handler if there is a scrollEl
3482
+ if (this.isAutoScroll) {
3483
+ this.stopListeningTo(this.scrollEl, 'scroll'); // will probably get removed by unbindHandlers too :(
3484
+ }
3485
+ },
3486
+
3487
+
3488
+ // Computes and stores the bounding rectangle of scrollEl
3489
+ computeScrollBounds: function() {
3490
+ if (this.isAutoScroll) {
3491
+ this.scrollBounds = getOuterRect(this.scrollEl);
3492
+ // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars
3493
+ }
3494
+ },
3495
+
3496
+
3497
+ // Called when the dragging is in progress and scrolling should be updated
3498
+ updateAutoScroll: function(ev) {
3499
+ var sensitivity = this.scrollSensitivity;
3500
+ var bounds = this.scrollBounds;
3501
+ var topCloseness, bottomCloseness;
3502
+ var leftCloseness, rightCloseness;
3503
+ var topVel = 0;
3504
+ var leftVel = 0;
3505
+
3506
+ if (bounds) { // only scroll if scrollEl exists
3507
+
3508
+ // compute closeness to edges. valid range is from 0.0 - 1.0
3509
+ topCloseness = (sensitivity - (getEvY(ev) - bounds.top)) / sensitivity;
3510
+ bottomCloseness = (sensitivity - (bounds.bottom - getEvY(ev))) / sensitivity;
3511
+ leftCloseness = (sensitivity - (getEvX(ev) - bounds.left)) / sensitivity;
3512
+ rightCloseness = (sensitivity - (bounds.right - getEvX(ev))) / sensitivity;
3513
+
3514
+ // translate vertical closeness into velocity.
3515
+ // mouse must be completely in bounds for velocity to happen.
3516
+ if (topCloseness >= 0 && topCloseness <= 1) {
3517
+ topVel = topCloseness * this.scrollSpeed * -1; // negative. for scrolling up
3518
+ }
3519
+ else if (bottomCloseness >= 0 && bottomCloseness <= 1) {
3520
+ topVel = bottomCloseness * this.scrollSpeed;
3521
+ }
3522
+
3523
+ // translate horizontal closeness into velocity
3524
+ if (leftCloseness >= 0 && leftCloseness <= 1) {
3525
+ leftVel = leftCloseness * this.scrollSpeed * -1; // negative. for scrolling left
3526
+ }
3527
+ else if (rightCloseness >= 0 && rightCloseness <= 1) {
3528
+ leftVel = rightCloseness * this.scrollSpeed;
3529
+ }
3530
+ }
3531
+
3532
+ this.setScrollVel(topVel, leftVel);
3533
+ },
3534
+
3535
+
3536
+ // Sets the speed-of-scrolling for the scrollEl
3537
+ setScrollVel: function(topVel, leftVel) {
3538
+
3539
+ this.scrollTopVel = topVel;
3540
+ this.scrollLeftVel = leftVel;
3541
+
3542
+ this.constrainScrollVel(); // massages into realistic values
3543
+
3544
+ // if there is non-zero velocity, and an animation loop hasn't already started, then START
3545
+ if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) {
3546
+ this.scrollIntervalId = setInterval(
3547
+ proxy(this, 'scrollIntervalFunc'), // scope to `this`
3548
+ this.scrollIntervalMs
3549
+ );
3550
+ }
3551
+ },
3552
+
3553
+
3554
+ // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way
3555
+ constrainScrollVel: function() {
3556
+ var el = this.scrollEl;
3557
+
3558
+ if (this.scrollTopVel < 0) { // scrolling up?
3559
+ if (el.scrollTop() <= 0) { // already scrolled all the way up?
3560
+ this.scrollTopVel = 0;
3561
+ }
3562
+ }
3563
+ else if (this.scrollTopVel > 0) { // scrolling down?
3564
+ if (el.scrollTop() + el[0].clientHeight >= el[0].scrollHeight) { // already scrolled all the way down?
3565
+ this.scrollTopVel = 0;
3566
+ }
3567
+ }
3568
+
3569
+ if (this.scrollLeftVel < 0) { // scrolling left?
3570
+ if (el.scrollLeft() <= 0) { // already scrolled all the left?
3571
+ this.scrollLeftVel = 0;
3572
+ }
3573
+ }
3574
+ else if (this.scrollLeftVel > 0) { // scrolling right?
3575
+ if (el.scrollLeft() + el[0].clientWidth >= el[0].scrollWidth) { // already scrolled all the way right?
3576
+ this.scrollLeftVel = 0;
3577
+ }
3578
+ }
3579
+ },
3580
+
3581
+
3582
+ // This function gets called during every iteration of the scrolling animation loop
3583
+ scrollIntervalFunc: function() {
3584
+ var el = this.scrollEl;
3585
+ var frac = this.scrollIntervalMs / 1000; // considering animation frequency, what the vel should be mult'd by
3586
+
3587
+ // change the value of scrollEl's scroll
3588
+ if (this.scrollTopVel) {
3589
+ el.scrollTop(el.scrollTop() + this.scrollTopVel * frac);
3590
+ }
3591
+ if (this.scrollLeftVel) {
3592
+ el.scrollLeft(el.scrollLeft() + this.scrollLeftVel * frac);
3593
+ }
3594
+
3595
+ this.constrainScrollVel(); // since the scroll values changed, recompute the velocities
3596
+
3597
+ // if scrolled all the way, which causes the vels to be zero, stop the animation loop
3598
+ if (!this.scrollTopVel && !this.scrollLeftVel) {
3599
+ this.endAutoScroll();
3600
+ }
3601
+ },
3602
+
3603
+
3604
+ // Kills any existing scrolling animation loop
3605
+ endAutoScroll: function() {
3606
+ if (this.scrollIntervalId) {
3607
+ clearInterval(this.scrollIntervalId);
3608
+ this.scrollIntervalId = null;
3609
+
3610
+ this.handleScrollEnd();
3611
+ }
3612
+ },
3613
+
3614
+
3615
+ // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce)
3616
+ handleDebouncedScroll: function() {
3617
+ // recompute all coordinates, but *only* if this is *not* part of our scrolling animation
3618
+ if (!this.scrollIntervalId) {
3619
+ this.handleScrollEnd();
3620
+ }
3621
+ },
3622
+
3623
+
3624
+ // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
3625
+ handleScrollEnd: function() {
3626
+ }
3627
+
3628
+ });
3629
+ ;;
3630
+
3631
+ /* Tracks mouse movements over a component and raises events about which hit the mouse is over.
3632
+ ------------------------------------------------------------------------------------------------------------------------
3633
+ options:
3634
+ - subjectEl
3635
+ - subjectCenter
3636
+ */
3637
+
3638
+ var HitDragListener = DragListener.extend({
3639
+
3640
+ component: null, // converts coordinates to hits
3641
+ // methods: hitsNeeded, hitsNotNeeded, queryHit
3642
+
3643
+ origHit: null, // the hit the mouse was over when listening started
3644
+ hit: null, // the hit the mouse is over
3645
+ coordAdjust: null, // delta that will be added to the mouse coordinates when computing collisions
3646
+
3647
+
3648
+ constructor: function(component, options) {
3649
+ DragListener.call(this, options); // call the super-constructor
3650
+
3651
+ this.component = component;
3652
+ },
3653
+
3654
+
3655
+ // Called when drag listening starts (but a real drag has not necessarily began).
3656
+ // ev might be undefined if dragging was started manually.
3657
+ handleInteractionStart: function(ev) {
3658
+ var subjectEl = this.subjectEl;
3659
+ var subjectRect;
3660
+ var origPoint;
3661
+ var point;
3662
+
3663
+ this.component.hitsNeeded();
3664
+ this.computeScrollBounds(); // for autoscroll
3665
+
3666
+ if (ev) {
3667
+ origPoint = { left: getEvX(ev), top: getEvY(ev) };
3668
+ point = origPoint;
3669
+
3670
+ // constrain the point to bounds of the element being dragged
3671
+ if (subjectEl) {
3672
+ subjectRect = getOuterRect(subjectEl); // used for centering as well
3673
+ point = constrainPoint(point, subjectRect);
3674
+ }
3675
+
3676
+ this.origHit = this.queryHit(point.left, point.top);
3677
+
3678
+ // treat the center of the subject as the collision point?
3679
+ if (subjectEl && this.options.subjectCenter) {
3680
+
3681
+ // only consider the area the subject overlaps the hit. best for large subjects.
3682
+ // TODO: skip this if hit didn't supply left/right/top/bottom
3683
+ if (this.origHit) {
3684
+ subjectRect = intersectRects(this.origHit, subjectRect) ||
3685
+ subjectRect; // in case there is no intersection
3686
+ }
3687
+
3688
+ point = getRectCenter(subjectRect);
3689
+ }
3690
+
3691
+ this.coordAdjust = diffPoints(point, origPoint); // point - origPoint
3692
+ }
3693
+ else {
3694
+ this.origHit = null;
3695
+ this.coordAdjust = null;
3696
+ }
3697
+
3698
+ // call the super-method. do it after origHit has been computed
3699
+ DragListener.prototype.handleInteractionStart.apply(this, arguments);
3700
+ },
3701
+
3702
+
3703
+ // Called when the actual drag has started
3704
+ handleDragStart: function(ev) {
3705
+ var hit;
3706
+
3707
+ DragListener.prototype.handleDragStart.apply(this, arguments); // call the super-method
3708
+
3709
+ // might be different from this.origHit if the min-distance is large
3710
+ hit = this.queryHit(getEvX(ev), getEvY(ev));
3711
+
3712
+ // report the initial hit the mouse is over
3713
+ // especially important if no min-distance and drag starts immediately
3714
+ if (hit) {
3715
+ this.handleHitOver(hit);
3716
+ }
3717
+ },
3718
+
3719
+
3720
+ // Called when the drag moves
3721
+ handleDrag: function(dx, dy, ev) {
3722
+ var hit;
3723
+
3724
+ DragListener.prototype.handleDrag.apply(this, arguments); // call the super-method
3725
+
3726
+ hit = this.queryHit(getEvX(ev), getEvY(ev));
3727
+
3728
+ if (!isHitsEqual(hit, this.hit)) { // a different hit than before?
3729
+ if (this.hit) {
3730
+ this.handleHitOut();
3731
+ }
3732
+ if (hit) {
3733
+ this.handleHitOver(hit);
3734
+ }
3735
+ }
3736
+ },
3737
+
3738
+
3739
+ // Called when dragging has been stopped
3740
+ handleDragEnd: function() {
3741
+ this.handleHitDone();
3742
+ DragListener.prototype.handleDragEnd.apply(this, arguments); // call the super-method
3743
+ },
3744
+
3745
+
3746
+ // Called when a the mouse has just moved over a new hit
3747
+ handleHitOver: function(hit) {
3748
+ var isOrig = isHitsEqual(hit, this.origHit);
3749
+
3750
+ this.hit = hit;
3751
+
3752
+ this.trigger('hitOver', this.hit, isOrig, this.origHit);
3753
+ },
3754
+
3755
+
3756
+ // Called when the mouse has just moved out of a hit
3757
+ handleHitOut: function() {
3758
+ if (this.hit) {
3759
+ this.trigger('hitOut', this.hit);
3760
+ this.handleHitDone();
3761
+ this.hit = null;
3762
+ }
3763
+ },
3764
+
3765
+
3766
+ // Called after a hitOut. Also called before a dragStop
3767
+ handleHitDone: function() {
3768
+ if (this.hit) {
3769
+ this.trigger('hitDone', this.hit);
3770
+ }
3771
+ },
3772
+
3773
+
3774
+ // Called when the interaction ends, whether there was a real drag or not
3775
+ handleInteractionEnd: function() {
3776
+ DragListener.prototype.handleInteractionEnd.apply(this, arguments); // call the super-method
3777
+
3778
+ this.origHit = null;
3779
+ this.hit = null;
3780
+
3781
+ this.component.hitsNotNeeded();
3782
+ },
3783
+
3784
+
3785
+ // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
3786
+ handleScrollEnd: function() {
3787
+ DragListener.prototype.handleScrollEnd.apply(this, arguments); // call the super-method
3788
+
3789
+ // hits' absolute positions will be in new places after a user's scroll.
3790
+ // HACK for recomputing.
3791
+ if (this.isDragging) {
3792
+ this.component.releaseHits();
3793
+ this.component.prepareHits();
3794
+ }
3795
+ },
3796
+
3797
+
3798
+ // Gets the hit underneath the coordinates for the given mouse event
3799
+ queryHit: function(left, top) {
3800
+
3801
+ if (this.coordAdjust) {
3802
+ left += this.coordAdjust.left;
3803
+ top += this.coordAdjust.top;
3804
+ }
3805
+
3806
+ return this.component.queryHit(left, top);
3807
+ }
3808
+
3809
+ });
3810
+
3811
+
3812
+ // Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component.
3813
+ // Two null values will be considered equal, as two "out of the component" states are the same.
3814
+ function isHitsEqual(hit0, hit1) {
3815
+
3816
+ if (!hit0 && !hit1) {
3817
+ return true;
3818
+ }
3819
+
3820
+ if (hit0 && hit1) {
3821
+ return hit0.component === hit1.component &&
3822
+ isHitPropsWithin(hit0, hit1) &&
3823
+ isHitPropsWithin(hit1, hit0); // ensures all props are identical
3824
+ }
3825
+
3826
+ return false;
3827
+ }
3828
+
3829
+
3830
+ // Returns true if all of subHit's non-standard properties are within superHit
3831
+ function isHitPropsWithin(subHit, superHit) {
3832
+ for (var propName in subHit) {
3833
+ if (!/^(component|left|right|top|bottom)$/.test(propName)) {
3834
+ if (subHit[propName] !== superHit[propName]) {
3835
+ return false;
3836
+ }
3837
+ }
3838
+ }
3839
+ return true;
3840
+ }
3841
+
3842
+ ;;
3843
+
3844
+ /*
3845
+ Listens to document and window-level user-interaction events, like touch events and mouse events,
3846
+ and fires these events as-is to whoever is observing a GlobalEmitter.
3847
+ Best when used as a singleton via GlobalEmitter.get()
3848
+
3849
+ Normalizes mouse/touch events. For examples:
3850
+ - ignores the the simulated mouse events that happen after a quick tap: mousemove+mousedown+mouseup+click
3851
+ - compensates for various buggy scenarios where a touchend does not fire
3852
+ */
3853
+
3854
+ FC.touchMouseIgnoreWait = 500;
3855
+
3856
+ var GlobalEmitter = Class.extend(ListenerMixin, EmitterMixin, {
3857
+
3858
+ isTouching: false,
3859
+ mouseIgnoreDepth: 0,
3860
+ handleScrollProxy: null,
3861
+
3862
+
3863
+ bind: function() {
3864
+ var _this = this;
3865
+
3866
+ this.listenTo($(document), {
3867
+ touchstart: this.handleTouchStart,
3868
+ touchcancel: this.handleTouchCancel,
3869
+ touchend: this.handleTouchEnd,
3870
+ mousedown: this.handleMouseDown,
3871
+ mousemove: this.handleMouseMove,
3872
+ mouseup: this.handleMouseUp,
3873
+ click: this.handleClick,
3874
+ selectstart: this.handleSelectStart,
3875
+ contextmenu: this.handleContextMenu
3876
+ });
3877
+
3878
+ // because we need to call preventDefault
3879
+ // because https://www.chromestatus.com/features/5093566007214080
3880
+ // TODO: investigate performance because this is a global handler
3881
+ window.addEventListener(
3882
+ 'touchmove',
3883
+ this.handleTouchMoveProxy = function(ev) {
3884
+ _this.handleTouchMove($.Event(ev));
3885
+ },
3886
+ { passive: false } // allows preventDefault()
3887
+ );
3888
+
3889
+ // attach a handler to get called when ANY scroll action happens on the page.
3890
+ // this was impossible to do with normal on/off because 'scroll' doesn't bubble.
3891
+ // http://stackoverflow.com/a/32954565/96342
3892
+ window.addEventListener(
3893
+ 'scroll',
3894
+ this.handleScrollProxy = function(ev) {
3895
+ _this.handleScroll($.Event(ev));
3896
+ },
3897
+ true // useCapture
3898
+ );
3899
+ },
3900
+
3901
+ unbind: function() {
3902
+ this.stopListeningTo($(document));
3903
+
3904
+ window.removeEventListener(
3905
+ 'touchmove',
3906
+ this.handleTouchMoveProxy
3907
+ );
3908
+
3909
+ window.removeEventListener(
3910
+ 'scroll',
3911
+ this.handleScrollProxy,
3912
+ true // useCapture
3913
+ );
3914
+ },
3915
+
3916
+
3917
+ // Touch Handlers
3918
+ // -----------------------------------------------------------------------------------------------------------------
3919
+
3920
+ handleTouchStart: function(ev) {
3921
+
3922
+ // if a previous touch interaction never ended with a touchend, then implicitly end it,
3923
+ // but since a new touch interaction is about to begin, don't start the mouse ignore period.
3924
+ this.stopTouch(ev, true); // skipMouseIgnore=true
3925
+
3926
+ this.isTouching = true;
3927
+ this.trigger('touchstart', ev);
3928
+ },
3929
+
3930
+ handleTouchMove: function(ev) {
3931
+ if (this.isTouching) {
3932
+ this.trigger('touchmove', ev);
3933
+ }
3934
+ },
3935
+
3936
+ handleTouchCancel: function(ev) {
3937
+ if (this.isTouching) {
3938
+ this.trigger('touchcancel', ev);
3939
+
3940
+ // Have touchcancel fire an artificial touchend. That way, handlers won't need to listen to both.
3941
+ // If touchend fires later, it won't have any effect b/c isTouching will be false.
3942
+ this.stopTouch(ev);
3943
+ }
3944
+ },
3945
+
3946
+ handleTouchEnd: function(ev) {
3947
+ this.stopTouch(ev);
3948
+ },
3949
+
3950
+
3951
+ // Mouse Handlers
3952
+ // -----------------------------------------------------------------------------------------------------------------
3953
+
3954
+ handleMouseDown: function(ev) {
3955
+ if (!this.shouldIgnoreMouse()) {
3956
+ this.trigger('mousedown', ev);
3957
+ }
3958
+ },
3959
+
3960
+ handleMouseMove: function(ev) {
3961
+ if (!this.shouldIgnoreMouse()) {
3962
+ this.trigger('mousemove', ev);
3963
+ }
3964
+ },
3965
+
3966
+ handleMouseUp: function(ev) {
3967
+ if (!this.shouldIgnoreMouse()) {
3968
+ this.trigger('mouseup', ev);
3969
+ }
3970
+ },
3971
+
3972
+ handleClick: function(ev) {
3973
+ if (!this.shouldIgnoreMouse()) {
3974
+ this.trigger('click', ev);
3975
+ }
3976
+ },
3977
+
3978
+
3979
+ // Misc Handlers
3980
+ // -----------------------------------------------------------------------------------------------------------------
3981
+
3982
+ handleSelectStart: function(ev) {
3983
+ this.trigger('selectstart', ev);
3984
+ },
3985
+
3986
+ handleContextMenu: function(ev) {
3987
+ this.trigger('contextmenu', ev);
3988
+ },
3989
+
3990
+ handleScroll: function(ev) {
3991
+ this.trigger('scroll', ev);
3992
+ },
3993
+
3994
+
3995
+ // Utils
3996
+ // -----------------------------------------------------------------------------------------------------------------
3997
+
3998
+ stopTouch: function(ev, skipMouseIgnore) {
3999
+ if (this.isTouching) {
4000
+ this.isTouching = false;
4001
+ this.trigger('touchend', ev);
4002
+
4003
+ if (!skipMouseIgnore) {
4004
+ this.startTouchMouseIgnore();
4005
+ }
4006
+ }
4007
+ },
4008
+
4009
+ startTouchMouseIgnore: function() {
4010
+ var _this = this;
4011
+ var wait = FC.touchMouseIgnoreWait;
4012
+
4013
+ if (wait) {
4014
+ this.mouseIgnoreDepth++;
4015
+ setTimeout(function() {
4016
+ _this.mouseIgnoreDepth--;
4017
+ }, wait);
4018
+ }
4019
+ },
4020
+
4021
+ shouldIgnoreMouse: function() {
4022
+ return this.isTouching || Boolean(this.mouseIgnoreDepth);
4023
+ }
4024
+
4025
+ });
4026
+
4027
+
4028
+ // Singleton
4029
+ // ---------------------------------------------------------------------------------------------------------------------
4030
+
4031
+ (function() {
4032
+ var globalEmitter = null;
4033
+ var neededCount = 0;
4034
+
4035
+
4036
+ // gets the singleton
4037
+ GlobalEmitter.get = function() {
4038
+
4039
+ if (!globalEmitter) {
4040
+ globalEmitter = new GlobalEmitter();
4041
+ globalEmitter.bind();
4042
+ }
4043
+
4044
+ return globalEmitter;
4045
+ };
4046
+
4047
+
4048
+ // called when an object knows it will need a GlobalEmitter in the near future.
4049
+ GlobalEmitter.needed = function() {
4050
+ GlobalEmitter.get(); // ensures globalEmitter
4051
+ neededCount++;
4052
+ };
4053
+
4054
+
4055
+ // called when the object that originally called needed() doesn't need a GlobalEmitter anymore.
4056
+ GlobalEmitter.unneeded = function() {
4057
+ neededCount--;
4058
+
4059
+ if (!neededCount) { // nobody else needs it
4060
+ globalEmitter.unbind();
4061
+ globalEmitter = null;
4062
+ }
4063
+ };
4064
+
4065
+ })();
4066
+
4067
+ ;;
4068
+
4069
+ /* Creates a clone of an element and lets it track the mouse as it moves
4070
+ ----------------------------------------------------------------------------------------------------------------------*/
4071
+
4072
+ var MouseFollower = Class.extend(ListenerMixin, {
4073
+
4074
+ options: null,
4075
+
4076
+ sourceEl: null, // the element that will be cloned and made to look like it is dragging
4077
+ el: null, // the clone of `sourceEl` that will track the mouse
4078
+ parentEl: null, // the element that `el` (the clone) will be attached to
4079
+
4080
+ // the initial position of el, relative to the offset parent. made to match the initial offset of sourceEl
4081
+ top0: null,
4082
+ left0: null,
4083
+
4084
+ // the absolute coordinates of the initiating touch/mouse action
4085
+ y0: null,
4086
+ x0: null,
4087
+
4088
+ // the number of pixels the mouse has moved from its initial position
4089
+ topDelta: null,
4090
+ leftDelta: null,
4091
+
4092
+ isFollowing: false,
4093
+ isHidden: false,
4094
+ isAnimating: false, // doing the revert animation?
4095
+
4096
+ constructor: function(sourceEl, options) {
4097
+ this.options = options = options || {};
4098
+ this.sourceEl = sourceEl;
4099
+ this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
4100
+ },
4101
+
4102
+
4103
+ // Causes the element to start following the mouse
4104
+ start: function(ev) {
4105
+ if (!this.isFollowing) {
4106
+ this.isFollowing = true;
4107
+
4108
+ this.y0 = getEvY(ev);
4109
+ this.x0 = getEvX(ev);
4110
+ this.topDelta = 0;
4111
+ this.leftDelta = 0;
4112
+
4113
+ if (!this.isHidden) {
4114
+ this.updatePosition();
4115
+ }
4116
+
4117
+ if (getEvIsTouch(ev)) {
4118
+ this.listenTo($(document), 'touchmove', this.handleMove);
4119
+ }
4120
+ else {
4121
+ this.listenTo($(document), 'mousemove', this.handleMove);
4122
+ }
4123
+ }
4124
+ },
4125
+
4126
+
4127
+ // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
4128
+ // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
4129
+ stop: function(shouldRevert, callback) {
4130
+ var _this = this;
4131
+ var revertDuration = this.options.revertDuration;
4132
+
4133
+ function complete() { // might be called by .animate(), which might change `this` context
4134
+ _this.isAnimating = false;
4135
+ _this.removeElement();
4136
+
4137
+ _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
4138
+
4139
+ if (callback) {
4140
+ callback();
4141
+ }
4142
+ }
4143
+
4144
+ if (this.isFollowing && !this.isAnimating) { // disallow more than one stop animation at a time
4145
+ this.isFollowing = false;
4146
+
4147
+ this.stopListeningTo($(document));
4148
+
4149
+ if (shouldRevert && revertDuration && !this.isHidden) { // do a revert animation?
4150
+ this.isAnimating = true;
4151
+ this.el.animate({
4152
+ top: this.top0,
4153
+ left: this.left0
4154
+ }, {
4155
+ duration: revertDuration,
4156
+ complete: complete
4157
+ });
4158
+ }
4159
+ else {
4160
+ complete();
4161
+ }
4162
+ }
4163
+ },
4164
+
4165
+
4166
+ // Gets the tracking element. Create it if necessary
4167
+ getEl: function() {
4168
+ var el = this.el;
4169
+
4170
+ if (!el) {
4171
+ el = this.el = this.sourceEl.clone()
4172
+ .addClass(this.options.additionalClass || '')
4173
+ .css({
4174
+ position: 'absolute',
4175
+ visibility: '', // in case original element was hidden (commonly through hideEvents())
4176
+ display: this.isHidden ? 'none' : '', // for when initially hidden
4177
+ margin: 0,
4178
+ right: 'auto', // erase and set width instead
4179
+ bottom: 'auto', // erase and set height instead
4180
+ width: this.sourceEl.width(), // explicit height in case there was a 'right' value
4181
+ height: this.sourceEl.height(), // explicit width in case there was a 'bottom' value
4182
+ opacity: this.options.opacity || '',
4183
+ zIndex: this.options.zIndex
4184
+ });
4185
+
4186
+ // we don't want long taps or any mouse interaction causing selection/menus.
4187
+ // would use preventSelection(), but that prevents selectstart, causing problems.
4188
+ el.addClass('fc-unselectable');
4189
+
4190
+ el.appendTo(this.parentEl);
4191
+ }
4192
+
4193
+ return el;
4194
+ },
4195
+
4196
+
4197
+ // Removes the tracking element if it has already been created
4198
+ removeElement: function() {
4199
+ if (this.el) {
4200
+ this.el.remove();
4201
+ this.el = null;
4202
+ }
4203
+ },
4204
+
4205
+
4206
+ // Update the CSS position of the tracking element
4207
+ updatePosition: function() {
4208
+ var sourceOffset;
4209
+ var origin;
4210
+
4211
+ this.getEl(); // ensure this.el
4212
+
4213
+ // make sure origin info was computed
4214
+ if (this.top0 === null) {
4215
+ sourceOffset = this.sourceEl.offset();
4216
+ origin = this.el.offsetParent().offset();
4217
+ this.top0 = sourceOffset.top - origin.top;
4218
+ this.left0 = sourceOffset.left - origin.left;
4219
+ }
4220
+
4221
+ this.el.css({
4222
+ top: this.top0 + this.topDelta,
4223
+ left: this.left0 + this.leftDelta
4224
+ });
4225
+ },
4226
+
4227
+
4228
+ // Gets called when the user moves the mouse
4229
+ handleMove: function(ev) {
4230
+ this.topDelta = getEvY(ev) - this.y0;
4231
+ this.leftDelta = getEvX(ev) - this.x0;
4232
+
4233
+ if (!this.isHidden) {
4234
+ this.updatePosition();
4235
+ }
4236
+ },
4237
+
4238
+
4239
+ // Temporarily makes the tracking element invisible. Can be called before following starts
4240
+ hide: function() {
4241
+ if (!this.isHidden) {
4242
+ this.isHidden = true;
4243
+ if (this.el) {
4244
+ this.el.hide();
4245
+ }
4246
+ }
4247
+ },
4248
+
4249
+
4250
+ // Show the tracking element after it has been temporarily hidden
4251
+ show: function() {
4252
+ if (this.isHidden) {
4253
+ this.isHidden = false;
4254
+ this.updatePosition();
4255
+ this.getEl().show();
4256
+ }
4257
+ }
4258
+
4259
+ });
4260
+
4261
+ ;;
4262
+
4263
+ /* An abstract class comprised of a "grid" of areas that each represent a specific datetime
4264
+ ----------------------------------------------------------------------------------------------------------------------*/
4265
+
4266
+ var Grid = FC.Grid = Class.extend(ListenerMixin, {
4267
+
4268
+ // self-config, overridable by subclasses
4269
+ hasDayInteractions: true, // can user click/select ranges of time?
4270
+
4271
+ view: null, // a View object
4272
+ isRTL: null, // shortcut to the view's isRTL option
4273
+
4274
+ start: null,
4275
+ end: null,
4276
+
4277
+ el: null, // the containing element
4278
+ elsByFill: null, // a hash of jQuery element sets used for rendering each fill. Keyed by fill name.
4279
+
4280
+ // derived from options
4281
+ eventTimeFormat: null,
4282
+ displayEventTime: null,
4283
+ displayEventEnd: null,
4284
+
4285
+ minResizeDuration: null, // TODO: hack. set by subclasses. minumum event resize duration
4286
+
4287
+ // if defined, holds the unit identified (ex: "year" or "month") that determines the level of granularity
4288
+ // of the date areas. if not defined, assumes to be day and time granularity.
4289
+ // TODO: port isTimeScale into same system?
4290
+ largeUnit: null,
4291
+
4292
+ dayClickListener: null,
4293
+ daySelectListener: null,
4294
+ segDragListener: null,
4295
+ segResizeListener: null,
4296
+ externalDragListener: null,
4297
+
4298
+
4299
+ constructor: function(view) {
4300
+ this.view = view;
4301
+ this.isRTL = view.opt('isRTL');
4302
+ this.elsByFill = {};
4303
+
4304
+ this.dayClickListener = this.buildDayClickListener();
4305
+ this.daySelectListener = this.buildDaySelectListener();
4306
+ },
4307
+
4308
+
4309
+ /* Options
4310
+ ------------------------------------------------------------------------------------------------------------------*/
4311
+
4312
+
4313
+ // Generates the format string used for event time text, if not explicitly defined by 'timeFormat'
4314
+ computeEventTimeFormat: function() {
4315
+ return this.view.opt('smallTimeFormat');
4316
+ },
4317
+
4318
+
4319
+ // Determines whether events should have their end times displayed, if not explicitly defined by 'displayEventTime'.
4320
+ // Only applies to non-all-day events.
4321
+ computeDisplayEventTime: function() {
4322
+ return true;
4323
+ },
4324
+
4325
+
4326
+ // Determines whether events should have their end times displayed, if not explicitly defined by 'displayEventEnd'
4327
+ computeDisplayEventEnd: function() {
4328
+ return true;
4329
+ },
4330
+
4331
+
4332
+ /* Dates
4333
+ ------------------------------------------------------------------------------------------------------------------*/
4334
+
4335
+
4336
+ // Tells the grid about what period of time to display.
4337
+ // Any date-related internal data should be generated.
4338
+ setRange: function(range) {
4339
+ this.start = range.start.clone();
4340
+ this.end = range.end.clone();
4341
+
4342
+ this.rangeUpdated();
4343
+ this.processRangeOptions();
4344
+ },
4345
+
4346
+
4347
+ // Called when internal variables that rely on the range should be updated
4348
+ rangeUpdated: function() {
4349
+ },
4350
+
4351
+
4352
+ // Updates values that rely on options and also relate to range
4353
+ processRangeOptions: function() {
4354
+ var view = this.view;
4355
+ var displayEventTime;
4356
+ var displayEventEnd;
4357
+
4358
+ this.eventTimeFormat =
4359
+ view.opt('eventTimeFormat') ||
4360
+ view.opt('timeFormat') || // deprecated
4361
+ this.computeEventTimeFormat();
4362
+
4363
+ displayEventTime = view.opt('displayEventTime');
4364
+ if (displayEventTime == null) {
4365
+ displayEventTime = this.computeDisplayEventTime(); // might be based off of range
4366
+ }
4367
+
4368
+ displayEventEnd = view.opt('displayEventEnd');
4369
+ if (displayEventEnd == null) {
4370
+ displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
4371
+ }
4372
+
4373
+ this.displayEventTime = displayEventTime;
4374
+ this.displayEventEnd = displayEventEnd;
4375
+ },
4376
+
4377
+
4378
+ // Converts a span (has unzoned start/end and any other grid-specific location information)
4379
+ // into an array of segments (pieces of events whose format is decided by the grid).
4380
+ spanToSegs: function(span) {
4381
+ // subclasses must implement
4382
+ },
4383
+
4384
+
4385
+ // Diffs the two dates, returning a duration, based on granularity of the grid
4386
+ // TODO: port isTimeScale into this system?
4387
+ diffDates: function(a, b) {
4388
+ if (this.largeUnit) {
4389
+ return diffByUnit(a, b, this.largeUnit);
4390
+ }
4391
+ else {
4392
+ return diffDayTime(a, b);
4393
+ }
4394
+ },
4395
+
4396
+
4397
+ /* Hit Area
4398
+ ------------------------------------------------------------------------------------------------------------------*/
4399
+
4400
+ hitsNeededDepth: 0, // necessary because multiple callers might need the same hits
4401
+
4402
+ hitsNeeded: function() {
4403
+ if (!(this.hitsNeededDepth++)) {
4404
+ this.prepareHits();
4405
+ }
4406
+ },
4407
+
4408
+ hitsNotNeeded: function() {
4409
+ if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) {
4410
+ this.releaseHits();
4411
+ }
4412
+ },
4413
+
4414
+
4415
+ // Called before one or more queryHit calls might happen. Should prepare any cached coordinates for queryHit
4416
+ prepareHits: function() {
4417
+ },
4418
+
4419
+
4420
+ // Called when queryHit calls have subsided. Good place to clear any coordinate caches.
4421
+ releaseHits: function() {
4422
+ },
4423
+
4424
+
4425
+ // Given coordinates from the topleft of the document, return data about the date-related area underneath.
4426
+ // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged).
4427
+ // Must have a `grid` property, a reference to this current grid. TODO: avoid this
4428
+ // The returned object will be processed by getHitSpan and getHitEl.
4429
+ queryHit: function(leftOffset, topOffset) {
4430
+ },
4431
+
4432
+
4433
+ // like getHitSpan, but returns null if the resulting span's range is invalid
4434
+ getSafeHitSpan: function(hit) {
4435
+ var hitSpan = this.getHitSpan(hit);
4436
+
4437
+ if (!isRangeWithinRange(hitSpan, this.view.activeRange)) {
4438
+ return null;
4439
+ }
4440
+
4441
+ return hitSpan;
4442
+ },
4443
+
4444
+
4445
+ // Given position-level information about a date-related area within the grid,
4446
+ // should return an object with at least a start/end date. Can provide other information as well.
4447
+ getHitSpan: function(hit) {
4448
+ },
4449
+
4450
+
4451
+ // Given position-level information about a date-related area within the grid,
4452
+ // should return a jQuery element that best represents it. passed to dayClick callback.
4453
+ getHitEl: function(hit) {
4454
+ },
4455
+
4456
+
4457
+ /* Rendering
4458
+ ------------------------------------------------------------------------------------------------------------------*/
4459
+
4460
+
4461
+ // Sets the container element that the grid should render inside of.
4462
+ // Does other DOM-related initializations.
4463
+ setElement: function(el) {
4464
+ this.el = el;
4465
+
4466
+ if (this.hasDayInteractions) {
4467
+ preventSelection(el);
4468
+
4469
+ this.bindDayHandler('touchstart', this.dayTouchStart);
4470
+ this.bindDayHandler('mousedown', this.dayMousedown);
4471
+ }
4472
+
4473
+ // attach event-element-related handlers. in Grid.events
4474
+ // same garbage collection note as above.
4475
+ this.bindSegHandlers();
4476
+
4477
+ this.bindGlobalHandlers();
4478
+ },
4479
+
4480
+
4481
+ bindDayHandler: function(name, handler) {
4482
+ var _this = this;
4483
+
4484
+ // attach a handler to the grid's root element.
4485
+ // jQuery will take care of unregistering them when removeElement gets called.
4486
+ this.el.on(name, function(ev) {
4487
+ if (
4488
+ !$(ev.target).is(
4489
+ _this.segSelector + ',' + // directly on an event element
4490
+ _this.segSelector + ' *,' + // within an event element
4491
+ '.fc-more,' + // a "more.." link
4492
+ 'a[data-goto]' // a clickable nav link
4493
+ )
4494
+ ) {
4495
+ return handler.call(_this, ev);
4496
+ }
4497
+ });
4498
+ },
4499
+
4500
+
4501
+ // Removes the grid's container element from the DOM. Undoes any other DOM-related attachments.
4502
+ // DOES NOT remove any content beforehand (doesn't clear events or call unrenderDates), unlike View
4503
+ removeElement: function() {
4504
+ this.unbindGlobalHandlers();
4505
+ this.clearDragListeners();
4506
+
4507
+ this.el.remove();
4508
+
4509
+ // NOTE: we don't null-out this.el for the same reasons we don't do it within View::removeElement
4510
+ },
4511
+
4512
+
4513
+ // Renders the basic structure of grid view before any content is rendered
4514
+ renderSkeleton: function() {
4515
+ // subclasses should implement
4516
+ },
4517
+
4518
+
4519
+ // Renders the grid's date-related content (like areas that represent days/times).
4520
+ // Assumes setRange has already been called and the skeleton has already been rendered.
4521
+ renderDates: function() {
4522
+ // subclasses should implement
4523
+ },
4524
+
4525
+
4526
+ // Unrenders the grid's date-related content
4527
+ unrenderDates: function() {
4528
+ // subclasses should implement
4529
+ },
4530
+
4531
+
4532
+ /* Handlers
4533
+ ------------------------------------------------------------------------------------------------------------------*/
4534
+
4535
+
4536
+ // Binds DOM handlers to elements that reside outside the grid, such as the document
4537
+ bindGlobalHandlers: function() {
4538
+ this.listenTo($(document), {
4539
+ dragstart: this.externalDragStart, // jqui
4540
+ sortstart: this.externalDragStart // jqui
4541
+ });
4542
+ },
4543
+
4544
+
4545
+ // Unbinds DOM handlers from elements that reside outside the grid
4546
+ unbindGlobalHandlers: function() {
4547
+ this.stopListeningTo($(document));
4548
+ },
4549
+
4550
+
4551
+ // Process a mousedown on an element that represents a day. For day clicking and selecting.
4552
+ dayMousedown: function(ev) {
4553
+ var view = this.view;
4554
+
4555
+ // HACK
4556
+ // This will still work even though bindDayHandler doesn't use GlobalEmitter.
4557
+ if (GlobalEmitter.get().shouldIgnoreMouse()) {
4558
+ return;
4559
+ }
4560
+
4561
+ this.dayClickListener.startInteraction(ev);
4562
+
4563
+ if (view.opt('selectable')) {
4564
+ this.daySelectListener.startInteraction(ev, {
4565
+ distance: view.opt('selectMinDistance')
4566
+ });
4567
+ }
4568
+ },
4569
+
4570
+
4571
+ dayTouchStart: function(ev) {
4572
+ var view = this.view;
4573
+ var selectLongPressDelay;
4574
+
4575
+ // On iOS (and Android?) when a new selection is initiated overtop another selection,
4576
+ // the touchend never fires because the elements gets removed mid-touch-interaction (my theory).
4577
+ // HACK: simply don't allow this to happen.
4578
+ // ALSO: prevent selection when an *event* is already raised.
4579
+ if (view.isSelected || view.selectedEvent) {
4580
+ return;
4581
+ }
4582
+
4583
+ selectLongPressDelay = view.opt('selectLongPressDelay');
4584
+ if (selectLongPressDelay == null) {
4585
+ selectLongPressDelay = view.opt('longPressDelay'); // fallback
4586
+ }
4587
+
4588
+ this.dayClickListener.startInteraction(ev);
4589
+
4590
+ if (view.opt('selectable')) {
4591
+ this.daySelectListener.startInteraction(ev, {
4592
+ delay: selectLongPressDelay
4593
+ });
4594
+ }
4595
+ },
4596
+
4597
+
4598
+ // Creates a listener that tracks the user's drag across day elements, for day clicking.
4599
+ buildDayClickListener: function() {
4600
+ var _this = this;
4601
+ var view = this.view;
4602
+ var dayClickHit; // null if invalid dayClick
4603
+
4604
+ var dragListener = new HitDragListener(this, {
4605
+ scroll: view.opt('dragScroll'),
4606
+ interactionStart: function() {
4607
+ dayClickHit = dragListener.origHit;
4608
+ },
4609
+ hitOver: function(hit, isOrig, origHit) {
4610
+ // if user dragged to another cell at any point, it can no longer be a dayClick
4611
+ if (!isOrig) {
4612
+ dayClickHit = null;
4613
+ }
4614
+ },
4615
+ hitOut: function() { // called before mouse moves to a different hit OR moved out of all hits
4616
+ dayClickHit = null;
4617
+ },
4618
+ interactionEnd: function(ev, isCancelled) {
4619
+ var hitSpan;
4620
+
4621
+ if (!isCancelled && dayClickHit) {
4622
+ hitSpan = _this.getSafeHitSpan(dayClickHit);
4623
+
4624
+ if (hitSpan) {
4625
+ view.triggerDayClick(hitSpan, _this.getHitEl(dayClickHit), ev);
4626
+ }
4627
+ }
4628
+ }
4629
+ });
4630
+
4631
+ // because dayClickListener won't be called with any time delay, "dragging" will begin immediately,
4632
+ // which will kill any touchmoving/scrolling. Prevent this.
4633
+ dragListener.shouldCancelTouchScroll = false;
4634
+
4635
+ dragListener.scrollAlwaysKills = true;
4636
+
4637
+ return dragListener;
4638
+ },
4639
+
4640
+
4641
+ // Creates a listener that tracks the user's drag across day elements, for day selecting.
4642
+ buildDaySelectListener: function() {
4643
+ var _this = this;
4644
+ var view = this.view;
4645
+ var selectionSpan; // null if invalid selection
4646
+
4647
+ var dragListener = new HitDragListener(this, {
4648
+ scroll: view.opt('dragScroll'),
4649
+ interactionStart: function() {
4650
+ selectionSpan = null;
4651
+ },
4652
+ dragStart: function() {
4653
+ view.unselect(); // since we could be rendering a new selection, we want to clear any old one
4654
+ },
4655
+ hitOver: function(hit, isOrig, origHit) {
4656
+ var origHitSpan;
4657
+ var hitSpan;
4658
+
4659
+ if (origHit) { // click needs to have started on a hit
4660
+
4661
+ origHitSpan = _this.getSafeHitSpan(origHit);
4662
+ hitSpan = _this.getSafeHitSpan(hit);
4663
+
4664
+ if (origHitSpan && hitSpan) {
4665
+ selectionSpan = _this.computeSelection(origHitSpan, hitSpan);
4666
+ }
4667
+ else {
4668
+ selectionSpan = null;
4669
+ }
4670
+
4671
+ if (selectionSpan) {
4672
+ _this.renderSelection(selectionSpan);
4673
+ }
4674
+ else if (selectionSpan === false) {
4675
+ disableCursor();
4676
+ }
4677
+ }
4678
+ },
4679
+ hitOut: function() { // called before mouse moves to a different hit OR moved out of all hits
4680
+ selectionSpan = null;
4681
+ _this.unrenderSelection();
4682
+ },
4683
+ hitDone: function() { // called after a hitOut OR before a dragEnd
4684
+ enableCursor();
4685
+ },
4686
+ interactionEnd: function(ev, isCancelled) {
4687
+ if (!isCancelled && selectionSpan) {
4688
+ // the selection will already have been rendered. just report it
4689
+ view.reportSelection(selectionSpan, ev);
4690
+ }
4691
+ }
4692
+ });
4693
+
4694
+ return dragListener;
4695
+ },
4696
+
4697
+
4698
+ // Kills all in-progress dragging.
4699
+ // Useful for when public API methods that result in re-rendering are invoked during a drag.
4700
+ // Also useful for when touch devices misbehave and don't fire their touchend.
4701
+ clearDragListeners: function() {
4702
+ this.dayClickListener.endInteraction();
4703
+ this.daySelectListener.endInteraction();
4704
+
4705
+ if (this.segDragListener) {
4706
+ this.segDragListener.endInteraction(); // will clear this.segDragListener
4707
+ }
4708
+ if (this.segResizeListener) {
4709
+ this.segResizeListener.endInteraction(); // will clear this.segResizeListener
4710
+ }
4711
+ if (this.externalDragListener) {
4712
+ this.externalDragListener.endInteraction(); // will clear this.externalDragListener
4713
+ }
4714
+ },
4715
+
4716
+
4717
+ /* Event Helper
4718
+ ------------------------------------------------------------------------------------------------------------------*/
4719
+ // TODO: should probably move this to Grid.events, like we did event dragging / resizing
4720
+
4721
+
4722
+ // Renders a mock event at the given event location, which contains zoned start/end properties.
4723
+ // Returns all mock event elements.
4724
+ renderEventLocationHelper: function(eventLocation, sourceSeg) {
4725
+ var fakeEvent = this.fabricateHelperEvent(eventLocation, sourceSeg);
4726
+
4727
+ return this.renderHelper(fakeEvent, sourceSeg); // do the actual rendering
4728
+ },
4729
+
4730
+
4731
+ // Builds a fake event given zoned event date properties and a segment is should be inspired from.
4732
+ // The range's end can be null, in which case the mock event that is rendered will have a null end time.
4733
+ // `sourceSeg` is the internal segment object involved in the drag. If null, something external is dragging.
4734
+ fabricateHelperEvent: function(eventLocation, sourceSeg) {
4735
+ var fakeEvent = sourceSeg ? createObject(sourceSeg.event) : {}; // mask the original event object if possible
4736
+
4737
+ fakeEvent.start = eventLocation.start.clone();
4738
+ fakeEvent.end = eventLocation.end ? eventLocation.end.clone() : null;
4739
+ fakeEvent.allDay = null; // force it to be freshly computed by normalizeEventDates
4740
+ this.view.calendar.normalizeEventDates(fakeEvent);
4741
+
4742
+ // this extra className will be useful for differentiating real events from mock events in CSS
4743
+ fakeEvent.className = (fakeEvent.className || []).concat('fc-helper');
4744
+
4745
+ // if something external is being dragged in, don't render a resizer
4746
+ if (!sourceSeg) {
4747
+ fakeEvent.editable = false;
4748
+ }
4749
+
4750
+ return fakeEvent;
4751
+ },
4752
+
4753
+
4754
+ // Renders a mock event. Given zoned event date properties.
4755
+ // Must return all mock event elements.
4756
+ renderHelper: function(eventLocation, sourceSeg) {
4757
+ // subclasses must implement
4758
+ },
4759
+
4760
+
4761
+ // Unrenders a mock event
4762
+ unrenderHelper: function() {
4763
+ // subclasses must implement
4764
+ },
4765
+
4766
+
4767
+ /* Selection
4768
+ ------------------------------------------------------------------------------------------------------------------*/
4769
+
4770
+
4771
+ // Renders a visual indication of a selection. Will highlight by default but can be overridden by subclasses.
4772
+ // Given a span (unzoned start/end and other misc data)
4773
+ renderSelection: function(span) {
4774
+ this.renderHighlight(span);
4775
+ },
4776
+
4777
+
4778
+ // Unrenders any visual indications of a selection. Will unrender a highlight by default.
4779
+ unrenderSelection: function() {
4780
+ this.unrenderHighlight();
4781
+ },
4782
+
4783
+
4784
+ // Given the first and last date-spans of a selection, returns another date-span object.
4785
+ // Subclasses can override and provide additional data in the span object. Will be passed to renderSelection().
4786
+ // Will return false if the selection is invalid and this should be indicated to the user.
4787
+ // Will return null/undefined if a selection invalid but no error should be reported.
4788
+ computeSelection: function(span0, span1) {
4789
+ var span = this.computeSelectionSpan(span0, span1);
4790
+
4791
+ if (span && !this.view.calendar.isSelectionSpanAllowed(span)) {
4792
+ return false;
4793
+ }
4794
+
4795
+ return span;
4796
+ },
4797
+
4798
+
4799
+ // Given two spans, must return the combination of the two.
4800
+ // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too.
4801
+ computeSelectionSpan: function(span0, span1) {
4802
+ var dates = [ span0.start, span0.end, span1.start, span1.end ];
4803
+
4804
+ dates.sort(compareNumbers); // sorts chronologically. works with Moments
4805
+
4806
+ return { start: dates[0].clone(), end: dates[3].clone() };
4807
+ },
4808
+
4809
+
4810
+ /* Highlight
4811
+ ------------------------------------------------------------------------------------------------------------------*/
4812
+
4813
+
4814
+ // Renders an emphasis on the given date range. Given a span (unzoned start/end and other misc data)
4815
+ renderHighlight: function(span) {
4816
+ this.renderFill('highlight', this.spanToSegs(span));
4817
+ },
4818
+
4819
+
4820
+ // Unrenders the emphasis on a date range
4821
+ unrenderHighlight: function() {
4822
+ this.unrenderFill('highlight');
4823
+ },
4824
+
4825
+
4826
+ // Generates an array of classNames for rendering the highlight. Used by the fill system.
4827
+ highlightSegClasses: function() {
4828
+ return [ 'fc-highlight' ];
4829
+ },
4830
+
4831
+
4832
+ /* Business Hours
4833
+ ------------------------------------------------------------------------------------------------------------------*/
4834
+
4835
+
4836
+ renderBusinessHours: function() {
4837
+ },
4838
+
4839
+
4840
+ unrenderBusinessHours: function() {
4841
+ },
4842
+
4843
+
4844
+ /* Now Indicator
4845
+ ------------------------------------------------------------------------------------------------------------------*/
4846
+
4847
+
4848
+ getNowIndicatorUnit: function() {
4849
+ },
4850
+
4851
+
4852
+ renderNowIndicator: function(date) {
4853
+ },
4854
+
4855
+
4856
+ unrenderNowIndicator: function() {
4857
+ },
4858
+
4859
+
4860
+ /* Fill System (highlight, background events, business hours)
4861
+ --------------------------------------------------------------------------------------------------------------------
4862
+ TODO: remove this system. like we did in TimeGrid
4863
+ */
4864
+
4865
+
4866
+ // Renders a set of rectangles over the given segments of time.
4867
+ // MUST RETURN a subset of segs, the segs that were actually rendered.
4868
+ // Responsible for populating this.elsByFill. TODO: better API for expressing this requirement
4869
+ renderFill: function(type, segs) {
4870
+ // subclasses must implement
4871
+ },
4872
+
4873
+
4874
+ // Unrenders a specific type of fill that is currently rendered on the grid
4875
+ unrenderFill: function(type) {
4876
+ var el = this.elsByFill[type];
4877
+
4878
+ if (el) {
4879
+ el.remove();
4880
+ delete this.elsByFill[type];
4881
+ }
4882
+ },
4883
+
4884
+
4885
+ // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
4886
+ // Only returns segments that successfully rendered.
4887
+ // To be harnessed by renderFill (implemented by subclasses).
4888
+ // Analagous to renderFgSegEls.
4889
+ renderFillSegEls: function(type, segs) {
4890
+ var _this = this;
4891
+ var segElMethod = this[type + 'SegEl'];
4892
+ var html = '';
4893
+ var renderedSegs = [];
4894
+ var i;
4895
+
4896
+ if (segs.length) {
4897
+
4898
+ // build a large concatenation of segment HTML
4899
+ for (i = 0; i < segs.length; i++) {
4900
+ html += this.fillSegHtml(type, segs[i]);
4901
+ }
4902
+
4903
+ // Grab individual elements from the combined HTML string. Use each as the default rendering.
4904
+ // Then, compute the 'el' for each segment.
4905
+ $(html).each(function(i, node) {
4906
+ var seg = segs[i];
4907
+ var el = $(node);
4908
+
4909
+ // allow custom filter methods per-type
4910
+ if (segElMethod) {
4911
+ el = segElMethod.call(_this, seg, el);
4912
+ }
4913
+
4914
+ if (el) { // custom filters did not cancel the render
4915
+ el = $(el); // allow custom filter to return raw DOM node
4916
+
4917
+ // correct element type? (would be bad if a non-TD were inserted into a table for example)
4918
+ if (el.is(_this.fillSegTag)) {
4919
+ seg.el = el;
4920
+ renderedSegs.push(seg);
4921
+ }
4922
+ }
4923
+ });
4924
+ }
4925
+
4926
+ return renderedSegs;
4927
+ },
4928
+
4929
+
4930
+ fillSegTag: 'div', // subclasses can override
4931
+
4932
+
4933
+ // Builds the HTML needed for one fill segment. Generic enough to work with different types.
4934
+ fillSegHtml: function(type, seg) {
4935
+
4936
+ // custom hooks per-type
4937
+ var classesMethod = this[type + 'SegClasses'];
4938
+ var cssMethod = this[type + 'SegCss'];
4939
+
4940
+ var classes = classesMethod ? classesMethod.call(this, seg) : [];
4941
+ var css = cssToStr(cssMethod ? cssMethod.call(this, seg) : {});
4942
+
4943
+ return '<' + this.fillSegTag +
4944
+ (classes.length ? ' class="' + classes.join(' ') + '"' : '') +
4945
+ (css ? ' style="' + css + '"' : '') +
4946
+ ' />';
4947
+ },
4948
+
4949
+
4950
+
4951
+ /* Generic rendering utilities for subclasses
4952
+ ------------------------------------------------------------------------------------------------------------------*/
4953
+
4954
+
4955
+ // Computes HTML classNames for a single-day element
4956
+ getDayClasses: function(date, noThemeHighlight) {
4957
+ var view = this.view;
4958
+ var classes = [];
4959
+ var today;
4960
+
4961
+ if (!isDateWithinRange(date, view.activeRange)) {
4962
+ classes.push('fc-disabled-day'); // TODO: jQuery UI theme?
4963
+ }
4964
+ else {
4965
+ classes.push('fc-' + dayIDs[date.day()]);
4966
+
4967
+ if (
4968
+ view.currentRangeAs('months') == 1 && // TODO: somehow get into MonthView
4969
+ date.month() != view.currentRange.start.month()
4970
+ ) {
4971
+ classes.push('fc-other-month');
4972
+ }
4973
+
4974
+ today = view.calendar.getNow();
4975
+
4976
+ if (date.isSame(today, 'day')) {
4977
+ classes.push('fc-today');
4978
+
4979
+ if (noThemeHighlight !== true) {
4980
+ classes.push(view.highlightStateClass);
4981
+ }
4982
+ }
4983
+ else if (date < today) {
4984
+ classes.push('fc-past');
4985
+ }
4986
+ else {
4987
+ classes.push('fc-future');
4988
+ }
4989
+ }
4990
+
4991
+ return classes;
4992
+ }
4993
+
4994
+ });
4995
+
4996
+ ;;
4997
+
4998
+ /* Event-rendering and event-interaction methods for the abstract Grid class
4999
+ ----------------------------------------------------------------------------------------------------------------------
5000
+
5001
+ Data Types:
5002
+ event - { title, id, start, (end), whatever }
5003
+ location - { start, (end), allDay }
5004
+ rawEventRange - { start, end }
5005
+ eventRange - { start, end, isStart, isEnd }
5006
+ eventSpan - { start, end, isStart, isEnd, whatever }
5007
+ eventSeg - { event, whatever }
5008
+ seg - { whatever }
5009
+ */
5010
+
5011
+ Grid.mixin({
5012
+
5013
+ // self-config, overridable by subclasses
5014
+ segSelector: '.fc-event-container > *', // what constitutes an event element?
5015
+
5016
+ mousedOverSeg: null, // the segment object the user's mouse is over. null if over nothing
5017
+ isDraggingSeg: false, // is a segment being dragged? boolean
5018
+ isResizingSeg: false, // is a segment being resized? boolean
5019
+ isDraggingExternal: false, // jqui-dragging an external element? boolean
5020
+ segs: null, // the *event* segments currently rendered in the grid. TODO: rename to `eventSegs`
5021
+
5022
+
5023
+ // Renders the given events onto the grid
5024
+ renderEvents: function(events) {
5025
+ var bgEvents = [];
5026
+ var fgEvents = [];
5027
+ var i;
5028
+
5029
+ for (i = 0; i < events.length; i++) {
5030
+ (isBgEvent(events[i]) ? bgEvents : fgEvents).push(events[i]);
5031
+ }
5032
+
5033
+ this.segs = [].concat( // record all segs
5034
+ this.renderBgEvents(bgEvents),
5035
+ this.renderFgEvents(fgEvents)
5036
+ );
5037
+ },
5038
+
5039
+
5040
+ renderBgEvents: function(events) {
5041
+ var segs = this.eventsToSegs(events);
5042
+
5043
+ // renderBgSegs might return a subset of segs, segs that were actually rendered
5044
+ return this.renderBgSegs(segs) || segs;
5045
+ },
5046
+
5047
+
5048
+ renderFgEvents: function(events) {
5049
+ var segs = this.eventsToSegs(events);
5050
+
5051
+ // renderFgSegs might return a subset of segs, segs that were actually rendered
5052
+ return this.renderFgSegs(segs) || segs;
5053
+ },
5054
+
5055
+
5056
+ // Unrenders all events currently rendered on the grid
5057
+ unrenderEvents: function() {
5058
+ this.handleSegMouseout(); // trigger an eventMouseout if user's mouse is over an event
5059
+ this.clearDragListeners();
5060
+
5061
+ this.unrenderFgSegs();
5062
+ this.unrenderBgSegs();
5063
+
5064
+ this.segs = null;
5065
+ },
5066
+
5067
+
5068
+ // Retrieves all rendered segment objects currently rendered on the grid
5069
+ getEventSegs: function() {
5070
+ return this.segs || [];
5071
+ },
5072
+
5073
+
5074
+ /* Foreground Segment Rendering
5075
+ ------------------------------------------------------------------------------------------------------------------*/
5076
+
5077
+
5078
+ // Renders foreground event segments onto the grid. May return a subset of segs that were rendered.
5079
+ renderFgSegs: function(segs) {
5080
+ // subclasses must implement
5081
+ },
5082
+
5083
+
5084
+ // Unrenders all currently rendered foreground segments
5085
+ unrenderFgSegs: function() {
5086
+ // subclasses must implement
5087
+ },
5088
+
5089
+
5090
+ // Renders and assigns an `el` property for each foreground event segment.
5091
+ // Only returns segments that successfully rendered.
5092
+ // A utility that subclasses may use.
5093
+ renderFgSegEls: function(segs, disableResizing) {
5094
+ var view = this.view;
5095
+ var html = '';
5096
+ var renderedSegs = [];
5097
+ var i;
5098
+
5099
+ if (segs.length) { // don't build an empty html string
5100
+
5101
+ // build a large concatenation of event segment HTML
5102
+ for (i = 0; i < segs.length; i++) {
5103
+ html += this.fgSegHtml(segs[i], disableResizing);
5104
+ }
5105
+
5106
+ // Grab individual elements from the combined HTML string. Use each as the default rendering.
5107
+ // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
5108
+ $(html).each(function(i, node) {
5109
+ var seg = segs[i];
5110
+ var el = view.resolveEventEl(seg.event, $(node));
5111
+
5112
+ if (el) {
5113
+ el.data('fc-seg', seg); // used by handlers
5114
+ seg.el = el;
5115
+ renderedSegs.push(seg);
5116
+ }
5117
+ });
5118
+ }
5119
+
5120
+ return renderedSegs;
5121
+ },
5122
+
5123
+
5124
+ // Generates the HTML for the default rendering of a foreground event segment. Used by renderFgSegEls()
5125
+ fgSegHtml: function(seg, disableResizing) {
5126
+ // subclasses should implement
5127
+ },
5128
+
5129
+
5130
+ /* Background Segment Rendering
5131
+ ------------------------------------------------------------------------------------------------------------------*/
5132
+
5133
+
5134
+ // Renders the given background event segments onto the grid.
5135
+ // Returns a subset of the segs that were actually rendered.
5136
+ renderBgSegs: function(segs) {
5137
+ return this.renderFill('bgEvent', segs);
5138
+ },
5139
+
5140
+
5141
+ // Unrenders all the currently rendered background event segments
5142
+ unrenderBgSegs: function() {
5143
+ this.unrenderFill('bgEvent');
5144
+ },
5145
+
5146
+
5147
+ // Renders a background event element, given the default rendering. Called by the fill system.
5148
+ bgEventSegEl: function(seg, el) {
5149
+ return this.view.resolveEventEl(seg.event, el); // will filter through eventRender
5150
+ },
5151
+
5152
+
5153
+ // Generates an array of classNames to be used for the default rendering of a background event.
5154
+ // Called by fillSegHtml.
5155
+ bgEventSegClasses: function(seg) {
5156
+ var event = seg.event;
5157
+ var source = event.source || {};
5158
+
5159
+ return [ 'fc-bgevent' ].concat(
5160
+ event.className,
5161
+ source.className || []
5162
+ );
5163
+ },
5164
+
5165
+
5166
+ // Generates a semicolon-separated CSS string to be used for the default rendering of a background event.
5167
+ // Called by fillSegHtml.
5168
+ bgEventSegCss: function(seg) {
5169
+ return {
5170
+ 'background-color': this.getSegSkinCss(seg)['background-color']
5171
+ };
5172
+ },
5173
+
5174
+
5175
+ // Generates an array of classNames to be used for the rendering business hours overlay. Called by the fill system.
5176
+ // Called by fillSegHtml.
5177
+ businessHoursSegClasses: function(seg) {
5178
+ return [ 'fc-nonbusiness', 'fc-bgevent' ];
5179
+ },
5180
+
5181
+
5182
+ /* Business Hours
5183
+ ------------------------------------------------------------------------------------------------------------------*/
5184
+
5185
+
5186
+ // Compute business hour segs for the grid's current date range.
5187
+ // Caller must ask if whole-day business hours are needed.
5188
+ // If no `businessHours` configuration value is specified, assumes the calendar default.
5189
+ buildBusinessHourSegs: function(wholeDay, businessHours) {
5190
+ return this.eventsToSegs(
5191
+ this.buildBusinessHourEvents(wholeDay, businessHours)
5192
+ );
5193
+ },
5194
+
5195
+
5196
+ // Compute business hour *events* for the grid's current date range.
5197
+ // Caller must ask if whole-day business hours are needed.
5198
+ // If no `businessHours` configuration value is specified, assumes the calendar default.
5199
+ buildBusinessHourEvents: function(wholeDay, businessHours) {
5200
+ var calendar = this.view.calendar;
5201
+ var events;
5202
+
5203
+ if (businessHours == null) {
5204
+ // fallback
5205
+ // access from calendawr. don't access from view. doesn't update with dynamic options.
5206
+ businessHours = calendar.opt('businessHours');
5207
+ }
5208
+
5209
+ events = calendar.computeBusinessHourEvents(wholeDay, businessHours);
5210
+
5211
+ // HACK. Eventually refactor business hours "events" system.
5212
+ // If no events are given, but businessHours is activated, this means the entire visible range should be
5213
+ // marked as *not* business-hours, via inverse-background rendering.
5214
+ if (!events.length && businessHours) {
5215
+ events = [
5216
+ $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, {
5217
+ start: this.view.activeRange.end, // guaranteed out-of-range
5218
+ end: this.view.activeRange.end, // "
5219
+ dow: null
5220
+ })
5221
+ ];
5222
+ }
5223
+
5224
+ return events;
5225
+ },
5226
+
5227
+
5228
+ /* Handlers
5229
+ ------------------------------------------------------------------------------------------------------------------*/
5230
+
5231
+
5232
+ // Attaches event-element-related handlers for *all* rendered event segments of the view.
5233
+ bindSegHandlers: function() {
5234
+ this.bindSegHandlersToEl(this.el);
5235
+ },
5236
+
5237
+
5238
+ // Attaches event-element-related handlers to an arbitrary container element. leverages bubbling.
5239
+ bindSegHandlersToEl: function(el) {
5240
+ this.bindSegHandlerToEl(el, 'touchstart', this.handleSegTouchStart);
5241
+ this.bindSegHandlerToEl(el, 'mouseenter', this.handleSegMouseover);
5242
+ this.bindSegHandlerToEl(el, 'mouseleave', this.handleSegMouseout);
5243
+ this.bindSegHandlerToEl(el, 'mousedown', this.handleSegMousedown);
5244
+ this.bindSegHandlerToEl(el, 'click', this.handleSegClick);
5245
+ },
5246
+
5247
+
5248
+ // Executes a handler for any a user-interaction on a segment.
5249
+ // Handler gets called with (seg, ev), and with the `this` context of the Grid
5250
+ bindSegHandlerToEl: function(el, name, handler) {
5251
+ var _this = this;
5252
+
5253
+ el.on(name, this.segSelector, function(ev) {
5254
+ var seg = $(this).data('fc-seg'); // grab segment data. put there by View::renderEvents
5255
+
5256
+ // only call the handlers if there is not a drag/resize in progress
5257
+ if (seg && !_this.isDraggingSeg && !_this.isResizingSeg) {
5258
+ return handler.call(_this, seg, ev); // context will be the Grid
5259
+ }
5260
+ });
5261
+ },
5262
+
5263
+
5264
+ handleSegClick: function(seg, ev) {
5265
+ var res = this.view.publiclyTrigger('eventClick', seg.el[0], seg.event, ev); // can return `false` to cancel
5266
+ if (res === false) {
5267
+ ev.preventDefault();
5268
+ }
5269
+ },
5270
+
5271
+
5272
+ // Updates internal state and triggers handlers for when an event element is moused over
5273
+ handleSegMouseover: function(seg, ev) {
5274
+ if (
5275
+ !GlobalEmitter.get().shouldIgnoreMouse() &&
5276
+ !this.mousedOverSeg
5277
+ ) {
5278
+ this.mousedOverSeg = seg;
5279
+ if (this.view.isEventResizable(seg.event)) {
5280
+ seg.el.addClass('fc-allow-mouse-resize');
5281
+ }
5282
+ this.view.publiclyTrigger('eventMouseover', seg.el[0], seg.event, ev);
5283
+ }
5284
+ },
5285
+
5286
+
5287
+ // Updates internal state and triggers handlers for when an event element is moused out.
5288
+ // Can be given no arguments, in which case it will mouseout the segment that was previously moused over.
5289
+ handleSegMouseout: function(seg, ev) {
5290
+ ev = ev || {}; // if given no args, make a mock mouse event
5291
+
5292
+ if (this.mousedOverSeg) {
5293
+ seg = seg || this.mousedOverSeg; // if given no args, use the currently moused-over segment
5294
+ this.mousedOverSeg = null;
5295
+ if (this.view.isEventResizable(seg.event)) {
5296
+ seg.el.removeClass('fc-allow-mouse-resize');
5297
+ }
5298
+ this.view.publiclyTrigger('eventMouseout', seg.el[0], seg.event, ev);
5299
+ }
5300
+ },
5301
+
5302
+
5303
+ handleSegMousedown: function(seg, ev) {
5304
+ var isResizing = this.startSegResize(seg, ev, { distance: 5 });
5305
+
5306
+ if (!isResizing && this.view.isEventDraggable(seg.event)) {
5307
+ this.buildSegDragListener(seg)
5308
+ .startInteraction(ev, {
5309
+ distance: 5
5310
+ });
5311
+ }
5312
+ },
5313
+
5314
+
5315
+ handleSegTouchStart: function(seg, ev) {
5316
+ var view = this.view;
5317
+ var event = seg.event;
5318
+ var isSelected = view.isEventSelected(event);
5319
+ var isDraggable = view.isEventDraggable(event);
5320
+ var isResizable = view.isEventResizable(event);
5321
+ var isResizing = false;
5322
+ var dragListener;
5323
+ var eventLongPressDelay;
5324
+
5325
+ if (isSelected && isResizable) {
5326
+ // only allow resizing of the event is selected
5327
+ isResizing = this.startSegResize(seg, ev);
5328
+ }
5329
+
5330
+ if (!isResizing && (isDraggable || isResizable)) { // allowed to be selected?
5331
+
5332
+ eventLongPressDelay = view.opt('eventLongPressDelay');
5333
+ if (eventLongPressDelay == null) {
5334
+ eventLongPressDelay = view.opt('longPressDelay'); // fallback
5335
+ }
5336
+
5337
+ dragListener = isDraggable ?
5338
+ this.buildSegDragListener(seg) :
5339
+ this.buildSegSelectListener(seg); // seg isn't draggable, but still needs to be selected
5340
+
5341
+ dragListener.startInteraction(ev, { // won't start if already started
5342
+ delay: isSelected ? 0 : eventLongPressDelay // do delay if not already selected
5343
+ });
5344
+ }
5345
+ },
5346
+
5347
+
5348
+ // returns boolean whether resizing actually started or not.
5349
+ // assumes the seg allows resizing.
5350
+ // `dragOptions` are optional.
5351
+ startSegResize: function(seg, ev, dragOptions) {
5352
+ if ($(ev.target).is('.fc-resizer')) {
5353
+ this.buildSegResizeListener(seg, $(ev.target).is('.fc-start-resizer'))
5354
+ .startInteraction(ev, dragOptions);
5355
+ return true;
5356
+ }
5357
+ return false;
5358
+ },
5359
+
5360
+
5361
+
5362
+ /* Event Dragging
5363
+ ------------------------------------------------------------------------------------------------------------------*/
5364
+
5365
+
5366
+ // Builds a listener that will track user-dragging on an event segment.
5367
+ // Generic enough to work with any type of Grid.
5368
+ // Has side effect of setting/unsetting `segDragListener`
5369
+ buildSegDragListener: function(seg) {
5370
+ var _this = this;
5371
+ var view = this.view;
5372
+ var el = seg.el;
5373
+ var event = seg.event;
5374
+ var isDragging;
5375
+ var mouseFollower; // A clone of the original element that will move with the mouse
5376
+ var dropLocation; // zoned event date properties
5377
+
5378
+ if (this.segDragListener) {
5379
+ return this.segDragListener;
5380
+ }
5381
+
5382
+ // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents
5383
+ // of the view.
5384
+ var dragListener = this.segDragListener = new HitDragListener(view, {
5385
+ scroll: view.opt('dragScroll'),
5386
+ subjectEl: el,
5387
+ subjectCenter: true,
5388
+ interactionStart: function(ev) {
5389
+ seg.component = _this; // for renderDrag
5390
+ isDragging = false;
5391
+ mouseFollower = new MouseFollower(seg.el, {
5392
+ additionalClass: 'fc-dragging',
5393
+ parentEl: view.el,
5394
+ opacity: dragListener.isTouch ? null : view.opt('dragOpacity'),
5395
+ revertDuration: view.opt('dragRevertDuration'),
5396
+ zIndex: 2 // one above the .fc-view
5397
+ });
5398
+ mouseFollower.hide(); // don't show until we know this is a real drag
5399
+ mouseFollower.start(ev);
5400
+ },
5401
+ dragStart: function(ev) {
5402
+ if (dragListener.isTouch && !view.isEventSelected(event)) {
5403
+ // if not previously selected, will fire after a delay. then, select the event
5404
+ view.selectEvent(event);
5405
+ }
5406
+ isDragging = true;
5407
+ _this.handleSegMouseout(seg, ev); // ensure a mouseout on the manipulated event has been reported
5408
+ _this.segDragStart(seg, ev);
5409
+ view.hideEvent(event); // hide all event segments. our mouseFollower will take over
5410
+ },
5411
+ hitOver: function(hit, isOrig, origHit) {
5412
+ var isAllowed = true;
5413
+ var origHitSpan;
5414
+ var hitSpan;
5415
+ var dragHelperEls;
5416
+
5417
+ // starting hit could be forced (DayGrid.limit)
5418
+ if (seg.hit) {
5419
+ origHit = seg.hit;
5420
+ }
5421
+
5422
+ // hit might not belong to this grid, so query origin grid
5423
+ origHitSpan = origHit.component.getSafeHitSpan(origHit);
5424
+ hitSpan = hit.component.getSafeHitSpan(hit);
5425
+
5426
+ if (origHitSpan && hitSpan) {
5427
+ dropLocation = _this.computeEventDrop(origHitSpan, hitSpan, event);
5428
+ isAllowed = dropLocation && _this.isEventLocationAllowed(dropLocation, event);
5429
+ }
5430
+ else {
5431
+ isAllowed = false;
5432
+ }
5433
+
5434
+ if (!isAllowed) {
5435
+ dropLocation = null;
5436
+ disableCursor();
5437
+ }
5438
+
5439
+ // if a valid drop location, have the subclass render a visual indication
5440
+ if (dropLocation && (dragHelperEls = view.renderDrag(dropLocation, seg))) {
5441
+
5442
+ dragHelperEls.addClass('fc-dragging');
5443
+ if (!dragListener.isTouch) {
5444
+ _this.applyDragOpacity(dragHelperEls);
5445
+ }
5446
+
5447
+ mouseFollower.hide(); // if the subclass is already using a mock event "helper", hide our own
5448
+ }
5449
+ else {
5450
+ mouseFollower.show(); // otherwise, have the helper follow the mouse (no snapping)
5451
+ }
5452
+
5453
+ if (isOrig) {
5454
+ dropLocation = null; // needs to have moved hits to be a valid drop
5455
+ }
5456
+ },
5457
+ hitOut: function() { // called before mouse moves to a different hit OR moved out of all hits
5458
+ view.unrenderDrag(); // unrender whatever was done in renderDrag
5459
+ mouseFollower.show(); // show in case we are moving out of all hits
5460
+ dropLocation = null;
5461
+ },
5462
+ hitDone: function() { // Called after a hitOut OR before a dragEnd
5463
+ enableCursor();
5464
+ },
5465
+ interactionEnd: function(ev) {
5466
+ delete seg.component; // prevent side effects
5467
+
5468
+ // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
5469
+ mouseFollower.stop(!dropLocation, function() {
5470
+ if (isDragging) {
5471
+ view.unrenderDrag();
5472
+ _this.segDragStop(seg, ev);
5473
+ }
5474
+
5475
+ if (dropLocation) {
5476
+ // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
5477
+ view.reportSegDrop(seg, dropLocation, _this.largeUnit, el, ev);
5478
+ }
5479
+ else {
5480
+ view.showEvent(event);
5481
+ }
5482
+ });
5483
+ _this.segDragListener = null;
5484
+ }
5485
+ });
5486
+
5487
+ return dragListener;
5488
+ },
5489
+
5490
+
5491
+ // seg isn't draggable, but let's use a generic DragListener
5492
+ // simply for the delay, so it can be selected.
5493
+ // Has side effect of setting/unsetting `segDragListener`
5494
+ buildSegSelectListener: function(seg) {
5495
+ var _this = this;
5496
+ var view = this.view;
5497
+ var event = seg.event;
5498
+
5499
+ if (this.segDragListener) {
5500
+ return this.segDragListener;
5501
+ }
5502
+
5503
+ var dragListener = this.segDragListener = new DragListener({
5504
+ dragStart: function(ev) {
5505
+ if (dragListener.isTouch && !view.isEventSelected(event)) {
5506
+ // if not previously selected, will fire after a delay. then, select the event
5507
+ view.selectEvent(event);
5508
+ }
5509
+ },
5510
+ interactionEnd: function(ev) {
5511
+ _this.segDragListener = null;
5512
+ }
5513
+ });
5514
+
5515
+ return dragListener;
5516
+ },
5517
+
5518
+
5519
+ // Called before event segment dragging starts
5520
+ segDragStart: function(seg, ev) {
5521
+ this.isDraggingSeg = true;
5522
+ this.view.publiclyTrigger('eventDragStart', seg.el[0], seg.event, ev, {}); // last argument is jqui dummy
5523
+ },
5524
+
5525
+
5526
+ // Called after event segment dragging stops
5527
+ segDragStop: function(seg, ev) {
5528
+ this.isDraggingSeg = false;
5529
+ this.view.publiclyTrigger('eventDragStop', seg.el[0], seg.event, ev, {}); // last argument is jqui dummy
5530
+ },
5531
+
5532
+
5533
+ // Given the spans an event drag began, and the span event was dropped, calculates the new zoned start/end/allDay
5534
+ // values for the event. Subclasses may override and set additional properties to be used by renderDrag.
5535
+ // A falsy returned value indicates an invalid drop.
5536
+ // DOES NOT consider overlap/constraint.
5537
+ computeEventDrop: function(startSpan, endSpan, event) {
5538
+ var calendar = this.view.calendar;
5539
+ var dragStart = startSpan.start;
5540
+ var dragEnd = endSpan.start;
5541
+ var delta;
5542
+ var dropLocation; // zoned event date properties
5543
+
5544
+ if (dragStart.hasTime() === dragEnd.hasTime()) {
5545
+ delta = this.diffDates(dragEnd, dragStart);
5546
+
5547
+ // if an all-day event was in a timed area and it was dragged to a different time,
5548
+ // guarantee an end and adjust start/end to have times
5549
+ if (event.allDay && durationHasTime(delta)) {
5550
+ dropLocation = {
5551
+ start: event.start.clone(),
5552
+ end: calendar.getEventEnd(event), // will be an ambig day
5553
+ allDay: false // for normalizeEventTimes
5554
+ };
5555
+ calendar.normalizeEventTimes(dropLocation);
5556
+ }
5557
+ // othewise, work off existing values
5558
+ else {
5559
+ dropLocation = pluckEventDateProps(event);
5560
+ }
5561
+
5562
+ dropLocation.start.add(delta);
5563
+ if (dropLocation.end) {
5564
+ dropLocation.end.add(delta);
5565
+ }
5566
+ }
5567
+ else {
5568
+ // if switching from day <-> timed, start should be reset to the dropped date, and the end cleared
5569
+ dropLocation = {
5570
+ start: dragEnd.clone(),
5571
+ end: null, // end should be cleared
5572
+ allDay: !dragEnd.hasTime()
5573
+ };
5574
+ }
5575
+
5576
+ return dropLocation;
5577
+ },
5578
+
5579
+
5580
+ // Utility for apply dragOpacity to a jQuery set
5581
+ applyDragOpacity: function(els) {
5582
+ var opacity = this.view.opt('dragOpacity');
5583
+
5584
+ if (opacity != null) {
5585
+ els.css('opacity', opacity);
5586
+ }
5587
+ },
5588
+
5589
+
5590
+ /* External Element Dragging
5591
+ ------------------------------------------------------------------------------------------------------------------*/
5592
+
5593
+
5594
+ // Called when a jQuery UI drag is initiated anywhere in the DOM
5595
+ externalDragStart: function(ev, ui) {
5596
+ var view = this.view;
5597
+ var el;
5598
+ var accept;
5599
+
5600
+ if (view.opt('droppable')) { // only listen if this setting is on
5601
+ el = $((ui ? ui.item : null) || ev.target);
5602
+
5603
+ // Test that the dragged element passes the dropAccept selector or filter function.
5604
+ // FYI, the default is "*" (matches all)
5605
+ accept = view.opt('dropAccept');
5606
+ if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) {
5607
+ if (!this.isDraggingExternal) { // prevent double-listening if fired twice
5608
+ this.listenToExternalDrag(el, ev, ui);
5609
+ }
5610
+ }
5611
+ }
5612
+ },
5613
+
5614
+
5615
+ // Called when a jQuery UI drag starts and it needs to be monitored for dropping
5616
+ listenToExternalDrag: function(el, ev, ui) {
5617
+ var _this = this;
5618
+ var view = this.view;
5619
+ var meta = getDraggedElMeta(el); // extra data about event drop, including possible event to create
5620
+ var dropLocation; // a null value signals an unsuccessful drag
5621
+
5622
+ // listener that tracks mouse movement over date-associated pixel regions
5623
+ var dragListener = _this.externalDragListener = new HitDragListener(this, {
5624
+ interactionStart: function() {
5625
+ _this.isDraggingExternal = true;
5626
+ },
5627
+ hitOver: function(hit) {
5628
+ var isAllowed = true;
5629
+ var hitSpan = hit.component.getSafeHitSpan(hit); // hit might not belong to this grid
5630
+
5631
+ if (hitSpan) {
5632
+ dropLocation = _this.computeExternalDrop(hitSpan, meta);
5633
+ isAllowed = dropLocation && _this.isExternalLocationAllowed(dropLocation, meta.eventProps);
5634
+ }
5635
+ else {
5636
+ isAllowed = false;
5637
+ }
5638
+
5639
+ if (!isAllowed) {
5640
+ dropLocation = null;
5641
+ disableCursor();
5642
+ }
5643
+
5644
+ if (dropLocation) {
5645
+ _this.renderDrag(dropLocation); // called without a seg parameter
5646
+ }
5647
+ },
5648
+ hitOut: function() {
5649
+ dropLocation = null; // signal unsuccessful
5650
+ },
5651
+ hitDone: function() { // Called after a hitOut OR before a dragEnd
5652
+ enableCursor();
5653
+ _this.unrenderDrag();
5654
+ },
5655
+ interactionEnd: function(ev) {
5656
+ if (dropLocation) { // element was dropped on a valid hit
5657
+ view.reportExternalDrop(meta, dropLocation, el, ev, ui);
5658
+ }
5659
+ _this.isDraggingExternal = false;
5660
+ _this.externalDragListener = null;
5661
+ }
5662
+ });
5663
+
5664
+ dragListener.startDrag(ev); // start listening immediately
5665
+ },
5666
+
5667
+
5668
+ // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object),
5669
+ // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null.
5670
+ // Returning a null value signals an invalid drop hit.
5671
+ // DOES NOT consider overlap/constraint.
5672
+ computeExternalDrop: function(span, meta) {
5673
+ var calendar = this.view.calendar;
5674
+ var dropLocation = {
5675
+ start: calendar.applyTimezone(span.start), // simulate a zoned event start date
5676
+ end: null
5677
+ };
5678
+
5679
+ // if dropped on an all-day span, and element's metadata specified a time, set it
5680
+ if (meta.startTime && !dropLocation.start.hasTime()) {
5681
+ dropLocation.start.time(meta.startTime);
5682
+ }
5683
+
5684
+ if (meta.duration) {
5685
+ dropLocation.end = dropLocation.start.clone().add(meta.duration);
5686
+ }
5687
+
5688
+ return dropLocation;
5689
+ },
5690
+
5691
+
5692
+
5693
+ /* Drag Rendering (for both events and an external elements)
5694
+ ------------------------------------------------------------------------------------------------------------------*/
5695
+
5696
+
5697
+ // Renders a visual indication of an event or external element being dragged.
5698
+ // `dropLocation` contains hypothetical start/end/allDay values the event would have if dropped. end can be null.
5699
+ // `seg` is the internal segment object that is being dragged. If dragging an external element, `seg` is null.
5700
+ // A truthy returned value indicates this method has rendered a helper element.
5701
+ // Must return elements used for any mock events.
5702
+ renderDrag: function(dropLocation, seg) {
5703
+ // subclasses must implement
5704
+ },
5705
+
5706
+
5707
+ // Unrenders a visual indication of an event or external element being dragged
5708
+ unrenderDrag: function() {
5709
+ // subclasses must implement
5710
+ },
5711
+
5712
+
5713
+ /* Resizing
5714
+ ------------------------------------------------------------------------------------------------------------------*/
5715
+
5716
+
5717
+ // Creates a listener that tracks the user as they resize an event segment.
5718
+ // Generic enough to work with any type of Grid.
5719
+ buildSegResizeListener: function(seg, isStart) {
5720
+ var _this = this;
5721
+ var view = this.view;
5722
+ var calendar = view.calendar;
5723
+ var el = seg.el;
5724
+ var event = seg.event;
5725
+ var eventEnd = calendar.getEventEnd(event);
5726
+ var isDragging;
5727
+ var resizeLocation; // zoned event date properties. falsy if invalid resize
5728
+
5729
+ // Tracks mouse movement over the *grid's* coordinate map
5730
+ var dragListener = this.segResizeListener = new HitDragListener(this, {
5731
+ scroll: view.opt('dragScroll'),
5732
+ subjectEl: el,
5733
+ interactionStart: function() {
5734
+ isDragging = false;
5735
+ },
5736
+ dragStart: function(ev) {
5737
+ isDragging = true;
5738
+ _this.handleSegMouseout(seg, ev); // ensure a mouseout on the manipulated event has been reported
5739
+ _this.segResizeStart(seg, ev);
5740
+ },
5741
+ hitOver: function(hit, isOrig, origHit) {
5742
+ var isAllowed = true;
5743
+ var origHitSpan = _this.getSafeHitSpan(origHit);
5744
+ var hitSpan = _this.getSafeHitSpan(hit);
5745
+
5746
+ if (origHitSpan && hitSpan) {
5747
+ resizeLocation = isStart ?
5748
+ _this.computeEventStartResize(origHitSpan, hitSpan, event) :
5749
+ _this.computeEventEndResize(origHitSpan, hitSpan, event);
5750
+
5751
+ isAllowed = resizeLocation && _this.isEventLocationAllowed(resizeLocation, event);
5752
+ }
5753
+ else {
5754
+ isAllowed = false;
5755
+ }
5756
+
5757
+ if (!isAllowed) {
5758
+ resizeLocation = null;
5759
+ disableCursor();
5760
+ }
5761
+ else {
5762
+ if (
5763
+ resizeLocation.start.isSame(event.start.clone().stripZone()) &&
5764
+ resizeLocation.end.isSame(eventEnd.clone().stripZone())
5765
+ ) {
5766
+ // no change. (FYI, event dates might have zones)
5767
+ resizeLocation = null;
5768
+ }
5769
+ }
5770
+
5771
+ if (resizeLocation) {
5772
+ view.hideEvent(event);
5773
+ _this.renderEventResize(resizeLocation, seg);
5774
+ }
5775
+ },
5776
+ hitOut: function() { // called before mouse moves to a different hit OR moved out of all hits
5777
+ resizeLocation = null;
5778
+ view.showEvent(event); // for when out-of-bounds. show original
5779
+ },
5780
+ hitDone: function() { // resets the rendering to show the original event
5781
+ _this.unrenderEventResize();
5782
+ enableCursor();
5783
+ },
5784
+ interactionEnd: function(ev) {
5785
+ if (isDragging) {
5786
+ _this.segResizeStop(seg, ev);
5787
+ }
5788
+
5789
+ if (resizeLocation) { // valid date to resize to?
5790
+ // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
5791
+ view.reportSegResize(seg, resizeLocation, _this.largeUnit, el, ev);
5792
+ }
5793
+ else {
5794
+ view.showEvent(event);
5795
+ }
5796
+ _this.segResizeListener = null;
5797
+ }
5798
+ });
5799
+
5800
+ return dragListener;
5801
+ },
5802
+
5803
+
5804
+ // Called before event segment resizing starts
5805
+ segResizeStart: function(seg, ev) {
5806
+ this.isResizingSeg = true;
5807
+ this.view.publiclyTrigger('eventResizeStart', seg.el[0], seg.event, ev, {}); // last argument is jqui dummy
5808
+ },
5809
+
5810
+
5811
+ // Called after event segment resizing stops
5812
+ segResizeStop: function(seg, ev) {
5813
+ this.isResizingSeg = false;
5814
+ this.view.publiclyTrigger('eventResizeStop', seg.el[0], seg.event, ev, {}); // last argument is jqui dummy
5815
+ },
5816
+
5817
+
5818
+ // Returns new date-information for an event segment being resized from its start
5819
+ computeEventStartResize: function(startSpan, endSpan, event) {
5820
+ return this.computeEventResize('start', startSpan, endSpan, event);
5821
+ },
5822
+
5823
+
5824
+ // Returns new date-information for an event segment being resized from its end
5825
+ computeEventEndResize: function(startSpan, endSpan, event) {
5826
+ return this.computeEventResize('end', startSpan, endSpan, event);
5827
+ },
5828
+
5829
+
5830
+ // Returns new zoned date information for an event segment being resized from its start OR end
5831
+ // `type` is either 'start' or 'end'.
5832
+ // DOES NOT consider overlap/constraint.
5833
+ computeEventResize: function(type, startSpan, endSpan, event) {
5834
+ var calendar = this.view.calendar;
5835
+ var delta = this.diffDates(endSpan[type], startSpan[type]);
5836
+ var resizeLocation; // zoned event date properties
5837
+ var defaultDuration;
5838
+
5839
+ // build original values to work from, guaranteeing a start and end
5840
+ resizeLocation = {
5841
+ start: event.start.clone(),
5842
+ end: calendar.getEventEnd(event),
5843
+ allDay: event.allDay
5844
+ };
5845
+
5846
+ // if an all-day event was in a timed area and was resized to a time, adjust start/end to have times
5847
+ if (resizeLocation.allDay && durationHasTime(delta)) {
5848
+ resizeLocation.allDay = false;
5849
+ calendar.normalizeEventTimes(resizeLocation);
5850
+ }
5851
+
5852
+ resizeLocation[type].add(delta); // apply delta to start or end
5853
+
5854
+ // if the event was compressed too small, find a new reasonable duration for it
5855
+ if (!resizeLocation.start.isBefore(resizeLocation.end)) {
5856
+
5857
+ defaultDuration =
5858
+ this.minResizeDuration || // TODO: hack
5859
+ (event.allDay ?
5860
+ calendar.defaultAllDayEventDuration :
5861
+ calendar.defaultTimedEventDuration);
5862
+
5863
+ if (type == 'start') { // resizing the start?
5864
+ resizeLocation.start = resizeLocation.end.clone().subtract(defaultDuration);
5865
+ }
5866
+ else { // resizing the end?
5867
+ resizeLocation.end = resizeLocation.start.clone().add(defaultDuration);
5868
+ }
5869
+ }
5870
+
5871
+ return resizeLocation;
5872
+ },
5873
+
5874
+
5875
+ // Renders a visual indication of an event being resized.
5876
+ // `range` has the updated dates of the event. `seg` is the original segment object involved in the drag.
5877
+ // Must return elements used for any mock events.
5878
+ renderEventResize: function(range, seg) {
5879
+ // subclasses must implement
5880
+ },
5881
+
5882
+
5883
+ // Unrenders a visual indication of an event being resized.
5884
+ unrenderEventResize: function() {
5885
+ // subclasses must implement
5886
+ },
5887
+
5888
+
5889
+ /* Rendering Utils
5890
+ ------------------------------------------------------------------------------------------------------------------*/
5891
+
5892
+
5893
+ // Compute the text that should be displayed on an event's element.
5894
+ // `range` can be the Event object itself, or something range-like, with at least a `start`.
5895
+ // If event times are disabled, or the event has no time, will return a blank string.
5896
+ // If not specified, formatStr will default to the eventTimeFormat setting,
5897
+ // and displayEnd will default to the displayEventEnd setting.
5898
+ getEventTimeText: function(range, formatStr, displayEnd) {
5899
+
5900
+ if (formatStr == null) {
5901
+ formatStr = this.eventTimeFormat;
5902
+ }
5903
+
5904
+ if (displayEnd == null) {
5905
+ displayEnd = this.displayEventEnd;
5906
+ }
5907
+
5908
+ if (this.displayEventTime && range.start.hasTime()) {
5909
+ if (displayEnd && range.end) {
5910
+ return this.view.formatRange(range, formatStr);
5911
+ }
5912
+ else {
5913
+ return range.start.format(formatStr);
5914
+ }
5915
+ }
5916
+
5917
+ return '';
5918
+ },
5919
+
5920
+
5921
+ // Generic utility for generating the HTML classNames for an event segment's element
5922
+ getSegClasses: function(seg, isDraggable, isResizable) {
5923
+ var view = this.view;
5924
+ var classes = [
5925
+ 'fc-event',
5926
+ seg.isStart ? 'fc-start' : 'fc-not-start',
5927
+ seg.isEnd ? 'fc-end' : 'fc-not-end'
5928
+ ].concat(this.getSegCustomClasses(seg));
5929
+
5930
+ if (isDraggable) {
5931
+ classes.push('fc-draggable');
5932
+ }
5933
+ if (isResizable) {
5934
+ classes.push('fc-resizable');
5935
+ }
5936
+
5937
+ // event is currently selected? attach a className.
5938
+ if (view.isEventSelected(seg.event)) {
5939
+ classes.push('fc-selected');
5940
+ }
5941
+
5942
+ return classes;
5943
+ },
5944
+
5945
+
5946
+ // List of classes that were defined by the caller of the API in some way
5947
+ getSegCustomClasses: function(seg) {
5948
+ var event = seg.event;
5949
+
5950
+ return [].concat(
5951
+ event.className, // guaranteed to be an array
5952
+ event.source ? event.source.className : []
5953
+ );
5954
+ },
5955
+
5956
+
5957
+ // Utility for generating event skin-related CSS properties
5958
+ getSegSkinCss: function(seg) {
5959
+ return {
5960
+ 'background-color': this.getSegBackgroundColor(seg),
5961
+ 'border-color': this.getSegBorderColor(seg),
5962
+ color: this.getSegTextColor(seg)
5963
+ };
5964
+ },
5965
+
5966
+
5967
+ // Queries for caller-specified color, then falls back to default
5968
+ getSegBackgroundColor: function(seg) {
5969
+ return seg.event.backgroundColor ||
5970
+ seg.event.color ||
5971
+ this.getSegDefaultBackgroundColor(seg);
5972
+ },
5973
+
5974
+
5975
+ getSegDefaultBackgroundColor: function(seg) {
5976
+ var source = seg.event.source || {};
5977
+
5978
+ return source.backgroundColor ||
5979
+ source.color ||
5980
+ this.view.opt('eventBackgroundColor') ||
5981
+ this.view.opt('eventColor');
5982
+ },
5983
+
5984
+
5985
+ // Queries for caller-specified color, then falls back to default
5986
+ getSegBorderColor: function(seg) {
5987
+ return seg.event.borderColor ||
5988
+ seg.event.color ||
5989
+ this.getSegDefaultBorderColor(seg);
5990
+ },
5991
+
5992
+
5993
+ getSegDefaultBorderColor: function(seg) {
5994
+ var source = seg.event.source || {};
5995
+
5996
+ return source.borderColor ||
5997
+ source.color ||
5998
+ this.view.opt('eventBorderColor') ||
5999
+ this.view.opt('eventColor');
6000
+ },
6001
+
6002
+
6003
+ // Queries for caller-specified color, then falls back to default
6004
+ getSegTextColor: function(seg) {
6005
+ return seg.event.textColor ||
6006
+ this.getSegDefaultTextColor(seg);
6007
+ },
6008
+
6009
+
6010
+ getSegDefaultTextColor: function(seg) {
6011
+ var source = seg.event.source || {};
6012
+
6013
+ return source.textColor ||
6014
+ this.view.opt('eventTextColor');
6015
+ },
6016
+
6017
+
6018
+ /* Event Location Validation
6019
+ ------------------------------------------------------------------------------------------------------------------*/
6020
+
6021
+
6022
+ isEventLocationAllowed: function(eventLocation, event) {
6023
+ if (this.isEventLocationInRange(eventLocation)) {
6024
+ var calendar = this.view.calendar;
6025
+ var eventSpans = this.eventToSpans(eventLocation);
6026
+ var i;
6027
+
6028
+ if (eventSpans.length) {
6029
+ for (i = 0; i < eventSpans.length; i++) {
6030
+ if (!calendar.isEventSpanAllowed(eventSpans[i], event)) {
6031
+ return false;
6032
+ }
6033
+ }
6034
+
6035
+ return true;
6036
+ }
6037
+ }
6038
+
6039
+ return false;
6040
+ },
6041
+
6042
+
6043
+ isExternalLocationAllowed: function(eventLocation, metaProps) { // FOR the external element
6044
+ if (this.isEventLocationInRange(eventLocation)) {
6045
+ var calendar = this.view.calendar;
6046
+ var eventSpans = this.eventToSpans(eventLocation);
6047
+ var i;
6048
+
6049
+ if (eventSpans.length) {
6050
+ for (i = 0; i < eventSpans.length; i++) {
6051
+ if (!calendar.isExternalSpanAllowed(eventSpans[i], eventLocation, metaProps)) {
6052
+ return false;
6053
+ }
6054
+ }
6055
+
6056
+ return true;
6057
+ }
6058
+ }
6059
+
6060
+ return false;
6061
+ },
6062
+
6063
+
6064
+ isEventLocationInRange: function(eventLocation) {
6065
+ return isRangeWithinRange(
6066
+ this.eventToRawRange(eventLocation),
6067
+ this.view.validRange
6068
+ );
6069
+ },
6070
+
6071
+
6072
+ /* Converting events -> eventRange -> eventSpan -> eventSegs
6073
+ ------------------------------------------------------------------------------------------------------------------*/
6074
+
6075
+
6076
+ // Generates an array of segments for the given single event
6077
+ // Can accept an event "location" as well (which only has start/end and no allDay)
6078
+ eventToSegs: function(event) {
6079
+ return this.eventsToSegs([ event ]);
6080
+ },
6081
+
6082
+
6083
+ // Generates spans (always unzoned) for the given event.
6084
+ // Does not do any inverting for inverse-background events.
6085
+ // Can accept an event "location" as well (which only has start/end and no allDay)
6086
+ eventToSpans: function(event) {
6087
+ var eventRange = this.eventToRange(event); // { start, end, isStart, isEnd }
6088
+
6089
+ if (eventRange) {
6090
+ return this.eventRangeToSpans(eventRange, event);
6091
+ }
6092
+ else { // out of view's valid range
6093
+ return [];
6094
+ }
6095
+ },
6096
+
6097
+
6098
+
6099
+ // Converts an array of event objects into an array of event segment objects.
6100
+ // A custom `segSliceFunc` may be given for arbitrarily slicing up events.
6101
+ // Doesn't guarantee an order for the resulting array.
6102
+ eventsToSegs: function(allEvents, segSliceFunc) {
6103
+ var _this = this;
6104
+ var eventsById = groupEventsById(allEvents);
6105
+ var segs = [];
6106
+
6107
+ $.each(eventsById, function(id, events) {
6108
+ var visibleEvents = [];
6109
+ var eventRanges = [];
6110
+ var eventRange; // { start, end, isStart, isEnd }
6111
+ var i;
6112
+
6113
+ for (i = 0; i < events.length; i++) {
6114
+ eventRange = _this.eventToRange(events[i]); // might be null if completely out of range
6115
+
6116
+ if (eventRange) {
6117
+ eventRanges.push(eventRange);
6118
+ visibleEvents.push(events[i]);
6119
+ }
6120
+ }
6121
+
6122
+ // inverse-background events (utilize only the first event in calculations)
6123
+ if (isInverseBgEvent(events[0])) {
6124
+ eventRanges = _this.invertRanges(eventRanges); // will lose isStart/isEnd
6125
+
6126
+ for (i = 0; i < eventRanges.length; i++) {
6127
+ segs.push.apply(segs, // append to
6128
+ _this.eventRangeToSegs(eventRanges[i], events[0], segSliceFunc)
6129
+ );
6130
+ }
6131
+ }
6132
+ // normal event ranges
6133
+ else {
6134
+ for (i = 0; i < eventRanges.length; i++) {
6135
+ segs.push.apply(segs, // append to
6136
+ _this.eventRangeToSegs(eventRanges[i], visibleEvents[i], segSliceFunc)
6137
+ );
6138
+ }
6139
+ }
6140
+ });
6141
+
6142
+ return segs;
6143
+ },
6144
+
6145
+
6146
+ // Generates the unzoned start/end dates an event appears to occupy
6147
+ // Can accept an event "location" as well (which only has start/end and no allDay)
6148
+ // returns { start, end, isStart, isEnd }
6149
+ // If the event is completely outside of the grid's valid range, will return undefined.
6150
+ eventToRange: function(event) {
6151
+ return this.refineRawEventRange(
6152
+ this.eventToRawRange(event)
6153
+ );
6154
+ },
6155
+
6156
+
6157
+ // Ensures the given range is within the view's activeRange and is correctly localized.
6158
+ // Always returns a result
6159
+ refineRawEventRange: function(rawRange) {
6160
+ var view = this.view;
6161
+ var calendar = view.calendar;
6162
+ var range = intersectRanges(rawRange, view.activeRange);
6163
+
6164
+ if (range) { // otherwise, event doesn't have valid range
6165
+
6166
+ // hack: dynamic locale change forgets to upate stored event localed
6167
+ calendar.localizeMoment(range.start);
6168
+ calendar.localizeMoment(range.end);
6169
+
6170
+ return range;
6171
+ }
6172
+ },
6173
+
6174
+
6175
+ // not constrained to valid dates
6176
+ // not given localizeMoment hack
6177
+ eventToRawRange: function(event) {
6178
+ var calendar = this.view.calendar;
6179
+ var start = event.start.clone().stripZone();
6180
+ var end = (
6181
+ event.end ?
6182
+ event.end.clone() :
6183
+ // derive the end from the start and allDay. compute allDay if necessary
6184
+ calendar.getDefaultEventEnd(
6185
+ event.allDay != null ?
6186
+ event.allDay :
6187
+ !event.start.hasTime(),
6188
+ event.start
6189
+ )
6190
+ ).stripZone();
6191
+
6192
+ return { start: start, end: end };
6193
+ },
6194
+
6195
+
6196
+ // Given an event's range (unzoned start/end), and the event itself,
6197
+ // slice into segments (using the segSliceFunc function if specified)
6198
+ // eventRange - { start, end, isStart, isEnd }
6199
+ eventRangeToSegs: function(eventRange, event, segSliceFunc) {
6200
+ var eventSpans = this.eventRangeToSpans(eventRange, event);
6201
+ var segs = [];
6202
+ var i;
6203
+
6204
+ for (i = 0; i < eventSpans.length; i++) {
6205
+ segs.push.apply(segs, // append to
6206
+ this.eventSpanToSegs(eventSpans[i], event, segSliceFunc)
6207
+ );
6208
+ }
6209
+
6210
+ return segs;
6211
+ },
6212
+
6213
+
6214
+ // Given an event's unzoned date range, return an array of eventSpan objects.
6215
+ // eventSpan - { start, end, isStart, isEnd, otherthings... }
6216
+ // Subclasses can override.
6217
+ // Subclasses are obligated to forward eventRange.isStart/isEnd to the resulting spans.
6218
+ eventRangeToSpans: function(eventRange, event) {
6219
+ return [ $.extend({}, eventRange) ]; // copy into a single-item array
6220
+ },
6221
+
6222
+
6223
+ // Given an event's span (unzoned start/end and other misc data), and the event itself,
6224
+ // slices into segments and attaches event-derived properties to them.
6225
+ // eventSpan - { start, end, isStart, isEnd, otherthings... }
6226
+ eventSpanToSegs: function(eventSpan, event, segSliceFunc) {
6227
+ var segs = segSliceFunc ? segSliceFunc(eventSpan) : this.spanToSegs(eventSpan);
6228
+ var i, seg;
6229
+
6230
+ for (i = 0; i < segs.length; i++) {
6231
+ seg = segs[i];
6232
+
6233
+ // the eventSpan's isStart/isEnd takes precedence over the seg's
6234
+ if (!eventSpan.isStart) {
6235
+ seg.isStart = false;
6236
+ }
6237
+ if (!eventSpan.isEnd) {
6238
+ seg.isEnd = false;
6239
+ }
6240
+
6241
+ seg.event = event;
6242
+ seg.eventStartMS = +eventSpan.start; // TODO: not the best name after making spans unzoned
6243
+ seg.eventDurationMS = eventSpan.end - eventSpan.start;
6244
+ }
6245
+
6246
+ return segs;
6247
+ },
6248
+
6249
+
6250
+ // Produces a new array of range objects that will cover all the time NOT covered by the given ranges.
6251
+ // SIDE EFFECT: will mutate the given array and will use its date references.
6252
+ invertRanges: function(ranges) {
6253
+ var view = this.view;
6254
+ var viewStart = view.activeRange.start.clone(); // need a copy
6255
+ var viewEnd = view.activeRange.end.clone(); // need a copy
6256
+ var inverseRanges = [];
6257
+ var start = viewStart; // the end of the previous range. the start of the new range
6258
+ var i, range;
6259
+
6260
+ // ranges need to be in order. required for our date-walking algorithm
6261
+ ranges.sort(compareRanges);
6262
+
6263
+ for (i = 0; i < ranges.length; i++) {
6264
+ range = ranges[i];
6265
+
6266
+ // add the span of time before the event (if there is any)
6267
+ if (range.start > start) { // compare millisecond time (skip any ambig logic)
6268
+ inverseRanges.push({
6269
+ start: start,
6270
+ end: range.start
6271
+ });
6272
+ }
6273
+
6274
+ if (range.end > start) {
6275
+ start = range.end;
6276
+ }
6277
+ }
6278
+
6279
+ // add the span of time after the last event (if there is any)
6280
+ if (start < viewEnd) { // compare millisecond time (skip any ambig logic)
6281
+ inverseRanges.push({
6282
+ start: start,
6283
+ end: viewEnd
6284
+ });
6285
+ }
6286
+
6287
+ return inverseRanges;
6288
+ },
6289
+
6290
+
6291
+ sortEventSegs: function(segs) {
6292
+ segs.sort(proxy(this, 'compareEventSegs'));
6293
+ },
6294
+
6295
+
6296
+ // A cmp function for determining which segments should take visual priority
6297
+ compareEventSegs: function(seg1, seg2) {
6298
+ return seg1.eventStartMS - seg2.eventStartMS || // earlier events go first
6299
+ seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first
6300
+ seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
6301
+ compareByFieldSpecs(seg1.event, seg2.event, this.view.eventOrderSpecs);
6302
+ }
6303
+
6304
+ });
6305
+
6306
+
6307
+ /* Utilities
6308
+ ----------------------------------------------------------------------------------------------------------------------*/
6309
+
6310
+
6311
+ function pluckEventDateProps(event) {
6312
+ return {
6313
+ start: event.start.clone(),
6314
+ end: event.end ? event.end.clone() : null,
6315
+ allDay: event.allDay // keep it the same
6316
+ };
6317
+ }
6318
+ FC.pluckEventDateProps = pluckEventDateProps;
6319
+
6320
+
6321
+ function isBgEvent(event) { // returns true if background OR inverse-background
6322
+ var rendering = getEventRendering(event);
6323
+ return rendering === 'background' || rendering === 'inverse-background';
6324
+ }
6325
+ FC.isBgEvent = isBgEvent; // export
6326
+
6327
+
6328
+ function isInverseBgEvent(event) {
6329
+ return getEventRendering(event) === 'inverse-background';
6330
+ }
6331
+
6332
+
6333
+ function getEventRendering(event) {
6334
+ return firstDefined((event.source || {}).rendering, event.rendering);
6335
+ }
6336
+
6337
+
6338
+ function groupEventsById(events) {
6339
+ var eventsById = {};
6340
+ var i, event;
6341
+
6342
+ for (i = 0; i < events.length; i++) {
6343
+ event = events[i];
6344
+ (eventsById[event._id] || (eventsById[event._id] = [])).push(event);
6345
+ }
6346
+
6347
+ return eventsById;
6348
+ }
6349
+
6350
+
6351
+ // A cmp function for determining which non-inverted "ranges" (see above) happen earlier
6352
+ function compareRanges(range1, range2) {
6353
+ return range1.start - range2.start; // earlier ranges go first
6354
+ }
6355
+
6356
+
6357
+ /* External-Dragging-Element Data
6358
+ ----------------------------------------------------------------------------------------------------------------------*/
6359
+
6360
+ // Require all HTML5 data-* attributes used by FullCalendar to have this prefix.
6361
+ // A value of '' will query attributes like data-event. A value of 'fc' will query attributes like data-fc-event.
6362
+ FC.dataAttrPrefix = '';
6363
+
6364
+ // Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure
6365
+ // to be used for Event Object creation.
6366
+ // A defined `.eventProps`, even when empty, indicates that an event should be created.
6367
+ function getDraggedElMeta(el) {
6368
+ var prefix = FC.dataAttrPrefix;
6369
+ var eventProps; // properties for creating the event, not related to date/time
6370
+ var startTime; // a Duration
6371
+ var duration;
6372
+ var stick;
6373
+
6374
+ if (prefix) { prefix += '-'; }
6375
+ eventProps = el.data(prefix + 'event') || null;
6376
+
6377
+ if (eventProps) {
6378
+ if (typeof eventProps === 'object') {
6379
+ eventProps = $.extend({}, eventProps); // make a copy
6380
+ }
6381
+ else { // something like 1 or true. still signal event creation
6382
+ eventProps = {};
6383
+ }
6384
+
6385
+ // pluck special-cased date/time properties
6386
+ startTime = eventProps.start;
6387
+ if (startTime == null) { startTime = eventProps.time; } // accept 'time' as well
6388
+ duration = eventProps.duration;
6389
+ stick = eventProps.stick;
6390
+ delete eventProps.start;
6391
+ delete eventProps.time;
6392
+ delete eventProps.duration;
6393
+ delete eventProps.stick;
6394
+ }
6395
+
6396
+ // fallback to standalone attribute values for each of the date/time properties
6397
+ if (startTime == null) { startTime = el.data(prefix + 'start'); }
6398
+ if (startTime == null) { startTime = el.data(prefix + 'time'); } // accept 'time' as well
6399
+ if (duration == null) { duration = el.data(prefix + 'duration'); }
6400
+ if (stick == null) { stick = el.data(prefix + 'stick'); }
6401
+
6402
+ // massage into correct data types
6403
+ startTime = startTime != null ? moment.duration(startTime) : null;
6404
+ duration = duration != null ? moment.duration(duration) : null;
6405
+ stick = Boolean(stick);
6406
+
6407
+ return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick };
6408
+ }
6409
+
6410
+
6411
+ ;;
6412
+
6413
+ /*
6414
+ A set of rendering and date-related methods for a visual component comprised of one or more rows of day columns.
6415
+ Prerequisite: the object being mixed into needs to be a *Grid*
6416
+ */
6417
+ var DayTableMixin = FC.DayTableMixin = {
6418
+
6419
+ breakOnWeeks: false, // should create a new row for each week?
6420
+ dayDates: null, // whole-day dates for each column. left to right
6421
+ dayIndices: null, // for each day from start, the offset
6422
+ daysPerRow: null,
6423
+ rowCnt: null,
6424
+ colCnt: null,
6425
+ colHeadFormat: null,
6426
+
6427
+
6428
+ // Populates internal variables used for date calculation and rendering
6429
+ updateDayTable: function() {
6430
+ var view = this.view;
6431
+ var date = this.start.clone();
6432
+ var dayIndex = -1;
6433
+ var dayIndices = [];
6434
+ var dayDates = [];
6435
+ var daysPerRow;
6436
+ var firstDay;
6437
+ var rowCnt;
6438
+
6439
+ while (date.isBefore(this.end)) { // loop each day from start to end
6440
+ if (view.isHiddenDay(date)) {
6441
+ dayIndices.push(dayIndex + 0.5); // mark that it's between indices
6442
+ }
6443
+ else {
6444
+ dayIndex++;
6445
+ dayIndices.push(dayIndex);
6446
+ dayDates.push(date.clone());
6447
+ }
6448
+ date.add(1, 'days');
6449
+ }
6450
+
6451
+ if (this.breakOnWeeks) {
6452
+ // count columns until the day-of-week repeats
6453
+ firstDay = dayDates[0].day();
6454
+ for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) {
6455
+ if (dayDates[daysPerRow].day() == firstDay) {
6456
+ break;
6457
+ }
6458
+ }
6459
+ rowCnt = Math.ceil(dayDates.length / daysPerRow);
6460
+ }
6461
+ else {
6462
+ rowCnt = 1;
6463
+ daysPerRow = dayDates.length;
6464
+ }
6465
+
6466
+ this.dayDates = dayDates;
6467
+ this.dayIndices = dayIndices;
6468
+ this.daysPerRow = daysPerRow;
6469
+ this.rowCnt = rowCnt;
6470
+
6471
+ this.updateDayTableCols();
6472
+ },
6473
+
6474
+
6475
+ // Computes and assigned the colCnt property and updates any options that may be computed from it
6476
+ updateDayTableCols: function() {
6477
+ this.colCnt = this.computeColCnt();
6478
+ this.colHeadFormat = this.view.opt('columnFormat') || this.computeColHeadFormat();
6479
+ },
6480
+
6481
+
6482
+ // Determines how many columns there should be in the table
6483
+ computeColCnt: function() {
6484
+ return this.daysPerRow;
6485
+ },
6486
+
6487
+
6488
+ // Computes the ambiguously-timed moment for the given cell
6489
+ getCellDate: function(row, col) {
6490
+ return this.dayDates[
6491
+ this.getCellDayIndex(row, col)
6492
+ ].clone();
6493
+ },
6494
+
6495
+
6496
+ // Computes the ambiguously-timed date range for the given cell
6497
+ getCellRange: function(row, col) {
6498
+ var start = this.getCellDate(row, col);
6499
+ var end = start.clone().add(1, 'days');
6500
+
6501
+ return { start: start, end: end };
6502
+ },
6503
+
6504
+
6505
+ // Returns the number of day cells, chronologically, from the first of the grid (0-based)
6506
+ getCellDayIndex: function(row, col) {
6507
+ return row * this.daysPerRow + this.getColDayIndex(col);
6508
+ },
6509
+
6510
+
6511
+ // Returns the numner of day cells, chronologically, from the first cell in *any given row*
6512
+ getColDayIndex: function(col) {
6513
+ if (this.isRTL) {
6514
+ return this.colCnt - 1 - col;
6515
+ }
6516
+ else {
6517
+ return col;
6518
+ }
6519
+ },
6520
+
6521
+
6522
+ // Given a date, returns its chronolocial cell-index from the first cell of the grid.
6523
+ // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
6524
+ // If before the first offset, returns a negative number.
6525
+ // If after the last offset, returns an offset past the last cell offset.
6526
+ // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
6527
+ getDateDayIndex: function(date) {
6528
+ var dayIndices = this.dayIndices;
6529
+ var dayOffset = date.diff(this.start, 'days');
6530
+
6531
+ if (dayOffset < 0) {
6532
+ return dayIndices[0] - 1;
6533
+ }
6534
+ else if (dayOffset >= dayIndices.length) {
6535
+ return dayIndices[dayIndices.length - 1] + 1;
6536
+ }
6537
+ else {
6538
+ return dayIndices[dayOffset];
6539
+ }
6540
+ },
6541
+
6542
+
6543
+ /* Options
6544
+ ------------------------------------------------------------------------------------------------------------------*/
6545
+
6546
+
6547
+ // Computes a default column header formatting string if `colFormat` is not explicitly defined
6548
+ computeColHeadFormat: function() {
6549
+ // if more than one week row, or if there are a lot of columns with not much space,
6550
+ // put just the day numbers will be in each cell
6551
+ if (this.rowCnt > 1 || this.colCnt > 10) {
6552
+ return 'ddd'; // "Sat"
6553
+ }
6554
+ // multiple days, so full single date string WON'T be in title text
6555
+ else if (this.colCnt > 1) {
6556
+ return this.view.opt('dayOfMonthFormat'); // "Sat 12/10"
6557
+ }
6558
+ // single day, so full single date string will probably be in title text
6559
+ else {
6560
+ return 'dddd'; // "Saturday"
6561
+ }
6562
+ },
6563
+
6564
+
6565
+ /* Slicing
6566
+ ------------------------------------------------------------------------------------------------------------------*/
6567
+
6568
+
6569
+ // Slices up a date range into a segment for every week-row it intersects with
6570
+ sliceRangeByRow: function(range) {
6571
+ var daysPerRow = this.daysPerRow;
6572
+ var normalRange = this.view.computeDayRange(range); // make whole-day range, considering nextDayThreshold
6573
+ var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
6574
+ var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
6575
+ var segs = [];
6576
+ var row;
6577
+ var rowFirst, rowLast; // inclusive day-index range for current row
6578
+ var segFirst, segLast; // inclusive day-index range for segment
6579
+
6580
+ for (row = 0; row < this.rowCnt; row++) {
6581
+ rowFirst = row * daysPerRow;
6582
+ rowLast = rowFirst + daysPerRow - 1;
6583
+
6584
+ // intersect segment's offset range with the row's
6585
+ segFirst = Math.max(rangeFirst, rowFirst);
6586
+ segLast = Math.min(rangeLast, rowLast);
6587
+
6588
+ // deal with in-between indices
6589
+ segFirst = Math.ceil(segFirst); // in-between starts round to next cell
6590
+ segLast = Math.floor(segLast); // in-between ends round to prev cell
6591
+
6592
+ if (segFirst <= segLast) { // was there any intersection with the current row?
6593
+ segs.push({
6594
+ row: row,
6595
+
6596
+ // normalize to start of row
6597
+ firstRowDayIndex: segFirst - rowFirst,
6598
+ lastRowDayIndex: segLast - rowFirst,
6599
+
6600
+ // must be matching integers to be the segment's start/end
6601
+ isStart: segFirst === rangeFirst,
6602
+ isEnd: segLast === rangeLast
6603
+ });
6604
+ }
6605
+ }
6606
+
6607
+ return segs;
6608
+ },
6609
+
6610
+
6611
+ // Slices up a date range into a segment for every day-cell it intersects with.
6612
+ // TODO: make more DRY with sliceRangeByRow somehow.
6613
+ sliceRangeByDay: function(range) {
6614
+ var daysPerRow = this.daysPerRow;
6615
+ var normalRange = this.view.computeDayRange(range); // make whole-day range, considering nextDayThreshold
6616
+ var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
6617
+ var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
6618
+ var segs = [];
6619
+ var row;
6620
+ var rowFirst, rowLast; // inclusive day-index range for current row
6621
+ var i;
6622
+ var segFirst, segLast; // inclusive day-index range for segment
6623
+
6624
+ for (row = 0; row < this.rowCnt; row++) {
6625
+ rowFirst = row * daysPerRow;
6626
+ rowLast = rowFirst + daysPerRow - 1;
6627
+
6628
+ for (i = rowFirst; i <= rowLast; i++) {
6629
+
6630
+ // intersect segment's offset range with the row's
6631
+ segFirst = Math.max(rangeFirst, i);
6632
+ segLast = Math.min(rangeLast, i);
6633
+
6634
+ // deal with in-between indices
6635
+ segFirst = Math.ceil(segFirst); // in-between starts round to next cell
6636
+ segLast = Math.floor(segLast); // in-between ends round to prev cell
6637
+
6638
+ if (segFirst <= segLast) { // was there any intersection with the current row?
6639
+ segs.push({
6640
+ row: row,
6641
+
6642
+ // normalize to start of row
6643
+ firstRowDayIndex: segFirst - rowFirst,
6644
+ lastRowDayIndex: segLast - rowFirst,
6645
+
6646
+ // must be matching integers to be the segment's start/end
6647
+ isStart: segFirst === rangeFirst,
6648
+ isEnd: segLast === rangeLast
6649
+ });
6650
+ }
6651
+ }
6652
+ }
6653
+
6654
+ return segs;
6655
+ },
6656
+
6657
+
6658
+ /* Header Rendering
6659
+ ------------------------------------------------------------------------------------------------------------------*/
6660
+
6661
+
6662
+ renderHeadHtml: function() {
6663
+ var view = this.view;
6664
+
6665
+ return '' +
6666
+ '<div class="fc-row ' + view.widgetHeaderClass + '">' +
6667
+ '<table>' +
6668
+ '<thead>' +
6669
+ this.renderHeadTrHtml() +
6670
+ '</thead>' +
6671
+ '</table>' +
6672
+ '</div>';
6673
+ },
6674
+
6675
+
6676
+ renderHeadIntroHtml: function() {
6677
+ return this.renderIntroHtml(); // fall back to generic
6678
+ },
6679
+
6680
+
6681
+ renderHeadTrHtml: function() {
6682
+ return '' +
6683
+ '<tr>' +
6684
+ (this.isRTL ? '' : this.renderHeadIntroHtml()) +
6685
+ this.renderHeadDateCellsHtml() +
6686
+ (this.isRTL ? this.renderHeadIntroHtml() : '') +
6687
+ '</tr>';
6688
+ },
6689
+
6690
+
6691
+ renderHeadDateCellsHtml: function() {
6692
+ var htmls = [];
6693
+ var col, date;
6694
+
6695
+ for (col = 0; col < this.colCnt; col++) {
6696
+ date = this.getCellDate(0, col);
6697
+ htmls.push(this.renderHeadDateCellHtml(date));
6698
+ }
6699
+
6700
+ return htmls.join('');
6701
+ },
6702
+
6703
+
6704
+ // TODO: when internalApiVersion, accept an object for HTML attributes
6705
+ // (colspan should be no different)
6706
+ renderHeadDateCellHtml: function(date, colspan, otherAttrs) {
6707
+ var view = this.view;
6708
+ var isDateValid = isDateWithinRange(date, view.activeRange); // TODO: called too frequently. cache somehow.
6709
+ var classNames = [
6710
+ 'fc-day-header',
6711
+ view.widgetHeaderClass
6712
+ ];
6713
+ var innerHtml = htmlEscape(date.format(this.colHeadFormat));
6714
+
6715
+ // if only one row of days, the classNames on the header can represent the specific days beneath
6716
+ if (this.rowCnt === 1) {
6717
+ classNames = classNames.concat(
6718
+ // includes the day-of-week class
6719
+ // noThemeHighlight=true (don't highlight the header)
6720
+ this.getDayClasses(date, true)
6721
+ );
6722
+ }
6723
+ else {
6724
+ classNames.push('fc-' + dayIDs[date.day()]); // only add the day-of-week class
6725
+ }
6726
+
6727
+ return '' +
6728
+ '<th class="' + classNames.join(' ') + '"' +
6729
+ ((isDateValid && this.rowCnt) === 1 ?
6730
+ ' data-date="' + date.format('YYYY-MM-DD') + '"' :
6731
+ '') +
6732
+ (colspan > 1 ?
6733
+ ' colspan="' + colspan + '"' :
6734
+ '') +
6735
+ (otherAttrs ?
6736
+ ' ' + otherAttrs :
6737
+ '') +
6738
+ '>' +
6739
+ (isDateValid ?
6740
+ // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
6741
+ view.buildGotoAnchorHtml(
6742
+ { date: date, forceOff: this.rowCnt > 1 || this.colCnt === 1 },
6743
+ innerHtml
6744
+ ) :
6745
+ // if not valid, display text, but no link
6746
+ innerHtml
6747
+ ) +
6748
+ '</th>';
6749
+ },
6750
+
6751
+
6752
+ /* Background Rendering
6753
+ ------------------------------------------------------------------------------------------------------------------*/
6754
+
6755
+
6756
+ renderBgTrHtml: function(row) {
6757
+ return '' +
6758
+ '<tr>' +
6759
+ (this.isRTL ? '' : this.renderBgIntroHtml(row)) +
6760
+ this.renderBgCellsHtml(row) +
6761
+ (this.isRTL ? this.renderBgIntroHtml(row) : '') +
6762
+ '</tr>';
6763
+ },
6764
+
6765
+
6766
+ renderBgIntroHtml: function(row) {
6767
+ return this.renderIntroHtml(); // fall back to generic
6768
+ },
6769
+
6770
+
6771
+ renderBgCellsHtml: function(row) {
6772
+ var htmls = [];
6773
+ var col, date;
6774
+
6775
+ for (col = 0; col < this.colCnt; col++) {
6776
+ date = this.getCellDate(row, col);
6777
+ htmls.push(this.renderBgCellHtml(date));
6778
+ }
6779
+
6780
+ return htmls.join('');
6781
+ },
6782
+
6783
+
6784
+ renderBgCellHtml: function(date, otherAttrs) {
6785
+ var view = this.view;
6786
+ var isDateValid = isDateWithinRange(date, view.activeRange); // TODO: called too frequently. cache somehow.
6787
+ var classes = this.getDayClasses(date);
6788
+
6789
+ classes.unshift('fc-day', view.widgetContentClass);
6790
+
6791
+ return '<td class="' + classes.join(' ') + '"' +
6792
+ (isDateValid ?
6793
+ ' data-date="' + date.format('YYYY-MM-DD') + '"' : // if date has a time, won't format it
6794
+ '') +
6795
+ (otherAttrs ?
6796
+ ' ' + otherAttrs :
6797
+ '') +
6798
+ '></td>';
6799
+ },
6800
+
6801
+
6802
+ /* Generic
6803
+ ------------------------------------------------------------------------------------------------------------------*/
6804
+
6805
+
6806
+ // Generates the default HTML intro for any row. User classes should override
6807
+ renderIntroHtml: function() {
6808
+ },
6809
+
6810
+
6811
+ // TODO: a generic method for dealing with <tr>, RTL, intro
6812
+ // when increment internalApiVersion
6813
+ // wrapTr (scheduler)
6814
+
6815
+
6816
+ /* Utils
6817
+ ------------------------------------------------------------------------------------------------------------------*/
6818
+
6819
+
6820
+ // Applies the generic "intro" and "outro" HTML to the given cells.
6821
+ // Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro.
6822
+ bookendCells: function(trEl) {
6823
+ var introHtml = this.renderIntroHtml();
6824
+
6825
+ if (introHtml) {
6826
+ if (this.isRTL) {
6827
+ trEl.append(introHtml);
6828
+ }
6829
+ else {
6830
+ trEl.prepend(introHtml);
6831
+ }
6832
+ }
6833
+ }
6834
+
6835
+ };
6836
+
6837
+ ;;
6838
+
6839
+ /* A component that renders a grid of whole-days that runs horizontally. There can be multiple rows, one per week.
6840
+ ----------------------------------------------------------------------------------------------------------------------*/
6841
+
6842
+ var DayGrid = FC.DayGrid = Grid.extend(DayTableMixin, {
6843
+
6844
+ numbersVisible: false, // should render a row for day/week numbers? set by outside view. TODO: make internal
6845
+ bottomCoordPadding: 0, // hack for extending the hit area for the last row of the coordinate grid
6846
+
6847
+ rowEls: null, // set of fake row elements
6848
+ cellEls: null, // set of whole-day elements comprising the row's background
6849
+ helperEls: null, // set of cell skeleton elements for rendering the mock event "helper"
6850
+
6851
+ rowCoordCache: null,
6852
+ colCoordCache: null,
6853
+
6854
+
6855
+ // Renders the rows and columns into the component's `this.el`, which should already be assigned.
6856
+ // isRigid determins whether the individual rows should ignore the contents and be a constant height.
6857
+ // Relies on the view's colCnt and rowCnt. In the future, this component should probably be self-sufficient.
6858
+ renderDates: function(isRigid) {
6859
+ var view = this.view;
6860
+ var rowCnt = this.rowCnt;
6861
+ var colCnt = this.colCnt;
6862
+ var html = '';
6863
+ var row;
6864
+ var col;
6865
+
6866
+ for (row = 0; row < rowCnt; row++) {
6867
+ html += this.renderDayRowHtml(row, isRigid);
6868
+ }
6869
+ this.el.html(html);
6870
+
6871
+ this.rowEls = this.el.find('.fc-row');
6872
+ this.cellEls = this.el.find('.fc-day, .fc-disabled-day');
6873
+
6874
+ this.rowCoordCache = new CoordCache({
6875
+ els: this.rowEls,
6876
+ isVertical: true
6877
+ });
6878
+ this.colCoordCache = new CoordCache({
6879
+ els: this.cellEls.slice(0, this.colCnt), // only the first row
6880
+ isHorizontal: true
6881
+ });
6882
+
6883
+ // trigger dayRender with each cell's element
6884
+ for (row = 0; row < rowCnt; row++) {
6885
+ for (col = 0; col < colCnt; col++) {
6886
+ view.publiclyTrigger(
6887
+ 'dayRender',
6888
+ null,
6889
+ this.getCellDate(row, col),
6890
+ this.getCellEl(row, col)
6891
+ );
6892
+ }
6893
+ }
6894
+ },
6895
+
6896
+
6897
+ unrenderDates: function() {
6898
+ this.removeSegPopover();
6899
+ },
6900
+
6901
+
6902
+ renderBusinessHours: function() {
6903
+ var segs = this.buildBusinessHourSegs(true); // wholeDay=true
6904
+ this.renderFill('businessHours', segs, 'bgevent');
6905
+ },
6906
+
6907
+
6908
+ unrenderBusinessHours: function() {
6909
+ this.unrenderFill('businessHours');
6910
+ },
6911
+
6912
+
6913
+ // Generates the HTML for a single row, which is a div that wraps a table.
6914
+ // `row` is the row number.
6915
+ renderDayRowHtml: function(row, isRigid) {
6916
+ var view = this.view;
6917
+ var classes = [ 'fc-row', 'fc-week', view.widgetContentClass ];
6918
+
6919
+ if (isRigid) {
6920
+ classes.push('fc-rigid');
6921
+ }
6922
+
6923
+ return '' +
6924
+ '<div class="' + classes.join(' ') + '">' +
6925
+ '<div class="fc-bg">' +
6926
+ '<table>' +
6927
+ this.renderBgTrHtml(row) +
6928
+ '</table>' +
6929
+ '</div>' +
6930
+ '<div class="fc-content-skeleton">' +
6931
+ '<table>' +
6932
+ (this.numbersVisible ?
6933
+ '<thead>' +
6934
+ this.renderNumberTrHtml(row) +
6935
+ '</thead>' :
6936
+ ''
6937
+ ) +
6938
+ '</table>' +
6939
+ '</div>' +
6940
+ '</div>';
6941
+ },
6942
+
6943
+
6944
+ /* Grid Number Rendering
6945
+ ------------------------------------------------------------------------------------------------------------------*/
6946
+
6947
+
6948
+ renderNumberTrHtml: function(row) {
6949
+ return '' +
6950
+ '<tr>' +
6951
+ (this.isRTL ? '' : this.renderNumberIntroHtml(row)) +
6952
+ this.renderNumberCellsHtml(row) +
6953
+ (this.isRTL ? this.renderNumberIntroHtml(row) : '') +
6954
+ '</tr>';
6955
+ },
6956
+
6957
+
6958
+ renderNumberIntroHtml: function(row) {
6959
+ return this.renderIntroHtml();
6960
+ },
6961
+
6962
+
6963
+ renderNumberCellsHtml: function(row) {
6964
+ var htmls = [];
6965
+ var col, date;
6966
+
6967
+ for (col = 0; col < this.colCnt; col++) {
6968
+ date = this.getCellDate(row, col);
6969
+ htmls.push(this.renderNumberCellHtml(date));
6970
+ }
6971
+
6972
+ return htmls.join('');
6973
+ },
6974
+
6975
+
6976
+ // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
6977
+ // The number row will only exist if either day numbers or week numbers are turned on.
6978
+ renderNumberCellHtml: function(date) {
6979
+ var view = this.view;
6980
+ var html = '';
6981
+ var isDateValid = isDateWithinRange(date, view.activeRange); // TODO: called too frequently. cache somehow.
6982
+ var isDayNumberVisible = view.dayNumbersVisible && isDateValid;
6983
+ var classes;
6984
+ var weekCalcFirstDoW;
6985
+
6986
+ if (!isDayNumberVisible && !view.cellWeekNumbersVisible) {
6987
+ // no numbers in day cell (week number must be along the side)
6988
+ return '<td/>'; // will create an empty space above events :(
6989
+ }
6990
+
6991
+ classes = this.getDayClasses(date);
6992
+ classes.unshift('fc-day-top');
6993
+
6994
+ if (view.cellWeekNumbersVisible) {
6995
+ // To determine the day of week number change under ISO, we cannot
6996
+ // rely on moment.js methods such as firstDayOfWeek() or weekday(),
6997
+ // because they rely on the locale's dow (possibly overridden by
6998
+ // our firstDay option), which may not be Monday. We cannot change
6999
+ // dow, because that would affect the calendar start day as well.
7000
+ if (date._locale._fullCalendar_weekCalc === 'ISO') {
7001
+ weekCalcFirstDoW = 1; // Monday by ISO 8601 definition
7002
+ }
7003
+ else {
7004
+ weekCalcFirstDoW = date._locale.firstDayOfWeek();
7005
+ }
7006
+ }
7007
+
7008
+ html += '<td class="' + classes.join(' ') + '"' +
7009
+ (isDateValid ?
7010
+ ' data-date="' + date.format() + '"' :
7011
+ ''
7012
+ ) +
7013
+ '>';
7014
+
7015
+ if (view.cellWeekNumbersVisible && (date.day() == weekCalcFirstDoW)) {
7016
+ html += view.buildGotoAnchorHtml(
7017
+ { date: date, type: 'week' },
7018
+ { 'class': 'fc-week-number' },
7019
+ date.format('w') // inner HTML
7020
+ );
7021
+ }
7022
+
7023
+ if (isDayNumberVisible) {
7024
+ html += view.buildGotoAnchorHtml(
7025
+ date,
7026
+ { 'class': 'fc-day-number' },
7027
+ date.date() // inner HTML
7028
+ );
7029
+ }
7030
+
7031
+ html += '</td>';
7032
+
7033
+ return html;
7034
+ },
7035
+
7036
+
7037
+ /* Options
7038
+ ------------------------------------------------------------------------------------------------------------------*/
7039
+
7040
+
7041
+ // Computes a default event time formatting string if `timeFormat` is not explicitly defined
7042
+ computeEventTimeFormat: function() {
7043
+ return this.view.opt('extraSmallTimeFormat'); // like "6p" or "6:30p"
7044
+ },
7045
+
7046
+
7047
+ // Computes a default `displayEventEnd` value if one is not expliclty defined
7048
+ computeDisplayEventEnd: function() {
7049
+ return this.colCnt == 1; // we'll likely have space if there's only one day
7050
+ },
7051
+
7052
+
7053
+ /* Dates
7054
+ ------------------------------------------------------------------------------------------------------------------*/
7055
+
7056
+
7057
+ rangeUpdated: function() {
7058
+ this.updateDayTable();
7059
+ },
7060
+
7061
+
7062
+ // Slices up the given span (unzoned start/end with other misc data) into an array of segments
7063
+ spanToSegs: function(span) {
7064
+ var segs = this.sliceRangeByRow(span);
7065
+ var i, seg;
7066
+
7067
+ for (i = 0; i < segs.length; i++) {
7068
+ seg = segs[i];
7069
+ if (this.isRTL) {
7070
+ seg.leftCol = this.daysPerRow - 1 - seg.lastRowDayIndex;
7071
+ seg.rightCol = this.daysPerRow - 1 - seg.firstRowDayIndex;
7072
+ }
7073
+ else {
7074
+ seg.leftCol = seg.firstRowDayIndex;
7075
+ seg.rightCol = seg.lastRowDayIndex;
7076
+ }
7077
+ }
7078
+
7079
+ return segs;
7080
+ },
7081
+
7082
+
7083
+ /* Hit System
7084
+ ------------------------------------------------------------------------------------------------------------------*/
7085
+
7086
+
7087
+ prepareHits: function() {
7088
+ this.colCoordCache.build();
7089
+ this.rowCoordCache.build();
7090
+ this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
7091
+ },
7092
+
7093
+
7094
+ releaseHits: function() {
7095
+ this.colCoordCache.clear();
7096
+ this.rowCoordCache.clear();
7097
+ },
7098
+
7099
+
7100
+ queryHit: function(leftOffset, topOffset) {
7101
+ if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) {
7102
+ var col = this.colCoordCache.getHorizontalIndex(leftOffset);
7103
+ var row = this.rowCoordCache.getVerticalIndex(topOffset);
7104
+
7105
+ if (row != null && col != null) {
7106
+ return this.getCellHit(row, col);
7107
+ }
7108
+ }
7109
+ },
7110
+
7111
+
7112
+ getHitSpan: function(hit) {
7113
+ return this.getCellRange(hit.row, hit.col);
7114
+ },
7115
+
7116
+
7117
+ getHitEl: function(hit) {
7118
+ return this.getCellEl(hit.row, hit.col);
7119
+ },
7120
+
7121
+
7122
+ /* Cell System
7123
+ ------------------------------------------------------------------------------------------------------------------*/
7124
+ // FYI: the first column is the leftmost column, regardless of date
7125
+
7126
+
7127
+ getCellHit: function(row, col) {
7128
+ return {
7129
+ row: row,
7130
+ col: col,
7131
+ component: this, // needed unfortunately :(
7132
+ left: this.colCoordCache.getLeftOffset(col),
7133
+ right: this.colCoordCache.getRightOffset(col),
7134
+ top: this.rowCoordCache.getTopOffset(row),
7135
+ bottom: this.rowCoordCache.getBottomOffset(row)
7136
+ };
7137
+ },
7138
+
7139
+
7140
+ getCellEl: function(row, col) {
7141
+ return this.cellEls.eq(row * this.colCnt + col);
7142
+ },
7143
+
7144
+
7145
+ /* Event Drag Visualization
7146
+ ------------------------------------------------------------------------------------------------------------------*/
7147
+ // TODO: move to DayGrid.event, similar to what we did with Grid's drag methods
7148
+
7149
+
7150
+ // Renders a visual indication of an event or external element being dragged.
7151
+ // `eventLocation` has zoned start and end (optional)
7152
+ renderDrag: function(eventLocation, seg) {
7153
+ var eventSpans = this.eventToSpans(eventLocation);
7154
+ var i;
7155
+
7156
+ // always render a highlight underneath
7157
+ for (i = 0; i < eventSpans.length; i++) {
7158
+ this.renderHighlight(eventSpans[i]);
7159
+ }
7160
+
7161
+ // if a segment from the same calendar but another component is being dragged, render a helper event
7162
+ if (seg && seg.component !== this) {
7163
+ return this.renderEventLocationHelper(eventLocation, seg); // returns mock event elements
7164
+ }
7165
+ },
7166
+
7167
+
7168
+ // Unrenders any visual indication of a hovering event
7169
+ unrenderDrag: function() {
7170
+ this.unrenderHighlight();
7171
+ this.unrenderHelper();
7172
+ },
7173
+
7174
+
7175
+ /* Event Resize Visualization
7176
+ ------------------------------------------------------------------------------------------------------------------*/
7177
+
7178
+
7179
+ // Renders a visual indication of an event being resized
7180
+ renderEventResize: function(eventLocation, seg) {
7181
+ var eventSpans = this.eventToSpans(eventLocation);
7182
+ var i;
7183
+
7184
+ for (i = 0; i < eventSpans.length; i++) {
7185
+ this.renderHighlight(eventSpans[i]);
7186
+ }
7187
+
7188
+ return this.renderEventLocationHelper(eventLocation, seg); // returns mock event elements
7189
+ },
7190
+
7191
+
7192
+ // Unrenders a visual indication of an event being resized
7193
+ unrenderEventResize: function() {
7194
+ this.unrenderHighlight();
7195
+ this.unrenderHelper();
7196
+ },
7197
+
7198
+
7199
+ /* Event Helper
7200
+ ------------------------------------------------------------------------------------------------------------------*/
7201
+
7202
+
7203
+ // Renders a mock "helper" event. `sourceSeg` is the associated internal segment object. It can be null.
7204
+ renderHelper: function(event, sourceSeg) {
7205
+ var helperNodes = [];
7206
+ var segs = this.eventToSegs(event);
7207
+ var rowStructs;
7208
+
7209
+ segs = this.renderFgSegEls(segs); // assigns each seg's el and returns a subset of segs that were rendered
7210
+ rowStructs = this.renderSegRows(segs);
7211
+
7212
+ // inject each new event skeleton into each associated row
7213
+ this.rowEls.each(function(row, rowNode) {
7214
+ var rowEl = $(rowNode); // the .fc-row
7215
+ var skeletonEl = $('<div class="fc-helper-skeleton"><table/></div>'); // will be absolutely positioned
7216
+ var skeletonTop;
7217
+
7218
+ // If there is an original segment, match the top position. Otherwise, put it at the row's top level
7219
+ if (sourceSeg && sourceSeg.row === row) {
7220
+ skeletonTop = sourceSeg.el.position().top;
7221
+ }
7222
+ else {
7223
+ skeletonTop = rowEl.find('.fc-content-skeleton tbody').position().top;
7224
+ }
7225
+
7226
+ skeletonEl.css('top', skeletonTop)
7227
+ .find('table')
7228
+ .append(rowStructs[row].tbodyEl);
7229
+
7230
+ rowEl.append(skeletonEl);
7231
+ helperNodes.push(skeletonEl[0]);
7232
+ });
7233
+
7234
+ return ( // must return the elements rendered
7235
+ this.helperEls = $(helperNodes) // array -> jQuery set
7236
+ );
7237
+ },
7238
+
7239
+
7240
+ // Unrenders any visual indication of a mock helper event
7241
+ unrenderHelper: function() {
7242
+ if (this.helperEls) {
7243
+ this.helperEls.remove();
7244
+ this.helperEls = null;
7245
+ }
7246
+ },
7247
+
7248
+
7249
+ /* Fill System (highlight, background events, business hours)
7250
+ ------------------------------------------------------------------------------------------------------------------*/
7251
+
7252
+
7253
+ fillSegTag: 'td', // override the default tag name
7254
+
7255
+
7256
+ // Renders a set of rectangles over the given segments of days.
7257
+ // Only returns segments that successfully rendered.
7258
+ renderFill: function(type, segs, className) {
7259
+ var nodes = [];
7260
+ var i, seg;
7261
+ var skeletonEl;
7262
+
7263
+ segs = this.renderFillSegEls(type, segs); // assignes `.el` to each seg. returns successfully rendered segs
7264
+
7265
+ for (i = 0; i < segs.length; i++) {
7266
+ seg = segs[i];
7267
+ skeletonEl = this.renderFillRow(type, seg, className);
7268
+ this.rowEls.eq(seg.row).append(skeletonEl);
7269
+ nodes.push(skeletonEl[0]);
7270
+ }
7271
+
7272
+ this.elsByFill[type] = $(nodes);
7273
+
7274
+ return segs;
7275
+ },
7276
+
7277
+
7278
+ // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
7279
+ renderFillRow: function(type, seg, className) {
7280
+ var colCnt = this.colCnt;
7281
+ var startCol = seg.leftCol;
7282
+ var endCol = seg.rightCol + 1;
7283
+ var skeletonEl;
7284
+ var trEl;
7285
+
7286
+ className = className || type.toLowerCase();
7287
+
7288
+ skeletonEl = $(
7289
+ '<div class="fc-' + className + '-skeleton">' +
7290
+ '<table><tr/></table>' +
7291
+ '</div>'
7292
+ );
7293
+ trEl = skeletonEl.find('tr');
7294
+
7295
+ if (startCol > 0) {
7296
+ trEl.append('<td colspan="' + startCol + '"/>');
7297
+ }
7298
+
7299
+ trEl.append(
7300
+ seg.el.attr('colspan', endCol - startCol)
7301
+ );
7302
+
7303
+ if (endCol < colCnt) {
7304
+ trEl.append('<td colspan="' + (colCnt - endCol) + '"/>');
7305
+ }
7306
+
7307
+ this.bookendCells(trEl);
7308
+
7309
+ return skeletonEl;
7310
+ }
7311
+
7312
+ });
7313
+
7314
+ ;;
7315
+
7316
+ /* Event-rendering methods for the DayGrid class
7317
+ ----------------------------------------------------------------------------------------------------------------------*/
7318
+
7319
+ DayGrid.mixin({
7320
+
7321
+ rowStructs: null, // an array of objects, each holding information about a row's foreground event-rendering
7322
+
7323
+
7324
+ // Unrenders all events currently rendered on the grid
7325
+ unrenderEvents: function() {
7326
+ this.removeSegPopover(); // removes the "more.." events popover
7327
+ Grid.prototype.unrenderEvents.apply(this, arguments); // calls the super-method
7328
+ },
7329
+
7330
+
7331
+ // Retrieves all rendered segment objects currently rendered on the grid
7332
+ getEventSegs: function() {
7333
+ return Grid.prototype.getEventSegs.call(this) // get the segments from the super-method
7334
+ .concat(this.popoverSegs || []); // append the segments from the "more..." popover
7335
+ },
7336
+
7337
+
7338
+ // Renders the given background event segments onto the grid
7339
+ renderBgSegs: function(segs) {
7340
+
7341
+ // don't render timed background events
7342
+ var allDaySegs = $.grep(segs, function(seg) {
7343
+ return seg.event.allDay;
7344
+ });
7345
+
7346
+ return Grid.prototype.renderBgSegs.call(this, allDaySegs); // call the super-method
7347
+ },
7348
+
7349
+
7350
+ // Renders the given foreground event segments onto the grid
7351
+ renderFgSegs: function(segs) {
7352
+ var rowStructs;
7353
+
7354
+ // render an `.el` on each seg
7355
+ // returns a subset of the segs. segs that were actually rendered
7356
+ segs = this.renderFgSegEls(segs);
7357
+
7358
+ rowStructs = this.rowStructs = this.renderSegRows(segs);
7359
+
7360
+ // append to each row's content skeleton
7361
+ this.rowEls.each(function(i, rowNode) {
7362
+ $(rowNode).find('.fc-content-skeleton > table').append(
7363
+ rowStructs[i].tbodyEl
7364
+ );
7365
+ });
7366
+
7367
+ return segs; // return only the segs that were actually rendered
7368
+ },
7369
+
7370
+
7371
+ // Unrenders all currently rendered foreground event segments
7372
+ unrenderFgSegs: function() {
7373
+ var rowStructs = this.rowStructs || [];
7374
+ var rowStruct;
7375
+
7376
+ while ((rowStruct = rowStructs.pop())) {
7377
+ rowStruct.tbodyEl.remove();
7378
+ }
7379
+
7380
+ this.rowStructs = null;
7381
+ },
7382
+
7383
+
7384
+ // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
7385
+ // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
7386
+ // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
7387
+ renderSegRows: function(segs) {
7388
+ var rowStructs = [];
7389
+ var segRows;
7390
+ var row;
7391
+
7392
+ segRows = this.groupSegRows(segs); // group into nested arrays
7393
+
7394
+ // iterate each row of segment groupings
7395
+ for (row = 0; row < segRows.length; row++) {
7396
+ rowStructs.push(
7397
+ this.renderSegRow(row, segRows[row])
7398
+ );
7399
+ }
7400
+
7401
+ return rowStructs;
7402
+ },
7403
+
7404
+
7405
+ // Builds the HTML to be used for the default element for an individual segment
7406
+ fgSegHtml: function(seg, disableResizing) {
7407
+ var view = this.view;
7408
+ var event = seg.event;
7409
+ var isDraggable = view.isEventDraggable(event);
7410
+ var isResizableFromStart = !disableResizing && event.allDay &&
7411
+ seg.isStart && view.isEventResizableFromStart(event);
7412
+ var isResizableFromEnd = !disableResizing && event.allDay &&
7413
+ seg.isEnd && view.isEventResizableFromEnd(event);
7414
+ var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
7415
+ var skinCss = cssToStr(this.getSegSkinCss(seg));
7416
+ var timeHtml = '';
7417
+ var timeText;
7418
+ var titleHtml;
7419
+
7420
+ classes.unshift('fc-day-grid-event', 'fc-h-event');
7421
+
7422
+ // Only display a timed events time if it is the starting segment
7423
+ if (seg.isStart) {
7424
+ timeText = this.getEventTimeText(event);
7425
+ if (timeText) {
7426
+ timeHtml = '<span class="fc-time">' + htmlEscape(timeText) + '</span>';
7427
+ }
7428
+ }
7429
+
7430
+ titleHtml =
7431
+ '<span class="fc-title">' +
7432
+ (htmlEscape(event.title || '') || '&nbsp;') + // we always want one line of height
7433
+ '</span>';
7434
+
7435
+ return '<a class="' + classes.join(' ') + '"' +
7436
+ (event.url ?
7437
+ ' href="' + htmlEscape(event.url) + '"' :
7438
+ ''
7439
+ ) +
7440
+ (skinCss ?
7441
+ ' style="' + skinCss + '"' :
7442
+ ''
7443
+ ) +
7444
+ '>' +
7445
+ '<div class="fc-content">' +
7446
+ (this.isRTL ?
7447
+ titleHtml + ' ' + timeHtml : // put a natural space in between
7448
+ timeHtml + ' ' + titleHtml //
7449
+ ) +
7450
+ '</div>' +
7451
+ (isResizableFromStart ?
7452
+ '<div class="fc-resizer fc-start-resizer" />' :
7453
+ ''
7454
+ ) +
7455
+ (isResizableFromEnd ?
7456
+ '<div class="fc-resizer fc-end-resizer" />' :
7457
+ ''
7458
+ ) +
7459
+ '</a>';
7460
+ },
7461
+
7462
+
7463
+ // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
7464
+ // the segments. Returns object with a bunch of internal data about how the render was calculated.
7465
+ // NOTE: modifies rowSegs
7466
+ renderSegRow: function(row, rowSegs) {
7467
+ var colCnt = this.colCnt;
7468
+ var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
7469
+ var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
7470
+ var tbody = $('<tbody/>');
7471
+ var segMatrix = []; // lookup for which segments are rendered into which level+col cells
7472
+ var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
7473
+ var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
7474
+ var i, levelSegs;
7475
+ var col;
7476
+ var tr;
7477
+ var j, seg;
7478
+ var td;
7479
+
7480
+ // populates empty cells from the current column (`col`) to `endCol`
7481
+ function emptyCellsUntil(endCol) {
7482
+ while (col < endCol) {
7483
+ // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
7484
+ td = (loneCellMatrix[i - 1] || [])[col];
7485
+ if (td) {
7486
+ td.attr(
7487
+ 'rowspan',
7488
+ parseInt(td.attr('rowspan') || 1, 10) + 1
7489
+ );
7490
+ }
7491
+ else {
7492
+ td = $('<td/>');
7493
+ tr.append(td);
7494
+ }
7495
+ cellMatrix[i][col] = td;
7496
+ loneCellMatrix[i][col] = td;
7497
+ col++;
7498
+ }
7499
+ }
7500
+
7501
+ for (i = 0; i < levelCnt; i++) { // iterate through all levels
7502
+ levelSegs = segLevels[i];
7503
+ col = 0;
7504
+ tr = $('<tr/>');
7505
+
7506
+ segMatrix.push([]);
7507
+ cellMatrix.push([]);
7508
+ loneCellMatrix.push([]);
7509
+
7510
+ // levelCnt might be 1 even though there are no actual levels. protect against this.
7511
+ // this single empty row is useful for styling.
7512
+ if (levelSegs) {
7513
+ for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
7514
+ seg = levelSegs[j];
7515
+
7516
+ emptyCellsUntil(seg.leftCol);
7517
+
7518
+ // create a container that occupies or more columns. append the event element.
7519
+ td = $('<td class="fc-event-container"/>').append(seg.el);
7520
+ if (seg.leftCol != seg.rightCol) {
7521
+ td.attr('colspan', seg.rightCol - seg.leftCol + 1);
7522
+ }
7523
+ else { // a single-column segment
7524
+ loneCellMatrix[i][col] = td;
7525
+ }
7526
+
7527
+ while (col <= seg.rightCol) {
7528
+ cellMatrix[i][col] = td;
7529
+ segMatrix[i][col] = seg;
7530
+ col++;
7531
+ }
7532
+
7533
+ tr.append(td);
7534
+ }
7535
+ }
7536
+
7537
+ emptyCellsUntil(colCnt); // finish off the row
7538
+ this.bookendCells(tr);
7539
+ tbody.append(tr);
7540
+ }
7541
+
7542
+ return { // a "rowStruct"
7543
+ row: row, // the row number
7544
+ tbodyEl: tbody,
7545
+ cellMatrix: cellMatrix,
7546
+ segMatrix: segMatrix,
7547
+ segLevels: segLevels,
7548
+ segs: rowSegs
7549
+ };
7550
+ },
7551
+
7552
+
7553
+ // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
7554
+ // NOTE: modifies segs
7555
+ buildSegLevels: function(segs) {
7556
+ var levels = [];
7557
+ var i, seg;
7558
+ var j;
7559
+
7560
+ // Give preference to elements with certain criteria, so they have
7561
+ // a chance to be closer to the top.
7562
+ this.sortEventSegs(segs);
7563
+
7564
+ for (i = 0; i < segs.length; i++) {
7565
+ seg = segs[i];
7566
+
7567
+ // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
7568
+ for (j = 0; j < levels.length; j++) {
7569
+ if (!isDaySegCollision(seg, levels[j])) {
7570
+ break;
7571
+ }
7572
+ }
7573
+ // `j` now holds the desired subrow index
7574
+ seg.level = j;
7575
+
7576
+ // create new level array if needed and append segment
7577
+ (levels[j] || (levels[j] = [])).push(seg);
7578
+ }
7579
+
7580
+ // order segments left-to-right. very important if calendar is RTL
7581
+ for (j = 0; j < levels.length; j++) {
7582
+ levels[j].sort(compareDaySegCols);
7583
+ }
7584
+
7585
+ return levels;
7586
+ },
7587
+
7588
+
7589
+ // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
7590
+ groupSegRows: function(segs) {
7591
+ var segRows = [];
7592
+ var i;
7593
+
7594
+ for (i = 0; i < this.rowCnt; i++) {
7595
+ segRows.push([]);
7596
+ }
7597
+
7598
+ for (i = 0; i < segs.length; i++) {
7599
+ segRows[segs[i].row].push(segs[i]);
7600
+ }
7601
+
7602
+ return segRows;
7603
+ }
7604
+
7605
+ });
7606
+
7607
+
7608
+ // Computes whether two segments' columns collide. They are assumed to be in the same row.
7609
+ function isDaySegCollision(seg, otherSegs) {
7610
+ var i, otherSeg;
7611
+
7612
+ for (i = 0; i < otherSegs.length; i++) {
7613
+ otherSeg = otherSegs[i];
7614
+
7615
+ if (
7616
+ otherSeg.leftCol <= seg.rightCol &&
7617
+ otherSeg.rightCol >= seg.leftCol
7618
+ ) {
7619
+ return true;
7620
+ }
7621
+ }
7622
+
7623
+ return false;
7624
+ }
7625
+
7626
+
7627
+ // A cmp function for determining the leftmost event
7628
+ function compareDaySegCols(a, b) {
7629
+ return a.leftCol - b.leftCol;
7630
+ }
7631
+
7632
+ ;;
7633
+
7634
+ /* Methods relate to limiting the number events for a given day on a DayGrid
7635
+ ----------------------------------------------------------------------------------------------------------------------*/
7636
+ // NOTE: all the segs being passed around in here are foreground segs
7637
+
7638
+ DayGrid.mixin({
7639
+
7640
+ segPopover: null, // the Popover that holds events that can't fit in a cell. null when not visible
7641
+ popoverSegs: null, // an array of segment objects that the segPopover holds. null when not visible
7642
+
7643
+
7644
+ removeSegPopover: function() {
7645
+ if (this.segPopover) {
7646
+ this.segPopover.hide(); // in handler, will call segPopover's removeElement
7647
+ }
7648
+ },
7649
+
7650
+
7651
+ // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
7652
+ // `levelLimit` can be false (don't limit), a number, or true (should be computed).
7653
+ limitRows: function(levelLimit) {
7654
+ var rowStructs = this.rowStructs || [];
7655
+ var row; // row #
7656
+ var rowLevelLimit;
7657
+
7658
+ for (row = 0; row < rowStructs.length; row++) {
7659
+ this.unlimitRow(row);
7660
+
7661
+ if (!levelLimit) {
7662
+ rowLevelLimit = false;
7663
+ }
7664
+ else if (typeof levelLimit === 'number') {
7665
+ rowLevelLimit = levelLimit;
7666
+ }
7667
+ else {
7668
+ rowLevelLimit = this.computeRowLevelLimit(row);
7669
+ }
7670
+
7671
+ if (rowLevelLimit !== false) {
7672
+ this.limitRow(row, rowLevelLimit);
7673
+ }
7674
+ }
7675
+ },
7676
+
7677
+
7678
+ // Computes the number of levels a row will accomodate without going outside its bounds.
7679
+ // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
7680
+ // `row` is the row number.
7681
+ computeRowLevelLimit: function(row) {
7682
+ var rowEl = this.rowEls.eq(row); // the containing "fake" row div
7683
+ var rowHeight = rowEl.height(); // TODO: cache somehow?
7684
+ var trEls = this.rowStructs[row].tbodyEl.children();
7685
+ var i, trEl;
7686
+ var trHeight;
7687
+
7688
+ function iterInnerHeights(i, childNode) {
7689
+ trHeight = Math.max(trHeight, $(childNode).outerHeight());
7690
+ }
7691
+
7692
+ // Reveal one level <tr> at a time and stop when we find one out of bounds
7693
+ for (i = 0; i < trEls.length; i++) {
7694
+ trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
7695
+
7696
+ // with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
7697
+ // so instead, find the tallest inner content element.
7698
+ trHeight = 0;
7699
+ trEl.find('> td > :first-child').each(iterInnerHeights);
7700
+
7701
+ if (trEl.position().top + trHeight > rowHeight) {
7702
+ return i;
7703
+ }
7704
+ }
7705
+
7706
+ return false; // should not limit at all
7707
+ },
7708
+
7709
+
7710
+ // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
7711
+ // `row` is the row number.
7712
+ // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
7713
+ limitRow: function(row, levelLimit) {
7714
+ var _this = this;
7715
+ var rowStruct = this.rowStructs[row];
7716
+ var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
7717
+ var col = 0; // col #, left-to-right (not chronologically)
7718
+ var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
7719
+ var cellMatrix; // a matrix (by level, then column) of all <td> jQuery elements in the row
7720
+ var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
7721
+ var i, seg;
7722
+ var segsBelow; // array of segment objects below `seg` in the current `col`
7723
+ var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
7724
+ var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
7725
+ var td, rowspan;
7726
+ var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
7727
+ var j;
7728
+ var moreTd, moreWrap, moreLink;
7729
+
7730
+ // Iterates through empty level cells and places "more" links inside if need be
7731
+ function emptyCellsUntil(endCol) { // goes from current `col` to `endCol`
7732
+ while (col < endCol) {
7733
+ segsBelow = _this.getCellSegs(row, col, levelLimit);
7734
+ if (segsBelow.length) {
7735
+ td = cellMatrix[levelLimit - 1][col];
7736
+ moreLink = _this.renderMoreLink(row, col, segsBelow);
7737
+ moreWrap = $('<div/>').append(moreLink);
7738
+ td.append(moreWrap);
7739
+ moreNodes.push(moreWrap[0]);
7740
+ }
7741
+ col++;
7742
+ }
7743
+ }
7744
+
7745
+ if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?
7746
+ levelSegs = rowStruct.segLevels[levelLimit - 1];
7747
+ cellMatrix = rowStruct.cellMatrix;
7748
+
7749
+ limitedNodes = rowStruct.tbodyEl.children().slice(levelLimit) // get level <tr> elements past the limit
7750
+ .addClass('fc-limited').get(); // hide elements and get a simple DOM-nodes array
7751
+
7752
+ // iterate though segments in the last allowable level
7753
+ for (i = 0; i < levelSegs.length; i++) {
7754
+ seg = levelSegs[i];
7755
+ emptyCellsUntil(seg.leftCol); // process empty cells before the segment
7756
+
7757
+ // determine *all* segments below `seg` that occupy the same columns
7758
+ colSegsBelow = [];
7759
+ totalSegsBelow = 0;
7760
+ while (col <= seg.rightCol) {
7761
+ segsBelow = this.getCellSegs(row, col, levelLimit);
7762
+ colSegsBelow.push(segsBelow);
7763
+ totalSegsBelow += segsBelow.length;
7764
+ col++;
7765
+ }
7766
+
7767
+ if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links?
7768
+ td = cellMatrix[levelLimit - 1][seg.leftCol]; // the segment's parent cell
7769
+ rowspan = td.attr('rowspan') || 1;
7770
+ segMoreNodes = [];
7771
+
7772
+ // make a replacement <td> for each column the segment occupies. will be one for each colspan
7773
+ for (j = 0; j < colSegsBelow.length; j++) {
7774
+ moreTd = $('<td class="fc-more-cell"/>').attr('rowspan', rowspan);
7775
+ segsBelow = colSegsBelow[j];
7776
+ moreLink = this.renderMoreLink(
7777
+ row,
7778
+ seg.leftCol + j,
7779
+ [ seg ].concat(segsBelow) // count seg as hidden too
7780
+ );
7781
+ moreWrap = $('<div/>').append(moreLink);
7782
+ moreTd.append(moreWrap);
7783
+ segMoreNodes.push(moreTd[0]);
7784
+ moreNodes.push(moreTd[0]);
7785
+ }
7786
+
7787
+ td.addClass('fc-limited').after($(segMoreNodes)); // hide original <td> and inject replacements
7788
+ limitedNodes.push(td[0]);
7789
+ }
7790
+ }
7791
+
7792
+ emptyCellsUntil(this.colCnt); // finish off the level
7793
+ rowStruct.moreEls = $(moreNodes); // for easy undoing later
7794
+ rowStruct.limitedEls = $(limitedNodes); // for easy undoing later
7795
+ }
7796
+ },
7797
+
7798
+
7799
+ // Reveals all levels and removes all "more"-related elements for a grid's row.
7800
+ // `row` is a row number.
7801
+ unlimitRow: function(row) {
7802
+ var rowStruct = this.rowStructs[row];
7803
+
7804
+ if (rowStruct.moreEls) {
7805
+ rowStruct.moreEls.remove();
7806
+ rowStruct.moreEls = null;
7807
+ }
7808
+
7809
+ if (rowStruct.limitedEls) {
7810
+ rowStruct.limitedEls.removeClass('fc-limited');
7811
+ rowStruct.limitedEls = null;
7812
+ }
7813
+ },
7814
+
7815
+
7816
+ // Renders an <a> element that represents hidden event element for a cell.
7817
+ // Responsible for attaching click handler as well.
7818
+ renderMoreLink: function(row, col, hiddenSegs) {
7819
+ var _this = this;
7820
+ var view = this.view;
7821
+
7822
+ return $('<a class="fc-more"/>')
7823
+ .text(
7824
+ this.getMoreLinkText(hiddenSegs.length)
7825
+ )
7826
+ .on('click', function(ev) {
7827
+ var clickOption = view.opt('eventLimitClick');
7828
+ var date = _this.getCellDate(row, col);
7829
+ var moreEl = $(this);
7830
+ var dayEl = _this.getCellEl(row, col);
7831
+ var allSegs = _this.getCellSegs(row, col);
7832
+
7833
+ // rescope the segments to be within the cell's date
7834
+ var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
7835
+ var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
7836
+
7837
+ if (typeof clickOption === 'function') {
7838
+ // the returned value can be an atomic option
7839
+ clickOption = view.publiclyTrigger('eventLimitClick', null, {
7840
+ date: date,
7841
+ dayEl: dayEl,
7842
+ moreEl: moreEl,
7843
+ segs: reslicedAllSegs,
7844
+ hiddenSegs: reslicedHiddenSegs
7845
+ }, ev);
7846
+ }
7847
+
7848
+ if (clickOption === 'popover') {
7849
+ _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
7850
+ }
7851
+ else if (typeof clickOption === 'string') { // a view name
7852
+ view.calendar.zoomTo(date, clickOption);
7853
+ }
7854
+ });
7855
+ },
7856
+
7857
+
7858
+ // Reveals the popover that displays all events within a cell
7859
+ showSegPopover: function(row, col, moreLink, segs) {
7860
+ var _this = this;
7861
+ var view = this.view;
7862
+ var moreWrap = moreLink.parent(); // the <div> wrapper around the <a>
7863
+ var topEl; // the element we want to match the top coordinate of
7864
+ var options;
7865
+
7866
+ if (this.rowCnt == 1) {
7867
+ topEl = view.el; // will cause the popover to cover any sort of header
7868
+ }
7869
+ else {
7870
+ topEl = this.rowEls.eq(row); // will align with top of row
7871
+ }
7872
+
7873
+ options = {
7874
+ className: 'fc-more-popover',
7875
+ content: this.renderSegPopoverContent(row, col, segs),
7876
+ parentEl: this.view.el, // attach to root of view. guarantees outside of scrollbars.
7877
+ top: topEl.offset().top,
7878
+ autoHide: true, // when the user clicks elsewhere, hide the popover
7879
+ viewportConstrain: view.opt('popoverViewportConstrain'),
7880
+ hide: function() {
7881
+ // kill everything when the popover is hidden
7882
+ // notify events to be removed
7883
+ if (_this.popoverSegs) {
7884
+ var seg;
7885
+ for (var i = 0; i < _this.popoverSegs.length; ++i) {
7886
+ seg = _this.popoverSegs[i];
7887
+ view.publiclyTrigger('eventDestroy', seg.event, seg.event, seg.el);
7888
+ }
7889
+ }
7890
+ _this.segPopover.removeElement();
7891
+ _this.segPopover = null;
7892
+ _this.popoverSegs = null;
7893
+ }
7894
+ };
7895
+
7896
+ // Determine horizontal coordinate.
7897
+ // We use the moreWrap instead of the <td> to avoid border confusion.
7898
+ if (this.isRTL) {
7899
+ options.right = moreWrap.offset().left + moreWrap.outerWidth() + 1; // +1 to be over cell border
7900
+ }
7901
+ else {
7902
+ options.left = moreWrap.offset().left - 1; // -1 to be over cell border
7903
+ }
7904
+
7905
+ this.segPopover = new Popover(options);
7906
+ this.segPopover.show();
7907
+
7908
+ // the popover doesn't live within the grid's container element, and thus won't get the event
7909
+ // delegated-handlers for free. attach event-related handlers to the popover.
7910
+ this.bindSegHandlersToEl(this.segPopover.el);
7911
+ },
7912
+
7913
+
7914
+ // Builds the inner DOM contents of the segment popover
7915
+ renderSegPopoverContent: function(row, col, segs) {
7916
+ var view = this.view;
7917
+ var isTheme = view.opt('theme');
7918
+ var title = this.getCellDate(row, col).format(view.opt('dayPopoverFormat'));
7919
+ var content = $(
7920
+ '<div class="fc-header ' + view.widgetHeaderClass + '">' +
7921
+ '<span class="fc-close ' +
7922
+ (isTheme ? 'ui-icon ui-icon-closethick' : 'fc-icon fc-icon-x') +
7923
+ '"></span>' +
7924
+ '<span class="fc-title">' +
7925
+ htmlEscape(title) +
7926
+ '</span>' +
7927
+ '<div class="fc-clear"/>' +
7928
+ '</div>' +
7929
+ '<div class="fc-body ' + view.widgetContentClass + '">' +
7930
+ '<div class="fc-event-container"></div>' +
7931
+ '</div>'
7932
+ );
7933
+ var segContainer = content.find('.fc-event-container');
7934
+ var i;
7935
+
7936
+ // render each seg's `el` and only return the visible segs
7937
+ segs = this.renderFgSegEls(segs, true); // disableResizing=true
7938
+ this.popoverSegs = segs;
7939
+
7940
+ for (i = 0; i < segs.length; i++) {
7941
+
7942
+ // because segments in the popover are not part of a grid coordinate system, provide a hint to any
7943
+ // grids that want to do drag-n-drop about which cell it came from
7944
+ this.hitsNeeded();
7945
+ segs[i].hit = this.getCellHit(row, col);
7946
+ this.hitsNotNeeded();
7947
+
7948
+ segContainer.append(segs[i].el);
7949
+ }
7950
+
7951
+ return content;
7952
+ },
7953
+
7954
+
7955
+ // Given the events within an array of segment objects, reslice them to be in a single day
7956
+ resliceDaySegs: function(segs, dayDate) {
7957
+
7958
+ // build an array of the original events
7959
+ var events = $.map(segs, function(seg) {
7960
+ return seg.event;
7961
+ });
7962
+
7963
+ var dayStart = dayDate.clone();
7964
+ var dayEnd = dayStart.clone().add(1, 'days');
7965
+ var dayRange = { start: dayStart, end: dayEnd };
7966
+
7967
+ // slice the events with a custom slicing function
7968
+ segs = this.eventsToSegs(
7969
+ events,
7970
+ function(range) {
7971
+ var seg = intersectRanges(range, dayRange); // undefind if no intersection
7972
+ return seg ? [ seg ] : []; // must return an array of segments
7973
+ }
7974
+ );
7975
+
7976
+ // force an order because eventsToSegs doesn't guarantee one
7977
+ this.sortEventSegs(segs);
7978
+
7979
+ return segs;
7980
+ },
7981
+
7982
+
7983
+ // Generates the text that should be inside a "more" link, given the number of events it represents
7984
+ getMoreLinkText: function(num) {
7985
+ var opt = this.view.opt('eventLimitText');
7986
+
7987
+ if (typeof opt === 'function') {
7988
+ return opt(num);
7989
+ }
7990
+ else {
7991
+ return '+' + num + ' ' + opt;
7992
+ }
7993
+ },
7994
+
7995
+
7996
+ // Returns segments within a given cell.
7997
+ // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
7998
+ getCellSegs: function(row, col, startLevel) {
7999
+ var segMatrix = this.rowStructs[row].segMatrix;
8000
+ var level = startLevel || 0;
8001
+ var segs = [];
8002
+ var seg;
8003
+
8004
+ while (level < segMatrix.length) {
8005
+ seg = segMatrix[level][col];
8006
+ if (seg) {
8007
+ segs.push(seg);
8008
+ }
8009
+ level++;
8010
+ }
8011
+
8012
+ return segs;
8013
+ }
8014
+
8015
+ });
8016
+
8017
+ ;;
8018
+
8019
+ /* A component that renders one or more columns of vertical time slots
8020
+ ----------------------------------------------------------------------------------------------------------------------*/
8021
+ // We mixin DayTable, even though there is only a single row of days
8022
+
8023
+ var TimeGrid = FC.TimeGrid = Grid.extend(DayTableMixin, {
8024
+
8025
+ slotDuration: null, // duration of a "slot", a distinct time segment on given day, visualized by lines
8026
+ snapDuration: null, // granularity of time for dragging and selecting
8027
+ snapsPerSlot: null,
8028
+ labelFormat: null, // formatting string for times running along vertical axis
8029
+ labelInterval: null, // duration of how often a label should be displayed for a slot
8030
+
8031
+ colEls: null, // cells elements in the day-row background
8032
+ slatContainerEl: null, // div that wraps all the slat rows
8033
+ slatEls: null, // elements running horizontally across all columns
8034
+ nowIndicatorEls: null,
8035
+
8036
+ colCoordCache: null,
8037
+ slatCoordCache: null,
8038
+
8039
+
8040
+ constructor: function() {
8041
+ Grid.apply(this, arguments); // call the super-constructor
8042
+
8043
+ this.processOptions();
8044
+ },
8045
+
8046
+
8047
+ // Renders the time grid into `this.el`, which should already be assigned.
8048
+ // Relies on the view's colCnt. In the future, this component should probably be self-sufficient.
8049
+ renderDates: function() {
8050
+ this.el.html(this.renderHtml());
8051
+ this.colEls = this.el.find('.fc-day, .fc-disabled-day');
8052
+ this.slatContainerEl = this.el.find('.fc-slats');
8053
+ this.slatEls = this.slatContainerEl.find('tr');
8054
+
8055
+ this.colCoordCache = new CoordCache({
8056
+ els: this.colEls,
8057
+ isHorizontal: true
8058
+ });
8059
+ this.slatCoordCache = new CoordCache({
8060
+ els: this.slatEls,
8061
+ isVertical: true
8062
+ });
8063
+
8064
+ this.renderContentSkeleton();
8065
+ },
8066
+
8067
+
8068
+ // Renders the basic HTML skeleton for the grid
8069
+ renderHtml: function() {
8070
+ return '' +
8071
+ '<div class="fc-bg">' +
8072
+ '<table>' +
8073
+ this.renderBgTrHtml(0) + // row=0
8074
+ '</table>' +
8075
+ '</div>' +
8076
+ '<div class="fc-slats">' +
8077
+ '<table>' +
8078
+ this.renderSlatRowHtml() +
8079
+ '</table>' +
8080
+ '</div>';
8081
+ },
8082
+
8083
+
8084
+ // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
8085
+ renderSlatRowHtml: function() {
8086
+ var view = this.view;
8087
+ var isRTL = this.isRTL;
8088
+ var html = '';
8089
+ var slotTime = moment.duration(+this.view.minTime); // wish there was .clone() for durations
8090
+ var slotDate; // will be on the view's first day, but we only care about its time
8091
+ var isLabeled;
8092
+ var axisHtml;
8093
+
8094
+ // Calculate the time for each slot
8095
+ while (slotTime < this.view.maxTime) {
8096
+ slotDate = this.start.clone().time(slotTime);
8097
+ isLabeled = isInt(divideDurationByDuration(slotTime, this.labelInterval));
8098
+
8099
+ axisHtml =
8100
+ '<td class="fc-axis fc-time ' + view.widgetContentClass + '" ' + view.axisStyleAttr() + '>' +
8101
+ (isLabeled ?
8102
+ '<span>' + // for matchCellWidths
8103
+ htmlEscape(slotDate.format(this.labelFormat)) +
8104
+ '</span>' :
8105
+ ''
8106
+ ) +
8107
+ '</td>';
8108
+
8109
+ html +=
8110
+ '<tr data-time="' + slotDate.format('HH:mm:ss') + '"' +
8111
+ (isLabeled ? '' : ' class="fc-minor"') +
8112
+ '>' +
8113
+ (!isRTL ? axisHtml : '') +
8114
+ '<td class="' + view.widgetContentClass + '"/>' +
8115
+ (isRTL ? axisHtml : '') +
8116
+ "</tr>";
8117
+
8118
+ slotTime.add(this.slotDuration);
8119
+ }
8120
+
8121
+ return html;
8122
+ },
8123
+
8124
+
8125
+ /* Options
8126
+ ------------------------------------------------------------------------------------------------------------------*/
8127
+
8128
+
8129
+ // Parses various options into properties of this object
8130
+ processOptions: function() {
8131
+ var view = this.view;
8132
+ var slotDuration = view.opt('slotDuration');
8133
+ var snapDuration = view.opt('snapDuration');
8134
+ var input;
8135
+
8136
+ slotDuration = moment.duration(slotDuration);
8137
+ snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration;
8138
+
8139
+ this.slotDuration = slotDuration;
8140
+ this.snapDuration = snapDuration;
8141
+ this.snapsPerSlot = slotDuration / snapDuration; // TODO: ensure an integer multiple?
8142
+
8143
+ this.minResizeDuration = snapDuration; // hack
8144
+
8145
+ // might be an array value (for TimelineView).
8146
+ // if so, getting the most granular entry (the last one probably).
8147
+ input = view.opt('slotLabelFormat');
8148
+ if ($.isArray(input)) {
8149
+ input = input[input.length - 1];
8150
+ }
8151
+
8152
+ this.labelFormat =
8153
+ input ||
8154
+ view.opt('smallTimeFormat'); // the computed default
8155
+
8156
+ input = view.opt('slotLabelInterval');
8157
+ this.labelInterval = input ?
8158
+ moment.duration(input) :
8159
+ this.computeLabelInterval(slotDuration);
8160
+ },
8161
+
8162
+
8163
+ // Computes an automatic value for slotLabelInterval
8164
+ computeLabelInterval: function(slotDuration) {
8165
+ var i;
8166
+ var labelInterval;
8167
+ var slotsPerLabel;
8168
+
8169
+ // find the smallest stock label interval that results in more than one slots-per-label
8170
+ for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
8171
+ labelInterval = moment.duration(AGENDA_STOCK_SUB_DURATIONS[i]);
8172
+ slotsPerLabel = divideDurationByDuration(labelInterval, slotDuration);
8173
+ if (isInt(slotsPerLabel) && slotsPerLabel > 1) {
8174
+ return labelInterval;
8175
+ }
8176
+ }
8177
+
8178
+ return moment.duration(slotDuration); // fall back. clone
8179
+ },
8180
+
8181
+
8182
+ // Computes a default event time formatting string if `timeFormat` is not explicitly defined
8183
+ computeEventTimeFormat: function() {
8184
+ return this.view.opt('noMeridiemTimeFormat'); // like "6:30" (no AM/PM)
8185
+ },
8186
+
8187
+
8188
+ // Computes a default `displayEventEnd` value if one is not expliclty defined
8189
+ computeDisplayEventEnd: function() {
8190
+ return true;
8191
+ },
8192
+
8193
+
8194
+ /* Hit System
8195
+ ------------------------------------------------------------------------------------------------------------------*/
8196
+
8197
+
8198
+ prepareHits: function() {
8199
+ this.colCoordCache.build();
8200
+ this.slatCoordCache.build();
8201
+ },
8202
+
8203
+
8204
+ releaseHits: function() {
8205
+ this.colCoordCache.clear();
8206
+ // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop
8207
+ },
8208
+
8209
+
8210
+ queryHit: function(leftOffset, topOffset) {
8211
+ var snapsPerSlot = this.snapsPerSlot;
8212
+ var colCoordCache = this.colCoordCache;
8213
+ var slatCoordCache = this.slatCoordCache;
8214
+
8215
+ if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) {
8216
+ var colIndex = colCoordCache.getHorizontalIndex(leftOffset);
8217
+ var slatIndex = slatCoordCache.getVerticalIndex(topOffset);
8218
+
8219
+ if (colIndex != null && slatIndex != null) {
8220
+ var slatTop = slatCoordCache.getTopOffset(slatIndex);
8221
+ var slatHeight = slatCoordCache.getHeight(slatIndex);
8222
+ var partial = (topOffset - slatTop) / slatHeight; // floating point number between 0 and 1
8223
+ var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
8224
+ var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
8225
+ var snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight;
8226
+ var snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight;
8227
+
8228
+ return {
8229
+ col: colIndex,
8230
+ snap: snapIndex,
8231
+ component: this, // needed unfortunately :(
8232
+ left: colCoordCache.getLeftOffset(colIndex),
8233
+ right: colCoordCache.getRightOffset(colIndex),
8234
+ top: snapTop,
8235
+ bottom: snapBottom
8236
+ };
8237
+ }
8238
+ }
8239
+ },
8240
+
8241
+
8242
+ getHitSpan: function(hit) {
8243
+ var start = this.getCellDate(0, hit.col); // row=0
8244
+ var time = this.computeSnapTime(hit.snap); // pass in the snap-index
8245
+ var end;
8246
+
8247
+ start.time(time);
8248
+ end = start.clone().add(this.snapDuration);
8249
+
8250
+ return { start: start, end: end };
8251
+ },
8252
+
8253
+
8254
+ getHitEl: function(hit) {
8255
+ return this.colEls.eq(hit.col);
8256
+ },
8257
+
8258
+
8259
+ /* Dates
8260
+ ------------------------------------------------------------------------------------------------------------------*/
8261
+
8262
+
8263
+ rangeUpdated: function() {
8264
+ this.updateDayTable();
8265
+ },
8266
+
8267
+
8268
+ // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day
8269
+ computeSnapTime: function(snapIndex) {
8270
+ return moment.duration(this.view.minTime + this.snapDuration * snapIndex);
8271
+ },
8272
+
8273
+
8274
+ // Slices up the given span (unzoned start/end with other misc data) into an array of segments
8275
+ spanToSegs: function(span) {
8276
+ var segs = this.sliceRangeByTimes(span);
8277
+ var i;
8278
+
8279
+ for (i = 0; i < segs.length; i++) {
8280
+ if (this.isRTL) {
8281
+ segs[i].col = this.daysPerRow - 1 - segs[i].dayIndex;
8282
+ }
8283
+ else {
8284
+ segs[i].col = segs[i].dayIndex;
8285
+ }
8286
+ }
8287
+
8288
+ return segs;
8289
+ },
8290
+
8291
+
8292
+ sliceRangeByTimes: function(range) {
8293
+ var segs = [];
8294
+ var seg;
8295
+ var dayIndex;
8296
+ var dayDate;
8297
+ var dayRange;
8298
+
8299
+ for (dayIndex = 0; dayIndex < this.daysPerRow; dayIndex++) {
8300
+ dayDate = this.dayDates[dayIndex].clone().time(0); // TODO: better API for this?
8301
+ dayRange = {
8302
+ start: dayDate.clone().add(this.view.minTime), // don't use .time() because it sux with negatives
8303
+ end: dayDate.clone().add(this.view.maxTime)
8304
+ };
8305
+ seg = intersectRanges(range, dayRange); // both will be ambig timezone
8306
+ if (seg) {
8307
+ seg.dayIndex = dayIndex;
8308
+ segs.push(seg);
8309
+ }
8310
+ }
8311
+
8312
+ return segs;
8313
+ },
8314
+
8315
+
8316
+ /* Coordinates
8317
+ ------------------------------------------------------------------------------------------------------------------*/
8318
+
8319
+
8320
+ updateSize: function(isResize) { // NOT a standard Grid method
8321
+ this.slatCoordCache.build();
8322
+
8323
+ if (isResize) {
8324
+ this.updateSegVerticals(
8325
+ [].concat(this.fgSegs || [], this.bgSegs || [], this.businessSegs || [])
8326
+ );
8327
+ }
8328
+ },
8329
+
8330
+
8331
+ getTotalSlatHeight: function() {
8332
+ return this.slatContainerEl.outerHeight();
8333
+ },
8334
+
8335
+
8336
+ // Computes the top coordinate, relative to the bounds of the grid, of the given date.
8337
+ // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
8338
+ computeDateTop: function(date, startOfDayDate) {
8339
+ return this.computeTimeTop(
8340
+ moment.duration(
8341
+ date - startOfDayDate.clone().stripTime()
8342
+ )
8343
+ );
8344
+ },
8345
+
8346
+
8347
+ // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
8348
+ computeTimeTop: function(time) {
8349
+ var len = this.slatEls.length;
8350
+ var slatCoverage = (time - this.view.minTime) / this.slotDuration; // floating-point value of # of slots covered
8351
+ var slatIndex;
8352
+ var slatRemainder;
8353
+
8354
+ // compute a floating-point number for how many slats should be progressed through.
8355
+ // from 0 to number of slats (inclusive)
8356
+ // constrained because minTime/maxTime might be customized.
8357
+ slatCoverage = Math.max(0, slatCoverage);
8358
+ slatCoverage = Math.min(len, slatCoverage);
8359
+
8360
+ // an integer index of the furthest whole slat
8361
+ // from 0 to number slats (*exclusive*, so len-1)
8362
+ slatIndex = Math.floor(slatCoverage);
8363
+ slatIndex = Math.min(slatIndex, len - 1);
8364
+
8365
+ // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
8366
+ // could be 1.0 if slatCoverage is covering *all* the slots
8367
+ slatRemainder = slatCoverage - slatIndex;
8368
+
8369
+ return this.slatCoordCache.getTopPosition(slatIndex) +
8370
+ this.slatCoordCache.getHeight(slatIndex) * slatRemainder;
8371
+ },
8372
+
8373
+
8374
+
8375
+ /* Event Drag Visualization
8376
+ ------------------------------------------------------------------------------------------------------------------*/
8377
+
8378
+
8379
+ // Renders a visual indication of an event being dragged over the specified date(s).
8380
+ // A returned value of `true` signals that a mock "helper" event has been rendered.
8381
+ renderDrag: function(eventLocation, seg) {
8382
+ var eventSpans;
8383
+ var i;
8384
+
8385
+ if (seg) { // if there is event information for this drag, render a helper event
8386
+
8387
+ // returns mock event elements
8388
+ // signal that a helper has been rendered
8389
+ return this.renderEventLocationHelper(eventLocation, seg);
8390
+ }
8391
+ else { // otherwise, just render a highlight
8392
+ eventSpans = this.eventToSpans(eventLocation);
8393
+
8394
+ for (i = 0; i < eventSpans.length; i++) {
8395
+ this.renderHighlight(eventSpans[i]);
8396
+ }
8397
+ }
8398
+ },
8399
+
8400
+
8401
+ // Unrenders any visual indication of an event being dragged
8402
+ unrenderDrag: function() {
8403
+ this.unrenderHelper();
8404
+ this.unrenderHighlight();
8405
+ },
8406
+
8407
+
8408
+ /* Event Resize Visualization
8409
+ ------------------------------------------------------------------------------------------------------------------*/
8410
+
8411
+
8412
+ // Renders a visual indication of an event being resized
8413
+ renderEventResize: function(eventLocation, seg) {
8414
+ return this.renderEventLocationHelper(eventLocation, seg); // returns mock event elements
8415
+ },
8416
+
8417
+
8418
+ // Unrenders any visual indication of an event being resized
8419
+ unrenderEventResize: function() {
8420
+ this.unrenderHelper();
8421
+ },
8422
+
8423
+
8424
+ /* Event Helper
8425
+ ------------------------------------------------------------------------------------------------------------------*/
8426
+
8427
+
8428
+ // Renders a mock "helper" event. `sourceSeg` is the original segment object and might be null (an external drag)
8429
+ renderHelper: function(event, sourceSeg) {
8430
+ return this.renderHelperSegs(this.eventToSegs(event), sourceSeg); // returns mock event elements
8431
+ },
8432
+
8433
+
8434
+ // Unrenders any mock helper event
8435
+ unrenderHelper: function() {
8436
+ this.unrenderHelperSegs();
8437
+ },
8438
+
8439
+
8440
+ /* Business Hours
8441
+ ------------------------------------------------------------------------------------------------------------------*/
8442
+
8443
+
8444
+ renderBusinessHours: function() {
8445
+ this.renderBusinessSegs(
8446
+ this.buildBusinessHourSegs()
8447
+ );
8448
+ },
8449
+
8450
+
8451
+ unrenderBusinessHours: function() {
8452
+ this.unrenderBusinessSegs();
8453
+ },
8454
+
8455
+
8456
+ /* Now Indicator
8457
+ ------------------------------------------------------------------------------------------------------------------*/
8458
+
8459
+
8460
+ getNowIndicatorUnit: function() {
8461
+ return 'minute'; // will refresh on the minute
8462
+ },
8463
+
8464
+
8465
+ renderNowIndicator: function(date) {
8466
+ // seg system might be overkill, but it handles scenario where line needs to be rendered
8467
+ // more than once because of columns with the same date (resources columns for example)
8468
+ var segs = this.spanToSegs({ start: date, end: date });
8469
+ var top = this.computeDateTop(date, date);
8470
+ var nodes = [];
8471
+ var i;
8472
+
8473
+ // render lines within the columns
8474
+ for (i = 0; i < segs.length; i++) {
8475
+ nodes.push($('<div class="fc-now-indicator fc-now-indicator-line"></div>')
8476
+ .css('top', top)
8477
+ .appendTo(this.colContainerEls.eq(segs[i].col))[0]);
8478
+ }
8479
+
8480
+ // render an arrow over the axis
8481
+ if (segs.length > 0) { // is the current time in view?
8482
+ nodes.push($('<div class="fc-now-indicator fc-now-indicator-arrow"></div>')
8483
+ .css('top', top)
8484
+ .appendTo(this.el.find('.fc-content-skeleton'))[0]);
8485
+ }
8486
+
8487
+ this.nowIndicatorEls = $(nodes);
8488
+ },
8489
+
8490
+
8491
+ unrenderNowIndicator: function() {
8492
+ if (this.nowIndicatorEls) {
8493
+ this.nowIndicatorEls.remove();
8494
+ this.nowIndicatorEls = null;
8495
+ }
8496
+ },
8497
+
8498
+
8499
+ /* Selection
8500
+ ------------------------------------------------------------------------------------------------------------------*/
8501
+
8502
+
8503
+ // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
8504
+ renderSelection: function(span) {
8505
+ if (this.view.opt('selectHelper')) { // this setting signals that a mock helper event should be rendered
8506
+
8507
+ // normally acceps an eventLocation, span has a start/end, which is good enough
8508
+ this.renderEventLocationHelper(span);
8509
+ }
8510
+ else {
8511
+ this.renderHighlight(span);
8512
+ }
8513
+ },
8514
+
8515
+
8516
+ // Unrenders any visual indication of a selection
8517
+ unrenderSelection: function() {
8518
+ this.unrenderHelper();
8519
+ this.unrenderHighlight();
8520
+ },
8521
+
8522
+
8523
+ /* Highlight
8524
+ ------------------------------------------------------------------------------------------------------------------*/
8525
+
8526
+
8527
+ renderHighlight: function(span) {
8528
+ this.renderHighlightSegs(this.spanToSegs(span));
8529
+ },
8530
+
8531
+
8532
+ unrenderHighlight: function() {
8533
+ this.unrenderHighlightSegs();
8534
+ }
8535
+
8536
+ });
8537
+
8538
+ ;;
8539
+
8540
+ /* Methods for rendering SEGMENTS, pieces of content that live on the view
8541
+ ( this file is no longer just for events )
8542
+ ----------------------------------------------------------------------------------------------------------------------*/
8543
+
8544
+ TimeGrid.mixin({
8545
+
8546
+ colContainerEls: null, // containers for each column
8547
+
8548
+ // inner-containers for each column where different types of segs live
8549
+ fgContainerEls: null,
8550
+ bgContainerEls: null,
8551
+ helperContainerEls: null,
8552
+ highlightContainerEls: null,
8553
+ businessContainerEls: null,
8554
+
8555
+ // arrays of different types of displayed segments
8556
+ fgSegs: null,
8557
+ bgSegs: null,
8558
+ helperSegs: null,
8559
+ highlightSegs: null,
8560
+ businessSegs: null,
8561
+
8562
+
8563
+ // Renders the DOM that the view's content will live in
8564
+ renderContentSkeleton: function() {
8565
+ var cellHtml = '';
8566
+ var i;
8567
+ var skeletonEl;
8568
+
8569
+ for (i = 0; i < this.colCnt; i++) {
8570
+ cellHtml +=
8571
+ '<td>' +
8572
+ '<div class="fc-content-col">' +
8573
+ '<div class="fc-event-container fc-helper-container"></div>' +
8574
+ '<div class="fc-event-container"></div>' +
8575
+ '<div class="fc-highlight-container"></div>' +
8576
+ '<div class="fc-bgevent-container"></div>' +
8577
+ '<div class="fc-business-container"></div>' +
8578
+ '</div>' +
8579
+ '</td>';
8580
+ }
8581
+
8582
+ skeletonEl = $(
8583
+ '<div class="fc-content-skeleton">' +
8584
+ '<table>' +
8585
+ '<tr>' + cellHtml + '</tr>' +
8586
+ '</table>' +
8587
+ '</div>'
8588
+ );
8589
+
8590
+ this.colContainerEls = skeletonEl.find('.fc-content-col');
8591
+ this.helperContainerEls = skeletonEl.find('.fc-helper-container');
8592
+ this.fgContainerEls = skeletonEl.find('.fc-event-container:not(.fc-helper-container)');
8593
+ this.bgContainerEls = skeletonEl.find('.fc-bgevent-container');
8594
+ this.highlightContainerEls = skeletonEl.find('.fc-highlight-container');
8595
+ this.businessContainerEls = skeletonEl.find('.fc-business-container');
8596
+
8597
+ this.bookendCells(skeletonEl.find('tr')); // TODO: do this on string level
8598
+ this.el.append(skeletonEl);
8599
+ },
8600
+
8601
+
8602
+ /* Foreground Events
8603
+ ------------------------------------------------------------------------------------------------------------------*/
8604
+
8605
+
8606
+ renderFgSegs: function(segs) {
8607
+ segs = this.renderFgSegsIntoContainers(segs, this.fgContainerEls);
8608
+ this.fgSegs = segs;
8609
+ return segs; // needed for Grid::renderEvents
8610
+ },
8611
+
8612
+
8613
+ unrenderFgSegs: function() {
8614
+ this.unrenderNamedSegs('fgSegs');
8615
+ },
8616
+
8617
+
8618
+ /* Foreground Helper Events
8619
+ ------------------------------------------------------------------------------------------------------------------*/
8620
+
8621
+
8622
+ renderHelperSegs: function(segs, sourceSeg) {
8623
+ var helperEls = [];
8624
+ var i, seg;
8625
+ var sourceEl;
8626
+
8627
+ segs = this.renderFgSegsIntoContainers(segs, this.helperContainerEls);
8628
+
8629
+ // Try to make the segment that is in the same row as sourceSeg look the same
8630
+ for (i = 0; i < segs.length; i++) {
8631
+ seg = segs[i];
8632
+ if (sourceSeg && sourceSeg.col === seg.col) {
8633
+ sourceEl = sourceSeg.el;
8634
+ seg.el.css({
8635
+ left: sourceEl.css('left'),
8636
+ right: sourceEl.css('right'),
8637
+ 'margin-left': sourceEl.css('margin-left'),
8638
+ 'margin-right': sourceEl.css('margin-right')
8639
+ });
8640
+ }
8641
+ helperEls.push(seg.el[0]);
8642
+ }
8643
+
8644
+ this.helperSegs = segs;
8645
+
8646
+ return $(helperEls); // must return rendered helpers
8647
+ },
8648
+
8649
+
8650
+ unrenderHelperSegs: function() {
8651
+ this.unrenderNamedSegs('helperSegs');
8652
+ },
8653
+
8654
+
8655
+ /* Background Events
8656
+ ------------------------------------------------------------------------------------------------------------------*/
8657
+
8658
+
8659
+ renderBgSegs: function(segs) {
8660
+ segs = this.renderFillSegEls('bgEvent', segs); // TODO: old fill system
8661
+ this.updateSegVerticals(segs);
8662
+ this.attachSegsByCol(this.groupSegsByCol(segs), this.bgContainerEls);
8663
+ this.bgSegs = segs;
8664
+ return segs; // needed for Grid::renderEvents
8665
+ },
8666
+
8667
+
8668
+ unrenderBgSegs: function() {
8669
+ this.unrenderNamedSegs('bgSegs');
8670
+ },
8671
+
8672
+
8673
+ /* Highlight
8674
+ ------------------------------------------------------------------------------------------------------------------*/
8675
+
8676
+
8677
+ renderHighlightSegs: function(segs) {
8678
+ segs = this.renderFillSegEls('highlight', segs); // TODO: old fill system
8679
+ this.updateSegVerticals(segs);
8680
+ this.attachSegsByCol(this.groupSegsByCol(segs), this.highlightContainerEls);
8681
+ this.highlightSegs = segs;
8682
+ },
8683
+
8684
+
8685
+ unrenderHighlightSegs: function() {
8686
+ this.unrenderNamedSegs('highlightSegs');
8687
+ },
8688
+
8689
+
8690
+ /* Business Hours
8691
+ ------------------------------------------------------------------------------------------------------------------*/
8692
+
8693
+
8694
+ renderBusinessSegs: function(segs) {
8695
+ segs = this.renderFillSegEls('businessHours', segs); // TODO: old fill system
8696
+ this.updateSegVerticals(segs);
8697
+ this.attachSegsByCol(this.groupSegsByCol(segs), this.businessContainerEls);
8698
+ this.businessSegs = segs;
8699
+ },
8700
+
8701
+
8702
+ unrenderBusinessSegs: function() {
8703
+ this.unrenderNamedSegs('businessSegs');
8704
+ },
8705
+
8706
+
8707
+ /* Seg Rendering Utils
8708
+ ------------------------------------------------------------------------------------------------------------------*/
8709
+
8710
+
8711
+ // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
8712
+ groupSegsByCol: function(segs) {
8713
+ var segsByCol = [];
8714
+ var i;
8715
+
8716
+ for (i = 0; i < this.colCnt; i++) {
8717
+ segsByCol.push([]);
8718
+ }
8719
+
8720
+ for (i = 0; i < segs.length; i++) {
8721
+ segsByCol[segs[i].col].push(segs[i]);
8722
+ }
8723
+
8724
+ return segsByCol;
8725
+ },
8726
+
8727
+
8728
+ // Given segments grouped by column, insert the segments' elements into a parallel array of container
8729
+ // elements, each living within a column.
8730
+ attachSegsByCol: function(segsByCol, containerEls) {
8731
+ var col;
8732
+ var segs;
8733
+ var i;
8734
+
8735
+ for (col = 0; col < this.colCnt; col++) { // iterate each column grouping
8736
+ segs = segsByCol[col];
8737
+
8738
+ for (i = 0; i < segs.length; i++) {
8739
+ containerEls.eq(col).append(segs[i].el);
8740
+ }
8741
+ }
8742
+ },
8743
+
8744
+
8745
+ // Given the name of a property of `this` object, assumed to be an array of segments,
8746
+ // loops through each segment and removes from DOM. Will null-out the property afterwards.
8747
+ unrenderNamedSegs: function(propName) {
8748
+ var segs = this[propName];
8749
+ var i;
8750
+
8751
+ if (segs) {
8752
+ for (i = 0; i < segs.length; i++) {
8753
+ segs[i].el.remove();
8754
+ }
8755
+ this[propName] = null;
8756
+ }
8757
+ },
8758
+
8759
+
8760
+
8761
+ /* Foreground Event Rendering Utils
8762
+ ------------------------------------------------------------------------------------------------------------------*/
8763
+
8764
+
8765
+ // Given an array of foreground segments, render a DOM element for each, computes position,
8766
+ // and attaches to the column inner-container elements.
8767
+ renderFgSegsIntoContainers: function(segs, containerEls) {
8768
+ var segsByCol;
8769
+ var col;
8770
+
8771
+ segs = this.renderFgSegEls(segs); // will call fgSegHtml
8772
+ segsByCol = this.groupSegsByCol(segs);
8773
+
8774
+ for (col = 0; col < this.colCnt; col++) {
8775
+ this.updateFgSegCoords(segsByCol[col]);
8776
+ }
8777
+
8778
+ this.attachSegsByCol(segsByCol, containerEls);
8779
+
8780
+ return segs;
8781
+ },
8782
+
8783
+
8784
+ // Renders the HTML for a single event segment's default rendering
8785
+ fgSegHtml: function(seg, disableResizing) {
8786
+ var view = this.view;
8787
+ var event = seg.event;
8788
+ var isDraggable = view.isEventDraggable(event);
8789
+ var isResizableFromStart = !disableResizing && seg.isStart && view.isEventResizableFromStart(event);
8790
+ var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventResizableFromEnd(event);
8791
+ var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
8792
+ var skinCss = cssToStr(this.getSegSkinCss(seg));
8793
+ var timeText;
8794
+ var fullTimeText; // more verbose time text. for the print stylesheet
8795
+ var startTimeText; // just the start time text
8796
+
8797
+ classes.unshift('fc-time-grid-event', 'fc-v-event');
8798
+
8799
+ if (view.isMultiDayEvent(event)) { // if the event appears to span more than one day...
8800
+ // Don't display time text on segments that run entirely through a day.
8801
+ // That would appear as midnight-midnight and would look dumb.
8802
+ // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
8803
+ if (seg.isStart || seg.isEnd) {
8804
+ timeText = this.getEventTimeText(seg);
8805
+ fullTimeText = this.getEventTimeText(seg, 'LT');
8806
+ startTimeText = this.getEventTimeText(seg, null, false); // displayEnd=false
8807
+ }
8808
+ } else {
8809
+ // Display the normal time text for the *event's* times
8810
+ timeText = this.getEventTimeText(event);
8811
+ fullTimeText = this.getEventTimeText(event, 'LT');
8812
+ startTimeText = this.getEventTimeText(event, null, false); // displayEnd=false
8813
+ }
8814
+
8815
+ return '<a class="' + classes.join(' ') + '"' +
8816
+ (event.url ?
8817
+ ' href="' + htmlEscape(event.url) + '"' :
8818
+ ''
8819
+ ) +
8820
+ (skinCss ?
8821
+ ' style="' + skinCss + '"' :
8822
+ ''
8823
+ ) +
8824
+ '>' +
8825
+ '<div class="fc-content">' +
8826
+ (timeText ?
8827
+ '<div class="fc-time"' +
8828
+ ' data-start="' + htmlEscape(startTimeText) + '"' +
8829
+ ' data-full="' + htmlEscape(fullTimeText) + '"' +
8830
+ '>' +
8831
+ '<span>' + htmlEscape(timeText) + '</span>' +
8832
+ '</div>' :
8833
+ ''
8834
+ ) +
8835
+ (event.title ?
8836
+ '<div class="fc-title">' +
8837
+ htmlEscape(event.title) +
8838
+ '</div>' :
8839
+ ''
8840
+ ) +
8841
+ '</div>' +
8842
+ '<div class="fc-bg"/>' +
8843
+ /* TODO: write CSS for this
8844
+ (isResizableFromStart ?
8845
+ '<div class="fc-resizer fc-start-resizer" />' :
8846
+ ''
8847
+ ) +
8848
+ */
8849
+ (isResizableFromEnd ?
8850
+ '<div class="fc-resizer fc-end-resizer" />' :
8851
+ ''
8852
+ ) +
8853
+ '</a>';
8854
+ },
8855
+
8856
+
8857
+ /* Seg Position Utils
8858
+ ------------------------------------------------------------------------------------------------------------------*/
8859
+
8860
+
8861
+ // Refreshes the CSS top/bottom coordinates for each segment element.
8862
+ // Works when called after initial render, after a window resize/zoom for example.
8863
+ updateSegVerticals: function(segs) {
8864
+ this.computeSegVerticals(segs);
8865
+ this.assignSegVerticals(segs);
8866
+ },
8867
+
8868
+
8869
+ // For each segment in an array, computes and assigns its top and bottom properties
8870
+ computeSegVerticals: function(segs) {
8871
+ var i, seg;
8872
+ var dayDate;
8873
+
8874
+ for (i = 0; i < segs.length; i++) {
8875
+ seg = segs[i];
8876
+ dayDate = this.dayDates[seg.dayIndex];
8877
+
8878
+ seg.top = this.computeDateTop(seg.start, dayDate);
8879
+ seg.bottom = this.computeDateTop(seg.end, dayDate);
8880
+ }
8881
+ },
8882
+
8883
+
8884
+ // Given segments that already have their top/bottom properties computed, applies those values to
8885
+ // the segments' elements.
8886
+ assignSegVerticals: function(segs) {
8887
+ var i, seg;
8888
+
8889
+ for (i = 0; i < segs.length; i++) {
8890
+ seg = segs[i];
8891
+ seg.el.css(this.generateSegVerticalCss(seg));
8892
+ }
8893
+ },
8894
+
8895
+
8896
+ // Generates an object with CSS properties for the top/bottom coordinates of a segment element
8897
+ generateSegVerticalCss: function(seg) {
8898
+ return {
8899
+ top: seg.top,
8900
+ bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
8901
+ };
8902
+ },
8903
+
8904
+
8905
+ /* Foreground Event Positioning Utils
8906
+ ------------------------------------------------------------------------------------------------------------------*/
8907
+
8908
+
8909
+ // Given segments that are assumed to all live in the *same column*,
8910
+ // compute their verical/horizontal coordinates and assign to their elements.
8911
+ updateFgSegCoords: function(segs) {
8912
+ this.computeSegVerticals(segs); // horizontals relies on this
8913
+ this.computeFgSegHorizontals(segs); // compute horizontal coordinates, z-index's, and reorder the array
8914
+ this.assignSegVerticals(segs);
8915
+ this.assignFgSegHorizontals(segs);
8916
+ },
8917
+
8918
+
8919
+ // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
8920
+ // NOTE: Also reorders the given array by date!
8921
+ computeFgSegHorizontals: function(segs) {
8922
+ var levels;
8923
+ var level0;
8924
+ var i;
8925
+
8926
+ this.sortEventSegs(segs); // order by certain criteria
8927
+ levels = buildSlotSegLevels(segs);
8928
+ computeForwardSlotSegs(levels);
8929
+
8930
+ if ((level0 = levels[0])) {
8931
+
8932
+ for (i = 0; i < level0.length; i++) {
8933
+ computeSlotSegPressures(level0[i]);
8934
+ }
8935
+
8936
+ for (i = 0; i < level0.length; i++) {
8937
+ this.computeFgSegForwardBack(level0[i], 0, 0);
8938
+ }
8939
+ }
8940
+ },
8941
+
8942
+
8943
+ // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
8944
+ // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
8945
+ // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
8946
+ //
8947
+ // The segment might be part of a "series", which means consecutive segments with the same pressure
8948
+ // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
8949
+ // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
8950
+ // coordinate of the first segment in the series.
8951
+ computeFgSegForwardBack: function(seg, seriesBackwardPressure, seriesBackwardCoord) {
8952
+ var forwardSegs = seg.forwardSegs;
8953
+ var i;
8954
+
8955
+ if (seg.forwardCoord === undefined) { // not already computed
8956
+
8957
+ if (!forwardSegs.length) {
8958
+
8959
+ // if there are no forward segments, this segment should butt up against the edge
8960
+ seg.forwardCoord = 1;
8961
+ }
8962
+ else {
8963
+
8964
+ // sort highest pressure first
8965
+ this.sortForwardSegs(forwardSegs);
8966
+
8967
+ // this segment's forwardCoord will be calculated from the backwardCoord of the
8968
+ // highest-pressure forward segment.
8969
+ this.computeFgSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
8970
+ seg.forwardCoord = forwardSegs[0].backwardCoord;
8971
+ }
8972
+
8973
+ // calculate the backwardCoord from the forwardCoord. consider the series
8974
+ seg.backwardCoord = seg.forwardCoord -
8975
+ (seg.forwardCoord - seriesBackwardCoord) / // available width for series
8976
+ (seriesBackwardPressure + 1); // # of segments in the series
8977
+
8978
+ // use this segment's coordinates to computed the coordinates of the less-pressurized
8979
+ // forward segments
8980
+ for (i=0; i<forwardSegs.length; i++) {
8981
+ this.computeFgSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
8982
+ }
8983
+ }
8984
+ },
8985
+
8986
+
8987
+ sortForwardSegs: function(forwardSegs) {
8988
+ forwardSegs.sort(proxy(this, 'compareForwardSegs'));
8989
+ },
8990
+
8991
+
8992
+ // A cmp function for determining which forward segment to rely on more when computing coordinates.
8993
+ compareForwardSegs: function(seg1, seg2) {
8994
+ // put higher-pressure first
8995
+ return seg2.forwardPressure - seg1.forwardPressure ||
8996
+ // put segments that are closer to initial edge first (and favor ones with no coords yet)
8997
+ (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||
8998
+ // do normal sorting...
8999
+ this.compareEventSegs(seg1, seg2);
9000
+ },
9001
+
9002
+
9003
+ // Given foreground event segments that have already had their position coordinates computed,
9004
+ // assigns position-related CSS values to their elements.
9005
+ assignFgSegHorizontals: function(segs) {
9006
+ var i, seg;
9007
+
9008
+ for (i = 0; i < segs.length; i++) {
9009
+ seg = segs[i];
9010
+ seg.el.css(this.generateFgSegHorizontalCss(seg));
9011
+
9012
+ // if the height is short, add a className for alternate styling
9013
+ if (seg.bottom - seg.top < 30) {
9014
+ seg.el.addClass('fc-short');
9015
+ }
9016
+ }
9017
+ },
9018
+
9019
+
9020
+ // Generates an object with CSS properties/values that should be applied to an event segment element.
9021
+ // Contains important positioning-related properties that should be applied to any event element, customized or not.
9022
+ generateFgSegHorizontalCss: function(seg) {
9023
+ var shouldOverlap = this.view.opt('slotEventOverlap');
9024
+ var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
9025
+ var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
9026
+ var props = this.generateSegVerticalCss(seg); // get top/bottom first
9027
+ var left; // amount of space from left edge, a fraction of the total width
9028
+ var right; // amount of space from right edge, a fraction of the total width
9029
+
9030
+ if (shouldOverlap) {
9031
+ // double the width, but don't go beyond the maximum forward coordinate (1.0)
9032
+ forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
9033
+ }
9034
+
9035
+ if (this.isRTL) {
9036
+ left = 1 - forwardCoord;
9037
+ right = backwardCoord;
9038
+ }
9039
+ else {
9040
+ left = backwardCoord;
9041
+ right = 1 - forwardCoord;
9042
+ }
9043
+
9044
+ props.zIndex = seg.level + 1; // convert from 0-base to 1-based
9045
+ props.left = left * 100 + '%';
9046
+ props.right = right * 100 + '%';
9047
+
9048
+ if (shouldOverlap && seg.forwardPressure) {
9049
+ // add padding to the edge so that forward stacked events don't cover the resizer's icon
9050
+ props[this.isRTL ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
9051
+ }
9052
+
9053
+ return props;
9054
+ }
9055
+
9056
+ });
9057
+
9058
+
9059
+ // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
9060
+ // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
9061
+ function buildSlotSegLevels(segs) {
9062
+ var levels = [];
9063
+ var i, seg;
9064
+ var j;
9065
+
9066
+ for (i=0; i<segs.length; i++) {
9067
+ seg = segs[i];
9068
+
9069
+ // go through all the levels and stop on the first level where there are no collisions
9070
+ for (j=0; j<levels.length; j++) {
9071
+ if (!computeSlotSegCollisions(seg, levels[j]).length) {
9072
+ break;
9073
+ }
9074
+ }
9075
+
9076
+ seg.level = j;
9077
+
9078
+ (levels[j] || (levels[j] = [])).push(seg);
9079
+ }
9080
+
9081
+ return levels;
9082
+ }
9083
+
9084
+
9085
+ // For every segment, figure out the other segments that are in subsequent
9086
+ // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
9087
+ function computeForwardSlotSegs(levels) {
9088
+ var i, level;
9089
+ var j, seg;
9090
+ var k;
9091
+
9092
+ for (i=0; i<levels.length; i++) {
9093
+ level = levels[i];
9094
+
9095
+ for (j=0; j<level.length; j++) {
9096
+ seg = level[j];
9097
+
9098
+ seg.forwardSegs = [];
9099
+ for (k=i+1; k<levels.length; k++) {
9100
+ computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
9101
+ }
9102
+ }
9103
+ }
9104
+ }
9105
+
9106
+
9107
+ // Figure out which path forward (via seg.forwardSegs) results in the longest path until
9108
+ // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
9109
+ function computeSlotSegPressures(seg) {
9110
+ var forwardSegs = seg.forwardSegs;
9111
+ var forwardPressure = 0;
9112
+ var i, forwardSeg;
9113
+
9114
+ if (seg.forwardPressure === undefined) { // not already computed
9115
+
9116
+ for (i=0; i<forwardSegs.length; i++) {
9117
+ forwardSeg = forwardSegs[i];
9118
+
9119
+ // figure out the child's maximum forward path
9120
+ computeSlotSegPressures(forwardSeg);
9121
+
9122
+ // either use the existing maximum, or use the child's forward pressure
9123
+ // plus one (for the forwardSeg itself)
9124
+ forwardPressure = Math.max(
9125
+ forwardPressure,
9126
+ 1 + forwardSeg.forwardPressure
9127
+ );
9128
+ }
9129
+
9130
+ seg.forwardPressure = forwardPressure;
9131
+ }
9132
+ }
9133
+
9134
+
9135
+ // Find all the segments in `otherSegs` that vertically collide with `seg`.
9136
+ // Append into an optionally-supplied `results` array and return.
9137
+ function computeSlotSegCollisions(seg, otherSegs, results) {
9138
+ results = results || [];
9139
+
9140
+ for (var i=0; i<otherSegs.length; i++) {
9141
+ if (isSlotSegCollision(seg, otherSegs[i])) {
9142
+ results.push(otherSegs[i]);
9143
+ }
9144
+ }
9145
+
9146
+ return results;
9147
+ }
9148
+
9149
+
9150
+ // Do these segments occupy the same vertical space?
9151
+ function isSlotSegCollision(seg1, seg2) {
9152
+ return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
9153
+ }
9154
+
9155
+ ;;
9156
+
9157
+ /* An abstract class from which other views inherit from
9158
+ ----------------------------------------------------------------------------------------------------------------------*/
9159
+
9160
+ var View = FC.View = Model.extend({
9161
+
9162
+ type: null, // subclass' view name (string)
9163
+ name: null, // deprecated. use `type` instead
9164
+ title: null, // the text that will be displayed in the header's title
9165
+
9166
+ calendar: null, // owner Calendar object
9167
+ viewSpec: null,
9168
+ options: null, // hash containing all options. already merged with view-specific-options
9169
+ el: null, // the view's containing element. set by Calendar
9170
+
9171
+ renderQueue: null,
9172
+ batchRenderDepth: 0,
9173
+ isDatesRendered: false,
9174
+ isEventsRendered: false,
9175
+ isBaseRendered: false, // related to viewRender/viewDestroy triggers
9176
+
9177
+ queuedScroll: null,
9178
+
9179
+ isRTL: false,
9180
+ isSelected: false, // boolean whether a range of time is user-selected or not
9181
+ selectedEvent: null,
9182
+
9183
+ eventOrderSpecs: null, // criteria for ordering events when they have same date/time
9184
+
9185
+ // classNames styled by jqui themes
9186
+ widgetHeaderClass: null,
9187
+ widgetContentClass: null,
9188
+ highlightStateClass: null,
9189
+
9190
+ // for date utils, computed from options
9191
+ nextDayThreshold: null,
9192
+ isHiddenDayHash: null,
9193
+
9194
+ // now indicator
9195
+ isNowIndicatorRendered: null,
9196
+ initialNowDate: null, // result first getNow call
9197
+ initialNowQueriedMs: null, // ms time the getNow was called
9198
+ nowIndicatorTimeoutID: null, // for refresh timing of now indicator
9199
+ nowIndicatorIntervalID: null, // "
9200
+
9201
+
9202
+ constructor: function(calendar, viewSpec) {
9203
+ Model.prototype.constructor.call(this);
9204
+
9205
+ this.calendar = calendar;
9206
+ this.viewSpec = viewSpec;
9207
+
9208
+ // shortcuts
9209
+ this.type = viewSpec.type;
9210
+ this.options = viewSpec.options;
9211
+
9212
+ // .name is deprecated
9213
+ this.name = this.type;
9214
+
9215
+ this.nextDayThreshold = moment.duration(this.opt('nextDayThreshold'));
9216
+ this.initThemingProps();
9217
+ this.initHiddenDays();
9218
+ this.isRTL = this.opt('isRTL');
9219
+
9220
+ this.eventOrderSpecs = parseFieldSpecs(this.opt('eventOrder'));
9221
+
9222
+ this.renderQueue = this.buildRenderQueue();
9223
+ this.initAutoBatchRender();
9224
+
9225
+ this.initialize();
9226
+ },
9227
+
9228
+
9229
+ buildRenderQueue: function() {
9230
+ var _this = this;
9231
+ var renderQueue = new RenderQueue({
9232
+ event: this.opt('eventRenderWait')
9233
+ });
9234
+
9235
+ renderQueue.on('start', function() {
9236
+ _this.freezeHeight();
9237
+ _this.addScroll(_this.queryScroll());
9238
+ });
9239
+
9240
+ renderQueue.on('stop', function() {
9241
+ _this.thawHeight();
9242
+ _this.popScroll();
9243
+ });
9244
+
9245
+ return renderQueue;
9246
+ },
9247
+
9248
+
9249
+ initAutoBatchRender: function() {
9250
+ var _this = this;
9251
+
9252
+ this.on('before:change', function() {
9253
+ _this.startBatchRender();
9254
+ });
9255
+
9256
+ this.on('change', function() {
9257
+ _this.stopBatchRender();
9258
+ });
9259
+ },
9260
+
9261
+
9262
+ startBatchRender: function() {
9263
+ if (!(this.batchRenderDepth++)) {
9264
+ this.renderQueue.pause();
9265
+ }
9266
+ },
9267
+
9268
+
9269
+ stopBatchRender: function() {
9270
+ if (!(--this.batchRenderDepth)) {
9271
+ this.renderQueue.resume();
9272
+ }
9273
+ },
9274
+
9275
+
9276
+ // A good place for subclasses to initialize member variables
9277
+ initialize: function() {
9278
+ // subclasses can implement
9279
+ },
9280
+
9281
+
9282
+ // Retrieves an option with the given name
9283
+ opt: function(name) {
9284
+ return this.options[name];
9285
+ },
9286
+
9287
+
9288
+ // Triggers handlers that are view-related. Modifies args before passing to calendar.
9289
+ publiclyTrigger: function(name, thisObj) { // arguments beyond thisObj are passed along
9290
+ var calendar = this.calendar;
9291
+
9292
+ return calendar.publiclyTrigger.apply(
9293
+ calendar,
9294
+ [name, thisObj || this].concat(
9295
+ Array.prototype.slice.call(arguments, 2), // arguments beyond thisObj
9296
+ [ this ] // always make the last argument a reference to the view. TODO: deprecate
9297
+ )
9298
+ );
9299
+ },
9300
+
9301
+
9302
+ /* Title and Date Formatting
9303
+ ------------------------------------------------------------------------------------------------------------------*/
9304
+
9305
+
9306
+ // Sets the view's title property to the most updated computed value
9307
+ updateTitle: function() {
9308
+ this.title = this.computeTitle();
9309
+ this.calendar.setToolbarsTitle(this.title);
9310
+ },
9311
+
9312
+
9313
+ // Computes what the title at the top of the calendar should be for this view
9314
+ computeTitle: function() {
9315
+ var range;
9316
+
9317
+ // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
9318
+ if (/^(year|month)$/.test(this.currentRangeUnit)) {
9319
+ range = this.currentRange;
9320
+ }
9321
+ else { // for day units or smaller, use the actual day range
9322
+ range = this.activeRange;
9323
+ }
9324
+
9325
+ return this.formatRange(
9326
+ {
9327
+ // in case currentRange has a time, make sure timezone is correct
9328
+ start: this.calendar.applyTimezone(range.start),
9329
+ end: this.calendar.applyTimezone(range.end)
9330
+ },
9331
+ this.opt('titleFormat') || this.computeTitleFormat(),
9332
+ this.opt('titleRangeSeparator')
9333
+ );
9334
+ },
9335
+
9336
+
9337
+ // Generates the format string that should be used to generate the title for the current date range.
9338
+ // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
9339
+ computeTitleFormat: function() {
9340
+ if (this.currentRangeUnit == 'year') {
9341
+ return 'YYYY';
9342
+ }
9343
+ else if (this.currentRangeUnit == 'month') {
9344
+ return this.opt('monthYearFormat'); // like "September 2014"
9345
+ }
9346
+ else if (this.currentRangeAs('days') > 1) {
9347
+ return 'll'; // multi-day range. shorter, like "Sep 9 - 10 2014"
9348
+ }
9349
+ else {
9350
+ return 'LL'; // one day. longer, like "September 9 2014"
9351
+ }
9352
+ },
9353
+
9354
+
9355
+ // Utility for formatting a range. Accepts a range object, formatting string, and optional separator.
9356
+ // Displays all-day ranges naturally, with an inclusive end. Takes the current isRTL into account.
9357
+ // The timezones of the dates within `range` will be respected.
9358
+ formatRange: function(range, formatStr, separator) {
9359
+ var end = range.end;
9360
+
9361
+ if (!end.hasTime()) { // all-day?
9362
+ end = end.clone().subtract(1); // convert to inclusive. last ms of previous day
9363
+ }
9364
+
9365
+ return formatRange(range.start, end, formatStr, separator, this.opt('isRTL'));
9366
+ },
9367
+
9368
+
9369
+ getAllDayHtml: function() {
9370
+ return this.opt('allDayHtml') || htmlEscape(this.opt('allDayText'));
9371
+ },
9372
+
9373
+
9374
+ /* Navigation
9375
+ ------------------------------------------------------------------------------------------------------------------*/
9376
+
9377
+
9378
+ // Generates HTML for an anchor to another view into the calendar.
9379
+ // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
9380
+ // `gotoOptions` can either be a moment input, or an object with the form:
9381
+ // { date, type, forceOff }
9382
+ // `type` is a view-type like "day" or "week". default value is "day".
9383
+ // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
9384
+ buildGotoAnchorHtml: function(gotoOptions, attrs, innerHtml) {
9385
+ var date, type, forceOff;
9386
+ var finalOptions;
9387
+
9388
+ if ($.isPlainObject(gotoOptions)) {
9389
+ date = gotoOptions.date;
9390
+ type = gotoOptions.type;
9391
+ forceOff = gotoOptions.forceOff;
9392
+ }
9393
+ else {
9394
+ date = gotoOptions; // a single moment input
9395
+ }
9396
+ date = FC.moment(date); // if a string, parse it
9397
+
9398
+ finalOptions = { // for serialization into the link
9399
+ date: date.format('YYYY-MM-DD'),
9400
+ type: type || 'day'
9401
+ };
9402
+
9403
+ if (typeof attrs === 'string') {
9404
+ innerHtml = attrs;
9405
+ attrs = null;
9406
+ }
9407
+
9408
+ attrs = attrs ? ' ' + attrsToStr(attrs) : ''; // will have a leading space
9409
+ innerHtml = innerHtml || '';
9410
+
9411
+ if (!forceOff && this.opt('navLinks')) {
9412
+ return '<a' + attrs +
9413
+ ' data-goto="' + htmlEscape(JSON.stringify(finalOptions)) + '">' +
9414
+ innerHtml +
9415
+ '</a>';
9416
+ }
9417
+ else {
9418
+ return '<span' + attrs + '>' +
9419
+ innerHtml +
9420
+ '</span>';
9421
+ }
9422
+ },
9423
+
9424
+
9425
+ // Rendering Non-date-related Content
9426
+ // -----------------------------------------------------------------------------------------------------------------
9427
+
9428
+
9429
+ // Sets the container element that the view should render inside of, does global DOM-related initializations,
9430
+ // and renders all the non-date-related content inside.
9431
+ setElement: function(el) {
9432
+ this.el = el;
9433
+ this.bindGlobalHandlers();
9434
+ this.bindBaseRenderHandlers();
9435
+ this.renderSkeleton();
9436
+ },
9437
+
9438
+
9439
+ // Removes the view's container element from the DOM, clearing any content beforehand.
9440
+ // Undoes any other DOM-related attachments.
9441
+ removeElement: function() {
9442
+ this.unsetDate();
9443
+ this.unrenderSkeleton();
9444
+
9445
+ this.unbindGlobalHandlers();
9446
+ this.unbindBaseRenderHandlers();
9447
+
9448
+ this.el.remove();
9449
+ // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
9450
+ // We don't null-out the View's other jQuery element references upon destroy,
9451
+ // so we shouldn't kill this.el either.
9452
+ },
9453
+
9454
+
9455
+ // Renders the basic structure of the view before any content is rendered
9456
+ renderSkeleton: function() {
9457
+ // subclasses should implement
9458
+ },
9459
+
9460
+
9461
+ // Unrenders the basic structure of the view
9462
+ unrenderSkeleton: function() {
9463
+ // subclasses should implement
9464
+ },
9465
+
9466
+
9467
+ // Date Setting/Unsetting
9468
+ // -----------------------------------------------------------------------------------------------------------------
9469
+
9470
+
9471
+ setDate: function(date) {
9472
+ var currentDateProfile = this.get('dateProfile');
9473
+ var newDateProfile = this.buildDateProfile(date, null, true); // forceToValid=true
9474
+
9475
+ if (
9476
+ !currentDateProfile ||
9477
+ !isRangesEqual(currentDateProfile.activeRange, newDateProfile.activeRange)
9478
+ ) {
9479
+ this.set('dateProfile', newDateProfile);
9480
+ }
9481
+
9482
+ return newDateProfile.date;
9483
+ },
9484
+
9485
+
9486
+ unsetDate: function() {
9487
+ this.unset('dateProfile');
9488
+ },
9489
+
9490
+
9491
+ // Date Rendering
9492
+ // -----------------------------------------------------------------------------------------------------------------
9493
+
9494
+
9495
+ requestDateRender: function(dateProfile) {
9496
+ var _this = this;
9497
+
9498
+ this.renderQueue.queue(function() {
9499
+ _this.executeDateRender(dateProfile);
9500
+ }, 'date', 'init');
9501
+ },
9502
+
9503
+
9504
+ requestDateUnrender: function() {
9505
+ var _this = this;
9506
+
9507
+ this.renderQueue.queue(function() {
9508
+ _this.executeDateUnrender();
9509
+ }, 'date', 'destroy');
9510
+ },
9511
+
9512
+
9513
+ // Event Data
9514
+ // -----------------------------------------------------------------------------------------------------------------
9515
+
9516
+
9517
+ fetchInitialEvents: function(dateProfile) {
9518
+ return this.calendar.requestEvents(
9519
+ dateProfile.activeRange.start,
9520
+ dateProfile.activeRange.end
9521
+ );
9522
+ },
9523
+
9524
+
9525
+ bindEventChanges: function() {
9526
+ this.listenTo(this.calendar, 'eventsReset', this.resetEvents);
9527
+ },
9528
+
9529
+
9530
+ unbindEventChanges: function() {
9531
+ this.stopListeningTo(this.calendar, 'eventsReset');
9532
+ },
9533
+
9534
+
9535
+ setEvents: function(events) {
9536
+ this.set('currentEvents', events);
9537
+ this.set('hasEvents', true);
9538
+ },
9539
+
9540
+
9541
+ unsetEvents: function() {
9542
+ this.unset('currentEvents');
9543
+ this.unset('hasEvents');
9544
+ },
9545
+
9546
+
9547
+ resetEvents: function(events) {
9548
+ this.startBatchRender();
9549
+ this.unsetEvents();
9550
+ this.setEvents(events);
9551
+ this.stopBatchRender();
9552
+ },
9553
+
9554
+
9555
+ // Event Rendering
9556
+ // -----------------------------------------------------------------------------------------------------------------
9557
+
9558
+
9559
+ requestEventsRender: function(events) {
9560
+ var _this = this;
9561
+
9562
+ this.renderQueue.queue(function() {
9563
+ _this.executeEventsRender(events);
9564
+ }, 'event', 'init');
9565
+ },
9566
+
9567
+
9568
+ requestEventsUnrender: function() {
9569
+ var _this = this;
9570
+
9571
+ this.renderQueue.queue(function() {
9572
+ _this.executeEventsUnrender();
9573
+ }, 'event', 'destroy');
9574
+ },
9575
+
9576
+
9577
+ // Date High-level Rendering
9578
+ // -----------------------------------------------------------------------------------------------------------------
9579
+
9580
+
9581
+ // if dateProfile not specified, uses current
9582
+ executeDateRender: function(dateProfile, skipScroll) {
9583
+
9584
+ this.setDateProfileForRendering(dateProfile);
9585
+ this.updateTitle();
9586
+ this.calendar.updateToolbarButtons();
9587
+
9588
+ if (this.render) {
9589
+ this.render(); // TODO: deprecate
9590
+ }
9591
+
9592
+ this.renderDates();
9593
+ this.updateSize();
9594
+ this.renderBusinessHours(); // might need coordinates, so should go after updateSize()
9595
+ this.startNowIndicator();
9596
+
9597
+ if (!skipScroll) {
9598
+ this.addScroll(this.computeInitialDateScroll());
9599
+ }
9600
+
9601
+ this.isDatesRendered = true;
9602
+ this.trigger('datesRendered');
9603
+ },
9604
+
9605
+
9606
+ executeDateUnrender: function() {
9607
+
9608
+ this.unselect();
9609
+ this.stopNowIndicator();
9610
+
9611
+ this.trigger('before:datesUnrendered');
9612
+
9613
+ this.unrenderBusinessHours();
9614
+ this.unrenderDates();
9615
+
9616
+ if (this.destroy) {
9617
+ this.destroy(); // TODO: deprecate
9618
+ }
9619
+
9620
+ this.isDatesRendered = false;
9621
+ },
9622
+
9623
+
9624
+ // Date Low-level Rendering
9625
+ // -----------------------------------------------------------------------------------------------------------------
9626
+
9627
+
9628
+ // date-cell content only
9629
+ renderDates: function() {
9630
+ // subclasses should implement
9631
+ },
9632
+
9633
+
9634
+ // date-cell content only
9635
+ unrenderDates: function() {
9636
+ // subclasses should override
9637
+ },
9638
+
9639
+
9640
+ // Determing when the "meat" of the view is rendered (aka the base)
9641
+ // -----------------------------------------------------------------------------------------------------------------
9642
+
9643
+
9644
+ bindBaseRenderHandlers: function() {
9645
+ var _this = this;
9646
+
9647
+ this.on('datesRendered.baseHandler', function() {
9648
+ _this.onBaseRender();
9649
+ });
9650
+
9651
+ this.on('before:datesUnrendered.baseHandler', function() {
9652
+ _this.onBeforeBaseUnrender();
9653
+ });
9654
+ },
9655
+
9656
+
9657
+ unbindBaseRenderHandlers: function() {
9658
+ this.off('.baseHandler');
9659
+ },
9660
+
9661
+
9662
+ onBaseRender: function() {
9663
+ this.applyScreenState();
9664
+ this.publiclyTrigger('viewRender', this, this, this.el);
9665
+ },
9666
+
9667
+
9668
+ onBeforeBaseUnrender: function() {
9669
+ this.applyScreenState();
9670
+ this.publiclyTrigger('viewDestroy', this, this, this.el);
9671
+ },
9672
+
9673
+
9674
+ // Misc view rendering utils
9675
+ // -----------------------------------------------------------------------------------------------------------------
9676
+
9677
+
9678
+ // Binds DOM handlers to elements that reside outside the view container, such as the document
9679
+ bindGlobalHandlers: function() {
9680
+ this.listenTo(GlobalEmitter.get(), {
9681
+ touchstart: this.processUnselect,
9682
+ mousedown: this.handleDocumentMousedown
9683
+ });
9684
+ },
9685
+
9686
+
9687
+ // Unbinds DOM handlers from elements that reside outside the view container
9688
+ unbindGlobalHandlers: function() {
9689
+ this.stopListeningTo(GlobalEmitter.get());
9690
+ },
9691
+
9692
+
9693
+ // Initializes internal variables related to theming
9694
+ initThemingProps: function() {
9695
+ var tm = this.opt('theme') ? 'ui' : 'fc';
9696
+
9697
+ this.widgetHeaderClass = tm + '-widget-header';
9698
+ this.widgetContentClass = tm + '-widget-content';
9699
+ this.highlightStateClass = tm + '-state-highlight';
9700
+ },
9701
+
9702
+
9703
+ /* Business Hours
9704
+ ------------------------------------------------------------------------------------------------------------------*/
9705
+
9706
+
9707
+ // Renders business-hours onto the view. Assumes updateSize has already been called.
9708
+ renderBusinessHours: function() {
9709
+ // subclasses should implement
9710
+ },
9711
+
9712
+
9713
+ // Unrenders previously-rendered business-hours
9714
+ unrenderBusinessHours: function() {
9715
+ // subclasses should implement
9716
+ },
9717
+
9718
+
9719
+ /* Now Indicator
9720
+ ------------------------------------------------------------------------------------------------------------------*/
9721
+
9722
+
9723
+ // Immediately render the current time indicator and begins re-rendering it at an interval,
9724
+ // which is defined by this.getNowIndicatorUnit().
9725
+ // TODO: somehow do this for the current whole day's background too
9726
+ startNowIndicator: function() {
9727
+ var _this = this;
9728
+ var unit;
9729
+ var update;
9730
+ var delay; // ms wait value
9731
+
9732
+ if (this.opt('nowIndicator')) {
9733
+ unit = this.getNowIndicatorUnit();
9734
+ if (unit) {
9735
+ update = proxy(this, 'updateNowIndicator'); // bind to `this`
9736
+
9737
+ this.initialNowDate = this.calendar.getNow();
9738
+ this.initialNowQueriedMs = +new Date();
9739
+ this.renderNowIndicator(this.initialNowDate);
9740
+ this.isNowIndicatorRendered = true;
9741
+
9742
+ // wait until the beginning of the next interval
9743
+ delay = this.initialNowDate.clone().startOf(unit).add(1, unit) - this.initialNowDate;
9744
+ this.nowIndicatorTimeoutID = setTimeout(function() {
9745
+ _this.nowIndicatorTimeoutID = null;
9746
+ update();
9747
+ delay = +moment.duration(1, unit);
9748
+ delay = Math.max(100, delay); // prevent too frequent
9749
+ _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
9750
+ }, delay);
9751
+ }
9752
+ }
9753
+ },
9754
+
9755
+
9756
+ // rerenders the now indicator, computing the new current time from the amount of time that has passed
9757
+ // since the initial getNow call.
9758
+ updateNowIndicator: function() {
9759
+ if (this.isNowIndicatorRendered) {
9760
+ this.unrenderNowIndicator();
9761
+ this.renderNowIndicator(
9762
+ this.initialNowDate.clone().add(new Date() - this.initialNowQueriedMs) // add ms
9763
+ );
9764
+ }
9765
+ },
9766
+
9767
+
9768
+ // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
9769
+ // Won't cause side effects if indicator isn't rendered.
9770
+ stopNowIndicator: function() {
9771
+ if (this.isNowIndicatorRendered) {
9772
+
9773
+ if (this.nowIndicatorTimeoutID) {
9774
+ clearTimeout(this.nowIndicatorTimeoutID);
9775
+ this.nowIndicatorTimeoutID = null;
9776
+ }
9777
+ if (this.nowIndicatorIntervalID) {
9778
+ clearTimeout(this.nowIndicatorIntervalID);
9779
+ this.nowIndicatorIntervalID = null;
9780
+ }
9781
+
9782
+ this.unrenderNowIndicator();
9783
+ this.isNowIndicatorRendered = false;
9784
+ }
9785
+ },
9786
+
9787
+
9788
+ // Returns a string unit, like 'second' or 'minute' that defined how often the current time indicator
9789
+ // should be refreshed. If something falsy is returned, no time indicator is rendered at all.
9790
+ getNowIndicatorUnit: function() {
9791
+ // subclasses should implement
9792
+ },
9793
+
9794
+
9795
+ // Renders a current time indicator at the given datetime
9796
+ renderNowIndicator: function(date) {
9797
+ // subclasses should implement
9798
+ },
9799
+
9800
+
9801
+ // Undoes the rendering actions from renderNowIndicator
9802
+ unrenderNowIndicator: function() {
9803
+ // subclasses should implement
9804
+ },
9805
+
9806
+
9807
+ /* Dimensions
9808
+ ------------------------------------------------------------------------------------------------------------------*/
9809
+
9810
+
9811
+ // Refreshes anything dependant upon sizing of the container element of the grid
9812
+ updateSize: function(isResize) {
9813
+ var scroll;
9814
+
9815
+ if (isResize) {
9816
+ scroll = this.queryScroll();
9817
+ }
9818
+
9819
+ this.updateHeight(isResize);
9820
+ this.updateWidth(isResize);
9821
+ this.updateNowIndicator();
9822
+
9823
+ if (isResize) {
9824
+ this.applyScroll(scroll);
9825
+ }
9826
+ },
9827
+
9828
+
9829
+ // Refreshes the horizontal dimensions of the calendar
9830
+ updateWidth: function(isResize) {
9831
+ // subclasses should implement
9832
+ },
9833
+
9834
+
9835
+ // Refreshes the vertical dimensions of the calendar
9836
+ updateHeight: function(isResize) {
9837
+ var calendar = this.calendar; // we poll the calendar for height information
9838
+
9839
+ this.setHeight(
9840
+ calendar.getSuggestedViewHeight(),
9841
+ calendar.isHeightAuto()
9842
+ );
9843
+ },
9844
+
9845
+
9846
+ // Updates the vertical dimensions of the calendar to the specified height.
9847
+ // if `isAuto` is set to true, height becomes merely a suggestion and the view should use its "natural" height.
9848
+ setHeight: function(height, isAuto) {
9849
+ // subclasses should implement
9850
+ },
9851
+
9852
+
9853
+ /* Scroller
9854
+ ------------------------------------------------------------------------------------------------------------------*/
9855
+
9856
+
9857
+ addForcedScroll: function(scroll) {
9858
+ this.addScroll(
9859
+ $.extend(scroll, { isForced: true })
9860
+ );
9861
+ },
9862
+
9863
+
9864
+ addScroll: function(scroll) {
9865
+ var queuedScroll = this.queuedScroll || (this.queuedScroll = {});
9866
+
9867
+ if (!queuedScroll.isForced) {
9868
+ $.extend(queuedScroll, scroll);
9869
+ }
9870
+ },
9871
+
9872
+
9873
+ popScroll: function() {
9874
+ this.applyQueuedScroll();
9875
+ this.queuedScroll = null;
9876
+ },
9877
+
9878
+
9879
+ applyQueuedScroll: function() {
9880
+ if (this.queuedScroll) {
9881
+ this.applyScroll(this.queuedScroll);
9882
+ }
9883
+ },
9884
+
9885
+
9886
+ queryScroll: function() {
9887
+ var scroll = {};
9888
+
9889
+ if (this.isDatesRendered) {
9890
+ $.extend(scroll, this.queryDateScroll());
9891
+ }
9892
+
9893
+ return scroll;
9894
+ },
9895
+
9896
+
9897
+ applyScroll: function(scroll) {
9898
+ if (this.isDatesRendered) {
9899
+ this.applyDateScroll(scroll);
9900
+ }
9901
+ },
9902
+
9903
+
9904
+ computeInitialDateScroll: function() {
9905
+ return {}; // subclasses must implement
9906
+ },
9907
+
9908
+
9909
+ queryDateScroll: function() {
9910
+ return {}; // subclasses must implement
9911
+ },
9912
+
9913
+
9914
+ applyDateScroll: function(scroll) {
9915
+ ; // subclasses must implement
9916
+ },
9917
+
9918
+
9919
+ /* Height Freezing
9920
+ ------------------------------------------------------------------------------------------------------------------*/
9921
+
9922
+
9923
+ freezeHeight: function() {
9924
+ this.calendar.freezeContentHeight();
9925
+ },
9926
+
9927
+
9928
+ thawHeight: function() {
9929
+ this.calendar.thawContentHeight();
9930
+ },
9931
+
9932
+
9933
+ // Event High-level Rendering
9934
+ // -----------------------------------------------------------------------------------------------------------------
9935
+
9936
+
9937
+ executeEventsRender: function(events) {
9938
+ this.renderEvents(events);
9939
+ this.isEventsRendered = true;
9940
+
9941
+ this.onEventsRender();
9942
+ },
9943
+
9944
+
9945
+ executeEventsUnrender: function() {
9946
+ this.onBeforeEventsUnrender();
9947
+
9948
+ if (this.destroyEvents) {
9949
+ this.destroyEvents(); // TODO: deprecate
9950
+ }
9951
+
9952
+ this.unrenderEvents();
9953
+ this.isEventsRendered = false;
9954
+ },
9955
+
9956
+
9957
+ // Event Rendering Triggers
9958
+ // -----------------------------------------------------------------------------------------------------------------
9959
+
9960
+
9961
+ // Signals that all events have been rendered
9962
+ onEventsRender: function() {
9963
+ this.applyScreenState();
9964
+
9965
+ this.renderedEventSegEach(function(seg) {
9966
+ this.publiclyTrigger('eventAfterRender', seg.event, seg.event, seg.el);
9967
+ });
9968
+ this.publiclyTrigger('eventAfterAllRender');
9969
+ },
9970
+
9971
+
9972
+ // Signals that all event elements are about to be removed
9973
+ onBeforeEventsUnrender: function() {
9974
+ this.applyScreenState();
9975
+
9976
+ this.renderedEventSegEach(function(seg) {
9977
+ this.publiclyTrigger('eventDestroy', seg.event, seg.event, seg.el);
9978
+ });
9979
+ },
9980
+
9981
+
9982
+ applyScreenState: function() {
9983
+ this.thawHeight();
9984
+ this.freezeHeight();
9985
+ this.applyQueuedScroll();
9986
+ },
9987
+
9988
+
9989
+ // Event Low-level Rendering
9990
+ // -----------------------------------------------------------------------------------------------------------------
9991
+
9992
+
9993
+ // Renders the events onto the view.
9994
+ renderEvents: function(events) {
9995
+ // subclasses should implement
9996
+ },
9997
+
9998
+
9999
+ // Removes event elements from the view.
10000
+ unrenderEvents: function() {
10001
+ // subclasses should implement
10002
+ },
10003
+
10004
+
10005
+ // Event Rendering Utils
10006
+ // -----------------------------------------------------------------------------------------------------------------
10007
+
10008
+
10009
+ // Given an event and the default element used for rendering, returns the element that should actually be used.
10010
+ // Basically runs events and elements through the eventRender hook.
10011
+ resolveEventEl: function(event, el) {
10012
+ var custom = this.publiclyTrigger('eventRender', event, event, el);
10013
+
10014
+ if (custom === false) { // means don't render at all
10015
+ el = null;
10016
+ }
10017
+ else if (custom && custom !== true) {
10018
+ el = $(custom);
10019
+ }
10020
+
10021
+ return el;
10022
+ },
10023
+
10024
+
10025
+ // Hides all rendered event segments linked to the given event
10026
+ showEvent: function(event) {
10027
+ this.renderedEventSegEach(function(seg) {
10028
+ seg.el.css('visibility', '');
10029
+ }, event);
10030
+ },
10031
+
10032
+
10033
+ // Shows all rendered event segments linked to the given event
10034
+ hideEvent: function(event) {
10035
+ this.renderedEventSegEach(function(seg) {
10036
+ seg.el.css('visibility', 'hidden');
10037
+ }, event);
10038
+ },
10039
+
10040
+
10041
+ // Iterates through event segments that have been rendered (have an el). Goes through all by default.
10042
+ // If the optional `event` argument is specified, only iterates through segments linked to that event.
10043
+ // The `this` value of the callback function will be the view.
10044
+ renderedEventSegEach: function(func, event) {
10045
+ var segs = this.getEventSegs();
10046
+ var i;
10047
+
10048
+ for (i = 0; i < segs.length; i++) {
10049
+ if (!event || segs[i].event._id === event._id) {
10050
+ if (segs[i].el) {
10051
+ func.call(this, segs[i]);
10052
+ }
10053
+ }
10054
+ }
10055
+ },
10056
+
10057
+
10058
+ // Retrieves all the rendered segment objects for the view
10059
+ getEventSegs: function() {
10060
+ // subclasses must implement
10061
+ return [];
10062
+ },
10063
+
10064
+
10065
+ /* Event Drag-n-Drop
10066
+ ------------------------------------------------------------------------------------------------------------------*/
10067
+
10068
+
10069
+ // Computes if the given event is allowed to be dragged by the user
10070
+ isEventDraggable: function(event) {
10071
+ return this.isEventStartEditable(event);
10072
+ },
10073
+
10074
+
10075
+ isEventStartEditable: function(event) {
10076
+ return firstDefined(
10077
+ event.startEditable,
10078
+ (event.source || {}).startEditable,
10079
+ this.opt('eventStartEditable'),
10080
+ this.isEventGenerallyEditable(event)
10081
+ );
10082
+ },
10083
+
10084
+
10085
+ isEventGenerallyEditable: function(event) {
10086
+ return firstDefined(
10087
+ event.editable,
10088
+ (event.source || {}).editable,
10089
+ this.opt('editable')
10090
+ );
10091
+ },
10092
+
10093
+
10094
+ // Must be called when an event in the view is dropped onto new location.
10095
+ // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
10096
+ reportSegDrop: function(seg, dropLocation, largeUnit, el, ev) {
10097
+ var calendar = this.calendar;
10098
+ var mutateResult = calendar.mutateSeg(seg, dropLocation, largeUnit);
10099
+ var undoFunc = function() {
10100
+ mutateResult.undo();
10101
+ calendar.reportEventChange();
10102
+ };
10103
+
10104
+ this.triggerEventDrop(seg.event, mutateResult.dateDelta, undoFunc, el, ev);
10105
+ calendar.reportEventChange(); // will rerender events
10106
+ },
10107
+
10108
+
10109
+ // Triggers event-drop handlers that have subscribed via the API
10110
+ triggerEventDrop: function(event, dateDelta, undoFunc, el, ev) {
10111
+ this.publiclyTrigger('eventDrop', el[0], event, dateDelta, undoFunc, ev, {}); // {} = jqui dummy
10112
+ },
10113
+
10114
+
10115
+ /* External Element Drag-n-Drop
10116
+ ------------------------------------------------------------------------------------------------------------------*/
10117
+
10118
+
10119
+ // Must be called when an external element, via jQuery UI, has been dropped onto the calendar.
10120
+ // `meta` is the parsed data that has been embedded into the dragging event.
10121
+ // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
10122
+ reportExternalDrop: function(meta, dropLocation, el, ev, ui) {
10123
+ var eventProps = meta.eventProps;
10124
+ var eventInput;
10125
+ var event;
10126
+
10127
+ // Try to build an event object and render it. TODO: decouple the two
10128
+ if (eventProps) {
10129
+ eventInput = $.extend({}, eventProps, dropLocation);
10130
+ event = this.calendar.renderEvent(eventInput, meta.stick)[0]; // renderEvent returns an array
10131
+ }
10132
+
10133
+ this.triggerExternalDrop(event, dropLocation, el, ev, ui);
10134
+ },
10135
+
10136
+
10137
+ // Triggers external-drop handlers that have subscribed via the API
10138
+ triggerExternalDrop: function(event, dropLocation, el, ev, ui) {
10139
+
10140
+ // trigger 'drop' regardless of whether element represents an event
10141
+ this.publiclyTrigger('drop', el[0], dropLocation.start, ev, ui);
10142
+
10143
+ if (event) {
10144
+ this.publiclyTrigger('eventReceive', null, event); // signal an external event landed
10145
+ }
10146
+ },
10147
+
10148
+
10149
+ /* Drag-n-Drop Rendering (for both events and external elements)
10150
+ ------------------------------------------------------------------------------------------------------------------*/
10151
+
10152
+
10153
+ // Renders a visual indication of a event or external-element drag over the given drop zone.
10154
+ // If an external-element, seg will be `null`.
10155
+ // Must return elements used for any mock events.
10156
+ renderDrag: function(dropLocation, seg) {
10157
+ // subclasses must implement
10158
+ },
10159
+
10160
+
10161
+ // Unrenders a visual indication of an event or external-element being dragged.
10162
+ unrenderDrag: function() {
10163
+ // subclasses must implement
10164
+ },
10165
+
10166
+
10167
+ /* Event Resizing
10168
+ ------------------------------------------------------------------------------------------------------------------*/
10169
+
10170
+
10171
+ // Computes if the given event is allowed to be resized from its starting edge
10172
+ isEventResizableFromStart: function(event) {
10173
+ return this.opt('eventResizableFromStart') && this.isEventResizable(event);
10174
+ },
10175
+
10176
+
10177
+ // Computes if the given event is allowed to be resized from its ending edge
10178
+ isEventResizableFromEnd: function(event) {
10179
+ return this.isEventResizable(event);
10180
+ },
10181
+
10182
+
10183
+ // Computes if the given event is allowed to be resized by the user at all
10184
+ isEventResizable: function(event) {
10185
+ var source = event.source || {};
10186
+
10187
+ return firstDefined(
10188
+ event.durationEditable,
10189
+ source.durationEditable,
10190
+ this.opt('eventDurationEditable'),
10191
+ event.editable,
10192
+ source.editable,
10193
+ this.opt('editable')
10194
+ );
10195
+ },
10196
+
10197
+
10198
+ // Must be called when an event in the view has been resized to a new length
10199
+ reportSegResize: function(seg, resizeLocation, largeUnit, el, ev) {
10200
+ var calendar = this.calendar;
10201
+ var mutateResult = calendar.mutateSeg(seg, resizeLocation, largeUnit);
10202
+ var undoFunc = function() {
10203
+ mutateResult.undo();
10204
+ calendar.reportEventChange();
10205
+ };
10206
+
10207
+ this.triggerEventResize(seg.event, mutateResult.durationDelta, undoFunc, el, ev);
10208
+ calendar.reportEventChange(); // will rerender events
10209
+ },
10210
+
10211
+
10212
+ // Triggers event-resize handlers that have subscribed via the API
10213
+ triggerEventResize: function(event, durationDelta, undoFunc, el, ev) {
10214
+ this.publiclyTrigger('eventResize', el[0], event, durationDelta, undoFunc, ev, {}); // {} = jqui dummy
10215
+ },
10216
+
10217
+
10218
+ /* Selection (time range)
10219
+ ------------------------------------------------------------------------------------------------------------------*/
10220
+
10221
+
10222
+ // Selects a date span on the view. `start` and `end` are both Moments.
10223
+ // `ev` is the native mouse event that begin the interaction.
10224
+ select: function(span, ev) {
10225
+ this.unselect(ev);
10226
+ this.renderSelection(span);
10227
+ this.reportSelection(span, ev);
10228
+ },
10229
+
10230
+
10231
+ // Renders a visual indication of the selection
10232
+ renderSelection: function(span) {
10233
+ // subclasses should implement
10234
+ },
10235
+
10236
+
10237
+ // Called when a new selection is made. Updates internal state and triggers handlers.
10238
+ reportSelection: function(span, ev) {
10239
+ this.isSelected = true;
10240
+ this.triggerSelect(span, ev);
10241
+ },
10242
+
10243
+
10244
+ // Triggers handlers to 'select'
10245
+ triggerSelect: function(span, ev) {
10246
+ this.publiclyTrigger(
10247
+ 'select',
10248
+ null,
10249
+ this.calendar.applyTimezone(span.start), // convert to calendar's tz for external API
10250
+ this.calendar.applyTimezone(span.end), // "
10251
+ ev
10252
+ );
10253
+ },
10254
+
10255
+
10256
+ // Undoes a selection. updates in the internal state and triggers handlers.
10257
+ // `ev` is the native mouse event that began the interaction.
10258
+ unselect: function(ev) {
10259
+ if (this.isSelected) {
10260
+ this.isSelected = false;
10261
+ if (this.destroySelection) {
10262
+ this.destroySelection(); // TODO: deprecate
10263
+ }
10264
+ this.unrenderSelection();
10265
+ this.publiclyTrigger('unselect', null, ev);
10266
+ }
10267
+ },
10268
+
10269
+
10270
+ // Unrenders a visual indication of selection
10271
+ unrenderSelection: function() {
10272
+ // subclasses should implement
10273
+ },
10274
+
10275
+
10276
+ /* Event Selection
10277
+ ------------------------------------------------------------------------------------------------------------------*/
10278
+
10279
+
10280
+ selectEvent: function(event) {
10281
+ if (!this.selectedEvent || this.selectedEvent !== event) {
10282
+ this.unselectEvent();
10283
+ this.renderedEventSegEach(function(seg) {
10284
+ seg.el.addClass('fc-selected');
10285
+ }, event);
10286
+ this.selectedEvent = event;
10287
+ }
10288
+ },
10289
+
10290
+
10291
+ unselectEvent: function() {
10292
+ if (this.selectedEvent) {
10293
+ this.renderedEventSegEach(function(seg) {
10294
+ seg.el.removeClass('fc-selected');
10295
+ }, this.selectedEvent);
10296
+ this.selectedEvent = null;
10297
+ }
10298
+ },
10299
+
10300
+
10301
+ isEventSelected: function(event) {
10302
+ // event references might change on refetchEvents(), while selectedEvent doesn't,
10303
+ // so compare IDs
10304
+ return this.selectedEvent && this.selectedEvent._id === event._id;
10305
+ },
10306
+
10307
+
10308
+ /* Mouse / Touch Unselecting (time range & event unselection)
10309
+ ------------------------------------------------------------------------------------------------------------------*/
10310
+ // TODO: move consistently to down/start or up/end?
10311
+ // TODO: don't kill previous selection if touch scrolling
10312
+
10313
+
10314
+ handleDocumentMousedown: function(ev) {
10315
+ if (isPrimaryMouseButton(ev)) {
10316
+ this.processUnselect(ev);
10317
+ }
10318
+ },
10319
+
10320
+
10321
+ processUnselect: function(ev) {
10322
+ this.processRangeUnselect(ev);
10323
+ this.processEventUnselect(ev);
10324
+ },
10325
+
10326
+
10327
+ processRangeUnselect: function(ev) {
10328
+ var ignore;
10329
+
10330
+ // is there a time-range selection?
10331
+ if (this.isSelected && this.opt('unselectAuto')) {
10332
+ // only unselect if the clicked element is not identical to or inside of an 'unselectCancel' element
10333
+ ignore = this.opt('unselectCancel');
10334
+ if (!ignore || !$(ev.target).closest(ignore).length) {
10335
+ this.unselect(ev);
10336
+ }
10337
+ }
10338
+ },
10339
+
10340
+
10341
+ processEventUnselect: function(ev) {
10342
+ if (this.selectedEvent) {
10343
+ if (!$(ev.target).closest('.fc-selected').length) {
10344
+ this.unselectEvent();
10345
+ }
10346
+ }
10347
+ },
10348
+
10349
+
10350
+ /* Day Click
10351
+ ------------------------------------------------------------------------------------------------------------------*/
10352
+
10353
+
10354
+ // Triggers handlers to 'dayClick'
10355
+ // Span has start/end of the clicked area. Only the start is useful.
10356
+ triggerDayClick: function(span, dayEl, ev) {
10357
+ this.publiclyTrigger(
10358
+ 'dayClick',
10359
+ dayEl,
10360
+ this.calendar.applyTimezone(span.start), // convert to calendar's timezone for external API
10361
+ ev
10362
+ );
10363
+ },
10364
+
10365
+
10366
+ /* Date Utils
10367
+ ------------------------------------------------------------------------------------------------------------------*/
10368
+
10369
+
10370
+ // Returns the date range of the full days the given range visually appears to occupy.
10371
+ // Returns a new range object.
10372
+ computeDayRange: function(range) {
10373
+ var startDay = range.start.clone().stripTime(); // the beginning of the day the range starts
10374
+ var end = range.end;
10375
+ var endDay = null;
10376
+ var endTimeMS;
10377
+
10378
+ if (end) {
10379
+ endDay = end.clone().stripTime(); // the beginning of the day the range exclusively ends
10380
+ endTimeMS = +end.time(); // # of milliseconds into `endDay`
10381
+
10382
+ // If the end time is actually inclusively part of the next day and is equal to or
10383
+ // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
10384
+ // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
10385
+ if (endTimeMS && endTimeMS >= this.nextDayThreshold) {
10386
+ endDay.add(1, 'days');
10387
+ }
10388
+ }
10389
+
10390
+ // If no end was specified, or if it is within `startDay` but not past nextDayThreshold,
10391
+ // assign the default duration of one day.
10392
+ if (!end || endDay <= startDay) {
10393
+ endDay = startDay.clone().add(1, 'days');
10394
+ }
10395
+
10396
+ return { start: startDay, end: endDay };
10397
+ },
10398
+
10399
+
10400
+ // Does the given event visually appear to occupy more than one day?
10401
+ isMultiDayEvent: function(event) {
10402
+ var range = this.computeDayRange(event); // event is range-ish
10403
+
10404
+ return range.end.diff(range.start, 'days') > 1;
10405
+ }
10406
+
10407
+ });
10408
+
10409
+
10410
+ View.watch('displayingDates', [ 'dateProfile' ], function(deps) {
10411
+ this.requestDateRender(deps.dateProfile);
10412
+ }, function() {
10413
+ this.requestDateUnrender();
10414
+ });
10415
+
10416
+
10417
+ View.watch('initialEvents', [ 'dateProfile' ], function(deps) {
10418
+ return this.fetchInitialEvents(deps.dateProfile);
10419
+ });
10420
+
10421
+
10422
+ View.watch('bindingEvents', [ 'initialEvents' ], function(deps) {
10423
+ this.setEvents(deps.initialEvents);
10424
+ this.bindEventChanges();
10425
+ }, function() {
10426
+ this.unbindEventChanges();
10427
+ this.unsetEvents();
10428
+ });
10429
+
10430
+
10431
+ View.watch('displayingEvents', [ 'displayingDates', 'hasEvents' ], function() {
10432
+ this.requestEventsRender(this.get('currentEvents')); // if there were event mutations after initialEvents
10433
+ }, function() {
10434
+ this.requestEventsUnrender();
10435
+ });
10436
+
10437
+ ;;
10438
+
10439
+ View.mixin({
10440
+
10441
+ // range the view is formally responsible for.
10442
+ // for example, a month view might have 1st-31st, excluding padded dates
10443
+ currentRange: null,
10444
+ currentRangeUnit: null, // name of largest unit being displayed, like "month" or "week"
10445
+
10446
+ // date range with a rendered skeleton
10447
+ // includes not-active days that need some sort of DOM
10448
+ renderRange: null,
10449
+
10450
+ // dates that display events and accept drag-n-drop
10451
+ activeRange: null,
10452
+
10453
+ // constraint for where prev/next operations can go and where events can be dragged/resized to.
10454
+ // an object with optional start and end properties.
10455
+ validRange: null,
10456
+
10457
+ // how far the current date will move for a prev/next operation
10458
+ dateIncrement: null,
10459
+
10460
+ minTime: null, // Duration object that denotes the first visible time of any given day
10461
+ maxTime: null, // Duration object that denotes the exclusive visible end time of any given day
10462
+ usesMinMaxTime: false, // whether minTime/maxTime will affect the activeRange. Views must opt-in.
10463
+
10464
+ // DEPRECATED
10465
+ start: null, // use activeRange.start
10466
+ end: null, // use activeRange.end
10467
+ intervalStart: null, // use currentRange.start
10468
+ intervalEnd: null, // use currentRange.end
10469
+
10470
+
10471
+ /* Date Range Computation
10472
+ ------------------------------------------------------------------------------------------------------------------*/
10473
+
10474
+
10475
+ setDateProfileForRendering: function(dateProfile) {
10476
+ this.currentRange = dateProfile.currentRange;
10477
+ this.currentRangeUnit = dateProfile.currentRangeUnit;
10478
+ this.renderRange = dateProfile.renderRange;
10479
+ this.activeRange = dateProfile.activeRange;
10480
+ this.validRange = dateProfile.validRange;
10481
+ this.dateIncrement = dateProfile.dateIncrement;
10482
+ this.minTime = dateProfile.minTime;
10483
+ this.maxTime = dateProfile.maxTime;
10484
+
10485
+ // DEPRECATED, but we need to keep it updated
10486
+ this.start = dateProfile.activeRange.start;
10487
+ this.end = dateProfile.activeRange.end;
10488
+ this.intervalStart = dateProfile.currentRange.start;
10489
+ this.intervalEnd = dateProfile.currentRange.end;
10490
+ },
10491
+
10492
+
10493
+ // Builds a structure with info about what the dates/ranges will be for the "prev" view.
10494
+ buildPrevDateProfile: function(date) {
10495
+ var prevDate = date.clone().startOf(this.currentRangeUnit).subtract(this.dateIncrement);
10496
+
10497
+ return this.buildDateProfile(prevDate, -1);
10498
+ },
10499
+
10500
+
10501
+ // Builds a structure with info about what the dates/ranges will be for the "next" view.
10502
+ buildNextDateProfile: function(date) {
10503
+ var nextDate = date.clone().startOf(this.currentRangeUnit).add(this.dateIncrement);
10504
+
10505
+ return this.buildDateProfile(nextDate, 1);
10506
+ },
10507
+
10508
+
10509
+ // Builds a structure holding dates/ranges for rendering around the given date.
10510
+ // Optional direction param indicates whether the date is being incremented/decremented
10511
+ // from its previous value. decremented = -1, incremented = 1 (default).
10512
+ buildDateProfile: function(date, direction, forceToValid) {
10513
+ var validRange = this.buildValidRange();
10514
+ var minTime = null;
10515
+ var maxTime = null;
10516
+ var currentInfo;
10517
+ var renderRange;
10518
+ var activeRange;
10519
+ var isValid;
10520
+
10521
+ if (forceToValid) {
10522
+ date = constrainDate(date, validRange);
10523
+ }
10524
+
10525
+ currentInfo = this.buildCurrentRangeInfo(date, direction);
10526
+ renderRange = this.buildRenderRange(currentInfo.range, currentInfo.unit);
10527
+ activeRange = cloneRange(renderRange);
10528
+
10529
+ if (!this.opt('showNonCurrentDates')) {
10530
+ activeRange = constrainRange(activeRange, currentInfo.range);
10531
+ }
10532
+
10533
+ minTime = moment.duration(this.opt('minTime'));
10534
+ maxTime = moment.duration(this.opt('maxTime'));
10535
+ this.adjustActiveRange(activeRange, minTime, maxTime);
10536
+
10537
+ activeRange = constrainRange(activeRange, validRange);
10538
+ date = constrainDate(date, activeRange);
10539
+
10540
+ // it's invalid if the originally requested date is not contained,
10541
+ // or if the range is completely outside of the valid range.
10542
+ isValid = doRangesIntersect(currentInfo.range, validRange);
10543
+
10544
+ return {
10545
+ validRange: validRange,
10546
+ currentRange: currentInfo.range,
10547
+ currentRangeUnit: currentInfo.unit,
10548
+ activeRange: activeRange,
10549
+ renderRange: renderRange,
10550
+ minTime: minTime,
10551
+ maxTime: maxTime,
10552
+ isValid: isValid,
10553
+ date: date,
10554
+ dateIncrement: this.buildDateIncrement(currentInfo.duration)
10555
+ // pass a fallback (might be null) ^
10556
+ };
10557
+ },
10558
+
10559
+
10560
+ // Builds an object with optional start/end properties.
10561
+ // Indicates the minimum/maximum dates to display.
10562
+ buildValidRange: function() {
10563
+ return this.getRangeOption('validRange', this.calendar.getNow()) || {};
10564
+ },
10565
+
10566
+
10567
+ // Builds a structure with info about the "current" range, the range that is
10568
+ // highlighted as being the current month for example.
10569
+ // See buildDateProfile for a description of `direction`.
10570
+ // Guaranteed to have `range` and `unit` properties. `duration` is optional.
10571
+ buildCurrentRangeInfo: function(date, direction) {
10572
+ var duration = null;
10573
+ var unit = null;
10574
+ var range = null;
10575
+ var dayCount;
10576
+
10577
+ if (this.viewSpec.duration) {
10578
+ duration = this.viewSpec.duration;
10579
+ unit = this.viewSpec.durationUnit;
10580
+ range = this.buildRangeFromDuration(date, direction, duration, unit);
10581
+ }
10582
+ else if ((dayCount = this.opt('dayCount'))) {
10583
+ unit = 'day';
10584
+ range = this.buildRangeFromDayCount(date, direction, dayCount);
10585
+ }
10586
+ else if ((range = this.buildCustomVisibleRange(date))) {
10587
+ unit = computeGreatestUnit(range.start, range.end);
10588
+ }
10589
+ else {
10590
+ duration = this.getFallbackDuration();
10591
+ unit = computeGreatestUnit(duration);
10592
+ range = this.buildRangeFromDuration(date, direction, duration, unit);
10593
+ }
10594
+
10595
+ this.normalizeCurrentRange(range, unit); // modifies in-place
10596
+
10597
+ return { duration: duration, unit: unit, range: range };
10598
+ },
10599
+
10600
+
10601
+ getFallbackDuration: function() {
10602
+ return moment.duration({ days: 1 });
10603
+ },
10604
+
10605
+
10606
+ // If the range has day units or larger, remove times. Otherwise, ensure times.
10607
+ normalizeCurrentRange: function(range, unit) {
10608
+
10609
+ if (/^(year|month|week|day)$/.test(unit)) { // whole-days?
10610
+ range.start.stripTime();
10611
+ range.end.stripTime();
10612
+ }
10613
+ else { // needs to have a time?
10614
+ if (!range.start.hasTime()) {
10615
+ range.start.time(0); // give 00:00 time
10616
+ }
10617
+ if (!range.end.hasTime()) {
10618
+ range.end.time(0); // give 00:00 time
10619
+ }
10620
+ }
10621
+ },
10622
+
10623
+
10624
+ // Mutates the given activeRange to have time values (un-ambiguate)
10625
+ // if the minTime or maxTime causes the range to expand.
10626
+ // TODO: eventually activeRange should *always* have times.
10627
+ adjustActiveRange: function(range, minTime, maxTime) {
10628
+ var hasSpecialTimes = false;
10629
+
10630
+ if (this.usesMinMaxTime) {
10631
+
10632
+ if (minTime < 0) {
10633
+ range.start.time(0).add(minTime);
10634
+ hasSpecialTimes = true;
10635
+ }
10636
+
10637
+ if (maxTime > 24 * 60 * 60 * 1000) { // beyond 24 hours?
10638
+ range.end.time(maxTime - (24 * 60 * 60 * 1000));
10639
+ hasSpecialTimes = true;
10640
+ }
10641
+
10642
+ if (hasSpecialTimes) {
10643
+ if (!range.start.hasTime()) {
10644
+ range.start.time(0);
10645
+ }
10646
+ if (!range.end.hasTime()) {
10647
+ range.end.time(0);
10648
+ }
10649
+ }
10650
+ }
10651
+ },
10652
+
10653
+
10654
+ // Builds the "current" range when it is specified as an explicit duration.
10655
+ // `unit` is the already-computed computeGreatestUnit value of duration.
10656
+ buildRangeFromDuration: function(date, direction, duration, unit) {
10657
+ var alignment = this.opt('dateAlignment');
10658
+ var start = date.clone();
10659
+ var end;
10660
+ var dateIncrementInput;
10661
+ var dateIncrementDuration;
10662
+
10663
+ // if the view displays a single day or smaller
10664
+ if (duration.as('days') <= 1) {
10665
+ if (this.isHiddenDay(start)) {
10666
+ start = this.skipHiddenDays(start, direction);
10667
+ start.startOf('day');
10668
+ }
10669
+ }
10670
+
10671
+ // compute what the alignment should be
10672
+ if (!alignment) {
10673
+ dateIncrementInput = this.opt('dateIncrement');
10674
+
10675
+ if (dateIncrementInput) {
10676
+ dateIncrementDuration = moment.duration(dateIncrementInput);
10677
+
10678
+ // use the smaller of the two units
10679
+ if (dateIncrementDuration < duration) {
10680
+ alignment = computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput);
10681
+ }
10682
+ else {
10683
+ alignment = unit;
10684
+ }
10685
+ }
10686
+ else {
10687
+ alignment = unit;
10688
+ }
10689
+ }
10690
+
10691
+ start.startOf(alignment);
10692
+ end = start.clone().add(duration);
10693
+
10694
+ return { start: start, end: end };
10695
+ },
10696
+
10697
+
10698
+ // Builds the "current" range when a dayCount is specified.
10699
+ buildRangeFromDayCount: function(date, direction, dayCount) {
10700
+ var customAlignment = this.opt('dateAlignment');
10701
+ var runningCount = 0;
10702
+ var start = date.clone();
10703
+ var end;
10704
+
10705
+ if (customAlignment) {
10706
+ start.startOf(customAlignment);
10707
+ }
10708
+
10709
+ start.startOf('day');
10710
+ start = this.skipHiddenDays(start, direction);
10711
+
10712
+ end = start.clone();
10713
+ do {
10714
+ end.add(1, 'day');
10715
+ if (!this.isHiddenDay(end)) {
10716
+ runningCount++;
10717
+ }
10718
+ } while (runningCount < dayCount);
10719
+
10720
+ return { start: start, end: end };
10721
+ },
10722
+
10723
+
10724
+ // Builds a normalized range object for the "visible" range,
10725
+ // which is a way to define the currentRange and activeRange at the same time.
10726
+ buildCustomVisibleRange: function(date) {
10727
+ var visibleRange = this.getRangeOption(
10728
+ 'visibleRange',
10729
+ this.calendar.moment(date) // correct zone. also generates new obj that avoids mutations
10730
+ );
10731
+
10732
+ if (visibleRange && (!visibleRange.start || !visibleRange.end)) {
10733
+ return null;
10734
+ }
10735
+
10736
+ return visibleRange;
10737
+ },
10738
+
10739
+
10740
+ // Computes the range that will represent the element/cells for *rendering*,
10741
+ // but which may have voided days/times.
10742
+ buildRenderRange: function(currentRange, currentRangeUnit) {
10743
+ // cut off days in the currentRange that are hidden
10744
+ return this.trimHiddenDays(currentRange);
10745
+ },
10746
+
10747
+
10748
+ // Compute the duration value that should be added/substracted to the current date
10749
+ // when a prev/next operation happens.
10750
+ buildDateIncrement: function(fallback) {
10751
+ var dateIncrementInput = this.opt('dateIncrement');
10752
+ var customAlignment;
10753
+
10754
+ if (dateIncrementInput) {
10755
+ return moment.duration(dateIncrementInput);
10756
+ }
10757
+ else if ((customAlignment = this.opt('dateAlignment'))) {
10758
+ return moment.duration(1, customAlignment);
10759
+ }
10760
+ else if (fallback) {
10761
+ return fallback;
10762
+ }
10763
+ else {
10764
+ return moment.duration({ days: 1 });
10765
+ }
10766
+ },
10767
+
10768
+
10769
+ // Remove days from the beginning and end of the range that are computed as hidden.
10770
+ trimHiddenDays: function(inputRange) {
10771
+ return {
10772
+ start: this.skipHiddenDays(inputRange.start),
10773
+ end: this.skipHiddenDays(inputRange.end, -1, true) // exclusively move backwards
10774
+ };
10775
+ },
10776
+
10777
+
10778
+ // Compute the number of the give units in the "current" range.
10779
+ // Will return a floating-point number. Won't round.
10780
+ currentRangeAs: function(unit) {
10781
+ var currentRange = this.currentRange;
10782
+ return currentRange.end.diff(currentRange.start, unit, true);
10783
+ },
10784
+
10785
+
10786
+ // Arguments after name will be forwarded to a hypothetical function value
10787
+ // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
10788
+ // Always clone your objects if you fear mutation.
10789
+ getRangeOption: function(name) {
10790
+ var val = this.opt(name);
10791
+
10792
+ if (typeof val === 'function') {
10793
+ val = val.apply(
10794
+ null,
10795
+ Array.prototype.slice.call(arguments, 1)
10796
+ );
10797
+ }
10798
+
10799
+ if (val) {
10800
+ return this.calendar.parseRange(val);
10801
+ }
10802
+ },
10803
+
10804
+
10805
+ /* Hidden Days
10806
+ ------------------------------------------------------------------------------------------------------------------*/
10807
+
10808
+
10809
+ // Initializes internal variables related to calculating hidden days-of-week
10810
+ initHiddenDays: function() {
10811
+ var hiddenDays = this.opt('hiddenDays') || []; // array of day-of-week indices that are hidden
10812
+ var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
10813
+ var dayCnt = 0;
10814
+ var i;
10815
+
10816
+ if (this.opt('weekends') === false) {
10817
+ hiddenDays.push(0, 6); // 0=sunday, 6=saturday
10818
+ }
10819
+
10820
+ for (i = 0; i < 7; i++) {
10821
+ if (
10822
+ !(isHiddenDayHash[i] = $.inArray(i, hiddenDays) !== -1)
10823
+ ) {
10824
+ dayCnt++;
10825
+ }
10826
+ }
10827
+
10828
+ if (!dayCnt) {
10829
+ throw 'invalid hiddenDays'; // all days were hidden? bad.
10830
+ }
10831
+
10832
+ this.isHiddenDayHash = isHiddenDayHash;
10833
+ },
10834
+
10835
+
10836
+ // Is the current day hidden?
10837
+ // `day` is a day-of-week index (0-6), or a Moment
10838
+ isHiddenDay: function(day) {
10839
+ if (moment.isMoment(day)) {
10840
+ day = day.day();
10841
+ }
10842
+ return this.isHiddenDayHash[day];
10843
+ },
10844
+
10845
+
10846
+ // Incrementing the current day until it is no longer a hidden day, returning a copy.
10847
+ // DOES NOT CONSIDER validRange!
10848
+ // If the initial value of `date` is not a hidden day, don't do anything.
10849
+ // Pass `isExclusive` as `true` if you are dealing with an end date.
10850
+ // `inc` defaults to `1` (increment one day forward each time)
10851
+ skipHiddenDays: function(date, inc, isExclusive) {
10852
+ var out = date.clone();
10853
+ inc = inc || 1;
10854
+ while (
10855
+ this.isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]
10856
+ ) {
10857
+ out.add(inc, 'days');
10858
+ }
10859
+ return out;
10860
+ }
10861
+
10862
+ });
10863
+
10864
+ ;;
10865
+
10866
+ /*
10867
+ Embodies a div that has potential scrollbars
10868
+ */
10869
+ var Scroller = FC.Scroller = Class.extend({
10870
+
10871
+ el: null, // the guaranteed outer element
10872
+ scrollEl: null, // the element with the scrollbars
10873
+ overflowX: null,
10874
+ overflowY: null,
10875
+
10876
+
10877
+ constructor: function(options) {
10878
+ options = options || {};
10879
+ this.overflowX = options.overflowX || options.overflow || 'auto';
10880
+ this.overflowY = options.overflowY || options.overflow || 'auto';
10881
+ },
10882
+
10883
+
10884
+ render: function() {
10885
+ this.el = this.renderEl();
10886
+ this.applyOverflow();
10887
+ },
10888
+
10889
+
10890
+ renderEl: function() {
10891
+ return (this.scrollEl = $('<div class="fc-scroller"></div>'));
10892
+ },
10893
+
10894
+
10895
+ // sets to natural height, unlocks overflow
10896
+ clear: function() {
10897
+ this.setHeight('auto');
10898
+ this.applyOverflow();
10899
+ },
10900
+
10901
+
10902
+ destroy: function() {
10903
+ this.el.remove();
10904
+ },
10905
+
10906
+
10907
+ // Overflow
10908
+ // -----------------------------------------------------------------------------------------------------------------
10909
+
10910
+
10911
+ applyOverflow: function() {
10912
+ this.scrollEl.css({
10913
+ 'overflow-x': this.overflowX,
10914
+ 'overflow-y': this.overflowY
10915
+ });
10916
+ },
10917
+
10918
+
10919
+ // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
10920
+ // Useful for preserving scrollbar widths regardless of future resizes.
10921
+ // Can pass in scrollbarWidths for optimization.
10922
+ lockOverflow: function(scrollbarWidths) {
10923
+ var overflowX = this.overflowX;
10924
+ var overflowY = this.overflowY;
10925
+
10926
+ scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
10927
+
10928
+ if (overflowX === 'auto') {
10929
+ overflowX = (
10930
+ scrollbarWidths.top || scrollbarWidths.bottom || // horizontal scrollbars?
10931
+ // OR scrolling pane with massless scrollbars?
10932
+ this.scrollEl[0].scrollWidth - 1 > this.scrollEl[0].clientWidth
10933
+ // subtract 1 because of IE off-by-one issue
10934
+ ) ? 'scroll' : 'hidden';
10935
+ }
10936
+
10937
+ if (overflowY === 'auto') {
10938
+ overflowY = (
10939
+ scrollbarWidths.left || scrollbarWidths.right || // vertical scrollbars?
10940
+ // OR scrolling pane with massless scrollbars?
10941
+ this.scrollEl[0].scrollHeight - 1 > this.scrollEl[0].clientHeight
10942
+ // subtract 1 because of IE off-by-one issue
10943
+ ) ? 'scroll' : 'hidden';
10944
+ }
10945
+
10946
+ this.scrollEl.css({ 'overflow-x': overflowX, 'overflow-y': overflowY });
10947
+ },
10948
+
10949
+
10950
+ // Getters / Setters
10951
+ // -----------------------------------------------------------------------------------------------------------------
10952
+
10953
+
10954
+ setHeight: function(height) {
10955
+ this.scrollEl.height(height);
10956
+ },
10957
+
10958
+
10959
+ getScrollTop: function() {
10960
+ return this.scrollEl.scrollTop();
10961
+ },
10962
+
10963
+
10964
+ setScrollTop: function(top) {
10965
+ this.scrollEl.scrollTop(top);
10966
+ },
10967
+
10968
+
10969
+ getClientWidth: function() {
10970
+ return this.scrollEl[0].clientWidth;
10971
+ },
10972
+
10973
+
10974
+ getClientHeight: function() {
10975
+ return this.scrollEl[0].clientHeight;
10976
+ },
10977
+
10978
+
10979
+ getScrollbarWidths: function() {
10980
+ return getScrollbarWidths(this.scrollEl);
10981
+ }
10982
+
10983
+ });
10984
+
10985
+ ;;
10986
+ function Iterator(items) {
10987
+ this.items = items || [];
10988
+ }
10989
+
10990
+
10991
+ /* Calls a method on every item passing the arguments through */
10992
+ Iterator.prototype.proxyCall = function(methodName) {
10993
+ var args = Array.prototype.slice.call(arguments, 1);
10994
+ var results = [];
10995
+
10996
+ this.items.forEach(function(item) {
10997
+ results.push(item[methodName].apply(item, args));
10998
+ });
10999
+
11000
+ return results;
11001
+ };
11002
+
11003
+ ;;
11004
+
11005
+ /* Toolbar with buttons and title
11006
+ ----------------------------------------------------------------------------------------------------------------------*/
11007
+
11008
+ function Toolbar(calendar, toolbarOptions) {
11009
+ var t = this;
11010
+
11011
+ // exports
11012
+ t.setToolbarOptions = setToolbarOptions;
11013
+ t.render = render;
11014
+ t.removeElement = removeElement;
11015
+ t.updateTitle = updateTitle;
11016
+ t.activateButton = activateButton;
11017
+ t.deactivateButton = deactivateButton;
11018
+ t.disableButton = disableButton;
11019
+ t.enableButton = enableButton;
11020
+ t.getViewsWithButtons = getViewsWithButtons;
11021
+ t.el = null; // mirrors local `el`
11022
+
11023
+ // locals
11024
+ var el;
11025
+ var viewsWithButtons = [];
11026
+ var tm;
11027
+
11028
+ // method to update toolbar-specific options, not calendar-wide options
11029
+ function setToolbarOptions(newToolbarOptions) {
11030
+ toolbarOptions = newToolbarOptions;
11031
+ }
11032
+
11033
+ // can be called repeatedly and will rerender
11034
+ function render() {
11035
+ var sections = toolbarOptions.layout;
11036
+
11037
+ tm = calendar.opt('theme') ? 'ui' : 'fc';
11038
+
11039
+ if (sections) {
11040
+ if (!el) {
11041
+ el = this.el = $("<div class='fc-toolbar "+ toolbarOptions.extraClasses + "'/>");
11042
+ }
11043
+ else {
11044
+ el.empty();
11045
+ }
11046
+ el.append(renderSection('left'))
11047
+ .append(renderSection('right'))
11048
+ .append(renderSection('center'))
11049
+ .append('<div class="fc-clear"/>');
11050
+ }
11051
+ else {
11052
+ removeElement();
11053
+ }
11054
+ }
11055
+
11056
+
11057
+ function removeElement() {
11058
+ if (el) {
11059
+ el.remove();
11060
+ el = t.el = null;
11061
+ }
11062
+ }
11063
+
11064
+
11065
+ function renderSection(position) {
11066
+ var sectionEl = $('<div class="fc-' + position + '"/>');
11067
+ var buttonStr = toolbarOptions.layout[position];
11068
+ var calendarCustomButtons = calendar.opt('customButtons') || {};
11069
+ var calendarButtonText = calendar.opt('buttonText') || {};
11070
+
11071
+ if (buttonStr) {
11072
+ $.each(buttonStr.split(' '), function(i) {
11073
+ var groupChildren = $();
11074
+ var isOnlyButtons = true;
11075
+ var groupEl;
11076
+
11077
+ $.each(this.split(','), function(j, buttonName) {
11078
+ var customButtonProps;
11079
+ var viewSpec;
11080
+ var buttonClick;
11081
+ var overrideText; // text explicitly set by calendar's constructor options. overcomes icons
11082
+ var defaultText;
11083
+ var themeIcon;
11084
+ var normalIcon;
11085
+ var innerHtml;
11086
+ var classes;
11087
+ var button; // the element
11088
+
11089
+ if (buttonName == 'title') {
11090
+ groupChildren = groupChildren.add($('<h2>&nbsp;</h2>')); // we always want it to take up height
11091
+ isOnlyButtons = false;
11092
+ }
11093
+ else {
11094
+ if ((customButtonProps = calendarCustomButtons[buttonName])) {
11095
+ buttonClick = function(ev) {
11096
+ if (customButtonProps.click) {
11097
+ customButtonProps.click.call(button[0], ev);
11098
+ }
11099
+ };
11100
+ overrideText = ''; // icons will override text
11101
+ defaultText = customButtonProps.text;
11102
+ }
11103
+ else if ((viewSpec = calendar.getViewSpec(buttonName))) {
11104
+ buttonClick = function() {
11105
+ calendar.changeView(buttonName);
11106
+ };
11107
+ viewsWithButtons.push(buttonName);
11108
+ overrideText = viewSpec.buttonTextOverride;
11109
+ defaultText = viewSpec.buttonTextDefault;
11110
+ }
11111
+ else if (calendar[buttonName]) { // a calendar method
11112
+ buttonClick = function() {
11113
+ calendar[buttonName]();
11114
+ };
11115
+ overrideText = (calendar.overrides.buttonText || {})[buttonName];
11116
+ defaultText = calendarButtonText[buttonName]; // everything else is considered default
11117
+ }
11118
+
11119
+ if (buttonClick) {
11120
+
11121
+ themeIcon =
11122
+ customButtonProps ?
11123
+ customButtonProps.themeIcon :
11124
+ calendar.opt('themeButtonIcons')[buttonName];
11125
+
11126
+ normalIcon =
11127
+ customButtonProps ?
11128
+ customButtonProps.icon :
11129
+ calendar.opt('buttonIcons')[buttonName];
11130
+
11131
+ if (overrideText) {
11132
+ innerHtml = htmlEscape(overrideText);
11133
+ }
11134
+ else if (themeIcon && calendar.opt('theme')) {
11135
+ innerHtml = "<span class='ui-icon ui-icon-" + themeIcon + "'></span>";
11136
+ }
11137
+ else if (normalIcon && !calendar.opt('theme')) {
11138
+ innerHtml = "<span class='fc-icon fc-icon-" + normalIcon + "'></span>";
11139
+ }
11140
+ else {
11141
+ innerHtml = htmlEscape(defaultText);
11142
+ }
11143
+
11144
+ classes = [
11145
+ 'fc-' + buttonName + '-button',
11146
+ tm + '-button',
11147
+ tm + '-state-default'
11148
+ ];
11149
+
11150
+ button = $( // type="button" so that it doesn't submit a form
11151
+ '<button type="button" class="' + classes.join(' ') + '">' +
11152
+ innerHtml +
11153
+ '</button>'
11154
+ )
11155
+ .click(function(ev) {
11156
+ // don't process clicks for disabled buttons
11157
+ if (!button.hasClass(tm + '-state-disabled')) {
11158
+
11159
+ buttonClick(ev);
11160
+
11161
+ // after the click action, if the button becomes the "active" tab, or disabled,
11162
+ // it should never have a hover class, so remove it now.
11163
+ if (
11164
+ button.hasClass(tm + '-state-active') ||
11165
+ button.hasClass(tm + '-state-disabled')
11166
+ ) {
11167
+ button.removeClass(tm + '-state-hover');
11168
+ }
11169
+ }
11170
+ })
11171
+ .mousedown(function() {
11172
+ // the *down* effect (mouse pressed in).
11173
+ // only on buttons that are not the "active" tab, or disabled
11174
+ button
11175
+ .not('.' + tm + '-state-active')
11176
+ .not('.' + tm + '-state-disabled')
11177
+ .addClass(tm + '-state-down');
11178
+ })
11179
+ .mouseup(function() {
11180
+ // undo the *down* effect
11181
+ button.removeClass(tm + '-state-down');
11182
+ })
11183
+ .hover(
11184
+ function() {
11185
+ // the *hover* effect.
11186
+ // only on buttons that are not the "active" tab, or disabled
11187
+ button
11188
+ .not('.' + tm + '-state-active')
11189
+ .not('.' + tm + '-state-disabled')
11190
+ .addClass(tm + '-state-hover');
11191
+ },
11192
+ function() {
11193
+ // undo the *hover* effect
11194
+ button
11195
+ .removeClass(tm + '-state-hover')
11196
+ .removeClass(tm + '-state-down'); // if mouseleave happens before mouseup
11197
+ }
11198
+ );
11199
+
11200
+ groupChildren = groupChildren.add(button);
11201
+ }
11202
+ }
11203
+ });
11204
+
11205
+ if (isOnlyButtons) {
11206
+ groupChildren
11207
+ .first().addClass(tm + '-corner-left').end()
11208
+ .last().addClass(tm + '-corner-right').end();
11209
+ }
11210
+
11211
+ if (groupChildren.length > 1) {
11212
+ groupEl = $('<div/>');
11213
+ if (isOnlyButtons) {
11214
+ groupEl.addClass('fc-button-group');
11215
+ }
11216
+ groupEl.append(groupChildren);
11217
+ sectionEl.append(groupEl);
11218
+ }
11219
+ else {
11220
+ sectionEl.append(groupChildren); // 1 or 0 children
11221
+ }
11222
+ });
11223
+ }
11224
+
11225
+ return sectionEl;
11226
+ }
11227
+
11228
+
11229
+ function updateTitle(text) {
11230
+ if (el) {
11231
+ el.find('h2').text(text);
11232
+ }
11233
+ }
11234
+
11235
+
11236
+ function activateButton(buttonName) {
11237
+ if (el) {
11238
+ el.find('.fc-' + buttonName + '-button')
11239
+ .addClass(tm + '-state-active');
11240
+ }
11241
+ }
11242
+
11243
+
11244
+ function deactivateButton(buttonName) {
11245
+ if (el) {
11246
+ el.find('.fc-' + buttonName + '-button')
11247
+ .removeClass(tm + '-state-active');
11248
+ }
11249
+ }
11250
+
11251
+
11252
+ function disableButton(buttonName) {
11253
+ if (el) {
11254
+ el.find('.fc-' + buttonName + '-button')
11255
+ .prop('disabled', true)
11256
+ .addClass(tm + '-state-disabled');
11257
+ }
11258
+ }
11259
+
11260
+
11261
+ function enableButton(buttonName) {
11262
+ if (el) {
11263
+ el.find('.fc-' + buttonName + '-button')
11264
+ .prop('disabled', false)
11265
+ .removeClass(tm + '-state-disabled');
11266
+ }
11267
+ }
11268
+
11269
+
11270
+ function getViewsWithButtons() {
11271
+ return viewsWithButtons;
11272
+ }
11273
+
11274
+ }
11275
+
11276
+ ;;
11277
+
11278
+ var Calendar = FC.Calendar = Class.extend(EmitterMixin, {
11279
+
11280
+ view: null, // current View object
11281
+ viewsByType: null, // holds all instantiated view instances, current or not
11282
+ currentDate: null, // unzoned moment. private (public API should use getDate instead)
11283
+ loadingLevel: 0, // number of simultaneous loading tasks
11284
+
11285
+
11286
+ constructor: function(el, overrides) {
11287
+
11288
+ // declare the current calendar instance relies on GlobalEmitter. needed for garbage collection.
11289
+ // unneeded() is called in destroy.
11290
+ GlobalEmitter.needed();
11291
+
11292
+ this.el = el;
11293
+ this.viewsByType = {};
11294
+ this.viewSpecCache = {};
11295
+
11296
+ this.initOptionsInternals(overrides);
11297
+ this.initMomentInternals(); // needs to happen after options hash initialized
11298
+ this.initCurrentDate();
11299
+
11300
+ EventManager.call(this); // needs options immediately
11301
+ this.initialize();
11302
+ },
11303
+
11304
+
11305
+ // Subclasses can override this for initialization logic after the constructor has been called
11306
+ initialize: function() {
11307
+ },
11308
+
11309
+
11310
+ // Public API
11311
+ // -----------------------------------------------------------------------------------------------------------------
11312
+
11313
+
11314
+ getCalendar: function() {
11315
+ return this;
11316
+ },
11317
+
11318
+
11319
+ getView: function() {
11320
+ return this.view;
11321
+ },
11322
+
11323
+
11324
+ publiclyTrigger: function(name, thisObj) {
11325
+ var args = Array.prototype.slice.call(arguments, 2);
11326
+ var optHandler = this.opt(name);
11327
+
11328
+ thisObj = thisObj || this.el[0];
11329
+ this.triggerWith(name, thisObj, args); // Emitter's method
11330
+
11331
+ if (optHandler) {
11332
+ return optHandler.apply(thisObj, args);
11333
+ }
11334
+ },
11335
+
11336
+
11337
+ // View
11338
+ // -----------------------------------------------------------------------------------------------------------------
11339
+
11340
+
11341
+ // Given a view name for a custom view or a standard view, creates a ready-to-go View object
11342
+ instantiateView: function(viewType) {
11343
+ var spec = this.getViewSpec(viewType);
11344
+
11345
+ return new spec['class'](this, spec);
11346
+ },
11347
+
11348
+
11349
+ // Returns a boolean about whether the view is okay to instantiate at some point
11350
+ isValidViewType: function(viewType) {
11351
+ return Boolean(this.getViewSpec(viewType));
11352
+ },
11353
+
11354
+
11355
+ changeView: function(viewName, dateOrRange) {
11356
+
11357
+ if (dateOrRange) {
11358
+
11359
+ if (dateOrRange.start && dateOrRange.end) { // a range
11360
+ this.recordOptionOverrides({ // will not rerender
11361
+ visibleRange: dateOrRange
11362
+ });
11363
+ }
11364
+ else { // a date
11365
+ this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate
11366
+ }
11367
+ }
11368
+
11369
+ this.renderView(viewName);
11370
+ },
11371
+
11372
+
11373
+ // Forces navigation to a view for the given date.
11374
+ // `viewType` can be a specific view name or a generic one like "week" or "day".
11375
+ zoomTo: function(newDate, viewType) {
11376
+ var spec;
11377
+
11378
+ viewType = viewType || 'day'; // day is default zoom
11379
+ spec = this.getViewSpec(viewType) || this.getUnitViewSpec(viewType);
11380
+
11381
+ this.currentDate = newDate.clone();
11382
+ this.renderView(spec ? spec.type : null);
11383
+ },
11384
+
11385
+
11386
+ // Current Date
11387
+ // -----------------------------------------------------------------------------------------------------------------
11388
+
11389
+
11390
+ initCurrentDate: function() {
11391
+ var defaultDateInput = this.opt('defaultDate');
11392
+
11393
+ // compute the initial ambig-timezone date
11394
+ if (defaultDateInput != null) {
11395
+ this.currentDate = this.moment(defaultDateInput).stripZone();
11396
+ }
11397
+ else {
11398
+ this.currentDate = this.getNow(); // getNow already returns unzoned
11399
+ }
11400
+ },
11401
+
11402
+
11403
+ prev: function() {
11404
+ var prevInfo = this.view.buildPrevDateProfile(this.currentDate);
11405
+
11406
+ if (prevInfo.isValid) {
11407
+ this.currentDate = prevInfo.date;
11408
+ this.renderView();
11409
+ }
11410
+ },
11411
+
11412
+
11413
+ next: function() {
11414
+ var nextInfo = this.view.buildNextDateProfile(this.currentDate);
11415
+
11416
+ if (nextInfo.isValid) {
11417
+ this.currentDate = nextInfo.date;
11418
+ this.renderView();
11419
+ }
11420
+ },
11421
+
11422
+
11423
+ prevYear: function() {
11424
+ this.currentDate.add(-1, 'years');
11425
+ this.renderView();
11426
+ },
11427
+
11428
+
11429
+ nextYear: function() {
11430
+ this.currentDate.add(1, 'years');
11431
+ this.renderView();
11432
+ },
11433
+
11434
+
11435
+ today: function() {
11436
+ this.currentDate = this.getNow(); // should deny like prev/next?
11437
+ this.renderView();
11438
+ },
11439
+
11440
+
11441
+ gotoDate: function(zonedDateInput) {
11442
+ this.currentDate = this.moment(zonedDateInput).stripZone();
11443
+ this.renderView();
11444
+ },
11445
+
11446
+
11447
+ incrementDate: function(delta) {
11448
+ this.currentDate.add(moment.duration(delta));
11449
+ this.renderView();
11450
+ },
11451
+
11452
+
11453
+ // for external API
11454
+ getDate: function() {
11455
+ return this.applyTimezone(this.currentDate); // infuse the calendar's timezone
11456
+ },
11457
+
11458
+
11459
+ // Loading Triggering
11460
+ // -----------------------------------------------------------------------------------------------------------------
11461
+
11462
+
11463
+ // Should be called when any type of async data fetching begins
11464
+ pushLoading: function() {
11465
+ if (!(this.loadingLevel++)) {
11466
+ this.publiclyTrigger('loading', null, true, this.view);
11467
+ }
11468
+ },
11469
+
11470
+
11471
+ // Should be called when any type of async data fetching completes
11472
+ popLoading: function() {
11473
+ if (!(--this.loadingLevel)) {
11474
+ this.publiclyTrigger('loading', null, false, this.view);
11475
+ }
11476
+ },
11477
+
11478
+
11479
+ // Selection
11480
+ // -----------------------------------------------------------------------------------------------------------------
11481
+
11482
+
11483
+ // this public method receives start/end dates in any format, with any timezone
11484
+ select: function(zonedStartInput, zonedEndInput) {
11485
+ this.view.select(
11486
+ this.buildSelectSpan.apply(this, arguments)
11487
+ );
11488
+ },
11489
+
11490
+
11491
+ unselect: function() { // safe to be called before renderView
11492
+ if (this.view) {
11493
+ this.view.unselect();
11494
+ }
11495
+ },
11496
+
11497
+
11498
+ // Given arguments to the select method in the API, returns a span (unzoned start/end and other info)
11499
+ buildSelectSpan: function(zonedStartInput, zonedEndInput) {
11500
+ var start = this.moment(zonedStartInput).stripZone();
11501
+ var end;
11502
+
11503
+ if (zonedEndInput) {
11504
+ end = this.moment(zonedEndInput).stripZone();
11505
+ }
11506
+ else if (start.hasTime()) {
11507
+ end = start.clone().add(this.defaultTimedEventDuration);
11508
+ }
11509
+ else {
11510
+ end = start.clone().add(this.defaultAllDayEventDuration);
11511
+ }
11512
+
11513
+ return { start: start, end: end };
11514
+ },
11515
+
11516
+
11517
+ // Misc
11518
+ // -----------------------------------------------------------------------------------------------------------------
11519
+
11520
+
11521
+ // will return `null` if invalid range
11522
+ parseRange: function(rangeInput) {
11523
+ var start = null;
11524
+ var end = null;
11525
+
11526
+ if (rangeInput.start) {
11527
+ start = this.moment(rangeInput.start).stripZone();
11528
+ }
11529
+
11530
+ if (rangeInput.end) {
11531
+ end = this.moment(rangeInput.end).stripZone();
11532
+ }
11533
+
11534
+ if (!start && !end) {
11535
+ return null;
11536
+ }
11537
+
11538
+ if (start && end && end.isBefore(start)) {
11539
+ return null;
11540
+ }
11541
+
11542
+ return { start: start, end: end };
11543
+ },
11544
+
11545
+
11546
+ rerenderEvents: function() { // API method. destroys old events if previously rendered.
11547
+ if (this.elementVisible()) {
11548
+ this.reportEventChange(); // will re-trasmit events to the view, causing a rerender
11549
+ }
11550
+ }
11551
+
11552
+ });
11553
+
11554
+ ;;
11555
+ /*
11556
+ Options binding/triggering system.
11557
+ */
11558
+ Calendar.mixin({
11559
+
11560
+ dirDefaults: null, // option defaults related to LTR or RTL
11561
+ localeDefaults: null, // option defaults related to current locale
11562
+ overrides: null, // option overrides given to the fullCalendar constructor
11563
+ dynamicOverrides: null, // options set with dynamic setter method. higher precedence than view overrides.
11564
+ optionsModel: null, // all defaults combined with overrides
11565
+
11566
+
11567
+ initOptionsInternals: function(overrides) {
11568
+ this.overrides = $.extend({}, overrides); // make a copy
11569
+ this.dynamicOverrides = {};
11570
+ this.optionsModel = new Model();
11571
+
11572
+ this.populateOptionsHash();
11573
+ },
11574
+
11575
+
11576
+ // public getter/setter
11577
+ option: function(name, value) {
11578
+ var newOptionHash;
11579
+
11580
+ if (typeof name === 'string') {
11581
+ if (value === undefined) { // getter
11582
+ return this.optionsModel.get(name);
11583
+ }
11584
+ else { // setter for individual option
11585
+ newOptionHash = {};
11586
+ newOptionHash[name] = value;
11587
+ this.setOptions(newOptionHash);
11588
+ }
11589
+ }
11590
+ else if (typeof name === 'object') { // compound setter with object input
11591
+ this.setOptions(name);
11592
+ }
11593
+ },
11594
+
11595
+
11596
+ // private getter
11597
+ opt: function(name) {
11598
+ return this.optionsModel.get(name);
11599
+ },
11600
+
11601
+
11602
+ setOptions: function(newOptionHash) {
11603
+ var optionCnt = 0;
11604
+ var optionName;
11605
+
11606
+ this.recordOptionOverrides(newOptionHash);
11607
+
11608
+ for (optionName in newOptionHash) {
11609
+ optionCnt++;
11610
+ }
11611
+
11612
+ // special-case handling of single option change.
11613
+ // if only one option change, `optionName` will be its name.
11614
+ if (optionCnt === 1) {
11615
+ if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') {
11616
+ this.updateSize(true); // true = allow recalculation of height
11617
+ return;
11618
+ }
11619
+ else if (optionName === 'defaultDate') {
11620
+ return; // can't change date this way. use gotoDate instead
11621
+ }
11622
+ else if (optionName === 'businessHours') {
11623
+ if (this.view) {
11624
+ this.view.unrenderBusinessHours();
11625
+ this.view.renderBusinessHours();
11626
+ }
11627
+ return;
11628
+ }
11629
+ else if (optionName === 'timezone') {
11630
+ this.rezoneArrayEventSources();
11631
+ this.refetchEvents();
11632
+ return;
11633
+ }
11634
+ }
11635
+
11636
+ // catch-all. rerender the header and footer and rebuild/rerender the current view
11637
+ this.renderHeader();
11638
+ this.renderFooter();
11639
+
11640
+ // even non-current views will be affected by this option change. do before rerender
11641
+ // TODO: detangle
11642
+ this.viewsByType = {};
11643
+
11644
+ this.reinitView();
11645
+ },
11646
+
11647
+
11648
+ // Computes the flattened options hash for the calendar and assigns to `this.options`.
11649
+ // Assumes this.overrides and this.dynamicOverrides have already been initialized.
11650
+ populateOptionsHash: function() {
11651
+ var locale, localeDefaults;
11652
+ var isRTL, dirDefaults;
11653
+ var rawOptions;
11654
+
11655
+ locale = firstDefined( // explicit locale option given?
11656
+ this.dynamicOverrides.locale,
11657
+ this.overrides.locale
11658
+ );
11659
+ localeDefaults = localeOptionHash[locale];
11660
+ if (!localeDefaults) { // explicit locale option not given or invalid?
11661
+ locale = Calendar.defaults.locale;
11662
+ localeDefaults = localeOptionHash[locale] || {};
11663
+ }
11664
+
11665
+ isRTL = firstDefined( // based on options computed so far, is direction RTL?
11666
+ this.dynamicOverrides.isRTL,
11667
+ this.overrides.isRTL,
11668
+ localeDefaults.isRTL,
11669
+ Calendar.defaults.isRTL
11670
+ );
11671
+ dirDefaults = isRTL ? Calendar.rtlDefaults : {};
11672
+
11673
+ this.dirDefaults = dirDefaults;
11674
+ this.localeDefaults = localeDefaults;
11675
+
11676
+ rawOptions = mergeOptions([ // merge defaults and overrides. lowest to highest precedence
11677
+ Calendar.defaults, // global defaults
11678
+ dirDefaults,
11679
+ localeDefaults,
11680
+ this.overrides,
11681
+ this.dynamicOverrides
11682
+ ]);
11683
+ populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options
11684
+
11685
+ this.optionsModel.reset(rawOptions);
11686
+ },
11687
+
11688
+
11689
+ // stores the new options internally, but does not rerender anything.
11690
+ recordOptionOverrides: function(newOptionHash) {
11691
+ var optionName;
11692
+
11693
+ for (optionName in newOptionHash) {
11694
+ this.dynamicOverrides[optionName] = newOptionHash[optionName];
11695
+ }
11696
+
11697
+ this.viewSpecCache = {}; // the dynamic override invalidates the options in this cache, so just clear it
11698
+ this.populateOptionsHash(); // this.options needs to be recomputed after the dynamic override
11699
+ }
11700
+
11701
+ });
11702
+
11703
+ ;;
11704
+
11705
+ Calendar.mixin({
11706
+
11707
+ defaultAllDayEventDuration: null,
11708
+ defaultTimedEventDuration: null,
11709
+ localeData: null,
11710
+
11711
+
11712
+ initMomentInternals: function() {
11713
+ var _this = this;
11714
+
11715
+ this.defaultAllDayEventDuration = moment.duration(this.opt('defaultAllDayEventDuration'));
11716
+ this.defaultTimedEventDuration = moment.duration(this.opt('defaultTimedEventDuration'));
11717
+
11718
+ // Called immediately, and when any of the options change.
11719
+ // Happens before any internal objects rebuild or rerender, because this is very core.
11720
+ this.optionsModel.watch('buildingMomentLocale', [
11721
+ '?locale', '?monthNames', '?monthNamesShort', '?dayNames', '?dayNamesShort',
11722
+ '?firstDay', '?weekNumberCalculation'
11723
+ ], function(opts) {
11724
+ var weekNumberCalculation = opts.weekNumberCalculation;
11725
+ var firstDay = opts.firstDay;
11726
+ var _week;
11727
+
11728
+ // normalize
11729
+ if (weekNumberCalculation === 'iso') {
11730
+ weekNumberCalculation = 'ISO'; // normalize
11731
+ }
11732
+
11733
+ var localeData = createObject( // make a cheap copy
11734
+ getMomentLocaleData(opts.locale) // will fall back to en
11735
+ );
11736
+
11737
+ if (opts.monthNames) {
11738
+ localeData._months = opts.monthNames;
11739
+ }
11740
+ if (opts.monthNamesShort) {
11741
+ localeData._monthsShort = opts.monthNamesShort;
11742
+ }
11743
+ if (opts.dayNames) {
11744
+ localeData._weekdays = opts.dayNames;
11745
+ }
11746
+ if (opts.dayNamesShort) {
11747
+ localeData._weekdaysShort = opts.dayNamesShort;
11748
+ }
11749
+
11750
+ if (firstDay == null && weekNumberCalculation === 'ISO') {
11751
+ firstDay = 1;
11752
+ }
11753
+ if (firstDay != null) {
11754
+ _week = createObject(localeData._week); // _week: { dow: # }
11755
+ _week.dow = firstDay;
11756
+ localeData._week = _week;
11757
+ }
11758
+
11759
+ if ( // whitelist certain kinds of input
11760
+ weekNumberCalculation === 'ISO' ||
11761
+ weekNumberCalculation === 'local' ||
11762
+ typeof weekNumberCalculation === 'function'
11763
+ ) {
11764
+ localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it
11765
+ }
11766
+
11767
+ _this.localeData = localeData;
11768
+
11769
+ // If the internal current date object already exists, move to new locale.
11770
+ // We do NOT need to do this technique for event dates, because this happens when converting to "segments".
11771
+ if (_this.currentDate) {
11772
+ _this.localizeMoment(_this.currentDate); // sets to localeData
11773
+ }
11774
+ });
11775
+ },
11776
+
11777
+
11778
+ // Builds a moment using the settings of the current calendar: timezone and locale.
11779
+ // Accepts anything the vanilla moment() constructor accepts.
11780
+ moment: function() {
11781
+ var mom;
11782
+
11783
+ if (this.opt('timezone') === 'local') {
11784
+ mom = FC.moment.apply(null, arguments);
11785
+
11786
+ // Force the moment to be local, because FC.moment doesn't guarantee it.
11787
+ if (mom.hasTime()) { // don't give ambiguously-timed moments a local zone
11788
+ mom.local();
11789
+ }
11790
+ }
11791
+ else if (this.opt('timezone') === 'UTC') {
11792
+ mom = FC.moment.utc.apply(null, arguments); // process as UTC
11793
+ }
11794
+ else {
11795
+ mom = FC.moment.parseZone.apply(null, arguments); // let the input decide the zone
11796
+ }
11797
+
11798
+ this.localizeMoment(mom); // TODO
11799
+
11800
+ return mom;
11801
+ },
11802
+
11803
+
11804
+ // Updates the given moment's locale settings to the current calendar locale settings.
11805
+ localizeMoment: function(mom) {
11806
+ mom._locale = this.localeData;
11807
+ },
11808
+
11809
+
11810
+ // Returns a boolean about whether or not the calendar knows how to calculate
11811
+ // the timezone offset of arbitrary dates in the current timezone.
11812
+ getIsAmbigTimezone: function() {
11813
+ return this.opt('timezone') !== 'local' && this.opt('timezone') !== 'UTC';
11814
+ },
11815
+
11816
+
11817
+ // Returns a copy of the given date in the current timezone. Has no effect on dates without times.
11818
+ applyTimezone: function(date) {
11819
+ if (!date.hasTime()) {
11820
+ return date.clone();
11821
+ }
11822
+
11823
+ var zonedDate = this.moment(date.toArray());
11824
+ var timeAdjust = date.time() - zonedDate.time();
11825
+ var adjustedZonedDate;
11826
+
11827
+ // Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396)
11828
+ if (timeAdjust) { // is the time result different than expected?
11829
+ adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds
11830
+ if (date.time() - adjustedZonedDate.time() === 0) { // does it match perfectly now?
11831
+ zonedDate = adjustedZonedDate;
11832
+ }
11833
+ }
11834
+
11835
+ return zonedDate;
11836
+ },
11837
+
11838
+
11839
+ // Returns a moment for the current date, as defined by the client's computer or from the `now` option.
11840
+ // Will return an moment with an ambiguous timezone.
11841
+ getNow: function() {
11842
+ var now = this.opt('now');
11843
+ if (typeof now === 'function') {
11844
+ now = now();
11845
+ }
11846
+ return this.moment(now).stripZone();
11847
+ },
11848
+
11849
+
11850
+ // Produces a human-readable string for the given duration.
11851
+ // Side-effect: changes the locale of the given duration.
11852
+ humanizeDuration: function(duration) {
11853
+ return duration.locale(this.opt('locale')).humanize();
11854
+ },
11855
+
11856
+
11857
+
11858
+ // Event-Specific Date Utilities. TODO: move
11859
+ // -----------------------------------------------------------------------------------------------------------------
11860
+
11861
+
11862
+ // Get an event's normalized end date. If not present, calculate it from the defaults.
11863
+ getEventEnd: function(event) {
11864
+ if (event.end) {
11865
+ return event.end.clone();
11866
+ }
11867
+ else {
11868
+ return this.getDefaultEventEnd(event.allDay, event.start);
11869
+ }
11870
+ },
11871
+
11872
+
11873
+ // Given an event's allDay status and start date, return what its fallback end date should be.
11874
+ // TODO: rename to computeDefaultEventEnd
11875
+ getDefaultEventEnd: function(allDay, zonedStart) {
11876
+ var end = zonedStart.clone();
11877
+
11878
+ if (allDay) {
11879
+ end.stripTime().add(this.defaultAllDayEventDuration);
11880
+ }
11881
+ else {
11882
+ end.add(this.defaultTimedEventDuration);
11883
+ }
11884
+
11885
+ if (this.getIsAmbigTimezone()) {
11886
+ end.stripZone(); // we don't know what the tzo should be
11887
+ }
11888
+
11889
+ return end;
11890
+ }
11891
+
11892
+ });
11893
+
11894
+ ;;
11895
+
11896
+ Calendar.mixin({
11897
+
11898
+ viewSpecCache: null, // cache of view definitions (initialized in Calendar.js)
11899
+
11900
+
11901
+ // Gets information about how to create a view. Will use a cache.
11902
+ getViewSpec: function(viewType) {
11903
+ var cache = this.viewSpecCache;
11904
+
11905
+ return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType));
11906
+ },
11907
+
11908
+
11909
+ // Given a duration singular unit, like "week" or "day", finds a matching view spec.
11910
+ // Preference is given to views that have corresponding buttons.
11911
+ getUnitViewSpec: function(unit) {
11912
+ var viewTypes;
11913
+ var i;
11914
+ var spec;
11915
+
11916
+ if ($.inArray(unit, unitsDesc) != -1) {
11917
+
11918
+ // put views that have buttons first. there will be duplicates, but oh well
11919
+ viewTypes = this.header.getViewsWithButtons(); // TODO: include footer as well?
11920
+ $.each(FC.views, function(viewType) { // all views
11921
+ viewTypes.push(viewType);
11922
+ });
11923
+
11924
+ for (i = 0; i < viewTypes.length; i++) {
11925
+ spec = this.getViewSpec(viewTypes[i]);
11926
+ if (spec) {
11927
+ if (spec.singleUnit == unit) {
11928
+ return spec;
11929
+ }
11930
+ }
11931
+ }
11932
+ }
11933
+ },
11934
+
11935
+
11936
+ // Builds an object with information on how to create a given view
11937
+ buildViewSpec: function(requestedViewType) {
11938
+ var viewOverrides = this.overrides.views || {};
11939
+ var specChain = []; // for the view. lowest to highest priority
11940
+ var defaultsChain = []; // for the view. lowest to highest priority
11941
+ var overridesChain = []; // for the view. lowest to highest priority
11942
+ var viewType = requestedViewType;
11943
+ var spec; // for the view
11944
+ var overrides; // for the view
11945
+ var durationInput;
11946
+ var duration;
11947
+ var unit;
11948
+
11949
+ // iterate from the specific view definition to a more general one until we hit an actual View class
11950
+ while (viewType) {
11951
+ spec = fcViews[viewType];
11952
+ overrides = viewOverrides[viewType];
11953
+ viewType = null; // clear. might repopulate for another iteration
11954
+
11955
+ if (typeof spec === 'function') { // TODO: deprecate
11956
+ spec = { 'class': spec };
11957
+ }
11958
+
11959
+ if (spec) {
11960
+ specChain.unshift(spec);
11961
+ defaultsChain.unshift(spec.defaults || {});
11962
+ durationInput = durationInput || spec.duration;
11963
+ viewType = viewType || spec.type;
11964
+ }
11965
+
11966
+ if (overrides) {
11967
+ overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
11968
+ durationInput = durationInput || overrides.duration;
11969
+ viewType = viewType || overrides.type;
11970
+ }
11971
+ }
11972
+
11973
+ spec = mergeProps(specChain);
11974
+ spec.type = requestedViewType;
11975
+ if (!spec['class']) {
11976
+ return false;
11977
+ }
11978
+
11979
+ // fall back to top-level `duration` option
11980
+ durationInput = durationInput ||
11981
+ this.dynamicOverrides.duration ||
11982
+ this.overrides.duration;
11983
+
11984
+ if (durationInput) {
11985
+ duration = moment.duration(durationInput);
11986
+
11987
+ if (duration.valueOf()) { // valid?
11988
+
11989
+ unit = computeDurationGreatestUnit(duration, durationInput);
11990
+
11991
+ spec.duration = duration;
11992
+ spec.durationUnit = unit;
11993
+
11994
+ // view is a single-unit duration, like "week" or "day"
11995
+ // incorporate options for this. lowest priority
11996
+ if (duration.as(unit) === 1) {
11997
+ spec.singleUnit = unit;
11998
+ overridesChain.unshift(viewOverrides[unit] || {});
11999
+ }
12000
+ }
12001
+ }
12002
+
12003
+ spec.defaults = mergeOptions(defaultsChain);
12004
+ spec.overrides = mergeOptions(overridesChain);
12005
+
12006
+ this.buildViewSpecOptions(spec);
12007
+ this.buildViewSpecButtonText(spec, requestedViewType);
12008
+
12009
+ return spec;
12010
+ },
12011
+
12012
+
12013
+ // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
12014
+ buildViewSpecOptions: function(spec) {
12015
+ spec.options = mergeOptions([ // lowest to highest priority
12016
+ Calendar.defaults, // global defaults
12017
+ spec.defaults, // view's defaults (from ViewSubclass.defaults)
12018
+ this.dirDefaults,
12019
+ this.localeDefaults, // locale and dir take precedence over view's defaults!
12020
+ this.overrides, // calendar's overrides (options given to constructor)
12021
+ spec.overrides, // view's overrides (view-specific options)
12022
+ this.dynamicOverrides // dynamically set via setter. highest precedence
12023
+ ]);
12024
+ populateInstanceComputableOptions(spec.options);
12025
+ },
12026
+
12027
+
12028
+ // Computes and assigns a view spec's buttonText-related options
12029
+ buildViewSpecButtonText: function(spec, requestedViewType) {
12030
+
12031
+ // given an options object with a possible `buttonText` hash, lookup the buttonText for the
12032
+ // requested view, falling back to a generic unit entry like "week" or "day"
12033
+ function queryButtonText(options) {
12034
+ var buttonText = options.buttonText || {};
12035
+ return buttonText[requestedViewType] ||
12036
+ // view can decide to look up a certain key
12037
+ (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) ||
12038
+ // a key like "month"
12039
+ (spec.singleUnit ? buttonText[spec.singleUnit] : null);
12040
+ }
12041
+
12042
+ // highest to lowest priority
12043
+ spec.buttonTextOverride =
12044
+ queryButtonText(this.dynamicOverrides) ||
12045
+ queryButtonText(this.overrides) || // constructor-specified buttonText lookup hash takes precedence
12046
+ spec.overrides.buttonText; // `buttonText` for view-specific options is a string
12047
+
12048
+ // highest to lowest priority. mirrors buildViewSpecOptions
12049
+ spec.buttonTextDefault =
12050
+ queryButtonText(this.localeDefaults) ||
12051
+ queryButtonText(this.dirDefaults) ||
12052
+ spec.defaults.buttonText || // a single string. from ViewSubclass.defaults
12053
+ queryButtonText(Calendar.defaults) ||
12054
+ (spec.duration ? this.humanizeDuration(spec.duration) : null) || // like "3 days"
12055
+ requestedViewType; // fall back to given view name
12056
+ }
12057
+
12058
+ });
12059
+
12060
+ ;;
12061
+
12062
+ Calendar.mixin({
12063
+
12064
+ el: null,
12065
+ contentEl: null,
12066
+ suggestedViewHeight: null,
12067
+ windowResizeProxy: null,
12068
+ ignoreWindowResize: 0,
12069
+
12070
+
12071
+ render: function() {
12072
+ if (!this.contentEl) {
12073
+ this.initialRender();
12074
+ }
12075
+ else if (this.elementVisible()) {
12076
+ // mainly for the public API
12077
+ this.calcSize();
12078
+ this.renderView();
12079
+ }
12080
+ },
12081
+
12082
+
12083
+ initialRender: function() {
12084
+ var _this = this;
12085
+ var el = this.el;
12086
+
12087
+ el.addClass('fc');
12088
+
12089
+ // event delegation for nav links
12090
+ el.on('click.fc', 'a[data-goto]', function(ev) {
12091
+ var anchorEl = $(this);
12092
+ var gotoOptions = anchorEl.data('goto'); // will automatically parse JSON
12093
+ var date = _this.moment(gotoOptions.date);
12094
+ var viewType = gotoOptions.type;
12095
+
12096
+ // property like "navLinkDayClick". might be a string or a function
12097
+ var customAction = _this.view.opt('navLink' + capitaliseFirstLetter(viewType) + 'Click');
12098
+
12099
+ if (typeof customAction === 'function') {
12100
+ customAction(date, ev);
12101
+ }
12102
+ else {
12103
+ if (typeof customAction === 'string') {
12104
+ viewType = customAction;
12105
+ }
12106
+ _this.zoomTo(date, viewType);
12107
+ }
12108
+ });
12109
+
12110
+ // called immediately, and upon option change
12111
+ this.optionsModel.watch('applyingThemeClasses', [ '?theme' ], function(opts) {
12112
+ el.toggleClass('ui-widget', opts.theme);
12113
+ el.toggleClass('fc-unthemed', !opts.theme);
12114
+ });
12115
+
12116
+ // called immediately, and upon option change.
12117
+ // HACK: locale often affects isRTL, so we explicitly listen to that too.
12118
+ this.optionsModel.watch('applyingDirClasses', [ '?isRTL', '?locale' ], function(opts) {
12119
+ el.toggleClass('fc-ltr', !opts.isRTL);
12120
+ el.toggleClass('fc-rtl', opts.isRTL);
12121
+ });
12122
+
12123
+ this.contentEl = $("<div class='fc-view-container'/>").prependTo(el);
12124
+
12125
+ this.initToolbars();
12126
+ this.renderHeader();
12127
+ this.renderFooter();
12128
+ this.renderView(this.opt('defaultView'));
12129
+
12130
+ if (this.opt('handleWindowResize')) {
12131
+ $(window).resize(
12132
+ this.windowResizeProxy = debounce( // prevents rapid calls
12133
+ this.windowResize.bind(this),
12134
+ this.opt('windowResizeDelay')
12135
+ )
12136
+ );
12137
+ }
12138
+ },
12139
+
12140
+
12141
+ destroy: function() {
12142
+
12143
+ if (this.view) {
12144
+ this.view.removeElement();
12145
+
12146
+ // NOTE: don't null-out this.view in case API methods are called after destroy.
12147
+ // It is still the "current" view, just not rendered.
12148
+ }
12149
+
12150
+ this.toolbarsManager.proxyCall('removeElement');
12151
+ this.contentEl.remove();
12152
+ this.el.removeClass('fc fc-ltr fc-rtl fc-unthemed ui-widget');
12153
+
12154
+ this.el.off('.fc'); // unbind nav link handlers
12155
+
12156
+ if (this.windowResizeProxy) {
12157
+ $(window).unbind('resize', this.windowResizeProxy);
12158
+ this.windowResizeProxy = null;
12159
+ }
12160
+
12161
+ GlobalEmitter.unneeded();
12162
+ },
12163
+
12164
+
12165
+ elementVisible: function() {
12166
+ return this.el.is(':visible');
12167
+ },
12168
+
12169
+
12170
+
12171
+ // View Rendering
12172
+ // -----------------------------------------------------------------------------------
12173
+
12174
+
12175
+ // Renders a view because of a date change, view-type change, or for the first time.
12176
+ // If not given a viewType, keep the current view but render different dates.
12177
+ // Accepts an optional scroll state to restore to.
12178
+ renderView: function(viewType, forcedScroll) {
12179
+
12180
+ this.ignoreWindowResize++;
12181
+
12182
+ var needsClearView = this.view && viewType && this.view.type !== viewType;
12183
+
12184
+ // if viewType is changing, remove the old view's rendering
12185
+ if (needsClearView) {
12186
+ this.freezeContentHeight(); // prevent a scroll jump when view element is removed
12187
+ this.clearView();
12188
+ }
12189
+
12190
+ // if viewType changed, or the view was never created, create a fresh view
12191
+ if (!this.view && viewType) {
12192
+ this.view =
12193
+ this.viewsByType[viewType] ||
12194
+ (this.viewsByType[viewType] = this.instantiateView(viewType));
12195
+
12196
+ this.view.setElement(
12197
+ $("<div class='fc-view fc-" + viewType + "-view' />").appendTo(this.contentEl)
12198
+ );
12199
+ this.toolbarsManager.proxyCall('activateButton', viewType);
12200
+ }
12201
+
12202
+ if (this.view) {
12203
+
12204
+ if (forcedScroll) {
12205
+ this.view.addForcedScroll(forcedScroll);
12206
+ }
12207
+
12208
+ if (this.elementVisible()) {
12209
+ this.currentDate = this.view.setDate(this.currentDate);
12210
+ }
12211
+ }
12212
+
12213
+ if (needsClearView) {
12214
+ this.thawContentHeight();
12215
+ }
12216
+
12217
+ this.ignoreWindowResize--;
12218
+ },
12219
+
12220
+
12221
+ // Unrenders the current view and reflects this change in the Header.
12222
+ // Unregsiters the `view`, but does not remove from viewByType hash.
12223
+ clearView: function() {
12224
+ this.toolbarsManager.proxyCall('deactivateButton', this.view.type);
12225
+ this.view.removeElement();
12226
+ this.view = null;
12227
+ },
12228
+
12229
+
12230
+ // Destroys the view, including the view object. Then, re-instantiates it and renders it.
12231
+ // Maintains the same scroll state.
12232
+ // TODO: maintain any other user-manipulated state.
12233
+ reinitView: function() {
12234
+ this.ignoreWindowResize++;
12235
+ this.freezeContentHeight();
12236
+
12237
+ var viewType = this.view.type;
12238
+ var scrollState = this.view.queryScroll();
12239
+ this.clearView();
12240
+ this.calcSize();
12241
+ this.renderView(viewType, scrollState);
12242
+
12243
+ this.thawContentHeight();
12244
+ this.ignoreWindowResize--;
12245
+ },
12246
+
12247
+
12248
+ // Resizing
12249
+ // -----------------------------------------------------------------------------------
12250
+
12251
+
12252
+ getSuggestedViewHeight: function() {
12253
+ if (this.suggestedViewHeight === null) {
12254
+ this.calcSize();
12255
+ }
12256
+ return this.suggestedViewHeight;
12257
+ },
12258
+
12259
+
12260
+ isHeightAuto: function() {
12261
+ return this.opt('contentHeight') === 'auto' || this.opt('height') === 'auto';
12262
+ },
12263
+
12264
+
12265
+ updateSize: function(shouldRecalc) {
12266
+ if (this.elementVisible()) {
12267
+
12268
+ if (shouldRecalc) {
12269
+ this._calcSize();
12270
+ }
12271
+
12272
+ this.ignoreWindowResize++;
12273
+ this.view.updateSize(true); // isResize=true. will poll getSuggestedViewHeight() and isHeightAuto()
12274
+ this.ignoreWindowResize--;
12275
+
12276
+ return true; // signal success
12277
+ }
12278
+ },
12279
+
12280
+
12281
+ calcSize: function() {
12282
+ if (this.elementVisible()) {
12283
+ this._calcSize();
12284
+ }
12285
+ },
12286
+
12287
+
12288
+ _calcSize: function() { // assumes elementVisible
12289
+ var contentHeightInput = this.opt('contentHeight');
12290
+ var heightInput = this.opt('height');
12291
+
12292
+ if (typeof contentHeightInput === 'number') { // exists and not 'auto'
12293
+ this.suggestedViewHeight = contentHeightInput;
12294
+ }
12295
+ else if (typeof contentHeightInput === 'function') { // exists and is a function
12296
+ this.suggestedViewHeight = contentHeightInput();
12297
+ }
12298
+ else if (typeof heightInput === 'number') { // exists and not 'auto'
12299
+ this.suggestedViewHeight = heightInput - this.queryToolbarsHeight();
12300
+ }
12301
+ else if (typeof heightInput === 'function') { // exists and is a function
12302
+ this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight();
12303
+ }
12304
+ else if (heightInput === 'parent') { // set to height of parent element
12305
+ this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight();
12306
+ }
12307
+ else {
12308
+ this.suggestedViewHeight = Math.round(
12309
+ this.contentEl.width() /
12310
+ Math.max(this.opt('aspectRatio'), .5)
12311
+ );
12312
+ }
12313
+ },
12314
+
12315
+
12316
+ windowResize: function(ev) {
12317
+ if (
12318
+ !this.ignoreWindowResize &&
12319
+ ev.target === window && // so we don't process jqui "resize" events that have bubbled up
12320
+ this.view.renderRange // view has already been rendered
12321
+ ) {
12322
+ if (this.updateSize(true)) {
12323
+ this.view.publiclyTrigger('windowResize', this.el[0]);
12324
+ }
12325
+ }
12326
+ },
12327
+
12328
+
12329
+ /* Height "Freezing"
12330
+ -----------------------------------------------------------------------------*/
12331
+
12332
+
12333
+ freezeContentHeight: function() {
12334
+ this.contentEl.css({
12335
+ width: '100%',
12336
+ height: this.contentEl.height(),
12337
+ overflow: 'hidden'
12338
+ });
12339
+ },
12340
+
12341
+
12342
+ thawContentHeight: function() {
12343
+ this.contentEl.css({
12344
+ width: '',
12345
+ height: '',
12346
+ overflow: ''
12347
+ });
12348
+ }
12349
+
12350
+ });
12351
+
12352
+ ;;
12353
+
12354
+ Calendar.mixin({
12355
+
12356
+ header: null,
12357
+ footer: null,
12358
+ toolbarsManager: null,
12359
+
12360
+
12361
+ initToolbars: function() {
12362
+ this.header = new Toolbar(this, this.computeHeaderOptions());
12363
+ this.footer = new Toolbar(this, this.computeFooterOptions());
12364
+ this.toolbarsManager = new Iterator([ this.header, this.footer ]);
12365
+ },
12366
+
12367
+
12368
+ computeHeaderOptions: function() {
12369
+ return {
12370
+ extraClasses: 'fc-header-toolbar',
12371
+ layout: this.opt('header')
12372
+ };
12373
+ },
12374
+
12375
+
12376
+ computeFooterOptions: function() {
12377
+ return {
12378
+ extraClasses: 'fc-footer-toolbar',
12379
+ layout: this.opt('footer')
12380
+ };
12381
+ },
12382
+
12383
+
12384
+ // can be called repeatedly and Header will rerender
12385
+ renderHeader: function() {
12386
+ var header = this.header;
12387
+
12388
+ header.setToolbarOptions(this.computeHeaderOptions());
12389
+ header.render();
12390
+
12391
+ if (header.el) {
12392
+ this.el.prepend(header.el);
12393
+ }
12394
+ },
12395
+
12396
+
12397
+ // can be called repeatedly and Footer will rerender
12398
+ renderFooter: function() {
12399
+ var footer = this.footer;
12400
+
12401
+ footer.setToolbarOptions(this.computeFooterOptions());
12402
+ footer.render();
12403
+
12404
+ if (footer.el) {
12405
+ this.el.append(footer.el);
12406
+ }
12407
+ },
12408
+
12409
+
12410
+ setToolbarsTitle: function(title) {
12411
+ this.toolbarsManager.proxyCall('updateTitle', title);
12412
+ },
12413
+
12414
+
12415
+ updateToolbarButtons: function() {
12416
+ var now = this.getNow();
12417
+ var view = this.view;
12418
+ var todayInfo = view.buildDateProfile(now);
12419
+ var prevInfo = view.buildPrevDateProfile(this.currentDate);
12420
+ var nextInfo = view.buildNextDateProfile(this.currentDate);
12421
+
12422
+ this.toolbarsManager.proxyCall(
12423
+ (todayInfo.isValid && !isDateWithinRange(now, view.currentRange)) ?
12424
+ 'enableButton' :
12425
+ 'disableButton',
12426
+ 'today'
12427
+ );
12428
+
12429
+ this.toolbarsManager.proxyCall(
12430
+ prevInfo.isValid ?
12431
+ 'enableButton' :
12432
+ 'disableButton',
12433
+ 'prev'
12434
+ );
12435
+
12436
+ this.toolbarsManager.proxyCall(
12437
+ nextInfo.isValid ?
12438
+ 'enableButton' :
12439
+ 'disableButton',
12440
+ 'next'
12441
+ );
12442
+ },
12443
+
12444
+
12445
+ queryToolbarsHeight: function() {
12446
+ return this.toolbarsManager.items.reduce(function(accumulator, toolbar) {
12447
+ var toolbarHeight = toolbar.el ? toolbar.el.outerHeight(true) : 0; // includes margin
12448
+ return accumulator + toolbarHeight;
12449
+ }, 0);
12450
+ }
12451
+
12452
+ });
12453
+
12454
+ ;;
12455
+
12456
+ Calendar.defaults = {
12457
+
12458
+ titleRangeSeparator: ' \u2013 ', // en dash
12459
+ monthYearFormat: 'MMMM YYYY', // required for en. other locales rely on datepicker computable option
12460
+
12461
+ defaultTimedEventDuration: '02:00:00',
12462
+ defaultAllDayEventDuration: { days: 1 },
12463
+ forceEventDuration: false,
12464
+ nextDayThreshold: '09:00:00', // 9am
12465
+
12466
+ // display
12467
+ defaultView: 'month',
12468
+ aspectRatio: 1.35,
12469
+ header: {
12470
+ left: 'title',
12471
+ center: '',
12472
+ right: 'today prev,next'
12473
+ },
12474
+ weekends: true,
12475
+ weekNumbers: false,
12476
+
12477
+ weekNumberTitle: 'W',
12478
+ weekNumberCalculation: 'local',
12479
+
12480
+ //editable: false,
12481
+
12482
+ //nowIndicator: false,
12483
+
12484
+ scrollTime: '06:00:00',
12485
+ minTime: '00:00:00',
12486
+ maxTime: '24:00:00',
12487
+ showNonCurrentDates: true,
12488
+
12489
+ // event ajax
12490
+ lazyFetching: true,
12491
+ startParam: 'start',
12492
+ endParam: 'end',
12493
+ timezoneParam: 'timezone',
12494
+
12495
+ timezone: false,
12496
+
12497
+ //allDayDefault: undefined,
12498
+
12499
+ // locale
12500
+ isRTL: false,
12501
+ buttonText: {
12502
+ prev: "prev",
12503
+ next: "next",
12504
+ prevYear: "prev year",
12505
+ nextYear: "next year",
12506
+ year: 'year', // TODO: locale files need to specify this
12507
+ today: 'today',
12508
+ month: 'month',
12509
+ week: 'week',
12510
+ day: 'day'
12511
+ },
12512
+
12513
+ buttonIcons: {
12514
+ prev: 'left-single-arrow',
12515
+ next: 'right-single-arrow',
12516
+ prevYear: 'left-double-arrow',
12517
+ nextYear: 'right-double-arrow'
12518
+ },
12519
+
12520
+ allDayText: 'all-day',
12521
+
12522
+ // jquery-ui theming
12523
+ theme: false,
12524
+ themeButtonIcons: {
12525
+ prev: 'circle-triangle-w',
12526
+ next: 'circle-triangle-e',
12527
+ prevYear: 'seek-prev',
12528
+ nextYear: 'seek-next'
12529
+ },
12530
+
12531
+ //eventResizableFromStart: false,
12532
+ dragOpacity: .75,
12533
+ dragRevertDuration: 500,
12534
+ dragScroll: true,
12535
+
12536
+ //selectable: false,
12537
+ unselectAuto: true,
12538
+ //selectMinDistance: 0,
12539
+
12540
+ dropAccept: '*',
12541
+
12542
+ eventOrder: 'title',
12543
+ //eventRenderWait: null,
12544
+
12545
+ eventLimit: false,
12546
+ eventLimitText: 'more',
12547
+ eventLimitClick: 'popover',
12548
+ dayPopoverFormat: 'LL',
12549
+
12550
+ handleWindowResize: true,
12551
+ windowResizeDelay: 100, // milliseconds before an updateSize happens
12552
+
12553
+ longPressDelay: 1000
12554
+
12555
+ };
12556
+
12557
+
12558
+ Calendar.englishDefaults = { // used by locale.js
12559
+ dayPopoverFormat: 'dddd, MMMM D'
12560
+ };
12561
+
12562
+
12563
+ Calendar.rtlDefaults = { // right-to-left defaults
12564
+ header: { // TODO: smarter solution (first/center/last ?)
12565
+ left: 'next,prev today',
12566
+ center: '',
12567
+ right: 'title'
12568
+ },
12569
+ buttonIcons: {
12570
+ prev: 'right-single-arrow',
12571
+ next: 'left-single-arrow',
12572
+ prevYear: 'right-double-arrow',
12573
+ nextYear: 'left-double-arrow'
12574
+ },
12575
+ themeButtonIcons: {
12576
+ prev: 'circle-triangle-e',
12577
+ next: 'circle-triangle-w',
12578
+ nextYear: 'seek-prev',
12579
+ prevYear: 'seek-next'
12580
+ }
12581
+ };
12582
+
12583
+ ;;
12584
+
12585
+ var localeOptionHash = FC.locales = {}; // initialize and expose
12586
+
12587
+
12588
+ // TODO: document the structure and ordering of a FullCalendar locale file
12589
+
12590
+
12591
+ // Initialize jQuery UI datepicker translations while using some of the translations
12592
+ // Will set this as the default locales for datepicker.
12593
+ FC.datepickerLocale = function(localeCode, dpLocaleCode, dpOptions) {
12594
+
12595
+ // get the FullCalendar internal option hash for this locale. create if necessary
12596
+ var fcOptions = localeOptionHash[localeCode] || (localeOptionHash[localeCode] = {});
12597
+
12598
+ // transfer some simple options from datepicker to fc
12599
+ fcOptions.isRTL = dpOptions.isRTL;
12600
+ fcOptions.weekNumberTitle = dpOptions.weekHeader;
12601
+
12602
+ // compute some more complex options from datepicker
12603
+ $.each(dpComputableOptions, function(name, func) {
12604
+ fcOptions[name] = func(dpOptions);
12605
+ });
12606
+
12607
+ // is jQuery UI Datepicker is on the page?
12608
+ if ($.datepicker) {
12609
+
12610
+ // Register the locale data.
12611
+ // FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker
12612
+ // does it like "pt-BR" or if it doesn't have the locale, maybe just "pt".
12613
+ // Make an alias so the locale can be referenced either way.
12614
+ $.datepicker.regional[dpLocaleCode] =
12615
+ $.datepicker.regional[localeCode] = // alias
12616
+ dpOptions;
12617
+
12618
+ // Alias 'en' to the default locale data. Do this every time.
12619
+ $.datepicker.regional.en = $.datepicker.regional[''];
12620
+
12621
+ // Set as Datepicker's global defaults.
12622
+ $.datepicker.setDefaults(dpOptions);
12623
+ }
12624
+ };
12625
+
12626
+
12627
+ // Sets FullCalendar-specific translations. Will set the locales as the global default.
12628
+ FC.locale = function(localeCode, newFcOptions) {
12629
+ var fcOptions;
12630
+ var momOptions;
12631
+
12632
+ // get the FullCalendar internal option hash for this locale. create if necessary
12633
+ fcOptions = localeOptionHash[localeCode] || (localeOptionHash[localeCode] = {});
12634
+
12635
+ // provided new options for this locales? merge them in
12636
+ if (newFcOptions) {
12637
+ fcOptions = localeOptionHash[localeCode] = mergeOptions([ fcOptions, newFcOptions ]);
12638
+ }
12639
+
12640
+ // compute locale options that weren't defined.
12641
+ // always do this. newFcOptions can be undefined when initializing from i18n file,
12642
+ // so no way to tell if this is an initialization or a default-setting.
12643
+ momOptions = getMomentLocaleData(localeCode); // will fall back to en
12644
+ $.each(momComputableOptions, function(name, func) {
12645
+ if (fcOptions[name] == null) {
12646
+ fcOptions[name] = func(momOptions, fcOptions);
12647
+ }
12648
+ });
12649
+
12650
+ // set it as the default locale for FullCalendar
12651
+ Calendar.defaults.locale = localeCode;
12652
+ };
12653
+
12654
+
12655
+ // NOTE: can't guarantee any of these computations will run because not every locale has datepicker
12656
+ // configs, so make sure there are English fallbacks for these in the defaults file.
12657
+ var dpComputableOptions = {
12658
+
12659
+ buttonText: function(dpOptions) {
12660
+ return {
12661
+ // the translations sometimes wrongly contain HTML entities
12662
+ prev: stripHtmlEntities(dpOptions.prevText),
12663
+ next: stripHtmlEntities(dpOptions.nextText),
12664
+ today: stripHtmlEntities(dpOptions.currentText)
12665
+ };
12666
+ },
12667
+
12668
+ // Produces format strings like "MMMM YYYY" -> "September 2014"
12669
+ monthYearFormat: function(dpOptions) {
12670
+ return dpOptions.showMonthAfterYear ?
12671
+ 'YYYY[' + dpOptions.yearSuffix + '] MMMM' :
12672
+ 'MMMM YYYY[' + dpOptions.yearSuffix + ']';
12673
+ }
12674
+
12675
+ };
12676
+
12677
+ var momComputableOptions = {
12678
+
12679
+ // Produces format strings like "ddd M/D" -> "Fri 9/15"
12680
+ dayOfMonthFormat: function(momOptions, fcOptions) {
12681
+ var format = momOptions.longDateFormat('l'); // for the format like "M/D/YYYY"
12682
+
12683
+ // strip the year off the edge, as well as other misc non-whitespace chars
12684
+ format = format.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g, '');
12685
+
12686
+ if (fcOptions.isRTL) {
12687
+ format += ' ddd'; // for RTL, add day-of-week to end
12688
+ }
12689
+ else {
12690
+ format = 'ddd ' + format; // for LTR, add day-of-week to beginning
12691
+ }
12692
+ return format;
12693
+ },
12694
+
12695
+ // Produces format strings like "h:mma" -> "6:00pm"
12696
+ mediumTimeFormat: function(momOptions) { // can't be called `timeFormat` because collides with option
12697
+ return momOptions.longDateFormat('LT')
12698
+ .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
12699
+ },
12700
+
12701
+ // Produces format strings like "h(:mm)a" -> "6pm" / "6:30pm"
12702
+ smallTimeFormat: function(momOptions) {
12703
+ return momOptions.longDateFormat('LT')
12704
+ .replace(':mm', '(:mm)')
12705
+ .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
12706
+ .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
12707
+ },
12708
+
12709
+ // Produces format strings like "h(:mm)t" -> "6p" / "6:30p"
12710
+ extraSmallTimeFormat: function(momOptions) {
12711
+ return momOptions.longDateFormat('LT')
12712
+ .replace(':mm', '(:mm)')
12713
+ .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
12714
+ .replace(/\s*a$/i, 't'); // convert to AM/PM/am/pm to lowercase one-letter. remove any spaces beforehand
12715
+ },
12716
+
12717
+ // Produces format strings like "ha" / "H" -> "6pm" / "18"
12718
+ hourFormat: function(momOptions) {
12719
+ return momOptions.longDateFormat('LT')
12720
+ .replace(':mm', '')
12721
+ .replace(/(\Wmm)$/, '') // like above, but for foreign locales
12722
+ .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
12723
+ },
12724
+
12725
+ // Produces format strings like "h:mm" -> "6:30" (with no AM/PM)
12726
+ noMeridiemTimeFormat: function(momOptions) {
12727
+ return momOptions.longDateFormat('LT')
12728
+ .replace(/\s*a$/i, ''); // remove trailing AM/PM
12729
+ }
12730
+
12731
+ };
12732
+
12733
+
12734
+ // options that should be computed off live calendar options (considers override options)
12735
+ // TODO: best place for this? related to locale?
12736
+ // TODO: flipping text based on isRTL is a bad idea because the CSS `direction` might want to handle it
12737
+ var instanceComputableOptions = {
12738
+
12739
+ // Produces format strings for results like "Mo 16"
12740
+ smallDayDateFormat: function(options) {
12741
+ return options.isRTL ?
12742
+ 'D dd' :
12743
+ 'dd D';
12744
+ },
12745
+
12746
+ // Produces format strings for results like "Wk 5"
12747
+ weekFormat: function(options) {
12748
+ return options.isRTL ?
12749
+ 'w[ ' + options.weekNumberTitle + ']' :
12750
+ '[' + options.weekNumberTitle + ' ]w';
12751
+ },
12752
+
12753
+ // Produces format strings for results like "Wk5"
12754
+ smallWeekFormat: function(options) {
12755
+ return options.isRTL ?
12756
+ 'w[' + options.weekNumberTitle + ']' :
12757
+ '[' + options.weekNumberTitle + ']w';
12758
+ }
12759
+
12760
+ };
12761
+
12762
+ // TODO: make these computable properties in optionsModel
12763
+ function populateInstanceComputableOptions(options) {
12764
+ $.each(instanceComputableOptions, function(name, func) {
12765
+ if (options[name] == null) {
12766
+ options[name] = func(options);
12767
+ }
12768
+ });
12769
+ }
12770
+
12771
+
12772
+ // Returns moment's internal locale data. If doesn't exist, returns English.
12773
+ function getMomentLocaleData(localeCode) {
12774
+ return moment.localeData(localeCode) || moment.localeData('en');
12775
+ }
12776
+
12777
+
12778
+ // Initialize English by forcing computation of moment-derived options.
12779
+ // Also, sets it as the default.
12780
+ FC.locale('en', Calendar.englishDefaults);
12781
+
12782
+ ;;
12783
+
12784
+ FC.sourceNormalizers = [];
12785
+ FC.sourceFetchers = [];
12786
+
12787
+ var ajaxDefaults = {
12788
+ dataType: 'json',
12789
+ cache: false
12790
+ };
12791
+
12792
+ var eventGUID = 1;
12793
+
12794
+
12795
+ function EventManager() { // assumed to be a calendar
12796
+ var t = this;
12797
+
12798
+
12799
+ // exports
12800
+ t.requestEvents = requestEvents;
12801
+ t.reportEventChange = reportEventChange;
12802
+ t.isFetchNeeded = isFetchNeeded;
12803
+ t.fetchEvents = fetchEvents;
12804
+ t.fetchEventSources = fetchEventSources;
12805
+ t.refetchEvents = refetchEvents;
12806
+ t.refetchEventSources = refetchEventSources;
12807
+ t.getEventSources = getEventSources;
12808
+ t.getEventSourceById = getEventSourceById;
12809
+ t.addEventSource = addEventSource;
12810
+ t.removeEventSource = removeEventSource;
12811
+ t.removeEventSources = removeEventSources;
12812
+ t.updateEvent = updateEvent;
12813
+ t.updateEvents = updateEvents;
12814
+ t.renderEvent = renderEvent;
12815
+ t.renderEvents = renderEvents;
12816
+ t.removeEvents = removeEvents;
12817
+ t.clientEvents = clientEvents;
12818
+ t.mutateEvent = mutateEvent;
12819
+ t.normalizeEventDates = normalizeEventDates;
12820
+ t.normalizeEventTimes = normalizeEventTimes;
12821
+
12822
+
12823
+ // locals
12824
+ var stickySource = { events: [] };
12825
+ var sources = [ stickySource ];
12826
+ var rangeStart, rangeEnd;
12827
+ var pendingSourceCnt = 0; // outstanding fetch requests, max one per source
12828
+ var cache = []; // holds events that have already been expanded
12829
+ var prunedCache; // like cache, but only events that intersect with rangeStart/rangeEnd
12830
+
12831
+
12832
+ $.each(
12833
+ (t.opt('events') ? [ t.opt('events') ] : []).concat(t.opt('eventSources') || []),
12834
+ function(i, sourceInput) {
12835
+ var source = buildEventSource(sourceInput);
12836
+ if (source) {
12837
+ sources.push(source);
12838
+ }
12839
+ }
12840
+ );
12841
+
12842
+
12843
+
12844
+ function requestEvents(start, end) {
12845
+ if (!t.opt('lazyFetching') || isFetchNeeded(start, end)) {
12846
+ return fetchEvents(start, end);
12847
+ }
12848
+ else {
12849
+ return Promise.resolve(prunedCache);
12850
+ }
12851
+ }
12852
+
12853
+
12854
+ function reportEventChange() {
12855
+ prunedCache = filterEventsWithinRange(cache);
12856
+ t.trigger('eventsReset', prunedCache);
12857
+ }
12858
+
12859
+
12860
+ function filterEventsWithinRange(events) {
12861
+ var filteredEvents = [];
12862
+ var i, event;
12863
+
12864
+ for (i = 0; i < events.length; i++) {
12865
+ event = events[i];
12866
+
12867
+ if (
12868
+ event.start.clone().stripZone() < rangeEnd &&
12869
+ t.getEventEnd(event).stripZone() > rangeStart
12870
+ ) {
12871
+ filteredEvents.push(event);
12872
+ }
12873
+ }
12874
+
12875
+ return filteredEvents;
12876
+ }
12877
+
12878
+
12879
+ t.getEventCache = function() {
12880
+ return cache;
12881
+ };
12882
+
12883
+
12884
+
12885
+ /* Fetching
12886
+ -----------------------------------------------------------------------------*/
12887
+
12888
+
12889
+ // start and end are assumed to be unzoned
12890
+ function isFetchNeeded(start, end) {
12891
+ return !rangeStart || // nothing has been fetched yet?
12892
+ start < rangeStart || end > rangeEnd; // is part of the new range outside of the old range?
12893
+ }
12894
+
12895
+
12896
+ function fetchEvents(start, end) {
12897
+ rangeStart = start;
12898
+ rangeEnd = end;
12899
+ return refetchEvents();
12900
+ }
12901
+
12902
+
12903
+ // poorly named. fetches all sources with current `rangeStart` and `rangeEnd`.
12904
+ function refetchEvents() {
12905
+ return fetchEventSources(sources, 'reset');
12906
+ }
12907
+
12908
+
12909
+ // poorly named. fetches a subset of event sources.
12910
+ function refetchEventSources(matchInputs) {
12911
+ return fetchEventSources(getEventSourcesByMatchArray(matchInputs));
12912
+ }
12913
+
12914
+
12915
+ // expects an array of event source objects (the originals, not copies)
12916
+ // `specialFetchType` is an optimization parameter that affects purging of the event cache.
12917
+ function fetchEventSources(specificSources, specialFetchType) {
12918
+ var i, source;
12919
+
12920
+ if (specialFetchType === 'reset') {
12921
+ cache = [];
12922
+ }
12923
+ else if (specialFetchType !== 'add') {
12924
+ cache = excludeEventsBySources(cache, specificSources);
12925
+ }
12926
+
12927
+ for (i = 0; i < specificSources.length; i++) {
12928
+ source = specificSources[i];
12929
+
12930
+ // already-pending sources have already been accounted for in pendingSourceCnt
12931
+ if (source._status !== 'pending') {
12932
+ pendingSourceCnt++;
12933
+ }
12934
+
12935
+ source._fetchId = (source._fetchId || 0) + 1;
12936
+ source._status = 'pending';
12937
+ }
12938
+
12939
+ for (i = 0; i < specificSources.length; i++) {
12940
+ source = specificSources[i];
12941
+ tryFetchEventSource(source, source._fetchId);
12942
+ }
12943
+
12944
+ if (pendingSourceCnt) {
12945
+ return Promise.construct(function(resolve) {
12946
+ t.one('eventsReceived', resolve); // will send prunedCache
12947
+ });
12948
+ }
12949
+ else { // executed all synchronously, or no sources at all
12950
+ return Promise.resolve(prunedCache);
12951
+ }
12952
+ }
12953
+
12954
+
12955
+ // fetches an event source and processes its result ONLY if it is still the current fetch.
12956
+ // caller is responsible for incrementing pendingSourceCnt first.
12957
+ function tryFetchEventSource(source, fetchId) {
12958
+ _fetchEventSource(source, function(eventInputs) {
12959
+ var isArraySource = $.isArray(source.events);
12960
+ var i, eventInput;
12961
+ var abstractEvent;
12962
+
12963
+ if (
12964
+ // is this the source's most recent fetch?
12965
+ // if not, rely on an upcoming fetch of this source to decrement pendingSourceCnt
12966
+ fetchId === source._fetchId &&
12967
+ // event source no longer valid?
12968
+ source._status !== 'rejected'
12969
+ ) {
12970
+ source._status = 'resolved';
12971
+
12972
+ if (eventInputs) {
12973
+ for (i = 0; i < eventInputs.length; i++) {
12974
+ eventInput = eventInputs[i];
12975
+
12976
+ if (isArraySource) { // array sources have already been convert to Event Objects
12977
+ abstractEvent = eventInput;
12978
+ }
12979
+ else {
12980
+ abstractEvent = buildEventFromInput(eventInput, source);
12981
+ }
12982
+
12983
+ if (abstractEvent) { // not false (an invalid event)
12984
+ cache.push.apply( // append
12985
+ cache,
12986
+ expandEvent(abstractEvent) // add individual expanded events to the cache
12987
+ );
12988
+ }
12989
+ }
12990
+ }
12991
+
12992
+ decrementPendingSourceCnt();
12993
+ }
12994
+ });
12995
+ }
12996
+
12997
+
12998
+ function rejectEventSource(source) {
12999
+ var wasPending = source._status === 'pending';
13000
+
13001
+ source._status = 'rejected';
13002
+
13003
+ if (wasPending) {
13004
+ decrementPendingSourceCnt();
13005
+ }
13006
+ }
13007
+
13008
+
13009
+ function decrementPendingSourceCnt() {
13010
+ pendingSourceCnt--;
13011
+ if (!pendingSourceCnt) {
13012
+ reportEventChange(cache); // updates prunedCache
13013
+ t.trigger('eventsReceived', prunedCache);
13014
+ }
13015
+ }
13016
+
13017
+
13018
+ function _fetchEventSource(source, callback) {
13019
+ var i;
13020
+ var fetchers = FC.sourceFetchers;
13021
+ var res;
13022
+
13023
+ for (i=0; i<fetchers.length; i++) {
13024
+ res = fetchers[i].call(
13025
+ t, // this, the Calendar object
13026
+ source,
13027
+ rangeStart.clone(),
13028
+ rangeEnd.clone(),
13029
+ t.opt('timezone'),
13030
+ callback
13031
+ );
13032
+
13033
+ if (res === true) {
13034
+ // the fetcher is in charge. made its own async request
13035
+ return;
13036
+ }
13037
+ else if (typeof res == 'object') {
13038
+ // the fetcher returned a new source. process it
13039
+ _fetchEventSource(res, callback);
13040
+ return;
13041
+ }
13042
+ }
13043
+
13044
+ var events = source.events;
13045
+ if (events) {
13046
+ if ($.isFunction(events)) {
13047
+ t.pushLoading();
13048
+ events.call(
13049
+ t, // this, the Calendar object
13050
+ rangeStart.clone(),
13051
+ rangeEnd.clone(),
13052
+ t.opt('timezone'),
13053
+ function(events) {
13054
+ callback(events);
13055
+ t.popLoading();
13056
+ }
13057
+ );
13058
+ }
13059
+ else if ($.isArray(events)) {
13060
+ callback(events);
13061
+ }
13062
+ else {
13063
+ callback();
13064
+ }
13065
+ }else{
13066
+ var url = source.url;
13067
+ if (url) {
13068
+ var success = source.success;
13069
+ var error = source.error;
13070
+ var complete = source.complete;
13071
+
13072
+ // retrieve any outbound GET/POST $.ajax data from the options
13073
+ var customData;
13074
+ if ($.isFunction(source.data)) {
13075
+ // supplied as a function that returns a key/value object
13076
+ customData = source.data();
13077
+ }
13078
+ else {
13079
+ // supplied as a straight key/value object
13080
+ customData = source.data;
13081
+ }
13082
+
13083
+ // use a copy of the custom data so we can modify the parameters
13084
+ // and not affect the passed-in object.
13085
+ var data = $.extend({}, customData || {});
13086
+
13087
+ var startParam = firstDefined(source.startParam, t.opt('startParam'));
13088
+ var endParam = firstDefined(source.endParam, t.opt('endParam'));
13089
+ var timezoneParam = firstDefined(source.timezoneParam, t.opt('timezoneParam'));
13090
+
13091
+ if (startParam) {
13092
+ data[startParam] = rangeStart.format();
13093
+ }
13094
+ if (endParam) {
13095
+ data[endParam] = rangeEnd.format();
13096
+ }
13097
+ if (t.opt('timezone') && t.opt('timezone') != 'local') {
13098
+ data[timezoneParam] = t.opt('timezone');
13099
+ }
13100
+
13101
+ t.pushLoading();
13102
+ $.ajax($.extend({}, ajaxDefaults, source, {
13103
+ data: data,
13104
+ success: function(events) {
13105
+ events = events || [];
13106
+ var res = applyAll(success, this, arguments);
13107
+ if ($.isArray(res)) {
13108
+ events = res;
13109
+ }
13110
+ callback(events);
13111
+ },
13112
+ error: function() {
13113
+ applyAll(error, this, arguments);
13114
+ callback();
13115
+ },
13116
+ complete: function() {
13117
+ applyAll(complete, this, arguments);
13118
+ t.popLoading();
13119
+ }
13120
+ }));
13121
+ }else{
13122
+ callback();
13123
+ }
13124
+ }
13125
+ }
13126
+
13127
+
13128
+
13129
+ /* Sources
13130
+ -----------------------------------------------------------------------------*/
13131
+
13132
+
13133
+ function addEventSource(sourceInput) {
13134
+ var source = buildEventSource(sourceInput);
13135
+ if (source) {
13136
+ sources.push(source);
13137
+ fetchEventSources([ source ], 'add'); // will eventually call reportEventChange
13138
+ }
13139
+ }
13140
+
13141
+
13142
+ function buildEventSource(sourceInput) { // will return undefined if invalid source
13143
+ var normalizers = FC.sourceNormalizers;
13144
+ var source;
13145
+ var i;
13146
+
13147
+ if ($.isFunction(sourceInput) || $.isArray(sourceInput)) {
13148
+ source = { events: sourceInput };
13149
+ }
13150
+ else if (typeof sourceInput === 'string') {
13151
+ source = { url: sourceInput };
13152
+ }
13153
+ else if (typeof sourceInput === 'object') {
13154
+ source = $.extend({}, sourceInput); // shallow copy
13155
+ }
13156
+
13157
+ if (source) {
13158
+
13159
+ // TODO: repeat code, same code for event classNames
13160
+ if (source.className) {
13161
+ if (typeof source.className === 'string') {
13162
+ source.className = source.className.split(/\s+/);
13163
+ }
13164
+ // otherwise, assumed to be an array
13165
+ }
13166
+ else {
13167
+ source.className = [];
13168
+ }
13169
+
13170
+ // for array sources, we convert to standard Event Objects up front
13171
+ if ($.isArray(source.events)) {
13172
+ source.origArray = source.events; // for removeEventSource
13173
+ source.events = $.map(source.events, function(eventInput) {
13174
+ return buildEventFromInput(eventInput, source);
13175
+ });
13176
+ }
13177
+
13178
+ for (i=0; i<normalizers.length; i++) {
13179
+ normalizers[i].call(t, source);
13180
+ }
13181
+
13182
+ return source;
13183
+ }
13184
+ }
13185
+
13186
+
13187
+ function removeEventSource(matchInput) {
13188
+ removeSpecificEventSources(
13189
+ getEventSourcesByMatch(matchInput)
13190
+ );
13191
+ }
13192
+
13193
+
13194
+ // if called with no arguments, removes all.
13195
+ function removeEventSources(matchInputs) {
13196
+ if (matchInputs == null) {
13197
+ removeSpecificEventSources(sources, true); // isAll=true
13198
+ }
13199
+ else {
13200
+ removeSpecificEventSources(
13201
+ getEventSourcesByMatchArray(matchInputs)
13202
+ );
13203
+ }
13204
+ }
13205
+
13206
+
13207
+ function removeSpecificEventSources(targetSources, isAll) {
13208
+ var i;
13209
+
13210
+ // cancel pending requests
13211
+ for (i = 0; i < targetSources.length; i++) {
13212
+ rejectEventSource(targetSources[i]);
13213
+ }
13214
+
13215
+ if (isAll) { // an optimization
13216
+ sources = [];
13217
+ cache = [];
13218
+ }
13219
+ else {
13220
+ // remove from persisted source list
13221
+ sources = $.grep(sources, function(source) {
13222
+ for (i = 0; i < targetSources.length; i++) {
13223
+ if (source === targetSources[i]) {
13224
+ return false; // exclude
13225
+ }
13226
+ }
13227
+ return true; // include
13228
+ });
13229
+
13230
+ cache = excludeEventsBySources(cache, targetSources);
13231
+ }
13232
+
13233
+ reportEventChange();
13234
+ }
13235
+
13236
+
13237
+ function getEventSources() {
13238
+ return sources.slice(1); // returns a shallow copy of sources with stickySource removed
13239
+ }
13240
+
13241
+
13242
+ function getEventSourceById(id) {
13243
+ return $.grep(sources, function(source) {
13244
+ return source.id && source.id === id;
13245
+ })[0];
13246
+ }
13247
+
13248
+
13249
+ // like getEventSourcesByMatch, but accepts multple match criteria (like multiple IDs)
13250
+ function getEventSourcesByMatchArray(matchInputs) {
13251
+
13252
+ // coerce into an array
13253
+ if (!matchInputs) {
13254
+ matchInputs = [];
13255
+ }
13256
+ else if (!$.isArray(matchInputs)) {
13257
+ matchInputs = [ matchInputs ];
13258
+ }
13259
+
13260
+ var matchingSources = [];
13261
+ var i;
13262
+
13263
+ // resolve raw inputs to real event source objects
13264
+ for (i = 0; i < matchInputs.length; i++) {
13265
+ matchingSources.push.apply( // append
13266
+ matchingSources,
13267
+ getEventSourcesByMatch(matchInputs[i])
13268
+ );
13269
+ }
13270
+
13271
+ return matchingSources;
13272
+ }
13273
+
13274
+
13275
+ // matchInput can either by a real event source object, an ID, or the function/URL for the source.
13276
+ // returns an array of matching source objects.
13277
+ function getEventSourcesByMatch(matchInput) {
13278
+ var i, source;
13279
+
13280
+ // given an proper event source object
13281
+ for (i = 0; i < sources.length; i++) {
13282
+ source = sources[i];
13283
+ if (source === matchInput) {
13284
+ return [ source ];
13285
+ }
13286
+ }
13287
+
13288
+ // an ID match
13289
+ source = getEventSourceById(matchInput);
13290
+ if (source) {
13291
+ return [ source ];
13292
+ }
13293
+
13294
+ return $.grep(sources, function(source) {
13295
+ return isSourcesEquivalent(matchInput, source);
13296
+ });
13297
+ }
13298
+
13299
+
13300
+ function isSourcesEquivalent(source1, source2) {
13301
+ return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2);
13302
+ }
13303
+
13304
+
13305
+ function getSourcePrimitive(source) {
13306
+ return (
13307
+ (typeof source === 'object') ? // a normalized event source?
13308
+ (source.origArray || source.googleCalendarId || source.url || source.events) : // get the primitive
13309
+ null
13310
+ ) ||
13311
+ source; // the given argument *is* the primitive
13312
+ }
13313
+
13314
+
13315
+ // util
13316
+ // returns a filtered array without events that are part of any of the given sources
13317
+ function excludeEventsBySources(specificEvents, specificSources) {
13318
+ return $.grep(specificEvents, function(event) {
13319
+ for (var i = 0; i < specificSources.length; i++) {
13320
+ if (event.source === specificSources[i]) {
13321
+ return false; // exclude
13322
+ }
13323
+ }
13324
+ return true; // keep
13325
+ });
13326
+ }
13327
+
13328
+
13329
+
13330
+ /* Manipulation
13331
+ -----------------------------------------------------------------------------*/
13332
+
13333
+
13334
+ // Only ever called from the externally-facing API
13335
+ function updateEvent(event) {
13336
+ updateEvents([ event ]);
13337
+ }
13338
+
13339
+
13340
+ // Only ever called from the externally-facing API
13341
+ function updateEvents(events) {
13342
+ var i, event;
13343
+
13344
+ for (i = 0; i < events.length; i++) {
13345
+ event = events[i];
13346
+
13347
+ // massage start/end values, even if date string values
13348
+ event.start = t.moment(event.start);
13349
+ if (event.end) {
13350
+ event.end = t.moment(event.end);
13351
+ }
13352
+ else {
13353
+ event.end = null;
13354
+ }
13355
+
13356
+ mutateEvent(event, getMiscEventProps(event)); // will handle start/end/allDay normalization
13357
+ }
13358
+
13359
+ reportEventChange(); // reports event modifications (so we can redraw)
13360
+ }
13361
+
13362
+
13363
+ // Returns a hash of misc event properties that should be copied over to related events.
13364
+ function getMiscEventProps(event) {
13365
+ var props = {};
13366
+
13367
+ $.each(event, function(name, val) {
13368
+ if (isMiscEventPropName(name)) {
13369
+ if (val !== undefined && isAtomic(val)) { // a defined non-object
13370
+ props[name] = val;
13371
+ }
13372
+ }
13373
+ });
13374
+
13375
+ return props;
13376
+ }
13377
+
13378
+ // non-date-related, non-id-related, non-secret
13379
+ function isMiscEventPropName(name) {
13380
+ return !/^_|^(id|allDay|start|end)$/.test(name);
13381
+ }
13382
+
13383
+
13384
+ // returns the expanded events that were created
13385
+ function renderEvent(eventInput, stick) {
13386
+ return renderEvents([ eventInput ], stick);
13387
+ }
13388
+
13389
+
13390
+ // returns the expanded events that were created
13391
+ function renderEvents(eventInputs, stick) {
13392
+ var renderedEvents = [];
13393
+ var renderableEvents;
13394
+ var abstractEvent;
13395
+ var i, j, event;
13396
+
13397
+ for (i = 0; i < eventInputs.length; i++) {
13398
+ abstractEvent = buildEventFromInput(eventInputs[i]);
13399
+
13400
+ if (abstractEvent) { // not false (a valid input)
13401
+ renderableEvents = expandEvent(abstractEvent);
13402
+
13403
+ for (j = 0; j < renderableEvents.length; j++) {
13404
+ event = renderableEvents[j];
13405
+
13406
+ if (!event.source) {
13407
+ if (stick) {
13408
+ stickySource.events.push(event);
13409
+ event.source = stickySource;
13410
+ }
13411
+ cache.push(event);
13412
+ }
13413
+ }
13414
+
13415
+ renderedEvents = renderedEvents.concat(renderableEvents);
13416
+ }
13417
+ }
13418
+
13419
+ if (renderedEvents.length) { // any new events rendered?
13420
+ reportEventChange();
13421
+ }
13422
+
13423
+ return renderedEvents;
13424
+ }
13425
+
13426
+
13427
+ function removeEvents(filter) {
13428
+ var eventID;
13429
+ var i;
13430
+
13431
+ if (filter == null) { // null or undefined. remove all events
13432
+ filter = function() { return true; }; // will always match
13433
+ }
13434
+ else if (!$.isFunction(filter)) { // an event ID
13435
+ eventID = filter + '';
13436
+ filter = function(event) {
13437
+ return event._id == eventID;
13438
+ };
13439
+ }
13440
+
13441
+ // Purge event(s) from our local cache
13442
+ cache = $.grep(cache, filter, true); // inverse=true
13443
+
13444
+ // Remove events from array sources.
13445
+ // This works because they have been converted to official Event Objects up front.
13446
+ // (and as a result, event._id has been calculated).
13447
+ for (i=0; i<sources.length; i++) {
13448
+ if ($.isArray(sources[i].events)) {
13449
+ sources[i].events = $.grep(sources[i].events, filter, true);
13450
+ }
13451
+ }
13452
+
13453
+ reportEventChange();
13454
+ }
13455
+
13456
+
13457
+ function clientEvents(filter) {
13458
+ if ($.isFunction(filter)) {
13459
+ return $.grep(cache, filter);
13460
+ }
13461
+ else if (filter != null) { // not null, not undefined. an event ID
13462
+ filter += '';
13463
+ return $.grep(cache, function(e) {
13464
+ return e._id == filter;
13465
+ });
13466
+ }
13467
+ return cache; // else, return all
13468
+ }
13469
+
13470
+
13471
+ // Makes sure all array event sources have their internal event objects
13472
+ // converted over to the Calendar's current timezone.
13473
+ t.rezoneArrayEventSources = function() {
13474
+ var i;
13475
+ var events;
13476
+ var j;
13477
+
13478
+ for (i = 0; i < sources.length; i++) {
13479
+ events = sources[i].events;
13480
+ if ($.isArray(events)) {
13481
+
13482
+ for (j = 0; j < events.length; j++) {
13483
+ rezoneEventDates(events[j]);
13484
+ }
13485
+ }
13486
+ }
13487
+ };
13488
+
13489
+ function rezoneEventDates(event) {
13490
+ event.start = t.moment(event.start);
13491
+ if (event.end) {
13492
+ event.end = t.moment(event.end);
13493
+ }
13494
+ backupEventDates(event);
13495
+ }
13496
+
13497
+
13498
+ /* Event Normalization
13499
+ -----------------------------------------------------------------------------*/
13500
+
13501
+
13502
+ // Given a raw object with key/value properties, returns an "abstract" Event object.
13503
+ // An "abstract" event is an event that, if recurring, will not have been expanded yet.
13504
+ // Will return `false` when input is invalid.
13505
+ // `source` is optional
13506
+ function buildEventFromInput(input, source) {
13507
+ var calendarEventDataTransform = t.opt('eventDataTransform');
13508
+ var out = {};
13509
+ var start, end;
13510
+ var allDay;
13511
+
13512
+ if (calendarEventDataTransform) {
13513
+ input = calendarEventDataTransform(input);
13514
+ }
13515
+ if (source && source.eventDataTransform) {
13516
+ input = source.eventDataTransform(input);
13517
+ }
13518
+
13519
+ // Copy all properties over to the resulting object.
13520
+ // The special-case properties will be copied over afterwards.
13521
+ $.extend(out, input);
13522
+
13523
+ if (source) {
13524
+ out.source = source;
13525
+ }
13526
+
13527
+ out._id = input._id || (input.id === undefined ? '_fc' + eventGUID++ : input.id + '');
13528
+
13529
+ if (input.className) {
13530
+ if (typeof input.className == 'string') {
13531
+ out.className = input.className.split(/\s+/);
13532
+ }
13533
+ else { // assumed to be an array
13534
+ out.className = input.className;
13535
+ }
13536
+ }
13537
+ else {
13538
+ out.className = [];
13539
+ }
13540
+
13541
+ start = input.start || input.date; // "date" is an alias for "start"
13542
+ end = input.end;
13543
+
13544
+ // parse as a time (Duration) if applicable
13545
+ if (isTimeString(start)) {
13546
+ start = moment.duration(start);
13547
+ }
13548
+ if (isTimeString(end)) {
13549
+ end = moment.duration(end);
13550
+ }
13551
+
13552
+ if (input.dow || moment.isDuration(start) || moment.isDuration(end)) {
13553
+
13554
+ // the event is "abstract" (recurring) so don't calculate exact start/end dates just yet
13555
+ out.start = start ? moment.duration(start) : null; // will be a Duration or null
13556
+ out.end = end ? moment.duration(end) : null; // will be a Duration or null
13557
+ out._recurring = true; // our internal marker
13558
+ }
13559
+ else {
13560
+
13561
+ if (start) {
13562
+ start = t.moment(start);
13563
+ if (!start.isValid()) {
13564
+ return false;
13565
+ }
13566
+ }
13567
+
13568
+ if (end) {
13569
+ end = t.moment(end);
13570
+ if (!end.isValid()) {
13571
+ end = null; // let defaults take over
13572
+ }
13573
+ }
13574
+
13575
+ allDay = input.allDay;
13576
+ if (allDay === undefined) { // still undefined? fallback to default
13577
+ allDay = firstDefined(
13578
+ source ? source.allDayDefault : undefined,
13579
+ t.opt('allDayDefault')
13580
+ );
13581
+ // still undefined? normalizeEventDates will calculate it
13582
+ }
13583
+
13584
+ assignDatesToEvent(start, end, allDay, out);
13585
+ }
13586
+
13587
+ t.normalizeEvent(out); // hook for external use. a prototype method
13588
+
13589
+ return out;
13590
+ }
13591
+ t.buildEventFromInput = buildEventFromInput;
13592
+
13593
+
13594
+ // Normalizes and assigns the given dates to the given partially-formed event object.
13595
+ // NOTE: mutates the given start/end moments. does not make a copy.
13596
+ function assignDatesToEvent(start, end, allDay, event) {
13597
+ event.start = start;
13598
+ event.end = end;
13599
+ event.allDay = allDay;
13600
+ normalizeEventDates(event);
13601
+ backupEventDates(event);
13602
+ }
13603
+
13604
+
13605
+ // Ensures proper values for allDay/start/end. Accepts an Event object, or a plain object with event-ish properties.
13606
+ // NOTE: Will modify the given object.
13607
+ function normalizeEventDates(eventProps) {
13608
+
13609
+ normalizeEventTimes(eventProps);
13610
+
13611
+ if (eventProps.end && !eventProps.end.isAfter(eventProps.start)) {
13612
+ eventProps.end = null;
13613
+ }
13614
+
13615
+ if (!eventProps.end) {
13616
+ if (t.opt('forceEventDuration')) {
13617
+ eventProps.end = t.getDefaultEventEnd(eventProps.allDay, eventProps.start);
13618
+ }
13619
+ else {
13620
+ eventProps.end = null;
13621
+ }
13622
+ }
13623
+ }
13624
+
13625
+
13626
+ // Ensures the allDay property exists and the timeliness of the start/end dates are consistent
13627
+ function normalizeEventTimes(eventProps) {
13628
+ if (eventProps.allDay == null) {
13629
+ eventProps.allDay = !(eventProps.start.hasTime() || (eventProps.end && eventProps.end.hasTime()));
13630
+ }
13631
+
13632
+ if (eventProps.allDay) {
13633
+ eventProps.start.stripTime();
13634
+ if (eventProps.end) {
13635
+ // TODO: consider nextDayThreshold here? If so, will require a lot of testing and adjustment
13636
+ eventProps.end.stripTime();
13637
+ }
13638
+ }
13639
+ else {
13640
+ if (!eventProps.start.hasTime()) {
13641
+ eventProps.start = t.applyTimezone(eventProps.start.time(0)); // will assign a 00:00 time
13642
+ }
13643
+ if (eventProps.end && !eventProps.end.hasTime()) {
13644
+ eventProps.end = t.applyTimezone(eventProps.end.time(0)); // will assign a 00:00 time
13645
+ }
13646
+ }
13647
+ }
13648
+
13649
+
13650
+ // If the given event is a recurring event, break it down into an array of individual instances.
13651
+ // If not a recurring event, return an array with the single original event.
13652
+ // If given a falsy input (probably because of a failed buildEventFromInput call), returns an empty array.
13653
+ // HACK: can override the recurring window by providing custom rangeStart/rangeEnd (for businessHours).
13654
+ function expandEvent(abstractEvent, _rangeStart, _rangeEnd) {
13655
+ var events = [];
13656
+ var dowHash;
13657
+ var dow;
13658
+ var i;
13659
+ var date;
13660
+ var startTime, endTime;
13661
+ var start, end;
13662
+ var event;
13663
+
13664
+ _rangeStart = _rangeStart || rangeStart;
13665
+ _rangeEnd = _rangeEnd || rangeEnd;
13666
+
13667
+ if (abstractEvent) {
13668
+ if (abstractEvent._recurring) {
13669
+
13670
+ // make a boolean hash as to whether the event occurs on each day-of-week
13671
+ if ((dow = abstractEvent.dow)) {
13672
+ dowHash = {};
13673
+ for (i = 0; i < dow.length; i++) {
13674
+ dowHash[dow[i]] = true;
13675
+ }
13676
+ }
13677
+
13678
+ // iterate through every day in the current range
13679
+ date = _rangeStart.clone().stripTime(); // holds the date of the current day
13680
+ while (date.isBefore(_rangeEnd)) {
13681
+
13682
+ if (!dowHash || dowHash[date.day()]) { // if everyday, or this particular day-of-week
13683
+
13684
+ startTime = abstractEvent.start; // the stored start and end properties are times (Durations)
13685
+ endTime = abstractEvent.end; // "
13686
+ start = date.clone();
13687
+ end = null;
13688
+
13689
+ if (startTime) {
13690
+ start = start.time(startTime);
13691
+ }
13692
+ if (endTime) {
13693
+ end = date.clone().time(endTime);
13694
+ }
13695
+
13696
+ event = $.extend({}, abstractEvent); // make a copy of the original
13697
+ assignDatesToEvent(
13698
+ start, end,
13699
+ !startTime && !endTime, // allDay?
13700
+ event
13701
+ );
13702
+ events.push(event);
13703
+ }
13704
+
13705
+ date.add(1, 'days');
13706
+ }
13707
+ }
13708
+ else {
13709
+ events.push(abstractEvent); // return the original event. will be a one-item array
13710
+ }
13711
+ }
13712
+
13713
+ return events;
13714
+ }
13715
+ t.expandEvent = expandEvent;
13716
+
13717
+
13718
+
13719
+ /* Event Modification Math
13720
+ -----------------------------------------------------------------------------------------*/
13721
+
13722
+
13723
+ // Modifies an event and all related events by applying the given properties.
13724
+ // Special date-diffing logic is used for manipulation of dates.
13725
+ // If `props` does not contain start/end dates, the updated values are assumed to be the event's current start/end.
13726
+ // All date comparisons are done against the event's pristine _start and _end dates.
13727
+ // Returns an object with delta information and a function to undo all operations.
13728
+ // For making computations in a granularity greater than day/time, specify largeUnit.
13729
+ // NOTE: The given `newProps` might be mutated for normalization purposes.
13730
+ function mutateEvent(event, newProps, largeUnit) {
13731
+ var miscProps = {};
13732
+ var oldProps;
13733
+ var clearEnd;
13734
+ var startDelta;
13735
+ var endDelta;
13736
+ var durationDelta;
13737
+ var undoFunc;
13738
+
13739
+ // diffs the dates in the appropriate way, returning a duration
13740
+ function diffDates(date1, date0) { // date1 - date0
13741
+ if (largeUnit) {
13742
+ return diffByUnit(date1, date0, largeUnit);
13743
+ }
13744
+ else if (newProps.allDay) {
13745
+ return diffDay(date1, date0);
13746
+ }
13747
+ else {
13748
+ return diffDayTime(date1, date0);
13749
+ }
13750
+ }
13751
+
13752
+ newProps = newProps || {};
13753
+
13754
+ // normalize new date-related properties
13755
+ if (!newProps.start) {
13756
+ newProps.start = event.start.clone();
13757
+ }
13758
+ if (newProps.end === undefined) {
13759
+ newProps.end = event.end ? event.end.clone() : null;
13760
+ }
13761
+ if (newProps.allDay == null) { // is null or undefined?
13762
+ newProps.allDay = event.allDay;
13763
+ }
13764
+ normalizeEventDates(newProps);
13765
+
13766
+ // create normalized versions of the original props to compare against
13767
+ // need a real end value, for diffing
13768
+ oldProps = {
13769
+ start: event._start.clone(),
13770
+ end: event._end ? event._end.clone() : t.getDefaultEventEnd(event._allDay, event._start),
13771
+ allDay: newProps.allDay // normalize the dates in the same regard as the new properties
13772
+ };
13773
+ normalizeEventDates(oldProps);
13774
+
13775
+ // need to clear the end date if explicitly changed to null
13776
+ clearEnd = event._end !== null && newProps.end === null;
13777
+
13778
+ // compute the delta for moving the start date
13779
+ startDelta = diffDates(newProps.start, oldProps.start);
13780
+
13781
+ // compute the delta for moving the end date
13782
+ if (newProps.end) {
13783
+ endDelta = diffDates(newProps.end, oldProps.end);
13784
+ durationDelta = endDelta.subtract(startDelta);
13785
+ }
13786
+ else {
13787
+ durationDelta = null;
13788
+ }
13789
+
13790
+ // gather all non-date-related properties
13791
+ $.each(newProps, function(name, val) {
13792
+ if (isMiscEventPropName(name)) {
13793
+ if (val !== undefined) {
13794
+ miscProps[name] = val;
13795
+ }
13796
+ }
13797
+ });
13798
+
13799
+ // apply the operations to the event and all related events
13800
+ undoFunc = mutateEvents(
13801
+ clientEvents(event._id), // get events with this ID
13802
+ clearEnd,
13803
+ newProps.allDay,
13804
+ startDelta,
13805
+ durationDelta,
13806
+ miscProps
13807
+ );
13808
+
13809
+ return {
13810
+ dateDelta: startDelta,
13811
+ durationDelta: durationDelta,
13812
+ undo: undoFunc
13813
+ };
13814
+ }
13815
+
13816
+
13817
+ // Modifies an array of events in the following ways (operations are in order):
13818
+ // - clear the event's `end`
13819
+ // - convert the event to allDay
13820
+ // - add `dateDelta` to the start and end
13821
+ // - add `durationDelta` to the event's duration
13822
+ // - assign `miscProps` to the event
13823
+ //
13824
+ // Returns a function that can be called to undo all the operations.
13825
+ //
13826
+ // TODO: don't use so many closures. possible memory issues when lots of events with same ID.
13827
+ //
13828
+ function mutateEvents(events, clearEnd, allDay, dateDelta, durationDelta, miscProps) {
13829
+ var isAmbigTimezone = t.getIsAmbigTimezone();
13830
+ var undoFunctions = [];
13831
+
13832
+ // normalize zero-length deltas to be null
13833
+ if (dateDelta && !dateDelta.valueOf()) { dateDelta = null; }
13834
+ if (durationDelta && !durationDelta.valueOf()) { durationDelta = null; }
13835
+
13836
+ $.each(events, function(i, event) {
13837
+ var oldProps;
13838
+ var newProps;
13839
+
13840
+ // build an object holding all the old values, both date-related and misc.
13841
+ // for the undo function.
13842
+ oldProps = {
13843
+ start: event.start.clone(),
13844
+ end: event.end ? event.end.clone() : null,
13845
+ allDay: event.allDay
13846
+ };
13847
+ $.each(miscProps, function(name) {
13848
+ oldProps[name] = event[name];
13849
+ });
13850
+
13851
+ // new date-related properties. work off the original date snapshot.
13852
+ // ok to use references because they will be thrown away when backupEventDates is called.
13853
+ newProps = {
13854
+ start: event._start,
13855
+ end: event._end,
13856
+ allDay: allDay // normalize the dates in the same regard as the new properties
13857
+ };
13858
+ normalizeEventDates(newProps); // massages start/end/allDay
13859
+
13860
+ // strip or ensure the end date
13861
+ if (clearEnd) {
13862
+ newProps.end = null;
13863
+ }
13864
+ else if (durationDelta && !newProps.end) { // the duration translation requires an end date
13865
+ newProps.end = t.getDefaultEventEnd(newProps.allDay, newProps.start);
13866
+ }
13867
+
13868
+ if (dateDelta) {
13869
+ newProps.start.add(dateDelta);
13870
+ if (newProps.end) {
13871
+ newProps.end.add(dateDelta);
13872
+ }
13873
+ }
13874
+
13875
+ if (durationDelta) {
13876
+ newProps.end.add(durationDelta); // end already ensured above
13877
+ }
13878
+
13879
+ // if the dates have changed, and we know it is impossible to recompute the
13880
+ // timezone offsets, strip the zone.
13881
+ if (
13882
+ isAmbigTimezone &&
13883
+ !newProps.allDay &&
13884
+ (dateDelta || durationDelta)
13885
+ ) {
13886
+ newProps.start.stripZone();
13887
+ if (newProps.end) {
13888
+ newProps.end.stripZone();
13889
+ }
13890
+ }
13891
+
13892
+ $.extend(event, miscProps, newProps); // copy over misc props, then date-related props
13893
+ backupEventDates(event); // regenerate internal _start/_end/_allDay
13894
+
13895
+ undoFunctions.push(function() {
13896
+ $.extend(event, oldProps);
13897
+ backupEventDates(event); // regenerate internal _start/_end/_allDay
13898
+ });
13899
+ });
13900
+
13901
+ return function() {
13902
+ for (var i = 0; i < undoFunctions.length; i++) {
13903
+ undoFunctions[i]();
13904
+ }
13905
+ };
13906
+ }
13907
+
13908
+ }
13909
+
13910
+
13911
+ // returns an undo function
13912
+ Calendar.prototype.mutateSeg = function(seg, newProps) {
13913
+ return this.mutateEvent(seg.event, newProps);
13914
+ };
13915
+
13916
+
13917
+ // hook for external libs to manipulate event properties upon creation.
13918
+ // should manipulate the event in-place.
13919
+ Calendar.prototype.normalizeEvent = function(event) {
13920
+ };
13921
+
13922
+
13923
+ // Does the given span (start, end, and other location information)
13924
+ // fully contain the other?
13925
+ Calendar.prototype.spanContainsSpan = function(outerSpan, innerSpan) {
13926
+ var eventStart = outerSpan.start.clone().stripZone();
13927
+ var eventEnd = this.getEventEnd(outerSpan).stripZone();
13928
+
13929
+ return innerSpan.start >= eventStart && innerSpan.end <= eventEnd;
13930
+ };
13931
+
13932
+
13933
+ // Returns a list of events that the given event should be compared against when being considered for a move to
13934
+ // the specified span. Attached to the Calendar's prototype because EventManager is a mixin for a Calendar.
13935
+ Calendar.prototype.getPeerEvents = function(span, event) {
13936
+ var cache = this.getEventCache();
13937
+ var peerEvents = [];
13938
+ var i, otherEvent;
13939
+
13940
+ for (i = 0; i < cache.length; i++) {
13941
+ otherEvent = cache[i];
13942
+ if (
13943
+ !event ||
13944
+ event._id !== otherEvent._id // don't compare the event to itself or other related [repeating] events
13945
+ ) {
13946
+ peerEvents.push(otherEvent);
13947
+ }
13948
+ }
13949
+
13950
+ return peerEvents;
13951
+ };
13952
+
13953
+
13954
+ // updates the "backup" properties, which are preserved in order to compute diffs later on.
13955
+ function backupEventDates(event) {
13956
+ event._allDay = event.allDay;
13957
+ event._start = event.start.clone();
13958
+ event._end = event.end ? event.end.clone() : null;
13959
+ }
13960
+
13961
+
13962
+ /* Overlapping / Constraining
13963
+ -----------------------------------------------------------------------------------------*/
13964
+
13965
+
13966
+ // Determines if the given event can be relocated to the given span (unzoned start/end with other misc data)
13967
+ Calendar.prototype.isEventSpanAllowed = function(span, event) {
13968
+ var source = event.source || {};
13969
+ var eventAllowFunc = this.opt('eventAllow');
13970
+
13971
+ var constraint = firstDefined(
13972
+ event.constraint,
13973
+ source.constraint,
13974
+ this.opt('eventConstraint')
13975
+ );
13976
+
13977
+ var overlap = firstDefined(
13978
+ event.overlap,
13979
+ source.overlap,
13980
+ this.opt('eventOverlap')
13981
+ );
13982
+
13983
+ return this.isSpanAllowed(span, constraint, overlap, event) &&
13984
+ (!eventAllowFunc || eventAllowFunc(span, event) !== false);
13985
+ };
13986
+
13987
+
13988
+ // Determines if an external event can be relocated to the given span (unzoned start/end with other misc data)
13989
+ Calendar.prototype.isExternalSpanAllowed = function(eventSpan, eventLocation, eventProps) {
13990
+ var eventInput;
13991
+ var event;
13992
+
13993
+ // note: very similar logic is in View's reportExternalDrop
13994
+ if (eventProps) {
13995
+ eventInput = $.extend({}, eventProps, eventLocation);
13996
+ event = this.expandEvent(
13997
+ this.buildEventFromInput(eventInput)
13998
+ )[0];
13999
+ }
14000
+
14001
+ if (event) {
14002
+ return this.isEventSpanAllowed(eventSpan, event);
14003
+ }
14004
+ else { // treat it as a selection
14005
+
14006
+ return this.isSelectionSpanAllowed(eventSpan);
14007
+ }
14008
+ };
14009
+
14010
+
14011
+ // Determines the given span (unzoned start/end with other misc data) can be selected.
14012
+ Calendar.prototype.isSelectionSpanAllowed = function(span) {
14013
+ var selectAllowFunc = this.opt('selectAllow');
14014
+
14015
+ return this.isSpanAllowed(span, this.opt('selectConstraint'), this.opt('selectOverlap')) &&
14016
+ (!selectAllowFunc || selectAllowFunc(span) !== false);
14017
+ };
14018
+
14019
+
14020
+ // Returns true if the given span (caused by an event drop/resize or a selection) is allowed to exist
14021
+ // according to the constraint/overlap settings.
14022
+ // `event` is not required if checking a selection.
14023
+ Calendar.prototype.isSpanAllowed = function(span, constraint, overlap, event) {
14024
+ var constraintEvents;
14025
+ var anyContainment;
14026
+ var peerEvents;
14027
+ var i, peerEvent;
14028
+ var peerOverlap;
14029
+
14030
+ // the range must be fully contained by at least one of produced constraint events
14031
+ if (constraint != null) {
14032
+
14033
+ // not treated as an event! intermediate data structure
14034
+ // TODO: use ranges in the future
14035
+ constraintEvents = this.constraintToEvents(constraint);
14036
+ if (constraintEvents) { // not invalid
14037
+
14038
+ anyContainment = false;
14039
+ for (i = 0; i < constraintEvents.length; i++) {
14040
+ if (this.spanContainsSpan(constraintEvents[i], span)) {
14041
+ anyContainment = true;
14042
+ break;
14043
+ }
14044
+ }
14045
+
14046
+ if (!anyContainment) {
14047
+ return false;
14048
+ }
14049
+ }
14050
+ }
14051
+
14052
+ peerEvents = this.getPeerEvents(span, event);
14053
+
14054
+ for (i = 0; i < peerEvents.length; i++) {
14055
+ peerEvent = peerEvents[i];
14056
+
14057
+ // there needs to be an actual intersection before disallowing anything
14058
+ if (this.eventIntersectsRange(peerEvent, span)) {
14059
+
14060
+ // evaluate overlap for the given range and short-circuit if necessary
14061
+ if (overlap === false) {
14062
+ return false;
14063
+ }
14064
+ // if the event's overlap is a test function, pass the peer event in question as the first param
14065
+ else if (typeof overlap === 'function' && !overlap(peerEvent, event)) {
14066
+ return false;
14067
+ }
14068
+
14069
+ // if we are computing if the given range is allowable for an event, consider the other event's
14070
+ // EventObject-specific or Source-specific `overlap` property
14071
+ if (event) {
14072
+ peerOverlap = firstDefined(
14073
+ peerEvent.overlap,
14074
+ (peerEvent.source || {}).overlap
14075
+ // we already considered the global `eventOverlap`
14076
+ );
14077
+ if (peerOverlap === false) {
14078
+ return false;
14079
+ }
14080
+ // if the peer event's overlap is a test function, pass the subject event as the first param
14081
+ if (typeof peerOverlap === 'function' && !peerOverlap(event, peerEvent)) {
14082
+ return false;
14083
+ }
14084
+ }
14085
+ }
14086
+ }
14087
+
14088
+ return true;
14089
+ };
14090
+
14091
+
14092
+ // Given an event input from the API, produces an array of event objects. Possible event inputs:
14093
+ // 'businessHours'
14094
+ // An event ID (number or string)
14095
+ // An object with specific start/end dates or a recurring event (like what businessHours accepts)
14096
+ Calendar.prototype.constraintToEvents = function(constraintInput) {
14097
+
14098
+ if (constraintInput === 'businessHours') {
14099
+ return this.getCurrentBusinessHourEvents();
14100
+ }
14101
+
14102
+ if (typeof constraintInput === 'object') {
14103
+ if (constraintInput.start != null) { // needs to be event-like input
14104
+ return this.expandEvent(this.buildEventFromInput(constraintInput));
14105
+ }
14106
+ else {
14107
+ return null; // invalid
14108
+ }
14109
+ }
14110
+
14111
+ return this.clientEvents(constraintInput); // probably an ID
14112
+ };
14113
+
14114
+
14115
+ // Does the event's date range intersect with the given range?
14116
+ // start/end already assumed to have stripped zones :(
14117
+ Calendar.prototype.eventIntersectsRange = function(event, range) {
14118
+ var eventStart = event.start.clone().stripZone();
14119
+ var eventEnd = this.getEventEnd(event).stripZone();
14120
+
14121
+ return range.start < eventEnd && range.end > eventStart;
14122
+ };
14123
+
14124
+
14125
+ /* Business Hours
14126
+ -----------------------------------------------------------------------------------------*/
14127
+
14128
+ var BUSINESS_HOUR_EVENT_DEFAULTS = {
14129
+ id: '_fcBusinessHours', // will relate events from different calls to expandEvent
14130
+ start: '09:00',
14131
+ end: '17:00',
14132
+ dow: [ 1, 2, 3, 4, 5 ], // monday - friday
14133
+ rendering: 'inverse-background'
14134
+ // classNames are defined in businessHoursSegClasses
14135
+ };
14136
+
14137
+ // Return events objects for business hours within the current view.
14138
+ // Abuse of our event system :(
14139
+ Calendar.prototype.getCurrentBusinessHourEvents = function(wholeDay) {
14140
+ return this.computeBusinessHourEvents(wholeDay, this.opt('businessHours'));
14141
+ };
14142
+
14143
+ // Given a raw input value from options, return events objects for business hours within the current view.
14144
+ Calendar.prototype.computeBusinessHourEvents = function(wholeDay, input) {
14145
+ if (input === true) {
14146
+ return this.expandBusinessHourEvents(wholeDay, [ {} ]);
14147
+ }
14148
+ else if ($.isPlainObject(input)) {
14149
+ return this.expandBusinessHourEvents(wholeDay, [ input ]);
14150
+ }
14151
+ else if ($.isArray(input)) {
14152
+ return this.expandBusinessHourEvents(wholeDay, input, true);
14153
+ }
14154
+ else {
14155
+ return [];
14156
+ }
14157
+ };
14158
+
14159
+ // inputs expected to be an array of objects.
14160
+ // if ignoreNoDow is true, will ignore entries that don't specify a day-of-week (dow) key.
14161
+ Calendar.prototype.expandBusinessHourEvents = function(wholeDay, inputs, ignoreNoDow) {
14162
+ var view = this.getView();
14163
+ var events = [];
14164
+ var i, input;
14165
+
14166
+ for (i = 0; i < inputs.length; i++) {
14167
+ input = inputs[i];
14168
+
14169
+ if (ignoreNoDow && !input.dow) {
14170
+ continue;
14171
+ }
14172
+
14173
+ // give defaults. will make a copy
14174
+ input = $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, input);
14175
+
14176
+ // if a whole-day series is requested, clear the start/end times
14177
+ if (wholeDay) {
14178
+ input.start = null;
14179
+ input.end = null;
14180
+ }
14181
+
14182
+ events.push.apply(events, // append
14183
+ this.expandEvent(
14184
+ this.buildEventFromInput(input),
14185
+ view.activeRange.start,
14186
+ view.activeRange.end
14187
+ )
14188
+ );
14189
+ }
14190
+
14191
+ return events;
14192
+ };
14193
+
14194
+ ;;
14195
+
14196
+ /* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells.
14197
+ ----------------------------------------------------------------------------------------------------------------------*/
14198
+ // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
14199
+ // It is responsible for managing width/height.
14200
+
14201
+ var BasicView = FC.BasicView = View.extend({
14202
+
14203
+ scroller: null,
14204
+
14205
+ dayGridClass: DayGrid, // class the dayGrid will be instantiated from (overridable by subclasses)
14206
+ dayGrid: null, // the main subcomponent that does most of the heavy lifting
14207
+
14208
+ dayNumbersVisible: false, // display day numbers on each day cell?
14209
+ colWeekNumbersVisible: false, // display week numbers along the side?
14210
+ cellWeekNumbersVisible: false, // display week numbers in day cell?
14211
+
14212
+ weekNumberWidth: null, // width of all the week-number cells running down the side
14213
+
14214
+ headContainerEl: null, // div that hold's the dayGrid's rendered date header
14215
+ headRowEl: null, // the fake row element of the day-of-week header
14216
+
14217
+
14218
+ initialize: function() {
14219
+ this.dayGrid = this.instantiateDayGrid();
14220
+
14221
+ this.scroller = new Scroller({
14222
+ overflowX: 'hidden',
14223
+ overflowY: 'auto'
14224
+ });
14225
+ },
14226
+
14227
+
14228
+ // Generates the DayGrid object this view needs. Draws from this.dayGridClass
14229
+ instantiateDayGrid: function() {
14230
+ // generate a subclass on the fly with BasicView-specific behavior
14231
+ // TODO: cache this subclass
14232
+ var subclass = this.dayGridClass.extend(basicDayGridMethods);
14233
+
14234
+ return new subclass(this);
14235
+ },
14236
+
14237
+
14238
+ // Computes the date range that will be rendered.
14239
+ buildRenderRange: function(currentRange, currentRangeUnit) {
14240
+ var renderRange = View.prototype.buildRenderRange.apply(this, arguments);
14241
+
14242
+ // year and month views should be aligned with weeks. this is already done for week
14243
+ if (/^(year|month)$/.test(currentRangeUnit)) {
14244
+ renderRange.start.startOf('week');
14245
+
14246
+ // make end-of-week if not already
14247
+ if (renderRange.end.weekday()) {
14248
+ renderRange.end.add(1, 'week').startOf('week'); // exclusively move backwards
14249
+ }
14250
+ }
14251
+
14252
+ return this.trimHiddenDays(renderRange);
14253
+ },
14254
+
14255
+
14256
+ // Renders the view into `this.el`, which should already be assigned
14257
+ renderDates: function() {
14258
+
14259
+ this.dayGrid.breakOnWeeks = /year|month|week/.test(this.currentRangeUnit); // do before Grid::setRange
14260
+ this.dayGrid.setRange(this.renderRange);
14261
+
14262
+ this.dayNumbersVisible = this.dayGrid.rowCnt > 1; // TODO: make grid responsible
14263
+ if (this.opt('weekNumbers')) {
14264
+ if (this.opt('weekNumbersWithinDays')) {
14265
+ this.cellWeekNumbersVisible = true;
14266
+ this.colWeekNumbersVisible = false;
14267
+ }
14268
+ else {
14269
+ this.cellWeekNumbersVisible = false;
14270
+ this.colWeekNumbersVisible = true;
14271
+ };
14272
+ }
14273
+ this.dayGrid.numbersVisible = this.dayNumbersVisible ||
14274
+ this.cellWeekNumbersVisible || this.colWeekNumbersVisible;
14275
+
14276
+ this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml());
14277
+ this.renderHead();
14278
+
14279
+ this.scroller.render();
14280
+ var dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
14281
+ var dayGridEl = $('<div class="fc-day-grid" />').appendTo(dayGridContainerEl);
14282
+ this.el.find('.fc-body > tr > td').append(dayGridContainerEl);
14283
+
14284
+ this.dayGrid.setElement(dayGridEl);
14285
+ this.dayGrid.renderDates(this.hasRigidRows());
14286
+ },
14287
+
14288
+
14289
+ // render the day-of-week headers
14290
+ renderHead: function() {
14291
+ this.headContainerEl =
14292
+ this.el.find('.fc-head-container')
14293
+ .html(this.dayGrid.renderHeadHtml());
14294
+ this.headRowEl = this.headContainerEl.find('.fc-row');
14295
+ },
14296
+
14297
+
14298
+ // Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
14299
+ // always completely kill the dayGrid's rendering.
14300
+ unrenderDates: function() {
14301
+ this.dayGrid.unrenderDates();
14302
+ this.dayGrid.removeElement();
14303
+ this.scroller.destroy();
14304
+ },
14305
+
14306
+
14307
+ renderBusinessHours: function() {
14308
+ this.dayGrid.renderBusinessHours();
14309
+ },
14310
+
14311
+
14312
+ unrenderBusinessHours: function() {
14313
+ this.dayGrid.unrenderBusinessHours();
14314
+ },
14315
+
14316
+
14317
+ // Builds the HTML skeleton for the view.
14318
+ // The day-grid component will render inside of a container defined by this HTML.
14319
+ renderSkeletonHtml: function() {
14320
+ return '' +
14321
+ '<table>' +
14322
+ '<thead class="fc-head">' +
14323
+ '<tr>' +
14324
+ '<td class="fc-head-container ' + this.widgetHeaderClass + '"></td>' +
14325
+ '</tr>' +
14326
+ '</thead>' +
14327
+ '<tbody class="fc-body">' +
14328
+ '<tr>' +
14329
+ '<td class="' + this.widgetContentClass + '"></td>' +
14330
+ '</tr>' +
14331
+ '</tbody>' +
14332
+ '</table>';
14333
+ },
14334
+
14335
+
14336
+ // Generates an HTML attribute string for setting the width of the week number column, if it is known
14337
+ weekNumberStyleAttr: function() {
14338
+ if (this.weekNumberWidth !== null) {
14339
+ return 'style="width:' + this.weekNumberWidth + 'px"';
14340
+ }
14341
+ return '';
14342
+ },
14343
+
14344
+
14345
+ // Determines whether each row should have a constant height
14346
+ hasRigidRows: function() {
14347
+ var eventLimit = this.opt('eventLimit');
14348
+ return eventLimit && typeof eventLimit !== 'number';
14349
+ },
14350
+
14351
+
14352
+ /* Dimensions
14353
+ ------------------------------------------------------------------------------------------------------------------*/
14354
+
14355
+
14356
+ // Refreshes the horizontal dimensions of the view
14357
+ updateWidth: function() {
14358
+ if (this.colWeekNumbersVisible) {
14359
+ // Make sure all week number cells running down the side have the same width.
14360
+ // Record the width for cells created later.
14361
+ this.weekNumberWidth = matchCellWidths(
14362
+ this.el.find('.fc-week-number')
14363
+ );
14364
+ }
14365
+ },
14366
+
14367
+
14368
+ // Adjusts the vertical dimensions of the view to the specified values
14369
+ setHeight: function(totalHeight, isAuto) {
14370
+ var eventLimit = this.opt('eventLimit');
14371
+ var scrollerHeight;
14372
+ var scrollbarWidths;
14373
+
14374
+ // reset all heights to be natural
14375
+ this.scroller.clear();
14376
+ uncompensateScroll(this.headRowEl);
14377
+
14378
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
14379
+
14380
+ // is the event limit a constant level number?
14381
+ if (eventLimit && typeof eventLimit === 'number') {
14382
+ this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
14383
+ }
14384
+
14385
+ // distribute the height to the rows
14386
+ // (totalHeight is a "recommended" value if isAuto)
14387
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
14388
+ this.setGridHeight(scrollerHeight, isAuto);
14389
+
14390
+ // is the event limit dynamically calculated?
14391
+ if (eventLimit && typeof eventLimit !== 'number') {
14392
+ this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
14393
+ }
14394
+
14395
+ if (!isAuto) { // should we force dimensions of the scroll container?
14396
+
14397
+ this.scroller.setHeight(scrollerHeight);
14398
+ scrollbarWidths = this.scroller.getScrollbarWidths();
14399
+
14400
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
14401
+
14402
+ compensateScroll(this.headRowEl, scrollbarWidths);
14403
+
14404
+ // doing the scrollbar compensation might have created text overflow which created more height. redo
14405
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
14406
+ this.scroller.setHeight(scrollerHeight);
14407
+ }
14408
+
14409
+ // guarantees the same scrollbar widths
14410
+ this.scroller.lockOverflow(scrollbarWidths);
14411
+ }
14412
+ },
14413
+
14414
+
14415
+ // given a desired total height of the view, returns what the height of the scroller should be
14416
+ computeScrollerHeight: function(totalHeight) {
14417
+ return totalHeight -
14418
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
14419
+ },
14420
+
14421
+
14422
+ // Sets the height of just the DayGrid component in this view
14423
+ setGridHeight: function(height, isAuto) {
14424
+ if (isAuto) {
14425
+ undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
14426
+ }
14427
+ else {
14428
+ distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
14429
+ }
14430
+ },
14431
+
14432
+
14433
+ /* Scroll
14434
+ ------------------------------------------------------------------------------------------------------------------*/
14435
+
14436
+
14437
+ computeInitialDateScroll: function() {
14438
+ return { top: 0 };
14439
+ },
14440
+
14441
+
14442
+ queryDateScroll: function() {
14443
+ return { top: this.scroller.getScrollTop() };
14444
+ },
14445
+
14446
+
14447
+ applyDateScroll: function(scroll) {
14448
+ if (scroll.top !== undefined) {
14449
+ this.scroller.setScrollTop(scroll.top);
14450
+ }
14451
+ },
14452
+
14453
+
14454
+ /* Hit Areas
14455
+ ------------------------------------------------------------------------------------------------------------------*/
14456
+ // forward all hit-related method calls to dayGrid
14457
+
14458
+
14459
+ hitsNeeded: function() {
14460
+ this.dayGrid.hitsNeeded();
14461
+ },
14462
+
14463
+
14464
+ hitsNotNeeded: function() {
14465
+ this.dayGrid.hitsNotNeeded();
14466
+ },
14467
+
14468
+
14469
+ prepareHits: function() {
14470
+ this.dayGrid.prepareHits();
14471
+ },
14472
+
14473
+
14474
+ releaseHits: function() {
14475
+ this.dayGrid.releaseHits();
14476
+ },
14477
+
14478
+
14479
+ queryHit: function(left, top) {
14480
+ return this.dayGrid.queryHit(left, top);
14481
+ },
14482
+
14483
+
14484
+ getHitSpan: function(hit) {
14485
+ return this.dayGrid.getHitSpan(hit);
14486
+ },
14487
+
14488
+
14489
+ getHitEl: function(hit) {
14490
+ return this.dayGrid.getHitEl(hit);
14491
+ },
14492
+
14493
+
14494
+ /* Events
14495
+ ------------------------------------------------------------------------------------------------------------------*/
14496
+
14497
+
14498
+ // Renders the given events onto the view and populates the segments array
14499
+ renderEvents: function(events) {
14500
+ this.dayGrid.renderEvents(events);
14501
+
14502
+ this.updateHeight(); // must compensate for events that overflow the row
14503
+ },
14504
+
14505
+
14506
+ // Retrieves all segment objects that are rendered in the view
14507
+ getEventSegs: function() {
14508
+ return this.dayGrid.getEventSegs();
14509
+ },
14510
+
14511
+
14512
+ // Unrenders all event elements and clears internal segment data
14513
+ unrenderEvents: function() {
14514
+ this.dayGrid.unrenderEvents();
14515
+
14516
+ // we DON'T need to call updateHeight() because
14517
+ // a renderEvents() call always happens after this, which will eventually call updateHeight()
14518
+ },
14519
+
14520
+
14521
+ /* Dragging (for both events and external elements)
14522
+ ------------------------------------------------------------------------------------------------------------------*/
14523
+
14524
+
14525
+ // A returned value of `true` signals that a mock "helper" event has been rendered.
14526
+ renderDrag: function(dropLocation, seg) {
14527
+ return this.dayGrid.renderDrag(dropLocation, seg);
14528
+ },
14529
+
14530
+
14531
+ unrenderDrag: function() {
14532
+ this.dayGrid.unrenderDrag();
14533
+ },
14534
+
14535
+
14536
+ /* Selection
14537
+ ------------------------------------------------------------------------------------------------------------------*/
14538
+
14539
+
14540
+ // Renders a visual indication of a selection
14541
+ renderSelection: function(span) {
14542
+ this.dayGrid.renderSelection(span);
14543
+ },
14544
+
14545
+
14546
+ // Unrenders a visual indications of a selection
14547
+ unrenderSelection: function() {
14548
+ this.dayGrid.unrenderSelection();
14549
+ }
14550
+
14551
+ });
14552
+
14553
+
14554
+ // Methods that will customize the rendering behavior of the BasicView's dayGrid
14555
+ var basicDayGridMethods = {
14556
+
14557
+
14558
+ // Generates the HTML that will go before the day-of week header cells
14559
+ renderHeadIntroHtml: function() {
14560
+ var view = this.view;
14561
+
14562
+ if (view.colWeekNumbersVisible) {
14563
+ return '' +
14564
+ '<th class="fc-week-number ' + view.widgetHeaderClass + '" ' + view.weekNumberStyleAttr() + '>' +
14565
+ '<span>' + // needed for matchCellWidths
14566
+ htmlEscape(view.opt('weekNumberTitle')) +
14567
+ '</span>' +
14568
+ '</th>';
14569
+ }
14570
+
14571
+ return '';
14572
+ },
14573
+
14574
+
14575
+ // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
14576
+ renderNumberIntroHtml: function(row) {
14577
+ var view = this.view;
14578
+ var weekStart = this.getCellDate(row, 0);
14579
+
14580
+ if (view.colWeekNumbersVisible) {
14581
+ return '' +
14582
+ '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '>' +
14583
+ view.buildGotoAnchorHtml( // aside from link, important for matchCellWidths
14584
+ { date: weekStart, type: 'week', forceOff: this.colCnt === 1 },
14585
+ weekStart.format('w') // inner HTML
14586
+ ) +
14587
+ '</td>';
14588
+ }
14589
+
14590
+ return '';
14591
+ },
14592
+
14593
+
14594
+ // Generates the HTML that goes before the day bg cells for each day-row
14595
+ renderBgIntroHtml: function() {
14596
+ var view = this.view;
14597
+
14598
+ if (view.colWeekNumbersVisible) {
14599
+ return '<td class="fc-week-number ' + view.widgetContentClass + '" ' +
14600
+ view.weekNumberStyleAttr() + '></td>';
14601
+ }
14602
+
14603
+ return '';
14604
+ },
14605
+
14606
+
14607
+ // Generates the HTML that goes before every other type of row generated by DayGrid.
14608
+ // Affects helper-skeleton and highlight-skeleton rows.
14609
+ renderIntroHtml: function() {
14610
+ var view = this.view;
14611
+
14612
+ if (view.colWeekNumbersVisible) {
14613
+ return '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '></td>';
14614
+ }
14615
+
14616
+ return '';
14617
+ }
14618
+
14619
+ };
14620
+
14621
+ ;;
14622
+
14623
+ /* A month view with day cells running in rows (one-per-week) and columns
14624
+ ----------------------------------------------------------------------------------------------------------------------*/
14625
+
14626
+ var MonthView = FC.MonthView = BasicView.extend({
14627
+
14628
+
14629
+ // Computes the date range that will be rendered.
14630
+ buildRenderRange: function() {
14631
+ var renderRange = BasicView.prototype.buildRenderRange.apply(this, arguments);
14632
+ var rowCnt;
14633
+
14634
+ // ensure 6 weeks
14635
+ if (this.isFixedWeeks()) {
14636
+ rowCnt = Math.ceil( // could be partial weeks due to hiddenDays
14637
+ renderRange.end.diff(renderRange.start, 'weeks', true) // dontRound=true
14638
+ );
14639
+ renderRange.end.add(6 - rowCnt, 'weeks');
14640
+ }
14641
+
14642
+ return renderRange;
14643
+ },
14644
+
14645
+
14646
+ // Overrides the default BasicView behavior to have special multi-week auto-height logic
14647
+ setGridHeight: function(height, isAuto) {
14648
+
14649
+ // if auto, make the height of each row the height that it would be if there were 6 weeks
14650
+ if (isAuto) {
14651
+ height *= this.rowCnt / 6;
14652
+ }
14653
+
14654
+ distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
14655
+ },
14656
+
14657
+
14658
+ isFixedWeeks: function() {
14659
+ return this.opt('fixedWeekCount');
14660
+ }
14661
+
14662
+ });
14663
+
14664
+ ;;
14665
+
14666
+ fcViews.basic = {
14667
+ 'class': BasicView
14668
+ };
14669
+
14670
+ fcViews.basicDay = {
14671
+ type: 'basic',
14672
+ duration: { days: 1 }
14673
+ };
14674
+
14675
+ fcViews.basicWeek = {
14676
+ type: 'basic',
14677
+ duration: { weeks: 1 }
14678
+ };
14679
+
14680
+ fcViews.month = {
14681
+ 'class': MonthView,
14682
+ duration: { months: 1 }, // important for prev/next
14683
+ defaults: {
14684
+ fixedWeekCount: true
14685
+ }
14686
+ };
14687
+ ;;
14688
+
14689
+ /* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
14690
+ ----------------------------------------------------------------------------------------------------------------------*/
14691
+ // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
14692
+ // Responsible for managing width/height.
14693
+
14694
+ var AgendaView = FC.AgendaView = View.extend({
14695
+
14696
+ scroller: null,
14697
+
14698
+ timeGridClass: TimeGrid, // class used to instantiate the timeGrid. subclasses can override
14699
+ timeGrid: null, // the main time-grid subcomponent of this view
14700
+
14701
+ dayGridClass: DayGrid, // class used to instantiate the dayGrid. subclasses can override
14702
+ dayGrid: null, // the "all-day" subcomponent. if all-day is turned off, this will be null
14703
+
14704
+ axisWidth: null, // the width of the time axis running down the side
14705
+
14706
+ headContainerEl: null, // div that hold's the timeGrid's rendered date header
14707
+ noScrollRowEls: null, // set of fake row elements that must compensate when scroller has scrollbars
14708
+
14709
+ // when the time-grid isn't tall enough to occupy the given height, we render an <hr> underneath
14710
+ bottomRuleEl: null,
14711
+
14712
+ // indicates that minTime/maxTime affects rendering
14713
+ usesMinMaxTime: true,
14714
+
14715
+
14716
+ initialize: function() {
14717
+ this.timeGrid = this.instantiateTimeGrid();
14718
+
14719
+ if (this.opt('allDaySlot')) { // should we display the "all-day" area?
14720
+ this.dayGrid = this.instantiateDayGrid(); // the all-day subcomponent of this view
14721
+ }
14722
+
14723
+ this.scroller = new Scroller({
14724
+ overflowX: 'hidden',
14725
+ overflowY: 'auto'
14726
+ });
14727
+ },
14728
+
14729
+
14730
+ // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass
14731
+ instantiateTimeGrid: function() {
14732
+ var subclass = this.timeGridClass.extend(agendaTimeGridMethods);
14733
+
14734
+ return new subclass(this);
14735
+ },
14736
+
14737
+
14738
+ // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass
14739
+ instantiateDayGrid: function() {
14740
+ var subclass = this.dayGridClass.extend(agendaDayGridMethods);
14741
+
14742
+ return new subclass(this);
14743
+ },
14744
+
14745
+
14746
+ /* Rendering
14747
+ ------------------------------------------------------------------------------------------------------------------*/
14748
+
14749
+
14750
+ // Renders the view into `this.el`, which has already been assigned
14751
+ renderDates: function() {
14752
+
14753
+ this.timeGrid.setRange(this.renderRange);
14754
+
14755
+ if (this.dayGrid) {
14756
+ this.dayGrid.setRange(this.renderRange);
14757
+ }
14758
+
14759
+ this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml());
14760
+ this.renderHead();
14761
+
14762
+ this.scroller.render();
14763
+ var timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
14764
+ var timeGridEl = $('<div class="fc-time-grid" />').appendTo(timeGridWrapEl);
14765
+ this.el.find('.fc-body > tr > td').append(timeGridWrapEl);
14766
+
14767
+ this.timeGrid.setElement(timeGridEl);
14768
+ this.timeGrid.renderDates();
14769
+
14770
+ // the <hr> that sometimes displays under the time-grid
14771
+ this.bottomRuleEl = $('<hr class="fc-divider ' + this.widgetHeaderClass + '"/>')
14772
+ .appendTo(this.timeGrid.el); // inject it into the time-grid
14773
+
14774
+ if (this.dayGrid) {
14775
+ this.dayGrid.setElement(this.el.find('.fc-day-grid'));
14776
+ this.dayGrid.renderDates();
14777
+
14778
+ // have the day-grid extend it's coordinate area over the <hr> dividing the two grids
14779
+ this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
14780
+ }
14781
+
14782
+ this.noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)'); // fake rows not within the scroller
14783
+ },
14784
+
14785
+
14786
+ // render the day-of-week headers
14787
+ renderHead: function() {
14788
+ this.headContainerEl =
14789
+ this.el.find('.fc-head-container')
14790
+ .html(this.timeGrid.renderHeadHtml());
14791
+ },
14792
+
14793
+
14794
+ // Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
14795
+ // always completely kill each grid's rendering.
14796
+ unrenderDates: function() {
14797
+ this.timeGrid.unrenderDates();
14798
+ this.timeGrid.removeElement();
14799
+
14800
+ if (this.dayGrid) {
14801
+ this.dayGrid.unrenderDates();
14802
+ this.dayGrid.removeElement();
14803
+ }
14804
+
14805
+ this.scroller.destroy();
14806
+ },
14807
+
14808
+
14809
+ // Builds the HTML skeleton for the view.
14810
+ // The day-grid and time-grid components will render inside containers defined by this HTML.
14811
+ renderSkeletonHtml: function() {
14812
+ return '' +
14813
+ '<table>' +
14814
+ '<thead class="fc-head">' +
14815
+ '<tr>' +
14816
+ '<td class="fc-head-container ' + this.widgetHeaderClass + '"></td>' +
14817
+ '</tr>' +
14818
+ '</thead>' +
14819
+ '<tbody class="fc-body">' +
14820
+ '<tr>' +
14821
+ '<td class="' + this.widgetContentClass + '">' +
14822
+ (this.dayGrid ?
14823
+ '<div class="fc-day-grid"/>' +
14824
+ '<hr class="fc-divider ' + this.widgetHeaderClass + '"/>' :
14825
+ ''
14826
+ ) +
14827
+ '</td>' +
14828
+ '</tr>' +
14829
+ '</tbody>' +
14830
+ '</table>';
14831
+ },
14832
+
14833
+
14834
+ // Generates an HTML attribute string for setting the width of the axis, if it is known
14835
+ axisStyleAttr: function() {
14836
+ if (this.axisWidth !== null) {
14837
+ return 'style="width:' + this.axisWidth + 'px"';
14838
+ }
14839
+ return '';
14840
+ },
14841
+
14842
+
14843
+ /* Business Hours
14844
+ ------------------------------------------------------------------------------------------------------------------*/
14845
+
14846
+
14847
+ renderBusinessHours: function() {
14848
+ this.timeGrid.renderBusinessHours();
14849
+
14850
+ if (this.dayGrid) {
14851
+ this.dayGrid.renderBusinessHours();
14852
+ }
14853
+ },
14854
+
14855
+
14856
+ unrenderBusinessHours: function() {
14857
+ this.timeGrid.unrenderBusinessHours();
14858
+
14859
+ if (this.dayGrid) {
14860
+ this.dayGrid.unrenderBusinessHours();
14861
+ }
14862
+ },
14863
+
14864
+
14865
+ /* Now Indicator
14866
+ ------------------------------------------------------------------------------------------------------------------*/
14867
+
14868
+
14869
+ getNowIndicatorUnit: function() {
14870
+ return this.timeGrid.getNowIndicatorUnit();
14871
+ },
14872
+
14873
+
14874
+ renderNowIndicator: function(date) {
14875
+ this.timeGrid.renderNowIndicator(date);
14876
+ },
14877
+
14878
+
14879
+ unrenderNowIndicator: function() {
14880
+ this.timeGrid.unrenderNowIndicator();
14881
+ },
14882
+
14883
+
14884
+ /* Dimensions
14885
+ ------------------------------------------------------------------------------------------------------------------*/
14886
+
14887
+
14888
+ updateSize: function(isResize) {
14889
+ this.timeGrid.updateSize(isResize);
14890
+
14891
+ View.prototype.updateSize.call(this, isResize); // call the super-method
14892
+ },
14893
+
14894
+
14895
+ // Refreshes the horizontal dimensions of the view
14896
+ updateWidth: function() {
14897
+ // make all axis cells line up, and record the width so newly created axis cells will have it
14898
+ this.axisWidth = matchCellWidths(this.el.find('.fc-axis'));
14899
+ },
14900
+
14901
+
14902
+ // Adjusts the vertical dimensions of the view to the specified values
14903
+ setHeight: function(totalHeight, isAuto) {
14904
+ var eventLimit;
14905
+ var scrollerHeight;
14906
+ var scrollbarWidths;
14907
+
14908
+ // reset all dimensions back to the original state
14909
+ this.bottomRuleEl.hide(); // .show() will be called later if this <hr> is necessary
14910
+ this.scroller.clear(); // sets height to 'auto' and clears overflow
14911
+ uncompensateScroll(this.noScrollRowEls);
14912
+
14913
+ // limit number of events in the all-day area
14914
+ if (this.dayGrid) {
14915
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
14916
+
14917
+ eventLimit = this.opt('eventLimit');
14918
+ if (eventLimit && typeof eventLimit !== 'number') {
14919
+ eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
14920
+ }
14921
+ if (eventLimit) {
14922
+ this.dayGrid.limitRows(eventLimit);
14923
+ }
14924
+ }
14925
+
14926
+ if (!isAuto) { // should we force dimensions of the scroll container?
14927
+
14928
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
14929
+ this.scroller.setHeight(scrollerHeight);
14930
+ scrollbarWidths = this.scroller.getScrollbarWidths();
14931
+
14932
+ if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
14933
+
14934
+ // make the all-day and header rows lines up
14935
+ compensateScroll(this.noScrollRowEls, scrollbarWidths);
14936
+
14937
+ // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
14938
+ // and reapply the desired height to the scroller.
14939
+ scrollerHeight = this.computeScrollerHeight(totalHeight);
14940
+ this.scroller.setHeight(scrollerHeight);
14941
+ }
14942
+
14943
+ // guarantees the same scrollbar widths
14944
+ this.scroller.lockOverflow(scrollbarWidths);
14945
+
14946
+ // if there's any space below the slats, show the horizontal rule.
14947
+ // this won't cause any new overflow, because lockOverflow already called.
14948
+ if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
14949
+ this.bottomRuleEl.show();
14950
+ }
14951
+ }
14952
+ },
14953
+
14954
+
14955
+ // given a desired total height of the view, returns what the height of the scroller should be
14956
+ computeScrollerHeight: function(totalHeight) {
14957
+ return totalHeight -
14958
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
14959
+ },
14960
+
14961
+
14962
+ /* Scroll
14963
+ ------------------------------------------------------------------------------------------------------------------*/
14964
+
14965
+
14966
+ // Computes the initial pre-configured scroll state prior to allowing the user to change it
14967
+ computeInitialDateScroll: function() {
14968
+ var scrollTime = moment.duration(this.opt('scrollTime'));
14969
+ var top = this.timeGrid.computeTimeTop(scrollTime);
14970
+
14971
+ // zoom can give weird floating-point values. rather scroll a little bit further
14972
+ top = Math.ceil(top);
14973
+
14974
+ if (top) {
14975
+ top++; // to overcome top border that slots beyond the first have. looks better
14976
+ }
14977
+
14978
+ return { top: top };
14979
+ },
14980
+
14981
+
14982
+ queryDateScroll: function() {
14983
+ return { top: this.scroller.getScrollTop() };
14984
+ },
14985
+
14986
+
14987
+ applyDateScroll: function(scroll) {
14988
+ if (scroll.top !== undefined) {
14989
+ this.scroller.setScrollTop(scroll.top);
14990
+ }
14991
+ },
14992
+
14993
+
14994
+ /* Hit Areas
14995
+ ------------------------------------------------------------------------------------------------------------------*/
14996
+ // forward all hit-related method calls to the grids (dayGrid might not be defined)
14997
+
14998
+
14999
+ hitsNeeded: function() {
15000
+ this.timeGrid.hitsNeeded();
15001
+ if (this.dayGrid) {
15002
+ this.dayGrid.hitsNeeded();
15003
+ }
15004
+ },
15005
+
15006
+
15007
+ hitsNotNeeded: function() {
15008
+ this.timeGrid.hitsNotNeeded();
15009
+ if (this.dayGrid) {
15010
+ this.dayGrid.hitsNotNeeded();
15011
+ }
15012
+ },
15013
+
15014
+
15015
+ prepareHits: function() {
15016
+ this.timeGrid.prepareHits();
15017
+ if (this.dayGrid) {
15018
+ this.dayGrid.prepareHits();
15019
+ }
15020
+ },
15021
+
15022
+
15023
+ releaseHits: function() {
15024
+ this.timeGrid.releaseHits();
15025
+ if (this.dayGrid) {
15026
+ this.dayGrid.releaseHits();
15027
+ }
15028
+ },
15029
+
15030
+
15031
+ queryHit: function(left, top) {
15032
+ var hit = this.timeGrid.queryHit(left, top);
15033
+
15034
+ if (!hit && this.dayGrid) {
15035
+ hit = this.dayGrid.queryHit(left, top);
15036
+ }
15037
+
15038
+ return hit;
15039
+ },
15040
+
15041
+
15042
+ getHitSpan: function(hit) {
15043
+ // TODO: hit.component is set as a hack to identify where the hit came from
15044
+ return hit.component.getHitSpan(hit);
15045
+ },
15046
+
15047
+
15048
+ getHitEl: function(hit) {
15049
+ // TODO: hit.component is set as a hack to identify where the hit came from
15050
+ return hit.component.getHitEl(hit);
15051
+ },
15052
+
15053
+
15054
+ /* Events
15055
+ ------------------------------------------------------------------------------------------------------------------*/
15056
+
15057
+
15058
+ // Renders events onto the view and populates the View's segment array
15059
+ renderEvents: function(events) {
15060
+ var dayEvents = [];
15061
+ var timedEvents = [];
15062
+ var daySegs = [];
15063
+ var timedSegs;
15064
+ var i;
15065
+
15066
+ // separate the events into all-day and timed
15067
+ for (i = 0; i < events.length; i++) {
15068
+ if (events[i].allDay) {
15069
+ dayEvents.push(events[i]);
15070
+ }
15071
+ else {
15072
+ timedEvents.push(events[i]);
15073
+ }
15074
+ }
15075
+
15076
+ // render the events in the subcomponents
15077
+ timedSegs = this.timeGrid.renderEvents(timedEvents);
15078
+ if (this.dayGrid) {
15079
+ daySegs = this.dayGrid.renderEvents(dayEvents);
15080
+ }
15081
+
15082
+ // the all-day area is flexible and might have a lot of events, so shift the height
15083
+ this.updateHeight();
15084
+ },
15085
+
15086
+
15087
+ // Retrieves all segment objects that are rendered in the view
15088
+ getEventSegs: function() {
15089
+ return this.timeGrid.getEventSegs().concat(
15090
+ this.dayGrid ? this.dayGrid.getEventSegs() : []
15091
+ );
15092
+ },
15093
+
15094
+
15095
+ // Unrenders all event elements and clears internal segment data
15096
+ unrenderEvents: function() {
15097
+
15098
+ // unrender the events in the subcomponents
15099
+ this.timeGrid.unrenderEvents();
15100
+ if (this.dayGrid) {
15101
+ this.dayGrid.unrenderEvents();
15102
+ }
15103
+
15104
+ // we DON'T need to call updateHeight() because
15105
+ // a renderEvents() call always happens after this, which will eventually call updateHeight()
15106
+ },
15107
+
15108
+
15109
+ /* Dragging (for events and external elements)
15110
+ ------------------------------------------------------------------------------------------------------------------*/
15111
+
15112
+
15113
+ // A returned value of `true` signals that a mock "helper" event has been rendered.
15114
+ renderDrag: function(dropLocation, seg) {
15115
+ if (dropLocation.start.hasTime()) {
15116
+ return this.timeGrid.renderDrag(dropLocation, seg);
15117
+ }
15118
+ else if (this.dayGrid) {
15119
+ return this.dayGrid.renderDrag(dropLocation, seg);
15120
+ }
15121
+ },
15122
+
15123
+
15124
+ unrenderDrag: function() {
15125
+ this.timeGrid.unrenderDrag();
15126
+ if (this.dayGrid) {
15127
+ this.dayGrid.unrenderDrag();
15128
+ }
15129
+ },
15130
+
15131
+
15132
+ /* Selection
15133
+ ------------------------------------------------------------------------------------------------------------------*/
15134
+
15135
+
15136
+ // Renders a visual indication of a selection
15137
+ renderSelection: function(span) {
15138
+ if (span.start.hasTime() || span.end.hasTime()) {
15139
+ this.timeGrid.renderSelection(span);
15140
+ }
15141
+ else if (this.dayGrid) {
15142
+ this.dayGrid.renderSelection(span);
15143
+ }
15144
+ },
15145
+
15146
+
15147
+ // Unrenders a visual indications of a selection
15148
+ unrenderSelection: function() {
15149
+ this.timeGrid.unrenderSelection();
15150
+ if (this.dayGrid) {
15151
+ this.dayGrid.unrenderSelection();
15152
+ }
15153
+ }
15154
+
15155
+ });
15156
+
15157
+
15158
+ // Methods that will customize the rendering behavior of the AgendaView's timeGrid
15159
+ // TODO: move into TimeGrid
15160
+ var agendaTimeGridMethods = {
15161
+
15162
+
15163
+ // Generates the HTML that will go before the day-of week header cells
15164
+ renderHeadIntroHtml: function() {
15165
+ var view = this.view;
15166
+ var weekText;
15167
+
15168
+ if (view.opt('weekNumbers')) {
15169
+ weekText = this.start.format(view.opt('smallWeekFormat'));
15170
+
15171
+ return '' +
15172
+ '<th class="fc-axis fc-week-number ' + view.widgetHeaderClass + '" ' + view.axisStyleAttr() + '>' +
15173
+ view.buildGotoAnchorHtml( // aside from link, important for matchCellWidths
15174
+ { date: this.start, type: 'week', forceOff: this.colCnt > 1 },
15175
+ htmlEscape(weekText) // inner HTML
15176
+ ) +
15177
+ '</th>';
15178
+ }
15179
+ else {
15180
+ return '<th class="fc-axis ' + view.widgetHeaderClass + '" ' + view.axisStyleAttr() + '></th>';
15181
+ }
15182
+ },
15183
+
15184
+
15185
+ // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
15186
+ renderBgIntroHtml: function() {
15187
+ var view = this.view;
15188
+
15189
+ return '<td class="fc-axis ' + view.widgetContentClass + '" ' + view.axisStyleAttr() + '></td>';
15190
+ },
15191
+
15192
+
15193
+ // Generates the HTML that goes before all other types of cells.
15194
+ // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
15195
+ renderIntroHtml: function() {
15196
+ var view = this.view;
15197
+
15198
+ return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
15199
+ }
15200
+
15201
+ };
15202
+
15203
+
15204
+ // Methods that will customize the rendering behavior of the AgendaView's dayGrid
15205
+ var agendaDayGridMethods = {
15206
+
15207
+
15208
+ // Generates the HTML that goes before the all-day cells
15209
+ renderBgIntroHtml: function() {
15210
+ var view = this.view;
15211
+
15212
+ return '' +
15213
+ '<td class="fc-axis ' + view.widgetContentClass + '" ' + view.axisStyleAttr() + '>' +
15214
+ '<span>' + // needed for matchCellWidths
15215
+ view.getAllDayHtml() +
15216
+ '</span>' +
15217
+ '</td>';
15218
+ },
15219
+
15220
+
15221
+ // Generates the HTML that goes before all other types of cells.
15222
+ // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
15223
+ renderIntroHtml: function() {
15224
+ var view = this.view;
15225
+
15226
+ return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
15227
+ }
15228
+
15229
+ };
15230
+
15231
+ ;;
15232
+
15233
+ var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
15234
+
15235
+ // potential nice values for the slot-duration and interval-duration
15236
+ // from largest to smallest
15237
+ var AGENDA_STOCK_SUB_DURATIONS = [
15238
+ { hours: 1 },
15239
+ { minutes: 30 },
15240
+ { minutes: 15 },
15241
+ { seconds: 30 },
15242
+ { seconds: 15 }
15243
+ ];
15244
+
15245
+ fcViews.agenda = {
15246
+ 'class': AgendaView,
15247
+ defaults: {
15248
+ allDaySlot: true,
15249
+ slotDuration: '00:30:00',
15250
+ slotEventOverlap: true // a bad name. confused with overlap/constraint system
15251
+ }
15252
+ };
15253
+
15254
+ fcViews.agendaDay = {
15255
+ type: 'agenda',
15256
+ duration: { days: 1 }
15257
+ };
15258
+
15259
+ fcViews.agendaWeek = {
15260
+ type: 'agenda',
15261
+ duration: { weeks: 1 }
15262
+ };
15263
+ ;;
15264
+
15265
+ /*
15266
+ Responsible for the scroller, and forwarding event-related actions into the "grid"
15267
+ */
15268
+ var ListView = View.extend({
15269
+
15270
+ grid: null,
15271
+ scroller: null,
15272
+
15273
+ initialize: function() {
15274
+ this.grid = new ListViewGrid(this);
15275
+ this.scroller = new Scroller({
15276
+ overflowX: 'hidden',
15277
+ overflowY: 'auto'
15278
+ });
15279
+ },
15280
+
15281
+ renderSkeleton: function() {
15282
+ this.el.addClass(
15283
+ 'fc-list-view ' +
15284
+ this.widgetContentClass
15285
+ );
15286
+
15287
+ this.scroller.render();
15288
+ this.scroller.el.appendTo(this.el);
15289
+
15290
+ this.grid.setElement(this.scroller.scrollEl);
15291
+ },
15292
+
15293
+ unrenderSkeleton: function() {
15294
+ this.scroller.destroy(); // will remove the Grid too
15295
+ },
15296
+
15297
+ setHeight: function(totalHeight, isAuto) {
15298
+ this.scroller.setHeight(this.computeScrollerHeight(totalHeight));
15299
+ },
15300
+
15301
+ computeScrollerHeight: function(totalHeight) {
15302
+ return totalHeight -
15303
+ subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
15304
+ },
15305
+
15306
+ renderDates: function() {
15307
+ this.grid.setRange(this.renderRange); // needs to process range-related options
15308
+ },
15309
+
15310
+ renderEvents: function(events) {
15311
+ this.grid.renderEvents(events);
15312
+ },
15313
+
15314
+ unrenderEvents: function() {
15315
+ this.grid.unrenderEvents();
15316
+ },
15317
+
15318
+ isEventResizable: function(event) {
15319
+ return false;
15320
+ },
15321
+
15322
+ isEventDraggable: function(event) {
15323
+ return false;
15324
+ }
15325
+
15326
+ });
15327
+
15328
+ /*
15329
+ Responsible for event rendering and user-interaction.
15330
+ Its "el" is the inner-content of the above view's scroller.
15331
+ */
15332
+ var ListViewGrid = Grid.extend({
15333
+
15334
+ segSelector: '.fc-list-item', // which elements accept event actions
15335
+ hasDayInteractions: false, // no day selection or day clicking
15336
+
15337
+ // slices by day
15338
+ spanToSegs: function(span) {
15339
+ var view = this.view;
15340
+ var dayStart = view.renderRange.start.clone().time(0); // timed, so segs get times!
15341
+ var dayIndex = 0;
15342
+ var seg;
15343
+ var segs = [];
15344
+
15345
+ while (dayStart < view.renderRange.end) {
15346
+
15347
+ seg = intersectRanges(span, {
15348
+ start: dayStart,
15349
+ end: dayStart.clone().add(1, 'day')
15350
+ });
15351
+
15352
+ if (seg) {
15353
+ seg.dayIndex = dayIndex;
15354
+ segs.push(seg);
15355
+ }
15356
+
15357
+ dayStart.add(1, 'day');
15358
+ dayIndex++;
15359
+
15360
+ // detect when span won't go fully into the next day,
15361
+ // and mutate the latest seg to the be the end.
15362
+ if (
15363
+ seg && !seg.isEnd && span.end.hasTime() &&
15364
+ span.end < dayStart.clone().add(this.view.nextDayThreshold)
15365
+ ) {
15366
+ seg.end = span.end.clone();
15367
+ seg.isEnd = true;
15368
+ break;
15369
+ }
15370
+ }
15371
+
15372
+ return segs;
15373
+ },
15374
+
15375
+ // like "4:00am"
15376
+ computeEventTimeFormat: function() {
15377
+ return this.view.opt('mediumTimeFormat');
15378
+ },
15379
+
15380
+ // for events with a url, the whole <tr> should be clickable,
15381
+ // but it's impossible to wrap with an <a> tag. simulate this.
15382
+ handleSegClick: function(seg, ev) {
15383
+ var url;
15384
+
15385
+ Grid.prototype.handleSegClick.apply(this, arguments); // super. might prevent the default action
15386
+
15387
+ // not clicking on or within an <a> with an href
15388
+ if (!$(ev.target).closest('a[href]').length) {
15389
+ url = seg.event.url;
15390
+ if (url && !ev.isDefaultPrevented()) { // jsEvent not cancelled in handler
15391
+ window.location.href = url; // simulate link click
15392
+ }
15393
+ }
15394
+ },
15395
+
15396
+ // returns list of foreground segs that were actually rendered
15397
+ renderFgSegs: function(segs) {
15398
+ segs = this.renderFgSegEls(segs); // might filter away hidden events
15399
+
15400
+ if (!segs.length) {
15401
+ this.renderEmptyMessage();
15402
+ }
15403
+ else {
15404
+ this.renderSegList(segs);
15405
+ }
15406
+
15407
+ return segs;
15408
+ },
15409
+
15410
+ renderEmptyMessage: function() {
15411
+ this.el.html(
15412
+ '<div class="fc-list-empty-wrap2">' + // TODO: try less wraps
15413
+ '<div class="fc-list-empty-wrap1">' +
15414
+ '<div class="fc-list-empty">' +
15415
+ htmlEscape(this.view.opt('noEventsMessage')) +
15416
+ '</div>' +
15417
+ '</div>' +
15418
+ '</div>'
15419
+ );
15420
+ },
15421
+
15422
+ // render the event segments in the view
15423
+ renderSegList: function(allSegs) {
15424
+ var segsByDay = this.groupSegsByDay(allSegs); // sparse array
15425
+ var dayIndex;
15426
+ var daySegs;
15427
+ var i;
15428
+ var tableEl = $('<table class="fc-list-table"><tbody/></table>');
15429
+ var tbodyEl = tableEl.find('tbody');
15430
+
15431
+ for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
15432
+ daySegs = segsByDay[dayIndex];
15433
+ if (daySegs) { // sparse array, so might be undefined
15434
+
15435
+ // append a day header
15436
+ tbodyEl.append(this.dayHeaderHtml(
15437
+ this.view.renderRange.start.clone().add(dayIndex, 'days')
15438
+ ));
15439
+
15440
+ this.sortEventSegs(daySegs);
15441
+
15442
+ for (i = 0; i < daySegs.length; i++) {
15443
+ tbodyEl.append(daySegs[i].el); // append event row
15444
+ }
15445
+ }
15446
+ }
15447
+
15448
+ this.el.empty().append(tableEl);
15449
+ },
15450
+
15451
+ // Returns a sparse array of arrays, segs grouped by their dayIndex
15452
+ groupSegsByDay: function(segs) {
15453
+ var segsByDay = []; // sparse array
15454
+ var i, seg;
15455
+
15456
+ for (i = 0; i < segs.length; i++) {
15457
+ seg = segs[i];
15458
+ (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
15459
+ .push(seg);
15460
+ }
15461
+
15462
+ return segsByDay;
15463
+ },
15464
+
15465
+ // generates the HTML for the day headers that live amongst the event rows
15466
+ dayHeaderHtml: function(dayDate) {
15467
+ var view = this.view;
15468
+ var mainFormat = view.opt('listDayFormat');
15469
+ var altFormat = view.opt('listDayAltFormat');
15470
+
15471
+ return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' +
15472
+ '<td class="' + view.widgetHeaderClass + '" colspan="3">' +
15473
+ (mainFormat ?
15474
+ view.buildGotoAnchorHtml(
15475
+ dayDate,
15476
+ { 'class': 'fc-list-heading-main' },
15477
+ htmlEscape(dayDate.format(mainFormat)) // inner HTML
15478
+ ) :
15479
+ '') +
15480
+ (altFormat ?
15481
+ view.buildGotoAnchorHtml(
15482
+ dayDate,
15483
+ { 'class': 'fc-list-heading-alt' },
15484
+ htmlEscape(dayDate.format(altFormat)) // inner HTML
15485
+ ) :
15486
+ '') +
15487
+ '</td>' +
15488
+ '</tr>';
15489
+ },
15490
+
15491
+ // generates the HTML for a single event row
15492
+ fgSegHtml: function(seg) {
15493
+ var view = this.view;
15494
+ var classes = [ 'fc-list-item' ].concat(this.getSegCustomClasses(seg));
15495
+ var bgColor = this.getSegBackgroundColor(seg);
15496
+ var event = seg.event;
15497
+ var url = event.url;
15498
+ var timeHtml;
15499
+
15500
+ if (event.allDay) {
15501
+ timeHtml = view.getAllDayHtml();
15502
+ }
15503
+ else if (view.isMultiDayEvent(event)) { // if the event appears to span more than one day
15504
+ if (seg.isStart || seg.isEnd) { // outer segment that probably lasts part of the day
15505
+ timeHtml = htmlEscape(this.getEventTimeText(seg));
15506
+ }
15507
+ else { // inner segment that lasts the whole day
15508
+ timeHtml = view.getAllDayHtml();
15509
+ }
15510
+ }
15511
+ else {
15512
+ // Display the normal time text for the *event's* times
15513
+ timeHtml = htmlEscape(this.getEventTimeText(event));
15514
+ }
15515
+
15516
+ if (url) {
15517
+ classes.push('fc-has-url');
15518
+ }
15519
+
15520
+ return '<tr class="' + classes.join(' ') + '">' +
15521
+ (this.displayEventTime ?
15522
+ '<td class="fc-list-item-time ' + view.widgetContentClass + '">' +
15523
+ (timeHtml || '') +
15524
+ '</td>' :
15525
+ '') +
15526
+ '<td class="fc-list-item-marker ' + view.widgetContentClass + '">' +
15527
+ '<span class="fc-event-dot"' +
15528
+ (bgColor ?
15529
+ ' style="background-color:' + bgColor + '"' :
15530
+ '') +
15531
+ '></span>' +
15532
+ '</td>' +
15533
+ '<td class="fc-list-item-title ' + view.widgetContentClass + '">' +
15534
+ '<a' + (url ? ' href="' + htmlEscape(url) + '"' : '') + '>' +
15535
+ htmlEscape(seg.event.title || '') +
15536
+ '</a>' +
15537
+ '</td>' +
15538
+ '</tr>';
15539
+ }
15540
+
15541
+ });
15542
+
15543
+ ;;
15544
+
15545
+ fcViews.list = {
15546
+ 'class': ListView,
15547
+ buttonTextKey: 'list', // what to lookup in locale files
15548
+ defaults: {
15549
+ buttonText: 'list', // text to display for English
15550
+ listDayFormat: 'LL', // like "January 1, 2016"
15551
+ noEventsMessage: 'No events to display'
15552
+ }
15553
+ };
15554
+
15555
+ fcViews.listDay = {
15556
+ type: 'list',
15557
+ duration: { days: 1 },
15558
+ defaults: {
15559
+ listDayFormat: 'dddd' // day-of-week is all we need. full date is probably in header
15560
+ }
15561
+ };
15562
+
15563
+ fcViews.listWeek = {
15564
+ type: 'list',
15565
+ duration: { weeks: 1 },
15566
+ defaults: {
15567
+ listDayFormat: 'dddd', // day-of-week is more important
15568
+ listDayAltFormat: 'LL'
15569
+ }
15570
+ };
15571
+
15572
+ fcViews.listMonth = {
15573
+ type: 'list',
15574
+ duration: { month: 1 },
15575
+ defaults: {
15576
+ listDayAltFormat: 'dddd' // day-of-week is nice-to-have
15577
+ }
15578
+ };
15579
+
15580
+ fcViews.listYear = {
15581
+ type: 'list',
15582
+ duration: { year: 1 },
15583
+ defaults: {
15584
+ listDayAltFormat: 'dddd' // day-of-week is nice-to-have
15585
+ }
15586
+ };
15587
+
15588
+ ;;
15589
+
15590
+ return FC; // export for Node/CommonJS
15591
+ });
assets/lib/fullcalendar/fullcalendar.min.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Stylesheet
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */.fc-icon,body .fc{font-size:1em}.fc-button-group,.fc-icon{display:inline-block}.fc-bg,.fc-row .fc-bgevent-skeleton,.fc-row .fc-highlight-skeleton{bottom:0}.fc-icon,.fc-unselectable{-khtml-user-select:none;-webkit-touch-callout:none}.fc{direction:ltr;text-align:left}.fc-rtl{text-align:right}.fc th,.fc-basic-view td.fc-week-number,.fc-icon,.fc-toolbar{text-align:center}.fc-unthemed .fc-content,.fc-unthemed .fc-divider,.fc-unthemed .fc-list-heading td,.fc-unthemed .fc-list-view,.fc-unthemed .fc-popover,.fc-unthemed .fc-row,.fc-unthemed tbody,.fc-unthemed td,.fc-unthemed th,.fc-unthemed thead{border-color:#ddd}.fc-unthemed .fc-popover{background-color:#fff}.fc-unthemed .fc-divider,.fc-unthemed .fc-list-heading td,.fc-unthemed .fc-popover .fc-header{background:#eee}.fc-unthemed .fc-popover .fc-header .fc-close{color:#666}.fc-unthemed td.fc-today{background:#fcf8e3}.fc-highlight{background:#bce8f1;opacity:.3}.fc-bgevent{background:#8fdf82;opacity:.3}.fc-nonbusiness{background:#d7d7d7}.fc-unthemed .fc-disabled-day{background:#d7d7d7;opacity:.3}.ui-widget .fc-disabled-day{background-image:none}.fc-icon{height:1em;line-height:1em;overflow:hidden;font-family:"Courier New",Courier,monospace;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fc-icon:after{position:relative}.fc-icon-left-single-arrow:after{content:"\02039";font-weight:700;font-size:200%;top:-7%}.fc-icon-right-single-arrow:after{content:"\0203A";font-weight:700;font-size:200%;top:-7%}.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%}.fc-icon-right-triangle:after{content:"\25BA";font-size:125%;top:3%}.fc-icon-down-triangle:after{content:"\25BC";font-size:125%;top:2%}.fc-icon-x:after{content:"\000D7";font-size:200%;top:6%}.fc button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;height:2.1em;padding:0 .6em;font-size:1em;white-space:nowrap;cursor:pointer}.fc button::-moz-focus-inner{margin:0;padding:0}.fc-state-default{border:1px solid;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.fc-state-default.fc-corner-left{border-top-left-radius:4px;border-bottom-left-radius:4px}.fc-state-default.fc-corner-right{border-top-right-radius:4px;border-bottom-right-radius:4px}.fc button .fc-icon{position:relative;top:-.05em;margin:0 .2em;vertical-align:middle}.fc-state-active,.fc-state-disabled,.fc-state-down,.fc-state-hover{color:#333;background-color:#e6e6e6}.fc-state-hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.fc-state-active,.fc-state-down{background-color:#ccc;background-image:none;box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.fc-state-disabled{cursor:default;background-image:none;opacity:.65;box-shadow:none}.fc-event.fc-draggable,.fc-event[href],.fc-popover .fc-header .fc-close,a[data-goto]{cursor:pointer}.fc .fc-button-group>*{float:left;margin:0 0 0 -1px}.fc .fc-button-group>:first-child{margin-left:0}.fc-popover{position:absolute;box-shadow:0 2px 6px rgba(0,0,0,.15)}.fc-popover .fc-header{padding:2px 4px}.fc-popover .fc-header .fc-title{margin:0 2px}.fc-ltr .fc-popover .fc-header .fc-title,.fc-rtl .fc-popover .fc-header .fc-close{float:left}.fc-ltr .fc-popover .fc-header .fc-close,.fc-rtl .fc-popover .fc-header .fc-title{float:right}.fc-unthemed .fc-popover{border-width:1px;border-style:solid}.fc-unthemed .fc-popover .fc-header .fc-close{font-size:.9em;margin-top:2px}.fc-popover>.ui-widget-header+.ui-widget-content{border-top:0}.fc-divider{border-style:solid;border-width:1px}hr.fc-divider{height:0;margin:0;padding:0 0 2px;border-width:1px 0}.fc-bg table,.fc-row .fc-bgevent-skeleton table,.fc-row .fc-highlight-skeleton table{height:100%}.fc-clear{clear:both}.fc-bg,.fc-bgevent-skeleton,.fc-helper-skeleton,.fc-highlight-skeleton{position:absolute;top:0;left:0;right:0}.fc table{width:100%;box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border-spacing:0;font-size:1em}.fc td,.fc th{border-style:solid;border-width:1px;padding:0;vertical-align:top}.fc td.fc-today{border-style:double}a[data-goto]:hover{text-decoration:underline}.fc .fc-row{border-style:solid;border-width:0}.fc-row table{border-left:0 hidden transparent;border-right:0 hidden transparent;border-bottom:0 hidden transparent}.fc-row:first-child table{border-top:0 hidden transparent}.fc-row{position:relative}.fc-row .fc-bg{z-index:1}.fc-row .fc-bgevent-skeleton td,.fc-row .fc-highlight-skeleton td{border-color:transparent}.fc-row .fc-bgevent-skeleton{z-index:2}.fc-row .fc-highlight-skeleton{z-index:3}.fc-row .fc-content-skeleton{position:relative;z-index:4;padding-bottom:2px}.fc-row .fc-helper-skeleton{z-index:5}.fc-row .fc-content-skeleton td,.fc-row .fc-helper-skeleton td{background:0 0;border-color:transparent;border-bottom:0}.fc-row .fc-content-skeleton tbody td,.fc-row .fc-helper-skeleton tbody td{border-top:0}.fc-scroller{-webkit-overflow-scrolling:touch}.fc-row.fc-rigid,.fc-time-grid-event{overflow:hidden}.fc-scroller>.fc-day-grid,.fc-scroller>.fc-time-grid{position:relative;width:100%}.fc-event{position:relative;display:block;font-size:.85em;line-height:1.3;border-radius:3px;border:1px solid #3a87ad;font-weight:400}.fc-event,.fc-event-dot{background-color:#3a87ad}.fc-event,.fc-event:hover,.ui-widget .fc-event{color:#fff;text-decoration:none}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc-event .fc-bg{z-index:1;background:#fff;opacity:.25}.fc-event .fc-content{position:relative;z-index:2}.fc-event .fc-resizer{position:absolute;z-index:4;display:none}.fc-event.fc-allow-mouse-resize .fc-resizer,.fc-event.fc-selected .fc-resizer{display:block}.fc-event.fc-selected .fc-resizer:before{content:"";position:absolute;z-index:9999;top:50%;left:50%;width:40px;height:40px;margin-left:-20px;margin-top:-20px}.fc-event.fc-selected{z-index:9999!important;box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event.fc-selected.fc-dragging{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-h-event.fc-selected:before{content:"";position:absolute;z-index:3;top:-10px;bottom:-10px;left:0;right:0}.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;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;border-top-right-radius:0;border-bottom-right-radius:0}.fc-ltr .fc-h-event .fc-start-resizer,.fc-rtl .fc-h-event .fc-end-resizer{cursor:w-resize;left:-1px}.fc-ltr .fc-h-event .fc-end-resizer,.fc-rtl .fc-h-event .fc-start-resizer{cursor:e-resize;right:-1px}.fc-h-event.fc-allow-mouse-resize .fc-resizer{width:7px;top:-1px;bottom:-1px}.fc-h-event.fc-selected .fc-resizer{border-radius:4px;border-width:1px;width:6px;height:6px;border-style:solid;border-color:inherit;background:#fff;top:50%;margin-top:-4px}.fc-ltr .fc-h-event.fc-selected .fc-start-resizer,.fc-rtl .fc-h-event.fc-selected .fc-end-resizer{margin-left:-4px}.fc-ltr .fc-h-event.fc-selected .fc-end-resizer,.fc-rtl .fc-h-event.fc-selected .fc-start-resizer{margin-right:-4px}.fc-day-grid-event{margin:1px 2px 0;padding:0 1px}tr:first-child>td>.fc-day-grid-event{margin-top:2px}.fc-day-grid-event.fc-selected:after{content:"";position:absolute;z-index:1;top:-1px;right:-1px;bottom:-1px;left:-1px;background:#000;opacity:.25}.fc-day-grid-event .fc-content{white-space:nowrap;overflow:hidden}.fc-day-grid-event .fc-time{font-weight:700}.fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer,.fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer{margin-left:-2px}.fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer,.fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer{margin-right:-2px}a.fc-more{margin:1px 3px;font-size:.85em;cursor:pointer;text-decoration:none}a.fc-more:hover{text-decoration:underline}.fc-limited{display:none}.fc-day-grid .fc-row{z-index:1}.fc-more-popover{z-index:2;width:220px}.fc-more-popover .fc-event-container{padding:10px}.fc-now-indicator{position:absolute;border:0 solid red}.fc-unselectable{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.fc-toolbar.fc-header-toolbar{margin-bottom:1em}.fc-toolbar.fc-footer-toolbar{margin-top:1em}.fc-toolbar .fc-left{float:left}.fc-toolbar .fc-right{float:right}.fc-toolbar .fc-center{display:inline-block}.fc .fc-toolbar>*>*{float:left;margin-left:.75em}.fc .fc-toolbar>*>:first-child{margin-left:0}.fc-toolbar h2{margin:0}.fc-toolbar button{position:relative}.fc-toolbar .fc-state-hover,.fc-toolbar .ui-state-hover{z-index:2}.fc-toolbar .fc-state-down{z-index:3}.fc-toolbar .fc-state-active,.fc-toolbar .ui-state-active{z-index:4}.fc-toolbar button:focus{z-index:5}.fc-view-container *,.fc-view-container :after,.fc-view-container :before{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.fc-view,.fc-view>table{position:relative;z-index:1}.fc-basicDay-view .fc-content-skeleton,.fc-basicWeek-view .fc-content-skeleton{padding-bottom:1em}.fc-basic-view .fc-body .fc-row{min-height:4em}.fc-row.fc-rigid .fc-content-skeleton{position:absolute;top:0;left:0;right:0}.fc-day-top.fc-other-month{opacity:.3}.fc-basic-view .fc-day-number,.fc-basic-view .fc-week-number{padding:2px}.fc-basic-view th.fc-day-number,.fc-basic-view th.fc-week-number{padding:0 2px}.fc-ltr .fc-basic-view .fc-day-top .fc-day-number{float:right}.fc-rtl .fc-basic-view .fc-day-top .fc-day-number{float:left}.fc-ltr .fc-basic-view .fc-day-top .fc-week-number{float:left;border-radius:0 0 3px}.fc-rtl .fc-basic-view .fc-day-top .fc-week-number{float:right;border-radius:0 0 0 3px}.fc-basic-view .fc-day-top .fc-week-number{min-width:1.5em;text-align:center;background-color:#f2f2f2;color:grey}.fc-basic-view td.fc-week-number>*{display:inline-block;min-width:1.25em}.fc-agenda-view .fc-day-grid{position:relative;z-index:2}.fc-agenda-view .fc-day-grid .fc-row{min-height:3em}.fc-agenda-view .fc-day-grid .fc-row .fc-content-skeleton{padding-bottom:1em}.fc .fc-axis{vertical-align:middle;padding:0 4px;white-space:nowrap}.fc-ltr .fc-axis{text-align:right}.fc-rtl .fc-axis{text-align:left}.ui-widget td.fc-axis{font-weight:400}.fc-time-grid,.fc-time-grid-container{position:relative;z-index:1}.fc-time-grid{min-height:100%}.fc-time-grid table{border:0 hidden transparent}.fc-time-grid>.fc-bg{z-index:1}.fc-time-grid .fc-slats,.fc-time-grid>hr{position:relative;z-index:2}.fc-time-grid .fc-content-col{position:relative}.fc-time-grid .fc-content-skeleton{position:absolute;z-index:3;top:0;left:0;right:0}.fc-time-grid .fc-business-container{position:relative;z-index:1}.fc-time-grid .fc-bgevent-container{position:relative;z-index:2}.fc-time-grid .fc-highlight-container{z-index:3;position:relative}.fc-time-grid .fc-event-container{position:relative;z-index:4}.fc-time-grid .fc-now-indicator-line{z-index:5}.fc-time-grid .fc-helper-container{position:relative;z-index:6}.fc-time-grid .fc-slats td{height:1.5em;border-bottom:0}.fc-time-grid .fc-slats .fc-minor td{border-top-style:dotted}.fc-time-grid .fc-slats .ui-widget-content{background:0 0}.fc-time-grid .fc-highlight{position:absolute;left:0;right:0}.fc-ltr .fc-time-grid .fc-event-container{margin:0 2.5% 0 2px}.fc-rtl .fc-time-grid .fc-event-container{margin:0 2px 0 2.5%}.fc-time-grid .fc-bgevent,.fc-time-grid .fc-event{position:absolute;z-index:1}.fc-time-grid .fc-bgevent{left:0;right:0}.fc-v-event.fc-not-start{border-top-width:0;padding-top:1px;border-top-left-radius:0;border-top-right-radius:0}.fc-v-event.fc-not-end{border-bottom-width:0;padding-bottom:1px;border-bottom-left-radius:0;border-bottom-right-radius:0}.fc-time-grid-event.fc-selected{overflow:visible}.fc-time-grid-event.fc-selected .fc-bg{display:none}.fc-time-grid-event .fc-content{overflow:hidden}.fc-time-grid-event .fc-time,.fc-time-grid-event .fc-title{padding:0 1px}.fc-time-grid-event .fc-time{font-size:.85em;white-space:nowrap}.fc-time-grid-event.fc-short .fc-content{white-space:nowrap}.fc-time-grid-event.fc-short .fc-time,.fc-time-grid-event.fc-short .fc-title{display:inline-block;vertical-align:top}.fc-time-grid-event.fc-short .fc-time span{display:none}.fc-time-grid-event.fc-short .fc-time:before{content:attr(data-start)}.fc-time-grid-event.fc-short .fc-time:after{content:"\000A0-\000A0"}.fc-time-grid-event.fc-short .fc-title{font-size:.85em;padding:0}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer{left:0;right:0;bottom:0;height:8px;overflow:hidden;line-height:8px;font-size:11px;font-family:monospace;text-align:center;cursor:s-resize}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer:after{content:"="}.fc-time-grid-event.fc-selected .fc-resizer{border-radius:5px;border-width:1px;width:8px;height:8px;border-style:solid;border-color:inherit;background:#fff;left:50%;margin-left:-5px;bottom:-5px}.fc-time-grid .fc-now-indicator-line{border-top-width:1px;left:0;right:0}.fc-time-grid .fc-now-indicator-arrow{margin-top:-5px}.fc-ltr .fc-time-grid .fc-now-indicator-arrow{left:0;border-width:5px 0 5px 6px;border-top-color:transparent;border-bottom-color:transparent}.fc-rtl .fc-time-grid .fc-now-indicator-arrow{right:0;border-width:5px 6px 5px 0;border-top-color:transparent;border-bottom-color:transparent}.fc-event-dot{display:inline-block;width:10px;height:10px;border-radius:5px}.fc-rtl .fc-list-view{direction:rtl}.fc-list-view{border-width:1px;border-style:solid}.fc .fc-list-table{table-layout:auto}.fc-list-table td{border-width:1px 0 0;padding:8px 14px}.fc-list-table tr:first-child td{border-top-width:0}.fc-list-heading{border-bottom-width:1px}.fc-list-heading td{font-weight:700}.fc-ltr .fc-list-heading-main{float:left}.fc-ltr .fc-list-heading-alt,.fc-rtl .fc-list-heading-main{float:right}.fc-rtl .fc-list-heading-alt{float:left}.fc-list-item.fc-has-url{cursor:pointer}.fc-list-item:hover td{background-color:#f5f5f5}.fc-list-item-marker,.fc-list-item-time{white-space:nowrap;width:1px}.fc-ltr .fc-list-item-marker{padding-right:0}.fc-rtl .fc-list-item-marker{padding-left:0}.fc-list-item-title a{text-decoration:none;color:inherit}.fc-list-item-title a[href]:hover{text-decoration:underline}.fc-list-empty-wrap2{position:absolute;top:0;left:0;right:0;bottom:0}.fc-list-empty-wrap1{width:100%;height:100%;display:table}.fc-list-empty{display:table-cell;vertical-align:middle;text-align:center}.fc-unthemed .fc-list-empty{background-color:#eee}
assets/lib/fullcalendar/fullcalendar.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+ !function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("moment")):t(jQuery,moment)}(function(t,e){function n(t){return it(t,Qt)}function i(t,e){e.left&&t.css({"border-left-width":1,"margin-left":e.left-1}),e.right&&t.css({"border-right-width":1,"margin-right":e.right-1})}function r(t){t.css({"margin-left":"","margin-right":"","border-left-width":"","border-right-width":""})}function s(){t("body").addClass("fc-not-allowed")}function o(){t("body").removeClass("fc-not-allowed")}function a(e,n,i){var r=Math.floor(n/e.length),s=Math.floor(n-r*(e.length-1)),o=[],a=[],u=[],h=0;l(e),e.each(function(n,i){var l=n===e.length-1?s:r,c=t(i).outerHeight(!0);c<l?(o.push(i),a.push(c),u.push(t(i).height())):h+=c}),i&&(n-=h,r=Math.floor(n/o.length),s=Math.floor(n-r*(o.length-1))),t(o).each(function(e,n){var i=e===o.length-1?s:r,l=a[e],h=u[e],c=i-(l-h);l<i&&t(n).height(c)})}function l(t){t.height("")}function u(e){var n=0;return e.find("> *").each(function(e,i){var r=t(i).outerWidth();r>n&&(n=r)}),n++,e.width(n),n}function h(t,e){var n,i=t.add(e);return i.css({position:"relative",left:-1}),n=t.outerHeight()-e.outerHeight(),i.css({position:"",left:""}),n}function c(e){var n=e.css("position"),i=e.parents().filter(function(){var e=t(this);return/(auto|scroll)/.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==n&&i.length?i:t(e[0].ownerDocument||document)}function d(t,e){var n=t.offset(),i=n.left-(e?e.left:0),r=n.top-(e?e.top:0);return{left:i,right:i+t.outerWidth(),top:r,bottom:r+t.outerHeight()}}function f(t,e){var n=t.offset(),i=p(t),r=n.left+w(t,"border-left-width")+i.left-(e?e.left:0),s=n.top+w(t,"border-top-width")+i.top-(e?e.top:0);return{left:r,right:r+t[0].clientWidth,top:s,bottom:s+t[0].clientHeight}}function g(t,e){var n=t.offset(),i=n.left+w(t,"border-left-width")+w(t,"padding-left")-(e?e.left:0),r=n.top+w(t,"border-top-width")+w(t,"padding-top")-(e?e.top:0);return{left:i,right:i+t.width(),top:r,bottom:r+t.height()}}function p(t){var e,n=t[0].offsetWidth-t[0].clientWidth,i=t[0].offsetHeight-t[0].clientHeight;return n=v(n),i=v(i),e={left:0,right:0,top:0,bottom:i},m()&&"rtl"==t.css("direction")?e.left=n:e.right=n,e}function v(t){return t=Math.max(0,t),t=Math.round(t)}function m(){return null===Xt&&(Xt=y()),Xt}function y(){var e=t("<div><div/></div>").css({position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}).appendTo("body"),n=e.children(),i=n.offset().left>e.offset().left;return e.remove(),i}function w(t,e){return parseFloat(t.css(e))||0}function S(t){return 1==t.which&&!t.ctrlKey}function b(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageX:t.pageX}function E(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageY:t.pageY}function D(t){return/^touch/.test(t.type)}function T(t){t.addClass("fc-unselectable").on("selectstart",H)}function C(t){t.removeClass("fc-unselectable").off("selectstart",H)}function H(t){t.preventDefault()}function R(t,e){var n={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)};return n.left<n.right&&n.top<n.bottom&&n}function x(t,e){return{left:Math.min(Math.max(t.left,e.left),e.right),top:Math.min(Math.max(t.top,e.top),e.bottom)}}function I(t){return{left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}}function k(t,e){return{left:t.left-e.left,top:t.top-e.top}}function M(e){var n,i,r=[],s=[];for("string"==typeof e?s=e.split(/\s*,\s*/):"function"==typeof e?s=[e]:t.isArray(e)&&(s=e),n=0;n<s.length;n++)i=s[n],"string"==typeof i?r.push("-"==i.charAt(0)?{field:i.substring(1),order:-1}:{field:i,order:1}):"function"==typeof i&&r.push({func:i});return r}function B(t,e,n){var i,r;for(i=0;i<n.length;i++)if(r=L(t,e,n[i]))return r;return 0}function L(t,e,n){return n.func?n.func(t,e):N(t[n.field],e[n.field])*(n.order||1)}function N(e,n){return e||n?null==n?-1:null==e?1:"string"===t.type(e)||"string"===t.type(n)?String(e).localeCompare(String(n)):e-n:0}function z(t,e){var n,i,r,s,o=t.start,a=t.end,l=e.start,u=e.end;if(a>l&&o<u)return o>=l?(n=o.clone(),r=!0):(n=l.clone(),r=!1),a<=u?(i=a.clone(),s=!0):(i=u.clone(),s=!1),{start:n,end:i,isStart:r,isEnd:s}}function F(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days"),ms:t.time()-n.time()})}function A(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days")})}function G(t,n,i){return e.duration(Math.round(t.diff(n,i,!0)),i)}function V(t,e){var n,i,r;for(n=0;n<Jt.length&&(i=Jt[n],!((r=P(i,t,e))>=1&&vt(r)));n++);return i}function O(t,e){var n=V(t);return"week"===n&&"object"==typeof e&&e.days&&(n="day"),n}function P(t,n,i){return null!=i?i.diff(n,t,!0):e.isDuration(n)?n.as(t):n.end.diff(n.start,t,!0)}function _(t,e,n){var i;return tt(n)?(e-t)/n:(i=n.asMonths(),Math.abs(i)>=1&&vt(i)?e.diff(t,"months",!0)/i:e.diff(t,"days",!0)/n.asDays())}function W(t,e){var n,i;return tt(t)||tt(e)?t/e:(n=t.asMonths(),i=e.asMonths(),Math.abs(n)>=1&&vt(n)&&Math.abs(i)>=1&&vt(i)?n/i:t.asDays()/e.asDays())}function Y(t,n){var i;return tt(t)?e.duration(t*n):(i=t.asMonths(),Math.abs(i)>=1&&vt(i)?e.duration({months:i*n}):e.duration({days:t.asDays()*n}))}function q(t){return{start:t.start.clone(),end:t.end.clone()}}function U(t,e){return t=q(t),e.start&&(t.start=j(t.start,e)),e.end&&(t.end=K(t.end,e.end)),t}function j(t,e){return t=t.clone(),e.start&&(t=J(t,e.start)),e.end&&t>=e.end&&(t=e.end.clone().subtract(1)),t}function Z(t,e){return(!e.start||t>=e.start)&&(!e.end||t<e.end)}function $(t,e){return(!e.start||t.end>=e.start)&&(!e.end||t.start<e.end)}function Q(t,e){return(!e.start||t.start>=e.start)&&(!e.end||t.end<=e.end)}function X(t,e){return(t.start&&e.start&&t.start.isSame(e.start)||!t.start&&!e.start)&&(t.end&&e.end&&t.end.isSame(e.end)||!t.end&&!e.end)}function K(t,e){return(t.isBefore(e)?t:e).clone()}function J(t,e){return(t.isAfter(e)?t:e).clone()}function tt(t){return Boolean(t.hours()||t.minutes()||t.seconds()||t.milliseconds())}function et(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function nt(t){return/^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(t)}function it(t,e){var n,i,r,s,o,a,l={};if(e)for(n=0;n<e.length;n++){for(i=e[n],r=[],s=t.length-1;s>=0;s--)if("object"==typeof(o=t[s][i]))r.unshift(o);else if(void 0!==o){l[i]=o;break}r.length&&(l[i]=it(r))}for(n=t.length-1;n>=0;n--){a=t[n];for(i in a)i in l||(l[i]=a[i])}return l}function rt(t){var e=function(){};return e.prototype=t,new e}function st(t,e){for(var n in t)ot(t,n)&&(e[n]=t[n])}function ot(t,e){return te.call(t,e)}function at(e){return/undefined|null|boolean|number|string/.test(t.type(e))}function lt(e,n,i){if(t.isFunction(e)&&(e=[e]),e){var r,s;for(r=0;r<e.length;r++)s=e[r].apply(n,i)||s;return s}}function ut(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]}function ht(t){return(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function ct(t){return t.replace(/&.*?;/g,"")}function dt(e){var n=[];return t.each(e,function(t,e){null!=e&&n.push(t+":"+e)}),n.join(";")}function ft(e){var n=[];return t.each(e,function(t,e){null!=e&&n.push(t+'="'+ht(e)+'"')}),n.join(" ")}function gt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function pt(t,e){return t-e}function vt(t){return t%1==0}function mt(t,e){var n=t[e];return function(){return n.apply(t,arguments)}}function yt(t,e,n){var i,r,s,o,a,l=function(){var u=+new Date-o;u<e?i=setTimeout(l,e-u):(i=null,n||(a=t.apply(s,r),s=r=null))};return function(){s=this,r=arguments,o=+new Date;var u=n&&!i;return i||(i=setTimeout(l,e)),u&&(a=t.apply(s,r),s=r=null),a}}function wt(n,i,r){var s,o,a,l,u=n[0],h=1==n.length&&"string"==typeof u;return e.isMoment(u)||et(u)||void 0===u?l=e.apply(null,n):(s=!1,o=!1,h?ee.test(u)?(u+="-01",n=[u],s=!0,o=!0):(a=ne.exec(u))&&(s=!a[5],o=!0):t.isArray(u)&&(o=!0),l=i||s?e.utc.apply(e,n):e.apply(null,n),s?(l._ambigTime=!0,l._ambigZone=!0):r&&(o?l._ambigZone=!0:h&&l.utcOffset(u))),l._fullCalendar=!0,l}function St(t){return"en"!==t.locale()?t.clone().locale("en"):t}function bt(){}function Et(t,e){var n;return ot(e,"constructor")&&(n=e.constructor),"function"!=typeof n&&(n=e.constructor=function(){t.apply(this,arguments)}),n.prototype=rt(t.prototype),st(e,n.prototype),st(t,n),n}function Dt(t,e){st(e,t.prototype)}function Tt(t,e){t.then=function(n){return"function"==typeof n&&n(e),t}}function Ct(t){t.then=function(e,n){return"function"==typeof n&&n(),t}}function Ht(t,e){return!t&&!e||!(!t||!e)&&(t.component===e.component&&Rt(t,e)&&Rt(e,t))}function Rt(t,e){for(var n in t)if(!/^(component|left|right|top|bottom)$/.test(n)&&t[n]!==e[n])return!1;return!0}function xt(t){return{start:t.start.clone(),end:t.end?t.end.clone():null,allDay:t.allDay}}function It(t){var e=Mt(t);return"background"===e||"inverse-background"===e}function kt(t){return"inverse-background"===Mt(t)}function Mt(t){return ut((t.source||{}).rendering,t.rendering)}function Bt(t){var e,n,i={};for(e=0;e<t.length;e++)n=t[e],(i[n._id]||(i[n._id]=[])).push(n);return i}function Lt(t,e){return t.start-e.start}function Nt(n){var i,r,s,o,a=Zt.dataAttrPrefix;return a&&(a+="-"),i=n.data(a+"event")||null,i&&(i="object"==typeof i?t.extend({},i):{},r=i.start,null==r&&(r=i.time),s=i.duration,o=i.stick,delete i.start,delete i.time,delete i.duration,delete i.stick),null==r&&(r=n.data(a+"start")),null==r&&(r=n.data(a+"time")),null==s&&(s=n.data(a+"duration")),null==o&&(o=n.data(a+"stick")),r=null!=r?e.duration(r):null,s=null!=s?e.duration(s):null,o=Boolean(o),{eventProps:i,startTime:r,duration:s,stick:o}}function zt(t,e){var n,i;for(n=0;n<e.length;n++)if(i=e[n],i.leftCol<=t.rightCol&&i.rightCol>=t.leftCol)return!0;return!1}function Ft(t,e){return t.leftCol-e.leftCol}function At(t){var e,n,i,r=[];for(e=0;e<t.length;e++){for(n=t[e],i=0;i<r.length&&Ot(n,r[i]).length;i++);n.level=i,(r[i]||(r[i]=[])).push(n)}return r}function Gt(t){var e,n,i,r,s;for(e=0;e<t.length;e++)for(n=t[e],i=0;i<n.length;i++)for(r=n[i],r.forwardSegs=[],s=e+1;s<t.length;s++)Ot(r,t[s],r.forwardSegs)}function Vt(t){var e,n,i=t.forwardSegs,r=0;if(void 0===t.forwardPressure){for(e=0;e<i.length;e++)n=i[e],Vt(n),r=Math.max(r,1+n.forwardPressure);t.forwardPressure=r}}function Ot(t,e,n){n=n||[];for(var i=0;i<e.length;i++)Pt(t,e[i])&&n.push(e[i]);return n}function Pt(t,e){return t.bottom>e.top&&t.top<e.bottom}function _t(t){this.items=t||[]}function Wt(e,n){function i(t){n=t}function r(){var i=n.layout;p=e.opt("theme")?"ui":"fc",i?(g?g.empty():g=this.el=t("<div class='fc-toolbar "+n.extraClasses+"'/>"),g.append(o("left")).append(o("right")).append(o("center")).append('<div class="fc-clear"/>')):s()}function s(){g&&(g.remove(),g=f.el=null)}function o(i){var r=t('<div class="fc-'+i+'"/>'),s=n.layout[i],o=e.opt("customButtons")||{},a=e.opt("buttonText")||{};return s&&t.each(s.split(" "),function(n){var i,s=t(),l=!0;t.each(this.split(","),function(n,i){var r,u,h,c,d,f,g,m,y,w;"title"==i?(s=s.add(t("<h2>&nbsp;</h2>")),l=!1):((r=o[i])?(h=function(t){r.click&&r.click.call(w[0],t)},c="",d=r.text):(u=e.getViewSpec(i))?(h=function(){e.changeView(i)},v.push(i),c=u.buttonTextOverride,d=u.buttonTextDefault):e[i]&&(h=function(){e[i]()},c=(e.overrides.buttonText||{})[i],d=a[i]),h&&(f=r?r.themeIcon:e.opt("themeButtonIcons")[i],g=r?r.icon:e.opt("buttonIcons")[i],m=c?ht(c):f&&e.opt("theme")?"<span class='ui-icon ui-icon-"+f+"'></span>":g&&!e.opt("theme")?"<span class='fc-icon fc-icon-"+g+"'></span>":ht(d),y=["fc-"+i+"-button",p+"-button",p+"-state-default"],w=t('<button type="button" class="'+y.join(" ")+'">'+m+"</button>").click(function(t){w.hasClass(p+"-state-disabled")||(h(t),(w.hasClass(p+"-state-active")||w.hasClass(p+"-state-disabled"))&&w.removeClass(p+"-state-hover"))}).mousedown(function(){w.not("."+p+"-state-active").not("."+p+"-state-disabled").addClass(p+"-state-down")}).mouseup(function(){w.removeClass(p+"-state-down")}).hover(function(){w.not("."+p+"-state-active").not("."+p+"-state-disabled").addClass(p+"-state-hover")},function(){w.removeClass(p+"-state-hover").removeClass(p+"-state-down")}),s=s.add(w)))}),l&&s.first().addClass(p+"-corner-left").end().last().addClass(p+"-corner-right").end(),s.length>1?(i=t("<div/>"),l&&i.addClass("fc-button-group"),i.append(s),r.append(i)):r.append(s)}),r}function a(t){g&&g.find("h2").text(t)}function l(t){g&&g.find(".fc-"+t+"-button").addClass(p+"-state-active")}function u(t){g&&g.find(".fc-"+t+"-button").removeClass(p+"-state-active")}function h(t){g&&g.find(".fc-"+t+"-button").prop("disabled",!0).addClass(p+"-state-disabled")}function c(t){g&&g.find(".fc-"+t+"-button").prop("disabled",!1).removeClass(p+"-state-disabled")}function d(){return v}var f=this;f.setToolbarOptions=i,f.render=r,f.removeElement=s,f.updateTitle=a,f.activateButton=l,f.deactivateButton=u,f.disableButton=h,f.enableButton=c,f.getViewsWithButtons=d,f.el=null;var g,p,v=[]}function Yt(e){t.each(Me,function(t,n){null==e[t]&&(e[t]=n(e))})}function qt(t){return e.localeData(t)||e.localeData("en")}function Ut(){function n(t,e){return!q.opt("lazyFetching")||s(t,e)?o(t,e):he.resolve(Z)}function i(){Z=r(K),q.trigger("eventsReset",Z)}function r(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],n.start.clone().stripZone()<j&&q.getEventEnd(n).stripZone()>U&&i.push(n);return i}function s(t,e){return!U||t<U||e>j}function o(t,e){return U=t,j=e,a()}function a(){return u(Q,"reset")}function l(t){return u(b(t))}function u(t,e){var n,i;for("reset"===e?K=[]:"add"!==e&&(K=C(K,t)),n=0;n<t.length;n++)i=t[n],"pending"!==i._status&&X++,i._fetchId=(i._fetchId||0)+1,i._status="pending";for(n=0;n<t.length;n++)i=t[n],h(i,i._fetchId);return X?he.construct(function(t){q.one("eventsReceived",t)}):he.resolve(Z)}function h(e,n){f(e,function(i){var r,s,o,a=t.isArray(e.events);if(n===e._fetchId&&"rejected"!==e._status){if(e._status="resolved",i)for(r=0;r<i.length;r++)s=i[r],(o=a?s:z(s,e))&&K.push.apply(K,_(o));d()}})}function c(t){var e="pending"===t._status;t._status="rejected",e&&d()}function d(){--X||(i(K),q.trigger("eventsReceived",Z))}function f(e,n){var i,r,s=Zt.sourceFetchers;for(i=0;i<s.length;i++){if(!0===(r=s[i].call(q,e,U.clone(),j.clone(),q.opt("timezone"),n)))return;if("object"==typeof r)return void f(r,n)}var o=e.events;if(o)t.isFunction(o)?(q.pushLoading(),o.call(q,U.clone(),j.clone(),q.opt("timezone"),function(t){n(t),q.popLoading()})):t.isArray(o)?n(o):n();else{if(e.url){var a,l=e.success,u=e.error,h=e.complete;a=t.isFunction(e.data)?e.data():e.data;var c=t.extend({},a||{}),d=ut(e.startParam,q.opt("startParam")),g=ut(e.endParam,q.opt("endParam")),p=ut(e.timezoneParam,q.opt("timezoneParam"));d&&(c[d]=U.format()),g&&(c[g]=j.format()),q.opt("timezone")&&"local"!=q.opt("timezone")&&(c[p]=q.opt("timezone")),q.pushLoading(),t.ajax(t.extend({},Be,e,{data:c,success:function(e){e=e||[];var i=lt(l,this,arguments);t.isArray(i)&&(e=i),n(e)},error:function(){lt(u,this,arguments),n()},complete:function(){lt(h,this,arguments),q.popLoading()}}))}else n()}}function g(t){var e=p(t);e&&(Q.push(e),u([e],"add"))}function p(e){var n,i,r=Zt.sourceNormalizers;if(t.isFunction(e)||t.isArray(e)?n={events:e}:"string"==typeof e?n={url:e}:"object"==typeof e&&(n=t.extend({},e)),n){for(n.className?"string"==typeof n.className&&(n.className=n.className.split(/\s+/)):n.className=[],t.isArray(n.events)&&(n.origArray=n.events,n.events=t.map(n.events,function(t){return z(t,n)})),i=0;i<r.length;i++)r[i].call(q,n);return n}}function v(t){y(E(t))}function m(t){null==t?y(Q,!0):y(b(t))}function y(e,n){var r;for(r=0;r<e.length;r++)c(e[r]);n?(Q=[],K=[]):(Q=t.grep(Q,function(t){for(r=0;r<e.length;r++)if(t===e[r])return!1;return!0}),K=C(K,e)),i()}function w(){return Q.slice(1)}function S(e){return t.grep(Q,function(t){return t.id&&t.id===e})[0]}function b(e){e?t.isArray(e)||(e=[e]):e=[];var n,i=[];for(n=0;n<e.length;n++)i.push.apply(i,E(e[n]));return i}function E(e){var n,i;for(n=0;n<Q.length;n++)if((i=Q[n])===e)return[i];return i=S(e),i?[i]:t.grep(Q,function(t){return D(e,t)})}function D(t,e){return t&&e&&T(t)==T(e)}function T(t){return("object"==typeof t?t.origArray||t.googleCalendarId||t.url||t.events:null)||t}function C(e,n){return t.grep(e,function(t){for(var e=0;e<n.length;e++)if(t.source===n[e])return!1;return!0})}function H(t){R([t])}function R(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.start=q.moment(n.start),n.end?n.end=q.moment(n.end):n.end=null,W(n,x(n));i()}function x(e){var n={};return t.each(e,function(t,e){I(t)&&void 0!==e&&at(e)&&(n[t]=e)}),n}function I(t){return!/^_|^(id|allDay|start|end)$/.test(t)}function k(t,e){return M([t],e)}function M(t,e){var n,r,s,o,a,l=[];for(s=0;s<t.length;s++)if(r=z(t[s])){for(n=_(r),o=0;o<n.length;o++)a=n[o],a.source||(e&&($.events.push(a),a.source=$),K.push(a));l=l.concat(n)}return l.length&&i(),l}function B(e){var n,r;for(null==e?e=function(){return!0}:t.isFunction(e)||(n=e+"",e=function(t){return t._id==n}),K=t.grep(K,e,!0),r=0;r<Q.length;r++)t.isArray(Q[r].events)&&(Q[r].events=t.grep(Q[r].events,e,!0));i()}function L(e){return t.isFunction(e)?t.grep(K,e):null!=e?(e+="",t.grep(K,function(t){return t._id==e})):K}function N(t){t.start=q.moment(t.start),t.end&&(t.end=q.moment(t.end)),jt(t)}function z(n,i){var r,s,o,a=q.opt("eventDataTransform"),l={};if(a&&(n=a(n)),i&&i.eventDataTransform&&(n=i.eventDataTransform(n)),t.extend(l,n),i&&(l.source=i),l._id=n._id||(void 0===n.id?"_fc"+Le++:n.id+""),n.className?"string"==typeof n.className?l.className=n.className.split(/\s+/):l.className=n.className:l.className=[],r=n.start||n.date,s=n.end,nt(r)&&(r=e.duration(r)),nt(s)&&(s=e.duration(s)),n.dow||e.isDuration(r)||e.isDuration(s))l.start=r?e.duration(r):null,l.end=s?e.duration(s):null,l._recurring=!0;else{if(r&&(r=q.moment(r),!r.isValid()))return!1;s&&(s=q.moment(s),s.isValid()||(s=null)),o=n.allDay,void 0===o&&(o=ut(i?i.allDayDefault:void 0,q.opt("allDayDefault"))),V(r,s,o,l)}return q.normalizeEvent(l),l}function V(t,e,n,i){i.start=t,i.end=e,i.allDay=n,O(i),jt(i)}function O(t){P(t),t.end&&!t.end.isAfter(t.start)&&(t.end=null),t.end||(q.opt("forceEventDuration")?t.end=q.getDefaultEventEnd(t.allDay,t.start):t.end=null)}function P(t){null==t.allDay&&(t.allDay=!(t.start.hasTime()||t.end&&t.end.hasTime())),t.allDay?(t.start.stripTime(),t.end&&t.end.stripTime()):(t.start.hasTime()||(t.start=q.applyTimezone(t.start.time(0))),t.end&&!t.end.hasTime()&&(t.end=q.applyTimezone(t.end.time(0))))}function _(e,n,i){var r,s,o,a,l,u,h,c,d,f=[];if(n=n||U,i=i||j,e)if(e._recurring){if(s=e.dow)for(r={},o=0;o<s.length;o++)r[s[o]]=!0;for(a=n.clone().stripTime();a.isBefore(i);)r&&!r[a.day()]||(l=e.start,u=e.end,h=a.clone(),c=null,l&&(h=h.time(l)),u&&(c=a.clone().time(u)),d=t.extend({},e),V(h,c,!l&&!u,d),f.push(d)),a.add(1,"days")}else f.push(e);return f}function W(e,n,i){function r(t,e){return i?G(t,e,i):n.allDay?A(t,e):F(t,e)}var s,o,a,l,u,h,c={};return n=n||{},n.start||(n.start=e.start.clone()),void 0===n.end&&(n.end=e.end?e.end.clone():null),null==n.allDay&&(n.allDay=e.allDay),O(n),s={start:e._start.clone(),end:e._end?e._end.clone():q.getDefaultEventEnd(e._allDay,e._start),allDay:n.allDay},O(s),o=null!==e._end&&null===n.end,a=r(n.start,s.start),n.end?(l=r(n.end,s.end),u=l.subtract(a)):u=null,t.each(n,function(t,e){I(t)&&void 0!==e&&(c[t]=e)}),h=Y(L(e._id),o,n.allDay,a,u,c),{dateDelta:a,durationDelta:u,undo:h}}function Y(e,n,i,r,s,o){var a=q.getIsAmbigTimezone(),l=[];return r&&!r.valueOf()&&(r=null),s&&!s.valueOf()&&(s=null),t.each(e,function(e,u){var h,c;h={start:u.start.clone(),end:u.end?u.end.clone():null,allDay:u.allDay},t.each(o,function(t){h[t]=u[t]}),c={start:u._start,end:u._end,allDay:i},O(c),n?c.end=null:s&&!c.end&&(c.end=q.getDefaultEventEnd(c.allDay,c.start)),r&&(c.start.add(r),c.end&&c.end.add(r)),s&&c.end.add(s),a&&!c.allDay&&(r||s)&&(c.start.stripZone(),c.end&&c.end.stripZone()),t.extend(u,o,c),jt(u),l.push(function(){t.extend(u,h),jt(u)})}),function(){for(var t=0;t<l.length;t++)l[t]()}}var q=this;q.requestEvents=n,q.reportEventChange=i,q.isFetchNeeded=s,q.fetchEvents=o,q.fetchEventSources=u,q.refetchEvents=a,q.refetchEventSources=l,q.getEventSources=w,q.getEventSourceById=S,q.addEventSource=g,q.removeEventSource=v,q.removeEventSources=m,q.updateEvent=H,q.updateEvents=R,q.renderEvent=k,q.renderEvents=M,q.removeEvents=B,q.clientEvents=L,q.mutateEvent=W,q.normalizeEventDates=O,q.normalizeEventTimes=P;var U,j,Z,$={events:[]},Q=[$],X=0,K=[];t.each((q.opt("events")?[q.opt("events")]:[]).concat(q.opt("eventSources")||[]),function(t,e){var n=p(e);n&&Q.push(n)}),q.getEventCache=function(){return K},q.rezoneArrayEventSources=function(){var e,n,i;for(e=0;e<Q.length;e++)if(n=Q[e].events,t.isArray(n))for(i=0;i<n.length;i++)N(n[i])},q.buildEventFromInput=z,q.expandEvent=_}function jt(t){t._allDay=t.allDay,t._start=t.start.clone(),t._end=t.end?t.end.clone():null}var Zt=t.fullCalendar={version:"3.4.0",internalApiVersion:9},$t=Zt.views={};t.fn.fullCalendar=function(e){var n=Array.prototype.slice.call(arguments,1),i=this;return this.each(function(r,s){var o,a=t(s),l=a.data("fullCalendar");"string"==typeof e?l&&t.isFunction(l[e])&&(o=l[e].apply(l,n),r||(i=o),"destroy"===e&&a.removeData("fullCalendar")):l||(l=new Re(a,e),a.data("fullCalendar",l),l.render())}),i};var Qt=["header","footer","buttonText","buttonIcons","themeButtonIcons"];Zt.intersectRanges=z,Zt.applyAll=lt,Zt.debounce=yt,Zt.isInt=vt,Zt.htmlEscape=ht,Zt.cssToStr=dt,Zt.proxy=mt,Zt.capitaliseFirstLetter=gt,Zt.getOuterRect=d,Zt.getClientRect=f,Zt.getContentRect=g,Zt.getScrollbarWidths=p;var Xt=null;Zt.preventDefault=H,Zt.intersectRects=R,Zt.parseFieldSpecs=M,Zt.compareByFieldSpecs=B,Zt.compareByFieldSpec=L,Zt.flexibleCompare=N,Zt.computeGreatestUnit=V,Zt.divideRangeByDuration=_,Zt.divideDurationByDuration=W,Zt.multiplyDuration=Y,Zt.durationHasTime=tt;var Kt=["sun","mon","tue","wed","thu","fri","sat"],Jt=["year","month","week","day","hour","minute","second","millisecond"];Zt.log=function(){var t=window.console;if(t&&t.log)return t.log.apply(t,arguments)},Zt.warn=function(){var t=window.console;return t&&t.warn?t.warn.apply(t,arguments):Zt.log.apply(Zt,arguments)};var te={}.hasOwnProperty;Zt.createObject=rt;var ee=/^\s*\d{4}-\d\d$/,ne=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/,ie=e.fn,re=t.extend({},ie),se=e.momentProperties;se.push("_fullCalendar"),se.push("_ambigTime"),se.push("_ambigZone"),Zt.moment=function(){return wt(arguments)},Zt.moment.utc=function(){var t=wt(arguments,!0);return t.hasTime()&&t.utc(),t},Zt.moment.parseZone=function(){return wt(arguments,!0,!0)},ie.week=ie.weeks=function(t){var e=this._locale._fullCalendar_weekCalc;return null==t&&"function"==typeof e?e(this):"ISO"===e?re.isoWeek.apply(this,arguments):re.week.apply(this,arguments)},ie.time=function(t){if(!this._fullCalendar)return re.time.apply(this,arguments);if(null==t)return e.duration({hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()});this._ambigTime=!1,e.isDuration(t)||e.isMoment(t)||(t=e.duration(t));var n=0;return e.isDuration(t)&&(n=24*Math.floor(t.asDays())),this.hours(n+t.hours()).minutes(t.minutes()).seconds(t.seconds()).milliseconds(t.milliseconds())},ie.stripTime=function(){return this._ambigTime||(this.utc(!0),this.set({hours:0,minutes:0,seconds:0,ms:0}),this._ambigTime=!0,this._ambigZone=!0),this},ie.hasTime=function(){return!this._ambigTime},ie.stripZone=function(){var t;return this._ambigZone||(t=this._ambigTime,this.utc(!0),this._ambigTime=t||!1,this._ambigZone=!0),this},ie.hasZone=function(){return!this._ambigZone},ie.local=function(t){return re.local.call(this,this._ambigZone||t),this._ambigTime=!1,this._ambigZone=!1,this},ie.utc=function(t){return re.utc.call(this,t),this._ambigTime=!1,this._ambigZone=!1,this},ie.utcOffset=function(t){return null!=t&&(this._ambigTime=!1,this._ambigZone=!1),re.utcOffset.apply(this,arguments)},ie.format=function(){return this._fullCalendar&&arguments[0]?oe(this,arguments[0]):this._ambigTime?le(St(this),"YYYY-MM-DD"):this._ambigZone?le(St(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?le(St(this)):re.format.apply(this,arguments)},ie.toISOString=function(){return this._ambigTime?le(St(this),"YYYY-MM-DD"):this._ambigZone?le(St(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?re.toISOString.apply(St(this),arguments):re.toISOString.apply(this,arguments)},function(){function t(t,e){return h(r(e).fakeFormatString,t)}function e(t,e){return re.format.call(t,e)}function n(t,e,n,s,o){var a;return t=Zt.moment.parseZone(t),e=Zt.moment.parseZone(e),a=t.localeData(),n=a.longDateFormat(n)||n,i(r(n),t,e,s||" - ",o)}function i(t,e,n,i,r){var s,o,a,l=t.sameUnits,u=e.clone().stripZone(),h=n.clone().stripZone(),f=c(t.fakeFormatString,e),g=c(t.fakeFormatString,n),p="",v="",m="",y="",w="";for(s=0;s<l.length&&(!l[s]||u.isSame(h,l[s]));s++)p+=f[s];for(o=l.length-1;o>s&&(!l[o]||u.isSame(h,l[o]))&&(o-1!==s||"."!==f[o]);o--)v=f[o]+v;for(a=s;a<=o;a++)m+=f[a],y+=g[a];return(m||y)&&(w=r?y+i+m:m+i+y),d(p+w+v)}function r(t){return S[t]||(S[t]=s(t))}function s(t){var e=o(t);return{fakeFormatString:l(e),sameUnits:u(e)}}function o(t){for(var e,n=[],i=/\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=i.exec(t);)e[1]?n.push.apply(n,a(e[1])):e[2]?n.push({maybe:o(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push.apply(n,a(e[5]));return n}function a(t){return". "===t?["."," "]:[t]}function l(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],"string"==typeof n?i.push("["+n+"]"):n.token?n.token in y?i.push(p+"["+n.token+"]"):i.push(n.token):n.maybe&&i.push(v+l(n.maybe)+v);return i.join(g)}function u(t){var e,n,i,r=[];for(e=0;e<t.length;e++)n=t[e],n.token?(i=w[n.token.charAt(0)],r.push(i?i.unit:"second")):n.maybe?r.push.apply(r,u(n.maybe)):r.push(null);return r}function h(t,e){return d(c(t,e).join(""))}function c(t,n){var i,r,s=[],o=e(n,t),a=o.split(g);for(i=0;i<a.length;i++)r=a[i],r.charAt(0)===p?s.push(y[r.substring(1)](n)):s.push(r);return s}function d(t){return t.replace(m,function(t,e){return e.match(/[1-9]/)?e:""})}function f(t){var e,n,i,r,s=o(t);for(e=0;e<s.length;e++)n=s[e],n.token&&(i=w[n.token.charAt(0)])&&(!r||i.value>r.value)&&(r=i);return r?r.unit:null}Zt.formatDate=t,Zt.formatRange=n,Zt.oldMomentFormat=e,Zt.queryMostGranularFormatUnit=f;var g="\v",p="",v="",m=new RegExp(v+"([^"+v+"]*)"+v,"g"),y={t:function(t){return e(t,"a").charAt(0)},T:function(t){return e(t,"A").charAt(0)}},w={Y:{value:1,unit:"year"},M:{value:2,unit:"month"},W:{value:3,unit:"week"},w:{value:3,unit:"week"},D:{value:4,unit:"day"},d:{value:4,unit:"day"}},S={}}();var oe=Zt.formatDate,ae=Zt.formatRange,le=Zt.oldMomentFormat;Zt.Class=bt,bt.extend=function(){var t,e,n=arguments.length;for(t=0;t<n;t++)e=arguments[t],t<n-1&&Dt(this,e);return Et(this,e||{})},bt.mixin=function(t){Dt(this,t)};var ue=bt.extend(fe,ge,{_props:null,_watchers:null,_globalWatchArgs:null,constructor:function(){this._watchers={},this._props={},this.applyGlobalWatchers()},applyGlobalWatchers:function(){var t,e=this._globalWatchArgs||[];for(t=0;t<e.length;t++)this.watch.apply(this,e[t])},has:function(t){return t in this._props},get:function(t){return void 0===t?this._props:this._props[t]},set:function(t,e){var n;"string"==typeof t?(n={},n[t]=void 0===e?null:e):n=t,this.setProps(n)},reset:function(t){var e,n=this._props,i={};for(e in n)i[e]=void 0;for(e in t)i[e]=t[e];this.setProps(i)},unset:function(t){var e,n,i={};for(e="string"==typeof t?[t]:t,n=0;n<e.length;n++)i[e[n]]=void 0;this.setProps(i)},setProps:function(t){var e,n,i={},r=0;for(e in t)"object"!=typeof(n=t[e])&&n===this._props[e]||(i[e]=n,r++);if(r){this.trigger("before:batchChange",i);for(e in i)n=i[e],this.trigger("before:change",e,n),this.trigger("before:change:"+e,n);for(e in i)n=i[e],void 0===n?delete this._props[e]:this._props[e]=n,this.trigger("change:"+e,n),this.trigger("change",e,n);this.trigger("batchChange",i)}},watch:function(t,e,n,i){var r=this;this.unwatch(t),this._watchers[t]=this._watchDeps(e,function(e){var i=n.call(r,e);i&&i.then?(r.unset(t),i.then(function(e){r.set(t,e)})):r.set(t,i)},function(){r.unset(t),i&&i.call(r)})},unwatch:function(t){var e=this._watchers[t];e&&(delete this._watchers[t],e.teardown())},_watchDeps:function(t,e,n){function i(t,e,i){1===++a&&u===l&&(d=!0,n(),d=!1)}function r(t,n,i){void 0===n?(i||void 0===h[t]||u--,delete h[t]):(i||void 0!==h[t]||u++,h[t]=n),--a||u===l&&(d||e(h))}function s(t,e){o.on(t,e),c.push([t,e])}var o=this,a=0,l=t.length,u=0,h={},c=[],d=!1;return t.forEach(function(t){var e=!1;"?"===t.charAt(0)&&(t=t.substring(1),e=!0),s("before:change:"+t,function(n){i(t,n,e)}),s("change:"+t,function(n){r(t,n,e)})}),t.forEach(function(t){var e=!1;"?"===t.charAt(0)&&(t=t.substring(1),e=!0),o.has(t)?(h[t]=o.get(t),u++):e&&u++}),u===l&&e(h),{teardown:function(){for(var t=0;t<c.length;t++)o.off(c[t][0],c[t][1]);c=null,u===l&&n()},flash:function(){u===l&&(n(),e(h))}}},flash:function(t){var e=this._watchers[t];e&&e.flash()}});ue.watch=function(){var t=this.prototype;t._globalWatchArgs||(t._globalWatchArgs=[]),t._globalWatchArgs.push(arguments)},Zt.Model=ue;var he={construct:function(e){var n=t.Deferred(),i=n.promise();return"function"==typeof e&&e(function(t){n.resolve(t),Tt(i,t)},function(){n.reject(),Ct(i)}),i},resolve:function(e){var n=t.Deferred().resolve(e),i=n.promise();return Tt(i,e),i},reject:function(){var e=t.Deferred().reject(),n=e.promise();return Ct(n),n}};Zt.Promise=he;var ce=bt.extend(fe,{q:null,isPaused:!1,isRunning:!1,constructor:function(){this.q=[]},queue:function(){this.q.push.apply(this.q,arguments),this.tryStart()},pause:function(){this.isPaused=!0},resume:function(){this.isPaused=!1,this.tryStart()},tryStart:function(){!this.isRunning&&this.canRunNext()&&(this.isRunning=!0,this.trigger("start"),this.runNext())},canRunNext:function(){return!this.isPaused&&this.q.length},runNext:function(){this.runTask(this.q.shift())},runTask:function(t){this.runTaskFunc(t)},runTaskFunc:function(t){function e(){n.canRunNext()?n.runNext():(n.isRunning=!1,n.trigger("stop"))}var n=this,i=t();i&&i.then?i.then(e):e()}});Zt.TaskQueue=ce;var de=ce.extend({waitsByNamespace:null,waitNamespace:null,waitId:null,constructor:function(t){ce.call(this),this.waitsByNamespace=t||{}},queue:function(t,e,n){var i,r={func:t,namespace:e,type:n};e&&(i=this.waitsByNamespace[e]),this.waitNamespace&&(e===this.waitNamespace&&null!=i?this.delayWait(i):(this.clearWait(),this.tryStart())),this.compoundTask(r)&&(this.waitNamespace||null==i?this.tryStart():this.startWait(e,i))},startWait:function(t,e){this.waitNamespace=t,this.spawnWait(e)},delayWait:function(t){clearTimeout(this.waitId),this.spawnWait(t)},spawnWait:function(t){var e=this;this.waitId=setTimeout(function(){e.waitNamespace=null,e.tryStart()},t)},clearWait:function(){this.waitNamespace&&(clearTimeout(this.waitId),this.waitId=null,this.waitNamespace=null)},canRunNext:function(){if(!ce.prototype.canRunNext.apply(this,arguments))return!1;if(this.waitNamespace){for(var t=this.q,e=0;e<t.length;e++)if(t[e].namespace!==this.waitNamespace)return!0;return!1}return!0},runTask:function(t){this.runTaskFunc(t.func)},compoundTask:function(t){var e,n,i=this.q,r=!0;if(t.namespace&&("destroy"===t.type||"init"===t.type)){for(e=i.length-1;e>=0;e--)n=i[e],n.namespace!==t.namespace||"add"!==n.type&&"remove"!==n.type||i.splice(e,1);"destroy"===t.type?i.length&&(n=i[i.length-1],n.namespace===t.namespace&&("init"===n.type?(r=!1,i.pop()):"destroy"===n.type&&(r=!1))):"init"===t.type&&i.length&&(n=i[i.length-1],n.namespace===t.namespace&&"init"===n.type&&i.pop())}return r&&i.push(t),r}});Zt.RenderQueue=de;var fe=Zt.EmitterMixin={on:function(e,n){return t(this).on(e,this._prepareIntercept(n)),this},one:function(e,n){return t(this).one(e,this._prepareIntercept(n)),this},_prepareIntercept:function(e){var n=function(t,n){return e.apply(n.context||this,n.args||[])};return e.guid||(e.guid=t.guid++),n.guid=e.guid,n},
7
+ off:function(e,n){return t(this).off(e,n),this},trigger:function(e){var n=Array.prototype.slice.call(arguments,1);return t(this).triggerHandler(e,{args:n}),this},triggerWith:function(e,n,i){return t(this).triggerHandler(e,{context:n,args:i}),this}},ge=Zt.ListenerMixin=function(){var e=0;return{listenerId:null,listenTo:function(e,n,i){if("object"==typeof n)for(var r in n)n.hasOwnProperty(r)&&this.listenTo(e,r,n[r]);else"string"==typeof n&&e.on(n+"."+this.getListenerNamespace(),t.proxy(i,this))},stopListeningTo:function(t,e){t.off((e||"")+"."+this.getListenerNamespace())},getListenerNamespace:function(){return null==this.listenerId&&(this.listenerId=e++),"_listener"+this.listenerId}}}(),pe=bt.extend(ge,{isHidden:!0,options:null,el:null,margin:10,constructor:function(t){this.options=t||{}},show:function(){this.isHidden&&(this.el||this.render(),this.el.show(),this.position(),this.isHidden=!1,this.trigger("show"))},hide:function(){this.isHidden||(this.el.hide(),this.isHidden=!0,this.trigger("hide"))},render:function(){var e=this,n=this.options;this.el=t('<div class="fc-popover"/>').addClass(n.className||"").css({top:0,left:0}).append(n.content).appendTo(n.parentEl),this.el.on("click",".fc-close",function(){e.hide()}),n.autoHide&&this.listenTo(t(document),"mousedown",this.documentMousedown)},documentMousedown:function(e){this.el&&!t(e.target).closest(this.el).length&&this.hide()},removeElement:function(){this.hide(),this.el&&(this.el.remove(),this.el=null),this.stopListeningTo(t(document),"mousedown")},position:function(){var e,n,i,r,s,o=this.options,a=this.el.offsetParent().offset(),l=this.el.outerWidth(),u=this.el.outerHeight(),h=t(window),d=c(this.el);r=o.top||0,s=void 0!==o.left?o.left:void 0!==o.right?o.right-l:0,d.is(window)||d.is(document)?(d=h,e=0,n=0):(i=d.offset(),e=i.top,n=i.left),e+=h.scrollTop(),n+=h.scrollLeft(),!1!==o.viewportConstrain&&(r=Math.min(r,e+d.outerHeight()-u-this.margin),r=Math.max(r,e+this.margin),s=Math.min(s,n+d.outerWidth()-l-this.margin),s=Math.max(s,n+this.margin)),this.el.css({top:r-a.top,left:s-a.left})},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1))}}),ve=Zt.CoordCache=bt.extend({els:null,forcedOffsetParentEl:null,origin:null,boundingRect:null,isHorizontal:!1,isVertical:!1,lefts:null,rights:null,tops:null,bottoms:null,constructor:function(e){this.els=t(e.els),this.isHorizontal=e.isHorizontal,this.isVertical=e.isVertical,this.forcedOffsetParentEl=e.offsetParent?t(e.offsetParent):null},build:function(){var t=this.forcedOffsetParentEl;!t&&this.els.length>0&&(t=this.els.eq(0).offsetParent()),this.origin=t?t.offset():null,this.boundingRect=this.queryBoundingRect(),this.isHorizontal&&this.buildElHorizontals(),this.isVertical&&this.buildElVerticals()},clear:function(){this.origin=null,this.boundingRect=null,this.lefts=null,this.rights=null,this.tops=null,this.bottoms=null},ensureBuilt:function(){this.origin||this.build()},buildElHorizontals:function(){var e=[],n=[];this.els.each(function(i,r){var s=t(r),o=s.offset().left,a=s.outerWidth();e.push(o),n.push(o+a)}),this.lefts=e,this.rights=n},buildElVerticals:function(){var e=[],n=[];this.els.each(function(i,r){var s=t(r),o=s.offset().top,a=s.outerHeight();e.push(o),n.push(o+a)}),this.tops=e,this.bottoms=n},getHorizontalIndex:function(t){this.ensureBuilt();var e,n=this.lefts,i=this.rights,r=n.length;for(e=0;e<r;e++)if(t>=n[e]&&t<i[e])return e},getVerticalIndex:function(t){this.ensureBuilt();var e,n=this.tops,i=this.bottoms,r=n.length;for(e=0;e<r;e++)if(t>=n[e]&&t<i[e])return e},getLeftOffset:function(t){return this.ensureBuilt(),this.lefts[t]},getLeftPosition:function(t){return this.ensureBuilt(),this.lefts[t]-this.origin.left},getRightOffset:function(t){return this.ensureBuilt(),this.rights[t]},getRightPosition:function(t){return this.ensureBuilt(),this.rights[t]-this.origin.left},getWidth:function(t){return this.ensureBuilt(),this.rights[t]-this.lefts[t]},getTopOffset:function(t){return this.ensureBuilt(),this.tops[t]},getTopPosition:function(t){return this.ensureBuilt(),this.tops[t]-this.origin.top},getBottomOffset:function(t){return this.ensureBuilt(),this.bottoms[t]},getBottomPosition:function(t){return this.ensureBuilt(),this.bottoms[t]-this.origin.top},getHeight:function(t){return this.ensureBuilt(),this.bottoms[t]-this.tops[t]},queryBoundingRect:function(){var t;return this.els.length>0&&(t=c(this.els.eq(0)),!t.is(document))?f(t):null},isPointInBounds:function(t,e){return this.isLeftInBounds(t)&&this.isTopInBounds(e)},isLeftInBounds:function(t){return!this.boundingRect||t>=this.boundingRect.left&&t<this.boundingRect.right},isTopInBounds:function(t){return!this.boundingRect||t>=this.boundingRect.top&&t<this.boundingRect.bottom}}),me=Zt.DragListener=bt.extend(ge,{options:null,subjectEl:null,originX:null,originY:null,scrollEl:null,isInteracting:!1,isDistanceSurpassed:!1,isDelayEnded:!1,isDragging:!1,isTouch:!1,isGeneric:!1,delay:null,delayTimeoutId:null,minDistance:null,shouldCancelTouchScroll:!0,scrollAlwaysKills:!1,constructor:function(t){this.options=t||{}},startInteraction:function(e,n){if("mousedown"===e.type){if(we.get().shouldIgnoreMouse())return;if(!S(e))return;e.preventDefault()}this.isInteracting||(n=n||{},this.delay=ut(n.delay,this.options.delay,0),this.minDistance=ut(n.distance,this.options.distance,0),this.subjectEl=this.options.subjectEl,T(t("body")),this.isInteracting=!0,this.isTouch=D(e),this.isGeneric="dragstart"===e.type,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.originX=b(e),this.originY=E(e),this.scrollEl=c(t(e.target)),this.bindHandlers(),this.initAutoScroll(),this.handleInteractionStart(e),this.startDelay(e),this.minDistance||this.handleDistanceSurpassed(e))},handleInteractionStart:function(t){this.trigger("interactionStart",t)},endInteraction:function(e,n){this.isInteracting&&(this.endDrag(e),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null),this.destroyAutoScroll(),this.unbindHandlers(),this.isInteracting=!1,this.handleInteractionEnd(e,n),C(t("body")))},handleInteractionEnd:function(t,e){this.trigger("interactionEnd",t,e||!1)},bindHandlers:function(){var e=we.get();this.isGeneric?this.listenTo(t(document),{drag:this.handleMove,dragstop:this.endInteraction}):this.isTouch?this.listenTo(e,{touchmove:this.handleTouchMove,touchend:this.endInteraction,scroll:this.handleTouchScroll}):this.listenTo(e,{mousemove:this.handleMouseMove,mouseup:this.endInteraction}),this.listenTo(e,{selectstart:H,contextmenu:H})},unbindHandlers:function(){this.stopListeningTo(we.get()),this.stopListeningTo(t(document))},startDrag:function(t,e){this.startInteraction(t,e),this.isDragging||(this.isDragging=!0,this.handleDragStart(t))},handleDragStart:function(t){this.trigger("dragStart",t)},handleMove:function(t){var e=b(t)-this.originX,n=E(t)-this.originY,i=this.minDistance;this.isDistanceSurpassed||e*e+n*n>=i*i&&this.handleDistanceSurpassed(t),this.isDragging&&this.handleDrag(e,n,t)},handleDrag:function(t,e,n){this.trigger("drag",t,e,n),this.updateAutoScroll(n)},endDrag:function(t){this.isDragging&&(this.isDragging=!1,this.handleDragEnd(t))},handleDragEnd:function(t){this.trigger("dragEnd",t)},startDelay:function(t){var e=this;this.delay?this.delayTimeoutId=setTimeout(function(){e.handleDelayEnd(t)},this.delay):this.handleDelayEnd(t)},handleDelayEnd:function(t){this.isDelayEnded=!0,this.isDistanceSurpassed&&this.startDrag(t)},handleDistanceSurpassed:function(t){this.isDistanceSurpassed=!0,this.isDelayEnded&&this.startDrag(t)},handleTouchMove:function(t){this.isDragging&&this.shouldCancelTouchScroll&&t.preventDefault(),this.handleMove(t)},handleMouseMove:function(t){this.handleMove(t)},handleTouchScroll:function(t){this.isDragging&&!this.scrollAlwaysKills||this.endInteraction(t,!0)},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1)),this["_"+t]&&this["_"+t].apply(this,Array.prototype.slice.call(arguments,1))}});me.mixin({isAutoScroll:!1,scrollBounds:null,scrollTopVel:null,scrollLeftVel:null,scrollIntervalId:null,scrollSensitivity:30,scrollSpeed:200,scrollIntervalMs:50,initAutoScroll:function(){var t=this.scrollEl;this.isAutoScroll=this.options.scroll&&t&&!t.is(window)&&!t.is(document),this.isAutoScroll&&this.listenTo(t,"scroll",yt(this.handleDebouncedScroll,100))},destroyAutoScroll:function(){this.endAutoScroll(),this.isAutoScroll&&this.stopListeningTo(this.scrollEl,"scroll")},computeScrollBounds:function(){this.isAutoScroll&&(this.scrollBounds=d(this.scrollEl))},updateAutoScroll:function(t){var e,n,i,r,s=this.scrollSensitivity,o=this.scrollBounds,a=0,l=0;o&&(e=(s-(E(t)-o.top))/s,n=(s-(o.bottom-E(t)))/s,i=(s-(b(t)-o.left))/s,r=(s-(o.right-b(t)))/s,e>=0&&e<=1?a=e*this.scrollSpeed*-1:n>=0&&n<=1&&(a=n*this.scrollSpeed),i>=0&&i<=1?l=i*this.scrollSpeed*-1:r>=0&&r<=1&&(l=r*this.scrollSpeed)),this.setScrollVel(a,l)},setScrollVel:function(t,e){this.scrollTopVel=t,this.scrollLeftVel=e,this.constrainScrollVel(),!this.scrollTopVel&&!this.scrollLeftVel||this.scrollIntervalId||(this.scrollIntervalId=setInterval(mt(this,"scrollIntervalFunc"),this.scrollIntervalMs))},constrainScrollVel:function(){var t=this.scrollEl;this.scrollTopVel<0?t.scrollTop()<=0&&(this.scrollTopVel=0):this.scrollTopVel>0&&t.scrollTop()+t[0].clientHeight>=t[0].scrollHeight&&(this.scrollTopVel=0),this.scrollLeftVel<0?t.scrollLeft()<=0&&(this.scrollLeftVel=0):this.scrollLeftVel>0&&t.scrollLeft()+t[0].clientWidth>=t[0].scrollWidth&&(this.scrollLeftVel=0)},scrollIntervalFunc:function(){var t=this.scrollEl,e=this.scrollIntervalMs/1e3;this.scrollTopVel&&t.scrollTop(t.scrollTop()+this.scrollTopVel*e),this.scrollLeftVel&&t.scrollLeft(t.scrollLeft()+this.scrollLeftVel*e),this.constrainScrollVel(),this.scrollTopVel||this.scrollLeftVel||this.endAutoScroll()},endAutoScroll:function(){this.scrollIntervalId&&(clearInterval(this.scrollIntervalId),this.scrollIntervalId=null,this.handleScrollEnd())},handleDebouncedScroll:function(){this.scrollIntervalId||this.handleScrollEnd()},handleScrollEnd:function(){}});var ye=me.extend({component:null,origHit:null,hit:null,coordAdjust:null,constructor:function(t,e){me.call(this,e),this.component=t},handleInteractionStart:function(t){var e,n,i,r=this.subjectEl;this.component.hitsNeeded(),this.computeScrollBounds(),t?(n={left:b(t),top:E(t)},i=n,r&&(e=d(r),i=x(i,e)),this.origHit=this.queryHit(i.left,i.top),r&&this.options.subjectCenter&&(this.origHit&&(e=R(this.origHit,e)||e),i=I(e)),this.coordAdjust=k(i,n)):(this.origHit=null,this.coordAdjust=null),me.prototype.handleInteractionStart.apply(this,arguments)},handleDragStart:function(t){var e;me.prototype.handleDragStart.apply(this,arguments),(e=this.queryHit(b(t),E(t)))&&this.handleHitOver(e)},handleDrag:function(t,e,n){var i;me.prototype.handleDrag.apply(this,arguments),i=this.queryHit(b(n),E(n)),Ht(i,this.hit)||(this.hit&&this.handleHitOut(),i&&this.handleHitOver(i))},handleDragEnd:function(){this.handleHitDone(),me.prototype.handleDragEnd.apply(this,arguments)},handleHitOver:function(t){var e=Ht(t,this.origHit);this.hit=t,this.trigger("hitOver",this.hit,e,this.origHit)},handleHitOut:function(){this.hit&&(this.trigger("hitOut",this.hit),this.handleHitDone(),this.hit=null)},handleHitDone:function(){this.hit&&this.trigger("hitDone",this.hit)},handleInteractionEnd:function(){me.prototype.handleInteractionEnd.apply(this,arguments),this.origHit=null,this.hit=null,this.component.hitsNotNeeded()},handleScrollEnd:function(){me.prototype.handleScrollEnd.apply(this,arguments),this.isDragging&&(this.component.releaseHits(),this.component.prepareHits())},queryHit:function(t,e){return this.coordAdjust&&(t+=this.coordAdjust.left,e+=this.coordAdjust.top),this.component.queryHit(t,e)}});Zt.touchMouseIgnoreWait=500;var we=bt.extend(ge,fe,{isTouching:!1,mouseIgnoreDepth:0,handleScrollProxy:null,bind:function(){var e=this;this.listenTo(t(document),{touchstart:this.handleTouchStart,touchcancel:this.handleTouchCancel,touchend:this.handleTouchEnd,mousedown:this.handleMouseDown,mousemove:this.handleMouseMove,mouseup:this.handleMouseUp,click:this.handleClick,selectstart:this.handleSelectStart,contextmenu:this.handleContextMenu}),window.addEventListener("touchmove",this.handleTouchMoveProxy=function(n){e.handleTouchMove(t.Event(n))},{passive:!1}),window.addEventListener("scroll",this.handleScrollProxy=function(n){e.handleScroll(t.Event(n))},!0)},unbind:function(){this.stopListeningTo(t(document)),window.removeEventListener("touchmove",this.handleTouchMoveProxy),window.removeEventListener("scroll",this.handleScrollProxy,!0)},handleTouchStart:function(t){this.stopTouch(t,!0),this.isTouching=!0,this.trigger("touchstart",t)},handleTouchMove:function(t){this.isTouching&&this.trigger("touchmove",t)},handleTouchCancel:function(t){this.isTouching&&(this.trigger("touchcancel",t),this.stopTouch(t))},handleTouchEnd:function(t){this.stopTouch(t)},handleMouseDown:function(t){this.shouldIgnoreMouse()||this.trigger("mousedown",t)},handleMouseMove:function(t){this.shouldIgnoreMouse()||this.trigger("mousemove",t)},handleMouseUp:function(t){this.shouldIgnoreMouse()||this.trigger("mouseup",t)},handleClick:function(t){this.shouldIgnoreMouse()||this.trigger("click",t)},handleSelectStart:function(t){this.trigger("selectstart",t)},handleContextMenu:function(t){this.trigger("contextmenu",t)},handleScroll:function(t){this.trigger("scroll",t)},stopTouch:function(t,e){this.isTouching&&(this.isTouching=!1,this.trigger("touchend",t),e||this.startTouchMouseIgnore())},startTouchMouseIgnore:function(){var t=this,e=Zt.touchMouseIgnoreWait;e&&(this.mouseIgnoreDepth++,setTimeout(function(){t.mouseIgnoreDepth--},e))},shouldIgnoreMouse:function(){return this.isTouching||Boolean(this.mouseIgnoreDepth)}});!function(){var t=null,e=0;we.get=function(){return t||(t=new we,t.bind()),t},we.needed=function(){we.get(),e++},we.unneeded=function(){--e||(t.unbind(),t=null)}}();var Se=bt.extend(ge,{options:null,sourceEl:null,el:null,parentEl:null,top0:null,left0:null,y0:null,x0:null,topDelta:null,leftDelta:null,isFollowing:!1,isHidden:!1,isAnimating:!1,constructor:function(e,n){this.options=n=n||{},this.sourceEl=e,this.parentEl=n.parentEl?t(n.parentEl):e.parent()},start:function(e){this.isFollowing||(this.isFollowing=!0,this.y0=E(e),this.x0=b(e),this.topDelta=0,this.leftDelta=0,this.isHidden||this.updatePosition(),D(e)?this.listenTo(t(document),"touchmove",this.handleMove):this.listenTo(t(document),"mousemove",this.handleMove))},stop:function(e,n){function i(){r.isAnimating=!1,r.removeElement(),r.top0=r.left0=null,n&&n()}var r=this,s=this.options.revertDuration;this.isFollowing&&!this.isAnimating&&(this.isFollowing=!1,this.stopListeningTo(t(document)),e&&s&&!this.isHidden?(this.isAnimating=!0,this.el.animate({top:this.top0,left:this.left0},{duration:s,complete:i})):i())},getEl:function(){var t=this.el;return t||(t=this.el=this.sourceEl.clone().addClass(this.options.additionalClass||"").css({position:"absolute",visibility:"",display:this.isHidden?"none":"",margin:0,right:"auto",bottom:"auto",width:this.sourceEl.width(),height:this.sourceEl.height(),opacity:this.options.opacity||"",zIndex:this.options.zIndex}),t.addClass("fc-unselectable"),t.appendTo(this.parentEl)),t},removeElement:function(){this.el&&(this.el.remove(),this.el=null)},updatePosition:function(){var t,e;this.getEl(),null===this.top0&&(t=this.sourceEl.offset(),e=this.el.offsetParent().offset(),this.top0=t.top-e.top,this.left0=t.left-e.left),this.el.css({top:this.top0+this.topDelta,left:this.left0+this.leftDelta})},handleMove:function(t){this.topDelta=E(t)-this.y0,this.leftDelta=b(t)-this.x0,this.isHidden||this.updatePosition()},hide:function(){this.isHidden||(this.isHidden=!0,this.el&&this.el.hide())},show:function(){this.isHidden&&(this.isHidden=!1,this.updatePosition(),this.getEl().show())}}),be=Zt.Grid=bt.extend(ge,{hasDayInteractions:!0,view:null,isRTL:null,start:null,end:null,el:null,elsByFill:null,eventTimeFormat:null,displayEventTime:null,displayEventEnd:null,minResizeDuration:null,largeUnit:null,dayClickListener:null,daySelectListener:null,segDragListener:null,segResizeListener:null,externalDragListener:null,constructor:function(t){this.view=t,this.isRTL=t.opt("isRTL"),this.elsByFill={},this.dayClickListener=this.buildDayClickListener(),this.daySelectListener=this.buildDaySelectListener()},computeEventTimeFormat:function(){return this.view.opt("smallTimeFormat")},computeDisplayEventTime:function(){return!0},computeDisplayEventEnd:function(){return!0},setRange:function(t){this.start=t.start.clone(),this.end=t.end.clone(),this.rangeUpdated(),this.processRangeOptions()},rangeUpdated:function(){},processRangeOptions:function(){var t,e,n=this.view;this.eventTimeFormat=n.opt("eventTimeFormat")||n.opt("timeFormat")||this.computeEventTimeFormat(),t=n.opt("displayEventTime"),null==t&&(t=this.computeDisplayEventTime()),e=n.opt("displayEventEnd"),null==e&&(e=this.computeDisplayEventEnd()),this.displayEventTime=t,this.displayEventEnd=e},spanToSegs:function(t){},diffDates:function(t,e){return this.largeUnit?G(t,e,this.largeUnit):F(t,e)},hitsNeededDepth:0,hitsNeeded:function(){this.hitsNeededDepth++||this.prepareHits()},hitsNotNeeded:function(){this.hitsNeededDepth&&!--this.hitsNeededDepth&&this.releaseHits()},prepareHits:function(){},releaseHits:function(){},queryHit:function(t,e){},getSafeHitSpan:function(t){var e=this.getHitSpan(t);return Q(e,this.view.activeRange)?e:null},getHitSpan:function(t){},getHitEl:function(t){},setElement:function(t){this.el=t,this.hasDayInteractions&&(T(t),this.bindDayHandler("touchstart",this.dayTouchStart),this.bindDayHandler("mousedown",this.dayMousedown)),this.bindSegHandlers(),this.bindGlobalHandlers()},bindDayHandler:function(e,n){var i=this;this.el.on(e,function(e){if(!t(e.target).is(i.segSelector+","+i.segSelector+" *,.fc-more,a[data-goto]"))return n.call(i,e)})},removeElement:function(){this.unbindGlobalHandlers(),this.clearDragListeners(),this.el.remove()},renderSkeleton:function(){},renderDates:function(){},unrenderDates:function(){},bindGlobalHandlers:function(){this.listenTo(t(document),{dragstart:this.externalDragStart,sortstart:this.externalDragStart})},unbindGlobalHandlers:function(){this.stopListeningTo(t(document))},dayMousedown:function(t){var e=this.view;we.get().shouldIgnoreMouse()||(this.dayClickListener.startInteraction(t),e.opt("selectable")&&this.daySelectListener.startInteraction(t,{distance:e.opt("selectMinDistance")}))},dayTouchStart:function(t){var e,n=this.view;n.isSelected||n.selectedEvent||(e=n.opt("selectLongPressDelay"),null==e&&(e=n.opt("longPressDelay")),this.dayClickListener.startInteraction(t),n.opt("selectable")&&this.daySelectListener.startInteraction(t,{delay:e}))},buildDayClickListener:function(){var t,e=this,n=this.view,i=new ye(this,{scroll:n.opt("dragScroll"),interactionStart:function(){t=i.origHit},hitOver:function(e,n,i){n||(t=null)},hitOut:function(){t=null},interactionEnd:function(i,r){var s;!r&&t&&(s=e.getSafeHitSpan(t))&&n.triggerDayClick(s,e.getHitEl(t),i)}});return i.shouldCancelTouchScroll=!1,i.scrollAlwaysKills=!0,i},buildDaySelectListener:function(){var t,e=this,n=this.view;return new ye(this,{scroll:n.opt("dragScroll"),interactionStart:function(){t=null},dragStart:function(){n.unselect()},hitOver:function(n,i,r){var o,a;r&&(o=e.getSafeHitSpan(r),a=e.getSafeHitSpan(n),t=o&&a?e.computeSelection(o,a):null,t?e.renderSelection(t):!1===t&&s())},hitOut:function(){t=null,e.unrenderSelection()},hitDone:function(){o()},interactionEnd:function(e,i){!i&&t&&n.reportSelection(t,e)}})},clearDragListeners:function(){this.dayClickListener.endInteraction(),this.daySelectListener.endInteraction(),this.segDragListener&&this.segDragListener.endInteraction(),this.segResizeListener&&this.segResizeListener.endInteraction(),this.externalDragListener&&this.externalDragListener.endInteraction()},renderEventLocationHelper:function(t,e){var n=this.fabricateHelperEvent(t,e);return this.renderHelper(n,e)},fabricateHelperEvent:function(t,e){var n=e?rt(e.event):{};return n.start=t.start.clone(),n.end=t.end?t.end.clone():null,n.allDay=null,this.view.calendar.normalizeEventDates(n),n.className=(n.className||[]).concat("fc-helper"),e||(n.editable=!1),n},renderHelper:function(t,e){},unrenderHelper:function(){},renderSelection:function(t){this.renderHighlight(t)},unrenderSelection:function(){this.unrenderHighlight()},computeSelection:function(t,e){var n=this.computeSelectionSpan(t,e);return!(n&&!this.view.calendar.isSelectionSpanAllowed(n))&&n},computeSelectionSpan:function(t,e){var n=[t.start,t.end,e.start,e.end];return n.sort(pt),{start:n[0].clone(),end:n[3].clone()}},renderHighlight:function(t){this.renderFill("highlight",this.spanToSegs(t))},unrenderHighlight:function(){this.unrenderFill("highlight")},highlightSegClasses:function(){return["fc-highlight"]},renderBusinessHours:function(){},unrenderBusinessHours:function(){},getNowIndicatorUnit:function(){},renderNowIndicator:function(t){},unrenderNowIndicator:function(){},renderFill:function(t,e){},unrenderFill:function(t){var e=this.elsByFill[t];e&&(e.remove(),delete this.elsByFill[t])},renderFillSegEls:function(e,n){var i,r=this,s=this[e+"SegEl"],o="",a=[];if(n.length){for(i=0;i<n.length;i++)o+=this.fillSegHtml(e,n[i]);t(o).each(function(e,i){var o=n[e],l=t(i);s&&(l=s.call(r,o,l)),l&&(l=t(l),l.is(r.fillSegTag)&&(o.el=l,a.push(o)))})}return a},fillSegTag:"div",fillSegHtml:function(t,e){var n=this[t+"SegClasses"],i=this[t+"SegCss"],r=n?n.call(this,e):[],s=dt(i?i.call(this,e):{});return"<"+this.fillSegTag+(r.length?' class="'+r.join(" ")+'"':"")+(s?' style="'+s+'"':"")+" />"},getDayClasses:function(t,e){var n,i=this.view,r=[];return Z(t,i.activeRange)?(r.push("fc-"+Kt[t.day()]),1==i.currentRangeAs("months")&&t.month()!=i.currentRange.start.month()&&r.push("fc-other-month"),n=i.calendar.getNow(),t.isSame(n,"day")?(r.push("fc-today"),!0!==e&&r.push(i.highlightStateClass)):t<n?r.push("fc-past"):r.push("fc-future")):r.push("fc-disabled-day"),r}});be.mixin({segSelector:".fc-event-container > *",mousedOverSeg:null,isDraggingSeg:!1,isResizingSeg:!1,isDraggingExternal:!1,segs:null,renderEvents:function(t){var e,n=[],i=[];for(e=0;e<t.length;e++)(It(t[e])?n:i).push(t[e]);this.segs=[].concat(this.renderBgEvents(n),this.renderFgEvents(i))},renderBgEvents:function(t){var e=this.eventsToSegs(t);return this.renderBgSegs(e)||e},renderFgEvents:function(t){var e=this.eventsToSegs(t);return this.renderFgSegs(e)||e},unrenderEvents:function(){this.handleSegMouseout(),this.clearDragListeners(),this.unrenderFgSegs(),this.unrenderBgSegs(),this.segs=null},getEventSegs:function(){return this.segs||[]},renderFgSegs:function(t){},unrenderFgSegs:function(){},renderFgSegEls:function(e,n){var i,r=this.view,s="",o=[];if(e.length){for(i=0;i<e.length;i++)s+=this.fgSegHtml(e[i],n);t(s).each(function(n,i){var s=e[n],a=r.resolveEventEl(s.event,t(i));a&&(a.data("fc-seg",s),s.el=a,o.push(s))})}return o},fgSegHtml:function(t,e){},renderBgSegs:function(t){return this.renderFill("bgEvent",t)},unrenderBgSegs:function(){this.unrenderFill("bgEvent")},bgEventSegEl:function(t,e){return this.view.resolveEventEl(t.event,e)},bgEventSegClasses:function(t){var e=t.event,n=e.source||{};return["fc-bgevent"].concat(e.className,n.className||[])},bgEventSegCss:function(t){return{"background-color":this.getSegSkinCss(t)["background-color"]}},businessHoursSegClasses:function(t){return["fc-nonbusiness","fc-bgevent"]},buildBusinessHourSegs:function(t,e){return this.eventsToSegs(this.buildBusinessHourEvents(t,e))},buildBusinessHourEvents:function(e,n){var i,r=this.view.calendar;return null==n&&(n=r.opt("businessHours")),i=r.computeBusinessHourEvents(e,n),!i.length&&n&&(i=[t.extend({},Ne,{start:this.view.activeRange.end,end:this.view.activeRange.end,dow:null})]),i},bindSegHandlers:function(){this.bindSegHandlersToEl(this.el)},bindSegHandlersToEl:function(t){this.bindSegHandlerToEl(t,"touchstart",this.handleSegTouchStart),this.bindSegHandlerToEl(t,"mouseenter",this.handleSegMouseover),this.bindSegHandlerToEl(t,"mouseleave",this.handleSegMouseout),this.bindSegHandlerToEl(t,"mousedown",this.handleSegMousedown),this.bindSegHandlerToEl(t,"click",this.handleSegClick)},bindSegHandlerToEl:function(e,n,i){var r=this;e.on(n,this.segSelector,function(e){var n=t(this).data("fc-seg");if(n&&!r.isDraggingSeg&&!r.isResizingSeg)return i.call(r,n,e)})},handleSegClick:function(t,e){!1===this.view.publiclyTrigger("eventClick",t.el[0],t.event,e)&&e.preventDefault()},handleSegMouseover:function(t,e){we.get().shouldIgnoreMouse()||this.mousedOverSeg||(this.mousedOverSeg=t,this.view.isEventResizable(t.event)&&t.el.addClass("fc-allow-mouse-resize"),this.view.publiclyTrigger("eventMouseover",t.el[0],t.event,e))},handleSegMouseout:function(t,e){e=e||{},this.mousedOverSeg&&(t=t||this.mousedOverSeg,this.mousedOverSeg=null,this.view.isEventResizable(t.event)&&t.el.removeClass("fc-allow-mouse-resize"),this.view.publiclyTrigger("eventMouseout",t.el[0],t.event,e))},handleSegMousedown:function(t,e){!this.startSegResize(t,e,{distance:5})&&this.view.isEventDraggable(t.event)&&this.buildSegDragListener(t).startInteraction(e,{distance:5})},handleSegTouchStart:function(t,e){var n,i,r=this.view,s=t.event,o=r.isEventSelected(s),a=r.isEventDraggable(s),l=r.isEventResizable(s),u=!1;o&&l&&(u=this.startSegResize(t,e)),u||!a&&!l||(i=r.opt("eventLongPressDelay"),null==i&&(i=r.opt("longPressDelay")),n=a?this.buildSegDragListener(t):this.buildSegSelectListener(t),n.startInteraction(e,{delay:o?0:i}))},startSegResize:function(e,n,i){return!!t(n.target).is(".fc-resizer")&&(this.buildSegResizeListener(e,t(n.target).is(".fc-start-resizer")).startInteraction(n,i),!0)},buildSegDragListener:function(t){var e,n,i,r=this,a=this.view,l=t.el,u=t.event;if(this.segDragListener)return this.segDragListener;var h=this.segDragListener=new ye(a,{scroll:a.opt("dragScroll"),subjectEl:l,subjectCenter:!0,interactionStart:function(i){t.component=r,e=!1,n=new Se(t.el,{additionalClass:"fc-dragging",parentEl:a.el,opacity:h.isTouch?null:a.opt("dragOpacity"),revertDuration:a.opt("dragRevertDuration"),zIndex:2}),n.hide(),n.start(i)},dragStart:function(n){h.isTouch&&!a.isEventSelected(u)&&a.selectEvent(u),e=!0,r.handleSegMouseout(t,n),r.segDragStart(t,n),a.hideEvent(u)},hitOver:function(e,o,l){var c,d,f,g=!0;t.hit&&(l=t.hit),c=l.component.getSafeHitSpan(l),d=e.component.getSafeHitSpan(e),c&&d?(i=r.computeEventDrop(c,d,u),g=i&&r.isEventLocationAllowed(i,u)):g=!1,g||(i=null,s()),i&&(f=a.renderDrag(i,t))?(f.addClass("fc-dragging"),h.isTouch||r.applyDragOpacity(f),n.hide()):n.show(),o&&(i=null)},hitOut:function(){a.unrenderDrag(),n.show(),i=null},hitDone:function(){o()},interactionEnd:function(s){delete t.component,n.stop(!i,function(){e&&(a.unrenderDrag(),r.segDragStop(t,s)),i?a.reportSegDrop(t,i,r.largeUnit,l,s):a.showEvent(u)}),r.segDragListener=null}});return h},buildSegSelectListener:function(t){var e=this,n=this.view,i=t.event;if(this.segDragListener)return this.segDragListener;var r=this.segDragListener=new me({dragStart:function(t){r.isTouch&&!n.isEventSelected(i)&&n.selectEvent(i)},interactionEnd:function(t){e.segDragListener=null}});return r},segDragStart:function(t,e){this.isDraggingSeg=!0,this.view.publiclyTrigger("eventDragStart",t.el[0],t.event,e,{})},segDragStop:function(t,e){this.isDraggingSeg=!1,this.view.publiclyTrigger("eventDragStop",t.el[0],t.event,e,{})},computeEventDrop:function(t,e,n){var i,r,s=this.view.calendar,o=t.start,a=e.start;return o.hasTime()===a.hasTime()?(i=this.diffDates(a,o),n.allDay&&tt(i)?(r={start:n.start.clone(),end:s.getEventEnd(n),allDay:!1},s.normalizeEventTimes(r)):r=xt(n),r.start.add(i),r.end&&r.end.add(i)):r={start:a.clone(),end:null,allDay:!a.hasTime()},r},applyDragOpacity:function(t){var e=this.view.opt("dragOpacity");null!=e&&t.css("opacity",e)},externalDragStart:function(e,n){var i,r,s=this.view;s.opt("droppable")&&(i=t((n?n.item:null)||e.target),r=s.opt("dropAccept"),(t.isFunction(r)?r.call(i[0],i):i.is(r))&&(this.isDraggingExternal||this.listenToExternalDrag(i,e,n)))},listenToExternalDrag:function(t,e,n){var i,r=this,a=this.view,l=Nt(t);(r.externalDragListener=new ye(this,{interactionStart:function(){r.isDraggingExternal=!0},hitOver:function(t){var e=!0,n=t.component.getSafeHitSpan(t);n?(i=r.computeExternalDrop(n,l),e=i&&r.isExternalLocationAllowed(i,l.eventProps)):e=!1,e||(i=null,s()),i&&r.renderDrag(i)},hitOut:function(){i=null},hitDone:function(){o(),r.unrenderDrag()},interactionEnd:function(e){i&&a.reportExternalDrop(l,i,t,e,n),r.isDraggingExternal=!1,r.externalDragListener=null}})).startDrag(e)},computeExternalDrop:function(t,e){var n=this.view.calendar,i={start:n.applyTimezone(t.start),end:null};return e.startTime&&!i.start.hasTime()&&i.start.time(e.startTime),e.duration&&(i.end=i.start.clone().add(e.duration)),i},renderDrag:function(t,e){},unrenderDrag:function(){},buildSegResizeListener:function(t,e){var n,i,r=this,a=this.view,l=a.calendar,u=t.el,h=t.event,c=l.getEventEnd(h);return this.segResizeListener=new ye(this,{scroll:a.opt("dragScroll"),subjectEl:u,interactionStart:function(){n=!1},dragStart:function(e){n=!0,r.handleSegMouseout(t,e),r.segResizeStart(t,e)},hitOver:function(n,o,l){var u=!0,d=r.getSafeHitSpan(l),f=r.getSafeHitSpan(n);d&&f?(i=e?r.computeEventStartResize(d,f,h):r.computeEventEndResize(d,f,h),u=i&&r.isEventLocationAllowed(i,h)):u=!1,u?i.start.isSame(h.start.clone().stripZone())&&i.end.isSame(c.clone().stripZone())&&(i=null):(i=null,s()),i&&(a.hideEvent(h),r.renderEventResize(i,t))},hitOut:function(){i=null,a.showEvent(h)},hitDone:function(){r.unrenderEventResize(),o()},interactionEnd:function(e){n&&r.segResizeStop(t,e),i?a.reportSegResize(t,i,r.largeUnit,u,e):a.showEvent(h),r.segResizeListener=null}})},segResizeStart:function(t,e){this.isResizingSeg=!0,this.view.publiclyTrigger("eventResizeStart",t.el[0],t.event,e,{})},segResizeStop:function(t,e){this.isResizingSeg=!1,this.view.publiclyTrigger("eventResizeStop",t.el[0],t.event,e,{})},computeEventStartResize:function(t,e,n){return this.computeEventResize("start",t,e,n)},computeEventEndResize:function(t,e,n){return this.computeEventResize("end",t,e,n)},computeEventResize:function(t,e,n,i){var r,s,o=this.view.calendar,a=this.diffDates(n[t],e[t]);return r={start:i.start.clone(),end:o.getEventEnd(i),allDay:i.allDay},r.allDay&&tt(a)&&(r.allDay=!1,o.normalizeEventTimes(r)),r[t].add(a),r.start.isBefore(r.end)||(s=this.minResizeDuration||(i.allDay?o.defaultAllDayEventDuration:o.defaultTimedEventDuration),"start"==t?r.start=r.end.clone().subtract(s):r.end=r.start.clone().add(s)),r},renderEventResize:function(t,e){},unrenderEventResize:function(){},getEventTimeText:function(t,e,n){return null==e&&(e=this.eventTimeFormat),null==n&&(n=this.displayEventEnd),this.displayEventTime&&t.start.hasTime()?n&&t.end?this.view.formatRange(t,e):t.start.format(e):""},getSegClasses:function(t,e,n){var i=this.view,r=["fc-event",t.isStart?"fc-start":"fc-not-start",t.isEnd?"fc-end":"fc-not-end"].concat(this.getSegCustomClasses(t));return e&&r.push("fc-draggable"),n&&r.push("fc-resizable"),i.isEventSelected(t.event)&&r.push("fc-selected"),r},getSegCustomClasses:function(t){var e=t.event;return[].concat(e.className,e.source?e.source.className:[])},getSegSkinCss:function(t){return{"background-color":this.getSegBackgroundColor(t),"border-color":this.getSegBorderColor(t),color:this.getSegTextColor(t)}},getSegBackgroundColor:function(t){return t.event.backgroundColor||t.event.color||this.getSegDefaultBackgroundColor(t)},getSegDefaultBackgroundColor:function(t){var e=t.event.source||{};return e.backgroundColor||e.color||this.view.opt("eventBackgroundColor")||this.view.opt("eventColor")},getSegBorderColor:function(t){return t.event.borderColor||t.event.color||this.getSegDefaultBorderColor(t)},getSegDefaultBorderColor:function(t){var e=t.event.source||{};return e.borderColor||e.color||this.view.opt("eventBorderColor")||this.view.opt("eventColor")},getSegTextColor:function(t){
8
+ return t.event.textColor||this.getSegDefaultTextColor(t)},getSegDefaultTextColor:function(t){return(t.event.source||{}).textColor||this.view.opt("eventTextColor")},isEventLocationAllowed:function(t,e){if(this.isEventLocationInRange(t)){var n,i=this.view.calendar,r=this.eventToSpans(t);if(r.length){for(n=0;n<r.length;n++)if(!i.isEventSpanAllowed(r[n],e))return!1;return!0}}return!1},isExternalLocationAllowed:function(t,e){if(this.isEventLocationInRange(t)){var n,i=this.view.calendar,r=this.eventToSpans(t);if(r.length){for(n=0;n<r.length;n++)if(!i.isExternalSpanAllowed(r[n],t,e))return!1;return!0}}return!1},isEventLocationInRange:function(t){return Q(this.eventToRawRange(t),this.view.validRange)},eventToSegs:function(t){return this.eventsToSegs([t])},eventToSpans:function(t){var e=this.eventToRange(t);return e?this.eventRangeToSpans(e,t):[]},eventsToSegs:function(e,n){var i=this,r=Bt(e),s=[];return t.each(r,function(t,e){var r,o,a=[],l=[];for(o=0;o<e.length;o++)(r=i.eventToRange(e[o]))&&(l.push(r),a.push(e[o]));if(kt(e[0]))for(l=i.invertRanges(l),o=0;o<l.length;o++)s.push.apply(s,i.eventRangeToSegs(l[o],e[0],n));else for(o=0;o<l.length;o++)s.push.apply(s,i.eventRangeToSegs(l[o],a[o],n))}),s},eventToRange:function(t){return this.refineRawEventRange(this.eventToRawRange(t))},refineRawEventRange:function(t){var e=this.view,n=e.calendar,i=z(t,e.activeRange);if(i)return n.localizeMoment(i.start),n.localizeMoment(i.end),i},eventToRawRange:function(t){var e=this.view.calendar;return{start:t.start.clone().stripZone(),end:(t.end?t.end.clone():e.getDefaultEventEnd(null!=t.allDay?t.allDay:!t.start.hasTime(),t.start)).stripZone()}},eventRangeToSegs:function(t,e,n){var i,r=this.eventRangeToSpans(t,e),s=[];for(i=0;i<r.length;i++)s.push.apply(s,this.eventSpanToSegs(r[i],e,n));return s},eventRangeToSpans:function(e,n){return[t.extend({},e)]},eventSpanToSegs:function(t,e,n){var i,r,s=n?n(t):this.spanToSegs(t);for(i=0;i<s.length;i++)r=s[i],t.isStart||(r.isStart=!1),t.isEnd||(r.isEnd=!1),r.event=e,r.eventStartMS=+t.start,r.eventDurationMS=t.end-t.start;return s},invertRanges:function(t){var e,n,i=this.view,r=i.activeRange.start.clone(),s=i.activeRange.end.clone(),o=[],a=r;for(t.sort(Lt),e=0;e<t.length;e++)n=t[e],n.start>a&&o.push({start:a,end:n.start}),n.end>a&&(a=n.end);return a<s&&o.push({start:a,end:s}),o},sortEventSegs:function(t){t.sort(mt(this,"compareEventSegs"))},compareEventSegs:function(t,e){return t.eventStartMS-e.eventStartMS||e.eventDurationMS-t.eventDurationMS||e.event.allDay-t.event.allDay||B(t.event,e.event,this.view.eventOrderSpecs)}}),Zt.pluckEventDateProps=xt,Zt.isBgEvent=It,Zt.dataAttrPrefix="";var Ee=Zt.DayTableMixin={breakOnWeeks:!1,dayDates:null,dayIndices:null,daysPerRow:null,rowCnt:null,colCnt:null,colHeadFormat:null,updateDayTable:function(){for(var t,e,n,i=this.view,r=this.start.clone(),s=-1,o=[],a=[];r.isBefore(this.end);)i.isHiddenDay(r)?o.push(s+.5):(s++,o.push(s),a.push(r.clone())),r.add(1,"days");if(this.breakOnWeeks){for(e=a[0].day(),t=1;t<a.length&&a[t].day()!=e;t++);n=Math.ceil(a.length/t)}else n=1,t=a.length;this.dayDates=a,this.dayIndices=o,this.daysPerRow=t,this.rowCnt=n,this.updateDayTableCols()},updateDayTableCols:function(){this.colCnt=this.computeColCnt(),this.colHeadFormat=this.view.opt("columnFormat")||this.computeColHeadFormat()},computeColCnt:function(){return this.daysPerRow},getCellDate:function(t,e){return this.dayDates[this.getCellDayIndex(t,e)].clone()},getCellRange:function(t,e){var n=this.getCellDate(t,e);return{start:n,end:n.clone().add(1,"days")}},getCellDayIndex:function(t,e){return t*this.daysPerRow+this.getColDayIndex(e)},getColDayIndex:function(t){return this.isRTL?this.colCnt-1-t:t},getDateDayIndex:function(t){var e=this.dayIndices,n=t.diff(this.start,"days");return n<0?e[0]-1:n>=e.length?e[e.length-1]+1:e[n]},computeColHeadFormat:function(){return this.rowCnt>1||this.colCnt>10?"ddd":this.colCnt>1?this.view.opt("dayOfMonthFormat"):"dddd"},sliceRangeByRow:function(t){var e,n,i,r,s,o=this.daysPerRow,a=this.view.computeDayRange(t),l=this.getDateDayIndex(a.start),u=this.getDateDayIndex(a.end.clone().subtract(1,"days")),h=[];for(e=0;e<this.rowCnt;e++)n=e*o,i=n+o-1,r=Math.max(l,n),s=Math.min(u,i),r=Math.ceil(r),s=Math.floor(s),r<=s&&h.push({row:e,firstRowDayIndex:r-n,lastRowDayIndex:s-n,isStart:r===l,isEnd:s===u});return h},sliceRangeByDay:function(t){var e,n,i,r,s,o,a=this.daysPerRow,l=this.view.computeDayRange(t),u=this.getDateDayIndex(l.start),h=this.getDateDayIndex(l.end.clone().subtract(1,"days")),c=[];for(e=0;e<this.rowCnt;e++)for(n=e*a,i=n+a-1,r=n;r<=i;r++)s=Math.max(u,r),o=Math.min(h,r),s=Math.ceil(s),o=Math.floor(o),s<=o&&c.push({row:e,firstRowDayIndex:s-n,lastRowDayIndex:o-n,isStart:s===u,isEnd:o===h});return c},renderHeadHtml:function(){return'<div class="fc-row '+this.view.widgetHeaderClass+'"><table><thead>'+this.renderHeadTrHtml()+"</thead></table></div>"},renderHeadIntroHtml:function(){return this.renderIntroHtml()},renderHeadTrHtml:function(){return"<tr>"+(this.isRTL?"":this.renderHeadIntroHtml())+this.renderHeadDateCellsHtml()+(this.isRTL?this.renderHeadIntroHtml():"")+"</tr>"},renderHeadDateCellsHtml:function(){var t,e,n=[];for(t=0;t<this.colCnt;t++)e=this.getCellDate(0,t),n.push(this.renderHeadDateCellHtml(e));return n.join("")},renderHeadDateCellHtml:function(t,e,n){var i=this.view,r=Z(t,i.activeRange),s=["fc-day-header",i.widgetHeaderClass],o=ht(t.format(this.colHeadFormat));return 1===this.rowCnt?s=s.concat(this.getDayClasses(t,!0)):s.push("fc-"+Kt[t.day()]),'<th class="'+s.join(" ")+'"'+(1===(r&&this.rowCnt)?' data-date="'+t.format("YYYY-MM-DD")+'"':"")+(e>1?' colspan="'+e+'"':"")+(n?" "+n:"")+">"+(r?i.buildGotoAnchorHtml({date:t,forceOff:this.rowCnt>1||1===this.colCnt},o):o)+"</th>"},renderBgTrHtml:function(t){return"<tr>"+(this.isRTL?"":this.renderBgIntroHtml(t))+this.renderBgCellsHtml(t)+(this.isRTL?this.renderBgIntroHtml(t):"")+"</tr>"},renderBgIntroHtml:function(t){return this.renderIntroHtml()},renderBgCellsHtml:function(t){var e,n,i=[];for(e=0;e<this.colCnt;e++)n=this.getCellDate(t,e),i.push(this.renderBgCellHtml(n));return i.join("")},renderBgCellHtml:function(t,e){var n=this.view,i=Z(t,n.activeRange),r=this.getDayClasses(t);return r.unshift("fc-day",n.widgetContentClass),'<td class="'+r.join(" ")+'"'+(i?' data-date="'+t.format("YYYY-MM-DD")+'"':"")+(e?" "+e:"")+"></td>"},renderIntroHtml:function(){},bookendCells:function(t){var e=this.renderIntroHtml();e&&(this.isRTL?t.append(e):t.prepend(e))}},De=Zt.DayGrid=be.extend(Ee,{numbersVisible:!1,bottomCoordPadding:0,rowEls:null,cellEls:null,helperEls:null,rowCoordCache:null,colCoordCache:null,renderDates:function(t){var e,n,i=this.view,r=this.rowCnt,s=this.colCnt,o="";for(e=0;e<r;e++)o+=this.renderDayRowHtml(e,t);for(this.el.html(o),this.rowEls=this.el.find(".fc-row"),this.cellEls=this.el.find(".fc-day, .fc-disabled-day"),this.rowCoordCache=new ve({els:this.rowEls,isVertical:!0}),this.colCoordCache=new ve({els:this.cellEls.slice(0,this.colCnt),isHorizontal:!0}),e=0;e<r;e++)for(n=0;n<s;n++)i.publiclyTrigger("dayRender",null,this.getCellDate(e,n),this.getCellEl(e,n))},unrenderDates:function(){this.removeSegPopover()},renderBusinessHours:function(){var t=this.buildBusinessHourSegs(!0);this.renderFill("businessHours",t,"bgevent")},unrenderBusinessHours:function(){this.unrenderFill("businessHours")},renderDayRowHtml:function(t,e){var n=this.view,i=["fc-row","fc-week",n.widgetContentClass];return e&&i.push("fc-rigid"),'<div class="'+i.join(" ")+'"><div class="fc-bg"><table>'+this.renderBgTrHtml(t)+'</table></div><div class="fc-content-skeleton"><table>'+(this.numbersVisible?"<thead>"+this.renderNumberTrHtml(t)+"</thead>":"")+"</table></div></div>"},renderNumberTrHtml:function(t){return"<tr>"+(this.isRTL?"":this.renderNumberIntroHtml(t))+this.renderNumberCellsHtml(t)+(this.isRTL?this.renderNumberIntroHtml(t):"")+"</tr>"},renderNumberIntroHtml:function(t){return this.renderIntroHtml()},renderNumberCellsHtml:function(t){var e,n,i=[];for(e=0;e<this.colCnt;e++)n=this.getCellDate(t,e),i.push(this.renderNumberCellHtml(n));return i.join("")},renderNumberCellHtml:function(t){var e,n,i=this.view,r="",s=Z(t,i.activeRange),o=i.dayNumbersVisible&&s;return o||i.cellWeekNumbersVisible?(e=this.getDayClasses(t),e.unshift("fc-day-top"),i.cellWeekNumbersVisible&&(n="ISO"===t._locale._fullCalendar_weekCalc?1:t._locale.firstDayOfWeek()),r+='<td class="'+e.join(" ")+'"'+(s?' data-date="'+t.format()+'"':"")+">",i.cellWeekNumbersVisible&&t.day()==n&&(r+=i.buildGotoAnchorHtml({date:t,type:"week"},{class:"fc-week-number"},t.format("w"))),o&&(r+=i.buildGotoAnchorHtml(t,{class:"fc-day-number"},t.date())),r+="</td>"):"<td/>"},computeEventTimeFormat:function(){return this.view.opt("extraSmallTimeFormat")},computeDisplayEventEnd:function(){return 1==this.colCnt},rangeUpdated:function(){this.updateDayTable()},spanToSegs:function(t){var e,n,i=this.sliceRangeByRow(t);for(e=0;e<i.length;e++)n=i[e],this.isRTL?(n.leftCol=this.daysPerRow-1-n.lastRowDayIndex,n.rightCol=this.daysPerRow-1-n.firstRowDayIndex):(n.leftCol=n.firstRowDayIndex,n.rightCol=n.lastRowDayIndex);return i},prepareHits:function(){this.colCoordCache.build(),this.rowCoordCache.build(),this.rowCoordCache.bottoms[this.rowCnt-1]+=this.bottomCoordPadding},releaseHits:function(){this.colCoordCache.clear(),this.rowCoordCache.clear()},queryHit:function(t,e){if(this.colCoordCache.isLeftInBounds(t)&&this.rowCoordCache.isTopInBounds(e)){var n=this.colCoordCache.getHorizontalIndex(t),i=this.rowCoordCache.getVerticalIndex(e);if(null!=i&&null!=n)return this.getCellHit(i,n)}},getHitSpan:function(t){return this.getCellRange(t.row,t.col)},getHitEl:function(t){return this.getCellEl(t.row,t.col)},getCellHit:function(t,e){return{row:t,col:e,component:this,left:this.colCoordCache.getLeftOffset(e),right:this.colCoordCache.getRightOffset(e),top:this.rowCoordCache.getTopOffset(t),bottom:this.rowCoordCache.getBottomOffset(t)}},getCellEl:function(t,e){return this.cellEls.eq(t*this.colCnt+e)},renderDrag:function(t,e){var n,i=this.eventToSpans(t);for(n=0;n<i.length;n++)this.renderHighlight(i[n]);if(e&&e.component!==this)return this.renderEventLocationHelper(t,e)},unrenderDrag:function(){this.unrenderHighlight(),this.unrenderHelper()},renderEventResize:function(t,e){var n,i=this.eventToSpans(t);for(n=0;n<i.length;n++)this.renderHighlight(i[n]);return this.renderEventLocationHelper(t,e)},unrenderEventResize:function(){this.unrenderHighlight(),this.unrenderHelper()},renderHelper:function(e,n){var i,r=[],s=this.eventToSegs(e);return s=this.renderFgSegEls(s),i=this.renderSegRows(s),this.rowEls.each(function(e,s){var o,a=t(s),l=t('<div class="fc-helper-skeleton"><table/></div>');o=n&&n.row===e?n.el.position().top:a.find(".fc-content-skeleton tbody").position().top,l.css("top",o).find("table").append(i[e].tbodyEl),a.append(l),r.push(l[0])}),this.helperEls=t(r)},unrenderHelper:function(){this.helperEls&&(this.helperEls.remove(),this.helperEls=null)},fillSegTag:"td",renderFill:function(e,n,i){var r,s,o,a=[];for(n=this.renderFillSegEls(e,n),r=0;r<n.length;r++)s=n[r],o=this.renderFillRow(e,s,i),this.rowEls.eq(s.row).append(o),a.push(o[0]);return this.elsByFill[e]=t(a),n},renderFillRow:function(e,n,i){var r,s,o=this.colCnt,a=n.leftCol,l=n.rightCol+1;return i=i||e.toLowerCase(),r=t('<div class="fc-'+i+'-skeleton"><table><tr/></table></div>'),s=r.find("tr"),a>0&&s.append('<td colspan="'+a+'"/>'),s.append(n.el.attr("colspan",l-a)),l<o&&s.append('<td colspan="'+(o-l)+'"/>'),this.bookendCells(s),r}});De.mixin({rowStructs:null,unrenderEvents:function(){this.removeSegPopover(),be.prototype.unrenderEvents.apply(this,arguments)},getEventSegs:function(){return be.prototype.getEventSegs.call(this).concat(this.popoverSegs||[])},renderBgSegs:function(e){var n=t.grep(e,function(t){return t.event.allDay});return be.prototype.renderBgSegs.call(this,n)},renderFgSegs:function(e){var n;return e=this.renderFgSegEls(e),n=this.rowStructs=this.renderSegRows(e),this.rowEls.each(function(e,i){t(i).find(".fc-content-skeleton > table").append(n[e].tbodyEl)}),e},unrenderFgSegs:function(){for(var t,e=this.rowStructs||[];t=e.pop();)t.tbodyEl.remove();this.rowStructs=null},renderSegRows:function(t){var e,n,i=[];for(e=this.groupSegRows(t),n=0;n<e.length;n++)i.push(this.renderSegRow(n,e[n]));return i},fgSegHtml:function(t,e){var n,i,r=this.view,s=t.event,o=r.isEventDraggable(s),a=!e&&s.allDay&&t.isStart&&r.isEventResizableFromStart(s),l=!e&&s.allDay&&t.isEnd&&r.isEventResizableFromEnd(s),u=this.getSegClasses(t,o,a||l),h=dt(this.getSegSkinCss(t)),c="";return u.unshift("fc-day-grid-event","fc-h-event"),t.isStart&&(n=this.getEventTimeText(s))&&(c='<span class="fc-time">'+ht(n)+"</span>"),i='<span class="fc-title">'+(ht(s.title||"")||"&nbsp;")+"</span>",'<a class="'+u.join(" ")+'"'+(s.url?' href="'+ht(s.url)+'"':"")+(h?' style="'+h+'"':"")+'><div class="fc-content">'+(this.isRTL?i+" "+c:c+" "+i)+"</div>"+(a?'<div class="fc-resizer fc-start-resizer" />':"")+(l?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},renderSegRow:function(e,n){function i(e){for(;o<e;)h=(m[r-1]||[])[o],h?h.attr("rowspan",parseInt(h.attr("rowspan")||1,10)+1):(h=t("<td/>"),a.append(h)),v[r][o]=h,m[r][o]=h,o++}var r,s,o,a,l,u,h,c=this.colCnt,d=this.buildSegLevels(n),f=Math.max(1,d.length),g=t("<tbody/>"),p=[],v=[],m=[];for(r=0;r<f;r++){if(s=d[r],o=0,a=t("<tr/>"),p.push([]),v.push([]),m.push([]),s)for(l=0;l<s.length;l++){for(u=s[l],i(u.leftCol),h=t('<td class="fc-event-container"/>').append(u.el),u.leftCol!=u.rightCol?h.attr("colspan",u.rightCol-u.leftCol+1):m[r][o]=h;o<=u.rightCol;)v[r][o]=h,p[r][o]=u,o++;a.append(h)}i(c),this.bookendCells(a),g.append(a)}return{row:e,tbodyEl:g,cellMatrix:v,segMatrix:p,segLevels:d,segs:n}},buildSegLevels:function(t){var e,n,i,r=[];for(this.sortEventSegs(t),e=0;e<t.length;e++){for(n=t[e],i=0;i<r.length&&zt(n,r[i]);i++);n.level=i,(r[i]||(r[i]=[])).push(n)}for(i=0;i<r.length;i++)r[i].sort(Ft);return r},groupSegRows:function(t){var e,n=[];for(e=0;e<this.rowCnt;e++)n.push([]);for(e=0;e<t.length;e++)n[t[e].row].push(t[e]);return n}}),De.mixin({segPopover:null,popoverSegs:null,removeSegPopover:function(){this.segPopover&&this.segPopover.hide()},limitRows:function(t){var e,n,i=this.rowStructs||[];for(e=0;e<i.length;e++)this.unlimitRow(e),!1!==(n=!!t&&("number"==typeof t?t:this.computeRowLevelLimit(e)))&&this.limitRow(e,n)},computeRowLevelLimit:function(e){function n(e,n){s=Math.max(s,t(n).outerHeight())}var i,r,s,o=this.rowEls.eq(e),a=o.height(),l=this.rowStructs[e].tbodyEl.children();for(i=0;i<l.length;i++)if(r=l.eq(i).removeClass("fc-limited"),s=0,r.find("> td > :first-child").each(n),r.position().top+s>a)return i;return!1},limitRow:function(e,n){function i(i){for(;E<i;)u=w.getCellSegs(e,E,n),u.length&&(d=s[n-1][E],y=w.renderMoreLink(e,E,u),m=t("<div/>").append(y),d.append(m),b.push(m[0])),E++}var r,s,o,a,l,u,h,c,d,f,g,p,v,m,y,w=this,S=this.rowStructs[e],b=[],E=0;if(n&&n<S.segLevels.length){for(r=S.segLevels[n-1],s=S.cellMatrix,o=S.tbodyEl.children().slice(n).addClass("fc-limited").get(),a=0;a<r.length;a++){for(l=r[a],i(l.leftCol),c=[],h=0;E<=l.rightCol;)u=this.getCellSegs(e,E,n),c.push(u),h+=u.length,E++;if(h){for(d=s[n-1][l.leftCol],f=d.attr("rowspan")||1,g=[],p=0;p<c.length;p++)v=t('<td class="fc-more-cell"/>').attr("rowspan",f),u=c[p],y=this.renderMoreLink(e,l.leftCol+p,[l].concat(u)),m=t("<div/>").append(y),v.append(m),g.push(v[0]),b.push(v[0]);d.addClass("fc-limited").after(t(g)),o.push(d[0])}}i(this.colCnt),S.moreEls=t(b),S.limitedEls=t(o)}},unlimitRow:function(t){var e=this.rowStructs[t];e.moreEls&&(e.moreEls.remove(),e.moreEls=null),e.limitedEls&&(e.limitedEls.removeClass("fc-limited"),e.limitedEls=null)},renderMoreLink:function(e,n,i){var r=this,s=this.view;return t('<a class="fc-more"/>').text(this.getMoreLinkText(i.length)).on("click",function(o){var a=s.opt("eventLimitClick"),l=r.getCellDate(e,n),u=t(this),h=r.getCellEl(e,n),c=r.getCellSegs(e,n),d=r.resliceDaySegs(c,l),f=r.resliceDaySegs(i,l);"function"==typeof a&&(a=s.publiclyTrigger("eventLimitClick",null,{date:l,dayEl:h,moreEl:u,segs:d,hiddenSegs:f},o)),"popover"===a?r.showSegPopover(e,n,u,d):"string"==typeof a&&s.calendar.zoomTo(l,a)})},showSegPopover:function(t,e,n,i){var r,s,o=this,a=this.view,l=n.parent();r=1==this.rowCnt?a.el:this.rowEls.eq(t),s={className:"fc-more-popover",content:this.renderSegPopoverContent(t,e,i),parentEl:this.view.el,top:r.offset().top,autoHide:!0,viewportConstrain:a.opt("popoverViewportConstrain"),hide:function(){if(o.popoverSegs)for(var t,e=0;e<o.popoverSegs.length;++e)t=o.popoverSegs[e],a.publiclyTrigger("eventDestroy",t.event,t.event,t.el);o.segPopover.removeElement(),o.segPopover=null,o.popoverSegs=null}},this.isRTL?s.right=l.offset().left+l.outerWidth()+1:s.left=l.offset().left-1,this.segPopover=new pe(s),this.segPopover.show(),this.bindSegHandlersToEl(this.segPopover.el)},renderSegPopoverContent:function(e,n,i){var r,s=this.view,o=s.opt("theme"),a=this.getCellDate(e,n).format(s.opt("dayPopoverFormat")),l=t('<div class="fc-header '+s.widgetHeaderClass+'"><span class="fc-close '+(o?"ui-icon ui-icon-closethick":"fc-icon fc-icon-x")+'"></span><span class="fc-title">'+ht(a)+'</span><div class="fc-clear"/></div><div class="fc-body '+s.widgetContentClass+'"><div class="fc-event-container"></div></div>'),u=l.find(".fc-event-container");for(i=this.renderFgSegEls(i,!0),this.popoverSegs=i,r=0;r<i.length;r++)this.hitsNeeded(),i[r].hit=this.getCellHit(e,n),this.hitsNotNeeded(),u.append(i[r].el);return l},resliceDaySegs:function(e,n){var i=t.map(e,function(t){return t.event}),r=n.clone(),s=r.clone().add(1,"days"),o={start:r,end:s};return e=this.eventsToSegs(i,function(t){var e=z(t,o);return e?[e]:[]}),this.sortEventSegs(e),e},getMoreLinkText:function(t){var e=this.view.opt("eventLimitText");return"function"==typeof e?e(t):"+"+t+" "+e},getCellSegs:function(t,e,n){for(var i,r=this.rowStructs[t].segMatrix,s=n||0,o=[];s<r.length;)i=r[s][e],i&&o.push(i),s++;return o}});var Te=Zt.TimeGrid=be.extend(Ee,{slotDuration:null,snapDuration:null,snapsPerSlot:null,labelFormat:null,labelInterval:null,colEls:null,slatContainerEl:null,slatEls:null,nowIndicatorEls:null,colCoordCache:null,slatCoordCache:null,constructor:function(){be.apply(this,arguments),this.processOptions()},renderDates:function(){this.el.html(this.renderHtml()),this.colEls=this.el.find(".fc-day, .fc-disabled-day"),this.slatContainerEl=this.el.find(".fc-slats"),this.slatEls=this.slatContainerEl.find("tr"),this.colCoordCache=new ve({els:this.colEls,isHorizontal:!0}),this.slatCoordCache=new ve({els:this.slatEls,isVertical:!0}),this.renderContentSkeleton()},renderHtml:function(){return'<div class="fc-bg"><table>'+this.renderBgTrHtml(0)+'</table></div><div class="fc-slats"><table>'+this.renderSlatRowHtml()+"</table></div>"},renderSlatRowHtml:function(){for(var t,n,i,r=this.view,s=this.isRTL,o="",a=e.duration(+this.view.minTime);a<this.view.maxTime;)t=this.start.clone().time(a),n=vt(W(a,this.labelInterval)),i='<td class="fc-axis fc-time '+r.widgetContentClass+'" '+r.axisStyleAttr()+">"+(n?"<span>"+ht(t.format(this.labelFormat))+"</span>":"")+"</td>",o+='<tr data-time="'+t.format("HH:mm:ss")+'"'+(n?"":' class="fc-minor"')+">"+(s?"":i)+'<td class="'+r.widgetContentClass+'"/>'+(s?i:"")+"</tr>",a.add(this.slotDuration);return o},processOptions:function(){var n,i=this.view,r=i.opt("slotDuration"),s=i.opt("snapDuration");r=e.duration(r),s=s?e.duration(s):r,this.slotDuration=r,this.snapDuration=s,this.snapsPerSlot=r/s,this.minResizeDuration=s,n=i.opt("slotLabelFormat"),t.isArray(n)&&(n=n[n.length-1]),this.labelFormat=n||i.opt("smallTimeFormat"),n=i.opt("slotLabelInterval"),this.labelInterval=n?e.duration(n):this.computeLabelInterval(r)},computeLabelInterval:function(t){var n,i,r;for(n=_e.length-1;n>=0;n--)if(i=e.duration(_e[n]),r=W(i,t),vt(r)&&r>1)return i;return e.duration(t)},computeEventTimeFormat:function(){return this.view.opt("noMeridiemTimeFormat")},computeDisplayEventEnd:function(){return!0},prepareHits:function(){this.colCoordCache.build(),this.slatCoordCache.build()},releaseHits:function(){this.colCoordCache.clear()},queryHit:function(t,e){var n=this.snapsPerSlot,i=this.colCoordCache,r=this.slatCoordCache;if(i.isLeftInBounds(t)&&r.isTopInBounds(e)){var s=i.getHorizontalIndex(t),o=r.getVerticalIndex(e);if(null!=s&&null!=o){var a=r.getTopOffset(o),l=r.getHeight(o),u=(e-a)/l,h=Math.floor(u*n),c=o*n+h,d=a+h/n*l,f=a+(h+1)/n*l;return{col:s,snap:c,component:this,left:i.getLeftOffset(s),right:i.getRightOffset(s),top:d,bottom:f}}}},getHitSpan:function(t){var e,n=this.getCellDate(0,t.col),i=this.computeSnapTime(t.snap);return n.time(i),e=n.clone().add(this.snapDuration),{start:n,end:e}},getHitEl:function(t){return this.colEls.eq(t.col)},rangeUpdated:function(){this.updateDayTable()},computeSnapTime:function(t){return e.duration(this.view.minTime+this.snapDuration*t)},spanToSegs:function(t){var e,n=this.sliceRangeByTimes(t);for(e=0;e<n.length;e++)this.isRTL?n[e].col=this.daysPerRow-1-n[e].dayIndex:n[e].col=n[e].dayIndex;return n},sliceRangeByTimes:function(t){var e,n,i,r,s=[];for(n=0;n<this.daysPerRow;n++)i=this.dayDates[n].clone().time(0),r={start:i.clone().add(this.view.minTime),end:i.clone().add(this.view.maxTime)},(e=z(t,r))&&(e.dayIndex=n,s.push(e));return s},updateSize:function(t){this.slatCoordCache.build(),t&&this.updateSegVerticals([].concat(this.fgSegs||[],this.bgSegs||[],this.businessSegs||[]))},getTotalSlatHeight:function(){return this.slatContainerEl.outerHeight()},computeDateTop:function(t,n){return this.computeTimeTop(e.duration(t-n.clone().stripTime()))},computeTimeTop:function(t){var e,n,i=this.slatEls.length,r=(t-this.view.minTime)/this.slotDuration;return r=Math.max(0,r),r=Math.min(i,r),e=Math.floor(r),e=Math.min(e,i-1),n=r-e,this.slatCoordCache.getTopPosition(e)+this.slatCoordCache.getHeight(e)*n},renderDrag:function(t,e){var n,i;if(e)return this.renderEventLocationHelper(t,e);for(n=this.eventToSpans(t),i=0;i<n.length;i++)this.renderHighlight(n[i])},unrenderDrag:function(){this.unrenderHelper(),this.unrenderHighlight()},renderEventResize:function(t,e){return this.renderEventLocationHelper(t,e)},unrenderEventResize:function(){this.unrenderHelper()},renderHelper:function(t,e){return this.renderHelperSegs(this.eventToSegs(t),e)},unrenderHelper:function(){this.unrenderHelperSegs()},renderBusinessHours:function(){this.renderBusinessSegs(this.buildBusinessHourSegs())},unrenderBusinessHours:function(){this.unrenderBusinessSegs()},getNowIndicatorUnit:function(){return"minute"},renderNowIndicator:function(e){var n,i=this.spanToSegs({start:e,end:e}),r=this.computeDateTop(e,e),s=[];for(n=0;n<i.length;n++)s.push(t('<div class="fc-now-indicator fc-now-indicator-line"></div>').css("top",r).appendTo(this.colContainerEls.eq(i[n].col))[0]);i.length>0&&s.push(t('<div class="fc-now-indicator fc-now-indicator-arrow"></div>').css("top",r).appendTo(this.el.find(".fc-content-skeleton"))[0]),this.nowIndicatorEls=t(s)},unrenderNowIndicator:function(){this.nowIndicatorEls&&(this.nowIndicatorEls.remove(),this.nowIndicatorEls=null)},renderSelection:function(t){this.view.opt("selectHelper")?this.renderEventLocationHelper(t):this.renderHighlight(t)},unrenderSelection:function(){this.unrenderHelper(),this.unrenderHighlight()},renderHighlight:function(t){this.renderHighlightSegs(this.spanToSegs(t))},unrenderHighlight:function(){this.unrenderHighlightSegs()}});Te.mixin({colContainerEls:null,fgContainerEls:null,bgContainerEls:null,helperContainerEls:null,highlightContainerEls:null,businessContainerEls:null,fgSegs:null,bgSegs:null,helperSegs:null,highlightSegs:null,businessSegs:null,renderContentSkeleton:function(){var e,n,i="";for(e=0;e<this.colCnt;e++)i+='<td><div class="fc-content-col"><div class="fc-event-container fc-helper-container"></div><div class="fc-event-container"></div><div class="fc-highlight-container"></div><div class="fc-bgevent-container"></div><div class="fc-business-container"></div></div></td>';n=t('<div class="fc-content-skeleton"><table><tr>'+i+"</tr></table></div>"),this.colContainerEls=n.find(".fc-content-col"),this.helperContainerEls=n.find(".fc-helper-container"),this.fgContainerEls=n.find(".fc-event-container:not(.fc-helper-container)"),this.bgContainerEls=n.find(".fc-bgevent-container"),this.highlightContainerEls=n.find(".fc-highlight-container"),this.businessContainerEls=n.find(".fc-business-container"),this.bookendCells(n.find("tr")),this.el.append(n)},renderFgSegs:function(t){return t=this.renderFgSegsIntoContainers(t,this.fgContainerEls),this.fgSegs=t,t},unrenderFgSegs:function(){this.unrenderNamedSegs("fgSegs")},renderHelperSegs:function(e,n){var i,r,s,o=[];for(e=this.renderFgSegsIntoContainers(e,this.helperContainerEls),i=0;i<e.length;i++)r=e[i],n&&n.col===r.col&&(s=n.el,r.el.css({left:s.css("left"),right:s.css("right"),"margin-left":s.css("margin-left"),"margin-right":s.css("margin-right")})),o.push(r.el[0]);return this.helperSegs=e,t(o)},unrenderHelperSegs:function(){this.unrenderNamedSegs("helperSegs")},renderBgSegs:function(t){return t=this.renderFillSegEls("bgEvent",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.bgContainerEls),this.bgSegs=t,t},unrenderBgSegs:function(){this.unrenderNamedSegs("bgSegs")},renderHighlightSegs:function(t){t=this.renderFillSegEls("highlight",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.highlightContainerEls),this.highlightSegs=t},unrenderHighlightSegs:function(){this.unrenderNamedSegs("highlightSegs")},renderBusinessSegs:function(t){t=this.renderFillSegEls("businessHours",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.businessContainerEls),this.businessSegs=t},unrenderBusinessSegs:function(){this.unrenderNamedSegs("businessSegs")},groupSegsByCol:function(t){var e,n=[];for(e=0;e<this.colCnt;e++)n.push([]);for(e=0;e<t.length;e++)n[t[e].col].push(t[e]);return n},attachSegsByCol:function(t,e){var n,i,r;for(n=0;n<this.colCnt;n++)for(i=t[n],r=0;r<i.length;r++)e.eq(n).append(i[r].el)},unrenderNamedSegs:function(t){var e,n=this[t];if(n){for(e=0;e<n.length;e++)n[e].el.remove();this[t]=null}},renderFgSegsIntoContainers:function(t,e){var n,i;for(t=this.renderFgSegEls(t),n=this.groupSegsByCol(t),i=0;i<this.colCnt;i++)this.updateFgSegCoords(n[i]);return this.attachSegsByCol(n,e),t},fgSegHtml:function(t,e){var n,i,r,s=this.view,o=t.event,a=s.isEventDraggable(o),l=!e&&t.isStart&&s.isEventResizableFromStart(o),u=!e&&t.isEnd&&s.isEventResizableFromEnd(o),h=this.getSegClasses(t,a,l||u),c=dt(this.getSegSkinCss(t));return h.unshift("fc-time-grid-event","fc-v-event"),s.isMultiDayEvent(o)?(t.isStart||t.isEnd)&&(n=this.getEventTimeText(t),i=this.getEventTimeText(t,"LT"),r=this.getEventTimeText(t,null,!1)):(n=this.getEventTimeText(o),i=this.getEventTimeText(o,"LT"),r=this.getEventTimeText(o,null,!1)),'<a class="'+h.join(" ")+'"'+(o.url?' href="'+ht(o.url)+'"':"")+(c?' style="'+c+'"':"")+'><div class="fc-content">'+(n?'<div class="fc-time" data-start="'+ht(r)+'" data-full="'+ht(i)+'"><span>'+ht(n)+"</span></div>":"")+(o.title?'<div class="fc-title">'+ht(o.title)+"</div>":"")+'</div><div class="fc-bg"/>'+(u?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},updateSegVerticals:function(t){this.computeSegVerticals(t),this.assignSegVerticals(t)},computeSegVerticals:function(t){var e,n,i;for(e=0;e<t.length;e++)n=t[e],i=this.dayDates[n.dayIndex],n.top=this.computeDateTop(n.start,i),n.bottom=this.computeDateTop(n.end,i)},assignSegVerticals:function(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.el.css(this.generateSegVerticalCss(n))},generateSegVerticalCss:function(t){return{top:t.top,bottom:-t.bottom}},updateFgSegCoords:function(t){this.computeSegVerticals(t),this.computeFgSegHorizontals(t),this.assignSegVerticals(t),this.assignFgSegHorizontals(t)},computeFgSegHorizontals:function(t){var e,n,i;if(this.sortEventSegs(t),e=At(t),Gt(e),n=e[0]){for(i=0;i<n.length;i++)Vt(n[i]);for(i=0;i<n.length;i++)this.computeFgSegForwardBack(n[i],0,0)}},computeFgSegForwardBack:function(t,e,n){var i,r=t.forwardSegs;if(void 0===t.forwardCoord)for(r.length?(this.sortForwardSegs(r),this.computeFgSegForwardBack(r[0],e+1,n),t.forwardCoord=r[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-n)/(e+1),i=0;i<r.length;i++)this.computeFgSegForwardBack(r[i],0,t.forwardCoord)},sortForwardSegs:function(t){t.sort(mt(this,"compareForwardSegs"))},compareForwardSegs:function(t,e){return e.forwardPressure-t.forwardPressure||(t.backwardCoord||0)-(e.backwardCoord||0)||this.compareEventSegs(t,e)},assignFgSegHorizontals:function(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.el.css(this.generateFgSegHorizontalCss(n)),n.bottom-n.top<30&&n.el.addClass("fc-short")},generateFgSegHorizontalCss:function(t){var e,n,i=this.view.opt("slotEventOverlap"),r=t.backwardCoord,s=t.forwardCoord,o=this.generateSegVerticalCss(t);return i&&(s=Math.min(1,r+2*(s-r))),this.isRTL?(e=1-s,n=r):(e=r,n=1-s),o.zIndex=t.level+1,o.left=100*e+"%",o.right=100*n+"%",i&&t.forwardPressure&&(o[this.isRTL?"marginLeft":"marginRight"]=20),o}});var Ce=Zt.View=ue.extend({type:null,name:null,title:null,calendar:null,viewSpec:null,options:null,el:null,renderQueue:null,batchRenderDepth:0,isDatesRendered:!1,isEventsRendered:!1,isBaseRendered:!1,queuedScroll:null,isRTL:!1,isSelected:!1,selectedEvent:null,eventOrderSpecs:null,widgetHeaderClass:null,widgetContentClass:null,highlightStateClass:null,nextDayThreshold:null,isHiddenDayHash:null,isNowIndicatorRendered:null,initialNowDate:null,initialNowQueriedMs:null,nowIndicatorTimeoutID:null,nowIndicatorIntervalID:null,constructor:function(t,n){ue.prototype.constructor.call(this),this.calendar=t,this.viewSpec=n,this.type=n.type,this.options=n.options,this.name=this.type,this.nextDayThreshold=e.duration(this.opt("nextDayThreshold")),this.initThemingProps(),this.initHiddenDays(),this.isRTL=this.opt("isRTL"),this.eventOrderSpecs=M(this.opt("eventOrder")),this.renderQueue=this.buildRenderQueue(),this.initAutoBatchRender(),this.initialize()},buildRenderQueue:function(){var t=this,e=new de({event:this.opt("eventRenderWait")});return e.on("start",function(){t.freezeHeight(),t.addScroll(t.queryScroll())}),e.on("stop",function(){t.thawHeight(),t.popScroll()}),e},initAutoBatchRender:function(){var t=this;this.on("before:change",function(){t.startBatchRender()}),this.on("change",function(){t.stopBatchRender()})},startBatchRender:function(){this.batchRenderDepth++||this.renderQueue.pause()},stopBatchRender:function(){--this.batchRenderDepth||this.renderQueue.resume()},initialize:function(){},opt:function(t){return this.options[t]},publiclyTrigger:function(t,e){var n=this.calendar;return n.publiclyTrigger.apply(n,[t,e||this].concat(Array.prototype.slice.call(arguments,2),[this]))},updateTitle:function(){this.title=this.computeTitle(),this.calendar.setToolbarsTitle(this.title)},computeTitle:function(){var t;return t=/^(year|month)$/.test(this.currentRangeUnit)?this.currentRange:this.activeRange,this.formatRange({start:this.calendar.applyTimezone(t.start),end:this.calendar.applyTimezone(t.end)},this.opt("titleFormat")||this.computeTitleFormat(),this.opt("titleRangeSeparator"))},computeTitleFormat:function(){return"year"==this.currentRangeUnit?"YYYY":"month"==this.currentRangeUnit?this.opt("monthYearFormat"):this.currentRangeAs("days")>1?"ll":"LL"},formatRange:function(t,e,n){var i=t.end;return i.hasTime()||(i=i.clone().subtract(1)),ae(t.start,i,e,n,this.opt("isRTL"))},getAllDayHtml:function(){return this.opt("allDayHtml")||ht(this.opt("allDayText"))},buildGotoAnchorHtml:function(e,n,i){var r,s,o,a;return t.isPlainObject(e)?(r=e.date,s=e.type,o=e.forceOff):r=e,r=Zt.moment(r),a={date:r.format("YYYY-MM-DD"),type:s||"day"},"string"==typeof n&&(i=n,n=null),n=n?" "+ft(n):"",i=i||"",!o&&this.opt("navLinks")?"<a"+n+' data-goto="'+ht(JSON.stringify(a))+'">'+i+"</a>":"<span"+n+">"+i+"</span>"},setElement:function(t){this.el=t,this.bindGlobalHandlers(),this.bindBaseRenderHandlers(),this.renderSkeleton()},
9
+ removeElement:function(){this.unsetDate(),this.unrenderSkeleton(),this.unbindGlobalHandlers(),this.unbindBaseRenderHandlers(),this.el.remove()},renderSkeleton:function(){},unrenderSkeleton:function(){},setDate:function(t){var e=this.get("dateProfile"),n=this.buildDateProfile(t,null,!0);return e&&X(e.activeRange,n.activeRange)||this.set("dateProfile",n),n.date},unsetDate:function(){this.unset("dateProfile")},requestDateRender:function(t){var e=this;this.renderQueue.queue(function(){e.executeDateRender(t)},"date","init")},requestDateUnrender:function(){var t=this;this.renderQueue.queue(function(){t.executeDateUnrender()},"date","destroy")},fetchInitialEvents:function(t){return this.calendar.requestEvents(t.activeRange.start,t.activeRange.end)},bindEventChanges:function(){this.listenTo(this.calendar,"eventsReset",this.resetEvents)},unbindEventChanges:function(){this.stopListeningTo(this.calendar,"eventsReset")},setEvents:function(t){this.set("currentEvents",t),this.set("hasEvents",!0)},unsetEvents:function(){this.unset("currentEvents"),this.unset("hasEvents")},resetEvents:function(t){this.startBatchRender(),this.unsetEvents(),this.setEvents(t),this.stopBatchRender()},requestEventsRender:function(t){var e=this;this.renderQueue.queue(function(){e.executeEventsRender(t)},"event","init")},requestEventsUnrender:function(){var t=this;this.renderQueue.queue(function(){t.executeEventsUnrender()},"event","destroy")},executeDateRender:function(t,e){this.setDateProfileForRendering(t),this.updateTitle(),this.calendar.updateToolbarButtons(),this.render&&this.render(),this.renderDates(),this.updateSize(),this.renderBusinessHours(),this.startNowIndicator(),e||this.addScroll(this.computeInitialDateScroll()),this.isDatesRendered=!0,this.trigger("datesRendered")},executeDateUnrender:function(){this.unselect(),this.stopNowIndicator(),this.trigger("before:datesUnrendered"),this.unrenderBusinessHours(),this.unrenderDates(),this.destroy&&this.destroy(),this.isDatesRendered=!1},renderDates:function(){},unrenderDates:function(){},bindBaseRenderHandlers:function(){var t=this;this.on("datesRendered.baseHandler",function(){t.onBaseRender()}),this.on("before:datesUnrendered.baseHandler",function(){t.onBeforeBaseUnrender()})},unbindBaseRenderHandlers:function(){this.off(".baseHandler")},onBaseRender:function(){this.applyScreenState(),this.publiclyTrigger("viewRender",this,this,this.el)},onBeforeBaseUnrender:function(){this.applyScreenState(),this.publiclyTrigger("viewDestroy",this,this,this.el)},bindGlobalHandlers:function(){this.listenTo(we.get(),{touchstart:this.processUnselect,mousedown:this.handleDocumentMousedown})},unbindGlobalHandlers:function(){this.stopListeningTo(we.get())},initThemingProps:function(){var t=this.opt("theme")?"ui":"fc";this.widgetHeaderClass=t+"-widget-header",this.widgetContentClass=t+"-widget-content",this.highlightStateClass=t+"-state-highlight"},renderBusinessHours:function(){},unrenderBusinessHours:function(){},startNowIndicator:function(){var t,n,i,r=this;this.opt("nowIndicator")&&(t=this.getNowIndicatorUnit())&&(n=mt(this,"updateNowIndicator"),this.initialNowDate=this.calendar.getNow(),this.initialNowQueriedMs=+new Date,this.renderNowIndicator(this.initialNowDate),this.isNowIndicatorRendered=!0,i=this.initialNowDate.clone().startOf(t).add(1,t)-this.initialNowDate,this.nowIndicatorTimeoutID=setTimeout(function(){r.nowIndicatorTimeoutID=null,n(),i=+e.duration(1,t),i=Math.max(100,i),r.nowIndicatorIntervalID=setInterval(n,i)},i))},updateNowIndicator:function(){this.isNowIndicatorRendered&&(this.unrenderNowIndicator(),this.renderNowIndicator(this.initialNowDate.clone().add(new Date-this.initialNowQueriedMs)))},stopNowIndicator:function(){this.isNowIndicatorRendered&&(this.nowIndicatorTimeoutID&&(clearTimeout(this.nowIndicatorTimeoutID),this.nowIndicatorTimeoutID=null),this.nowIndicatorIntervalID&&(clearTimeout(this.nowIndicatorIntervalID),this.nowIndicatorIntervalID=null),this.unrenderNowIndicator(),this.isNowIndicatorRendered=!1)},getNowIndicatorUnit:function(){},renderNowIndicator:function(t){},unrenderNowIndicator:function(){},updateSize:function(t){var e;t&&(e=this.queryScroll()),this.updateHeight(t),this.updateWidth(t),this.updateNowIndicator(),t&&this.applyScroll(e)},updateWidth:function(t){},updateHeight:function(t){var e=this.calendar;this.setHeight(e.getSuggestedViewHeight(),e.isHeightAuto())},setHeight:function(t,e){},addForcedScroll:function(e){this.addScroll(t.extend(e,{isForced:!0}))},addScroll:function(e){var n=this.queuedScroll||(this.queuedScroll={});n.isForced||t.extend(n,e)},popScroll:function(){this.applyQueuedScroll(),this.queuedScroll=null},applyQueuedScroll:function(){this.queuedScroll&&this.applyScroll(this.queuedScroll)},queryScroll:function(){var e={};return this.isDatesRendered&&t.extend(e,this.queryDateScroll()),e},applyScroll:function(t){this.isDatesRendered&&this.applyDateScroll(t)},computeInitialDateScroll:function(){return{}},queryDateScroll:function(){return{}},applyDateScroll:function(t){},freezeHeight:function(){this.calendar.freezeContentHeight()},thawHeight:function(){this.calendar.thawContentHeight()},executeEventsRender:function(t){this.renderEvents(t),this.isEventsRendered=!0,this.onEventsRender()},executeEventsUnrender:function(){this.onBeforeEventsUnrender(),this.destroyEvents&&this.destroyEvents(),this.unrenderEvents(),this.isEventsRendered=!1},onEventsRender:function(){this.applyScreenState(),this.renderedEventSegEach(function(t){this.publiclyTrigger("eventAfterRender",t.event,t.event,t.el)}),this.publiclyTrigger("eventAfterAllRender")},onBeforeEventsUnrender:function(){this.applyScreenState(),this.renderedEventSegEach(function(t){this.publiclyTrigger("eventDestroy",t.event,t.event,t.el)})},applyScreenState:function(){this.thawHeight(),this.freezeHeight(),this.applyQueuedScroll()},renderEvents:function(t){},unrenderEvents:function(){},resolveEventEl:function(e,n){var i=this.publiclyTrigger("eventRender",e,e,n);return!1===i?n=null:i&&!0!==i&&(n=t(i)),n},showEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","")},t)},hideEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","hidden")},t)},renderedEventSegEach:function(t,e){var n,i=this.getEventSegs();for(n=0;n<i.length;n++)e&&i[n].event._id!==e._id||i[n].el&&t.call(this,i[n])},getEventSegs:function(){return[]},isEventDraggable:function(t){return this.isEventStartEditable(t)},isEventStartEditable:function(t){return ut(t.startEditable,(t.source||{}).startEditable,this.opt("eventStartEditable"),this.isEventGenerallyEditable(t))},isEventGenerallyEditable:function(t){return ut(t.editable,(t.source||{}).editable,this.opt("editable"))},reportSegDrop:function(t,e,n,i,r){var s=this.calendar,o=s.mutateSeg(t,e,n),a=function(){o.undo(),s.reportEventChange()};this.triggerEventDrop(t.event,o.dateDelta,a,i,r),s.reportEventChange()},triggerEventDrop:function(t,e,n,i,r){this.publiclyTrigger("eventDrop",i[0],t,e,n,r,{})},reportExternalDrop:function(e,n,i,r,s){var o,a,l=e.eventProps;l&&(o=t.extend({},l,n),a=this.calendar.renderEvent(o,e.stick)[0]),this.triggerExternalDrop(a,n,i,r,s)},triggerExternalDrop:function(t,e,n,i,r){this.publiclyTrigger("drop",n[0],e.start,i,r),t&&this.publiclyTrigger("eventReceive",null,t)},renderDrag:function(t,e){},unrenderDrag:function(){},isEventResizableFromStart:function(t){return this.opt("eventResizableFromStart")&&this.isEventResizable(t)},isEventResizableFromEnd:function(t){return this.isEventResizable(t)},isEventResizable:function(t){var e=t.source||{};return ut(t.durationEditable,e.durationEditable,this.opt("eventDurationEditable"),t.editable,e.editable,this.opt("editable"))},reportSegResize:function(t,e,n,i,r){var s=this.calendar,o=s.mutateSeg(t,e,n),a=function(){o.undo(),s.reportEventChange()};this.triggerEventResize(t.event,o.durationDelta,a,i,r),s.reportEventChange()},triggerEventResize:function(t,e,n,i,r){this.publiclyTrigger("eventResize",i[0],t,e,n,r,{})},select:function(t,e){this.unselect(e),this.renderSelection(t),this.reportSelection(t,e)},renderSelection:function(t){},reportSelection:function(t,e){this.isSelected=!0,this.triggerSelect(t,e)},triggerSelect:function(t,e){this.publiclyTrigger("select",null,this.calendar.applyTimezone(t.start),this.calendar.applyTimezone(t.end),e)},unselect:function(t){this.isSelected&&(this.isSelected=!1,this.destroySelection&&this.destroySelection(),this.unrenderSelection(),this.publiclyTrigger("unselect",null,t))},unrenderSelection:function(){},selectEvent:function(t){this.selectedEvent&&this.selectedEvent===t||(this.unselectEvent(),this.renderedEventSegEach(function(t){t.el.addClass("fc-selected")},t),this.selectedEvent=t)},unselectEvent:function(){this.selectedEvent&&(this.renderedEventSegEach(function(t){t.el.removeClass("fc-selected")},this.selectedEvent),this.selectedEvent=null)},isEventSelected:function(t){return this.selectedEvent&&this.selectedEvent._id===t._id},handleDocumentMousedown:function(t){S(t)&&this.processUnselect(t)},processUnselect:function(t){this.processRangeUnselect(t),this.processEventUnselect(t)},processRangeUnselect:function(e){var n;this.isSelected&&this.opt("unselectAuto")&&((n=this.opt("unselectCancel"))&&t(e.target).closest(n).length||this.unselect(e))},processEventUnselect:function(e){this.selectedEvent&&(t(e.target).closest(".fc-selected").length||this.unselectEvent())},triggerDayClick:function(t,e,n){this.publiclyTrigger("dayClick",e,this.calendar.applyTimezone(t.start),n)},computeDayRange:function(t){var e,n=t.start.clone().stripTime(),i=t.end,r=null;return i&&(r=i.clone().stripTime(),(e=+i.time())&&e>=this.nextDayThreshold&&r.add(1,"days")),(!i||r<=n)&&(r=n.clone().add(1,"days")),{start:n,end:r}},isMultiDayEvent:function(t){var e=this.computeDayRange(t);return e.end.diff(e.start,"days")>1}});Ce.watch("displayingDates",["dateProfile"],function(t){this.requestDateRender(t.dateProfile)},function(){this.requestDateUnrender()}),Ce.watch("initialEvents",["dateProfile"],function(t){return this.fetchInitialEvents(t.dateProfile)}),Ce.watch("bindingEvents",["initialEvents"],function(t){this.setEvents(t.initialEvents),this.bindEventChanges()},function(){this.unbindEventChanges(),this.unsetEvents()}),Ce.watch("displayingEvents",["displayingDates","hasEvents"],function(){this.requestEventsRender(this.get("currentEvents"))},function(){this.requestEventsUnrender()}),Ce.mixin({currentRange:null,currentRangeUnit:null,renderRange:null,activeRange:null,validRange:null,dateIncrement:null,minTime:null,maxTime:null,usesMinMaxTime:!1,start:null,end:null,intervalStart:null,intervalEnd:null,setDateProfileForRendering:function(t){this.currentRange=t.currentRange,this.currentRangeUnit=t.currentRangeUnit,this.renderRange=t.renderRange,this.activeRange=t.activeRange,this.validRange=t.validRange,this.dateIncrement=t.dateIncrement,this.minTime=t.minTime,this.maxTime=t.maxTime,this.start=t.activeRange.start,this.end=t.activeRange.end,this.intervalStart=t.currentRange.start,this.intervalEnd=t.currentRange.end},buildPrevDateProfile:function(t){var e=t.clone().startOf(this.currentRangeUnit).subtract(this.dateIncrement);return this.buildDateProfile(e,-1)},buildNextDateProfile:function(t){var e=t.clone().startOf(this.currentRangeUnit).add(this.dateIncrement);return this.buildDateProfile(e,1)},buildDateProfile:function(t,n,i){var r,s,o,a,l=this.buildValidRange(),u=null,h=null;return i&&(t=j(t,l)),r=this.buildCurrentRangeInfo(t,n),s=this.buildRenderRange(r.range,r.unit),o=q(s),this.opt("showNonCurrentDates")||(o=U(o,r.range)),u=e.duration(this.opt("minTime")),h=e.duration(this.opt("maxTime")),this.adjustActiveRange(o,u,h),o=U(o,l),t=j(t,o),a=$(r.range,l),{validRange:l,currentRange:r.range,currentRangeUnit:r.unit,activeRange:o,renderRange:s,minTime:u,maxTime:h,isValid:a,date:t,dateIncrement:this.buildDateIncrement(r.duration)}},buildValidRange:function(){return this.getRangeOption("validRange",this.calendar.getNow())||{}},buildCurrentRangeInfo:function(t,e){var n,i=null,r=null,s=null;return this.viewSpec.duration?(i=this.viewSpec.duration,r=this.viewSpec.durationUnit,s=this.buildRangeFromDuration(t,e,i,r)):(n=this.opt("dayCount"))?(r="day",s=this.buildRangeFromDayCount(t,e,n)):(s=this.buildCustomVisibleRange(t))?r=V(s.start,s.end):(i=this.getFallbackDuration(),r=V(i),s=this.buildRangeFromDuration(t,e,i,r)),this.normalizeCurrentRange(s,r),{duration:i,unit:r,range:s}},getFallbackDuration:function(){return e.duration({days:1})},normalizeCurrentRange:function(t,e){/^(year|month|week|day)$/.test(e)?(t.start.stripTime(),t.end.stripTime()):(t.start.hasTime()||t.start.time(0),t.end.hasTime()||t.end.time(0))},adjustActiveRange:function(t,e,n){var i=!1;this.usesMinMaxTime&&(e<0&&(t.start.time(0).add(e),i=!0),n>864e5&&(t.end.time(n-864e5),i=!0),i&&(t.start.hasTime()||t.start.time(0),t.end.hasTime()||t.end.time(0)))},buildRangeFromDuration:function(t,n,i,r){var s,o,a,l=this.opt("dateAlignment"),u=t.clone();return i.as("days")<=1&&this.isHiddenDay(u)&&(u=this.skipHiddenDays(u,n),u.startOf("day")),l||(o=this.opt("dateIncrement"),o?(a=e.duration(o),l=a<i?O(a,o):r):l=r),u.startOf(l),s=u.clone().add(i),{start:u,end:s}},buildRangeFromDayCount:function(t,e,n){var i,r=this.opt("dateAlignment"),s=0,o=t.clone();r&&o.startOf(r),o.startOf("day"),o=this.skipHiddenDays(o,e),i=o.clone();do{i.add(1,"day"),this.isHiddenDay(i)||s++}while(s<n);return{start:o,end:i}},buildCustomVisibleRange:function(t){var e=this.getRangeOption("visibleRange",this.calendar.moment(t));return!e||e.start&&e.end?e:null},buildRenderRange:function(t,e){return this.trimHiddenDays(t)},buildDateIncrement:function(t){var n,i=this.opt("dateIncrement");return i?e.duration(i):(n=this.opt("dateAlignment"))?e.duration(1,n):t||e.duration({days:1})},trimHiddenDays:function(t){return{start:this.skipHiddenDays(t.start),end:this.skipHiddenDays(t.end,-1,!0)}},currentRangeAs:function(t){var e=this.currentRange;return e.end.diff(e.start,t,!0)},getRangeOption:function(t){var e=this.opt(t);if("function"==typeof e&&(e=e.apply(null,Array.prototype.slice.call(arguments,1))),e)return this.calendar.parseRange(e)},initHiddenDays:function(){var e,n=this.opt("hiddenDays")||[],i=[],r=0;for(!1===this.opt("weekends")&&n.push(0,6),e=0;e<7;e++)(i[e]=-1!==t.inArray(e,n))||r++;if(!r)throw"invalid hiddenDays";this.isHiddenDayHash=i},isHiddenDay:function(t){return e.isMoment(t)&&(t=t.day()),this.isHiddenDayHash[t]},skipHiddenDays:function(t,e,n){var i=t.clone();for(e=e||1;this.isHiddenDayHash[(i.day()+(n?e:0)+7)%7];)i.add(e,"days");return i}});var He=Zt.Scroller=bt.extend({el:null,scrollEl:null,overflowX:null,overflowY:null,constructor:function(t){t=t||{},this.overflowX=t.overflowX||t.overflow||"auto",this.overflowY=t.overflowY||t.overflow||"auto"},render:function(){this.el=this.renderEl(),this.applyOverflow()},renderEl:function(){return this.scrollEl=t('<div class="fc-scroller"></div>')},clear:function(){this.setHeight("auto"),this.applyOverflow()},destroy:function(){this.el.remove()},applyOverflow:function(){this.scrollEl.css({"overflow-x":this.overflowX,"overflow-y":this.overflowY})},lockOverflow:function(t){var e=this.overflowX,n=this.overflowY;t=t||this.getScrollbarWidths(),"auto"===e&&(e=t.top||t.bottom||this.scrollEl[0].scrollWidth-1>this.scrollEl[0].clientWidth?"scroll":"hidden"),"auto"===n&&(n=t.left||t.right||this.scrollEl[0].scrollHeight-1>this.scrollEl[0].clientHeight?"scroll":"hidden"),this.scrollEl.css({"overflow-x":e,"overflow-y":n})},setHeight:function(t){this.scrollEl.height(t)},getScrollTop:function(){return this.scrollEl.scrollTop()},setScrollTop:function(t){this.scrollEl.scrollTop(t)},getClientWidth:function(){return this.scrollEl[0].clientWidth},getClientHeight:function(){return this.scrollEl[0].clientHeight},getScrollbarWidths:function(){return p(this.scrollEl)}});_t.prototype.proxyCall=function(t){var e=Array.prototype.slice.call(arguments,1),n=[];return this.items.forEach(function(i){n.push(i[t].apply(i,e))}),n};var Re=Zt.Calendar=bt.extend(fe,{view:null,viewsByType:null,currentDate:null,loadingLevel:0,constructor:function(t,e){we.needed(),this.el=t,this.viewsByType={},this.viewSpecCache={},this.initOptionsInternals(e),this.initMomentInternals(),this.initCurrentDate(),Ut.call(this),this.initialize()},initialize:function(){},getCalendar:function(){return this},getView:function(){return this.view},publiclyTrigger:function(t,e){var n=Array.prototype.slice.call(arguments,2),i=this.opt(t);if(e=e||this.el[0],this.triggerWith(t,e,n),i)return i.apply(e,n)},instantiateView:function(t){var e=this.getViewSpec(t);return new e.class(this,e)},isValidViewType:function(t){return Boolean(this.getViewSpec(t))},changeView:function(t,e){e&&(e.start&&e.end?this.recordOptionOverrides({visibleRange:e}):this.currentDate=this.moment(e).stripZone()),this.renderView(t)},zoomTo:function(t,e){var n;e=e||"day",n=this.getViewSpec(e)||this.getUnitViewSpec(e),this.currentDate=t.clone(),this.renderView(n?n.type:null)},initCurrentDate:function(){var t=this.opt("defaultDate");this.currentDate=null!=t?this.moment(t).stripZone():this.getNow()},prev:function(){var t=this.view.buildPrevDateProfile(this.currentDate);t.isValid&&(this.currentDate=t.date,this.renderView())},next:function(){var t=this.view.buildNextDateProfile(this.currentDate);t.isValid&&(this.currentDate=t.date,this.renderView())},prevYear:function(){this.currentDate.add(-1,"years"),this.renderView()},nextYear:function(){this.currentDate.add(1,"years"),this.renderView()},today:function(){this.currentDate=this.getNow(),this.renderView()},gotoDate:function(t){this.currentDate=this.moment(t).stripZone(),this.renderView()},incrementDate:function(t){this.currentDate.add(e.duration(t)),this.renderView()},getDate:function(){return this.applyTimezone(this.currentDate)},pushLoading:function(){this.loadingLevel++||this.publiclyTrigger("loading",null,!0,this.view)},popLoading:function(){--this.loadingLevel||this.publiclyTrigger("loading",null,!1,this.view)},select:function(t,e){this.view.select(this.buildSelectSpan.apply(this,arguments))},unselect:function(){this.view&&this.view.unselect()},buildSelectSpan:function(t,e){var n,i=this.moment(t).stripZone();return n=e?this.moment(e).stripZone():i.hasTime()?i.clone().add(this.defaultTimedEventDuration):i.clone().add(this.defaultAllDayEventDuration),{start:i,end:n}},parseRange:function(t){var e=null,n=null;return t.start&&(e=this.moment(t.start).stripZone()),t.end&&(n=this.moment(t.end).stripZone()),e||n?e&&n&&n.isBefore(e)?null:{start:e,end:n}:null},rerenderEvents:function(){this.elementVisible()&&this.reportEventChange()}});Re.mixin({dirDefaults:null,localeDefaults:null,overrides:null,dynamicOverrides:null,optionsModel:null,initOptionsInternals:function(e){this.overrides=t.extend({},e),this.dynamicOverrides={},this.optionsModel=new ue,this.populateOptionsHash()},option:function(t,e){var n;if("string"==typeof t){if(void 0===e)return this.optionsModel.get(t);n={},n[t]=e,this.setOptions(n)}else"object"==typeof t&&this.setOptions(t)},opt:function(t){return this.optionsModel.get(t)},setOptions:function(t){var e,n=0;this.recordOptionOverrides(t);for(e in t)n++;if(1===n){if("height"===e||"contentHeight"===e||"aspectRatio"===e)return void this.updateSize(!0);if("defaultDate"===e)return;if("businessHours"===e)return void(this.view&&(this.view.unrenderBusinessHours(),this.view.renderBusinessHours()));if("timezone"===e)return this.rezoneArrayEventSources(),void this.refetchEvents()}this.renderHeader(),this.renderFooter(),this.viewsByType={},this.reinitView()},populateOptionsHash:function(){var t,e,i,r,s;t=ut(this.dynamicOverrides.locale,this.overrides.locale),e=xe[t],e||(t=Re.defaults.locale,e=xe[t]||{}),i=ut(this.dynamicOverrides.isRTL,this.overrides.isRTL,e.isRTL,Re.defaults.isRTL),r=i?Re.rtlDefaults:{},this.dirDefaults=r,this.localeDefaults=e,s=n([Re.defaults,r,e,this.overrides,this.dynamicOverrides]),Yt(s),this.optionsModel.reset(s)},recordOptionOverrides:function(t){var e;for(e in t)this.dynamicOverrides[e]=t[e];this.viewSpecCache={},this.populateOptionsHash()}}),Re.mixin({defaultAllDayEventDuration:null,defaultTimedEventDuration:null,localeData:null,initMomentInternals:function(){var t=this;this.defaultAllDayEventDuration=e.duration(this.opt("defaultAllDayEventDuration")),this.defaultTimedEventDuration=e.duration(this.opt("defaultTimedEventDuration")),this.optionsModel.watch("buildingMomentLocale",["?locale","?monthNames","?monthNamesShort","?dayNames","?dayNamesShort","?firstDay","?weekNumberCalculation"],function(e){var n,i=e.weekNumberCalculation,r=e.firstDay;"iso"===i&&(i="ISO");var s=rt(qt(e.locale));e.monthNames&&(s._months=e.monthNames),e.monthNamesShort&&(s._monthsShort=e.monthNamesShort),e.dayNames&&(s._weekdays=e.dayNames),e.dayNamesShort&&(s._weekdaysShort=e.dayNamesShort),null==r&&"ISO"===i&&(r=1),null!=r&&(n=rt(s._week),n.dow=r,s._week=n),"ISO"!==i&&"local"!==i&&"function"!=typeof i||(s._fullCalendar_weekCalc=i),t.localeData=s,t.currentDate&&t.localizeMoment(t.currentDate)})},moment:function(){var t;return"local"===this.opt("timezone")?(t=Zt.moment.apply(null,arguments),t.hasTime()&&t.local()):t="UTC"===this.opt("timezone")?Zt.moment.utc.apply(null,arguments):Zt.moment.parseZone.apply(null,arguments),this.localizeMoment(t),t},localizeMoment:function(t){t._locale=this.localeData},getIsAmbigTimezone:function(){return"local"!==this.opt("timezone")&&"UTC"!==this.opt("timezone")},applyTimezone:function(t){if(!t.hasTime())return t.clone();var e,n=this.moment(t.toArray()),i=t.time()-n.time();return i&&(e=n.clone().add(i),t.time()-e.time()==0&&(n=e)),n},getNow:function(){var t=this.opt("now");return"function"==typeof t&&(t=t()),this.moment(t).stripZone()},humanizeDuration:function(t){return t.locale(this.opt("locale")).humanize()},getEventEnd:function(t){return t.end?t.end.clone():this.getDefaultEventEnd(t.allDay,t.start)},getDefaultEventEnd:function(t,e){var n=e.clone();return t?n.stripTime().add(this.defaultAllDayEventDuration):n.add(this.defaultTimedEventDuration),this.getIsAmbigTimezone()&&n.stripZone(),n}}),Re.mixin({viewSpecCache:null,getViewSpec:function(t){var e=this.viewSpecCache;return e[t]||(e[t]=this.buildViewSpec(t))},getUnitViewSpec:function(e){var n,i,r;if(-1!=t.inArray(e,Jt))for(n=this.header.getViewsWithButtons(),t.each(Zt.views,function(t){n.push(t)}),i=0;i<n.length;i++)if((r=this.getViewSpec(n[i]))&&r.singleUnit==e)return r},buildViewSpec:function(t){for(var i,r,s,o,a,l=this.overrides.views||{},u=[],h=[],c=[],d=t;d;)i=$t[d],r=l[d],d=null,"function"==typeof i&&(i={class:i}),i&&(u.unshift(i),h.unshift(i.defaults||{}),s=s||i.duration,d=d||i.type),r&&(c.unshift(r),s=s||r.duration,d=d||r.type);return i=it(u),i.type=t,!!i.class&&(s=s||this.dynamicOverrides.duration||this.overrides.duration,s&&(o=e.duration(s),o.valueOf()&&(a=O(o,s),i.duration=o,i.durationUnit=a,1===o.as(a)&&(i.singleUnit=a,c.unshift(l[a]||{})))),i.defaults=n(h),i.overrides=n(c),this.buildViewSpecOptions(i),this.buildViewSpecButtonText(i,t),i)},buildViewSpecOptions:function(t){t.options=n([Re.defaults,t.defaults,this.dirDefaults,this.localeDefaults,this.overrides,t.overrides,this.dynamicOverrides]),Yt(t.options)},buildViewSpecButtonText:function(t,e){function n(n){var i=n.buttonText||{};return i[e]||(t.buttonTextKey?i[t.buttonTextKey]:null)||(t.singleUnit?i[t.singleUnit]:null)}t.buttonTextOverride=n(this.dynamicOverrides)||n(this.overrides)||t.overrides.buttonText,t.buttonTextDefault=n(this.localeDefaults)||n(this.dirDefaults)||t.defaults.buttonText||n(Re.defaults)||(t.duration?this.humanizeDuration(t.duration):null)||e}}),Re.mixin({el:null,contentEl:null,suggestedViewHeight:null,windowResizeProxy:null,ignoreWindowResize:0,render:function(){this.contentEl?this.elementVisible()&&(this.calcSize(),this.renderView()):this.initialRender()},initialRender:function(){var e=this,n=this.el;n.addClass("fc"),n.on("click.fc","a[data-goto]",function(n){var i=t(this),r=i.data("goto"),s=e.moment(r.date),o=r.type,a=e.view.opt("navLink"+gt(o)+"Click");"function"==typeof a?a(s,n):("string"==typeof a&&(o=a),e.zoomTo(s,o))}),this.optionsModel.watch("applyingThemeClasses",["?theme"],function(t){n.toggleClass("ui-widget",t.theme),n.toggleClass("fc-unthemed",!t.theme)}),this.optionsModel.watch("applyingDirClasses",["?isRTL","?locale"],function(t){n.toggleClass("fc-ltr",!t.isRTL),n.toggleClass("fc-rtl",t.isRTL)}),this.contentEl=t("<div class='fc-view-container'/>").prependTo(n),this.initToolbars(),this.renderHeader(),this.renderFooter(),this.renderView(this.opt("defaultView")),this.opt("handleWindowResize")&&t(window).resize(this.windowResizeProxy=yt(this.windowResize.bind(this),this.opt("windowResizeDelay")))},destroy:function(){this.view&&this.view.removeElement(),this.toolbarsManager.proxyCall("removeElement"),this.contentEl.remove(),this.el.removeClass("fc fc-ltr fc-rtl fc-unthemed ui-widget"),this.el.off(".fc"),this.windowResizeProxy&&(t(window).unbind("resize",this.windowResizeProxy),this.windowResizeProxy=null),we.unneeded()},elementVisible:function(){return this.el.is(":visible")},renderView:function(e,n){this.ignoreWindowResize++;var i=this.view&&e&&this.view.type!==e;i&&(this.freezeContentHeight(),this.clearView()),!this.view&&e&&(this.view=this.viewsByType[e]||(this.viewsByType[e]=this.instantiateView(e)),this.view.setElement(t("<div class='fc-view fc-"+e+"-view' />").appendTo(this.contentEl)),this.toolbarsManager.proxyCall("activateButton",e)),this.view&&(n&&this.view.addForcedScroll(n),this.elementVisible()&&(this.currentDate=this.view.setDate(this.currentDate))),i&&this.thawContentHeight(),this.ignoreWindowResize--},clearView:function(){this.toolbarsManager.proxyCall("deactivateButton",this.view.type),this.view.removeElement(),this.view=null},reinitView:function(){this.ignoreWindowResize++,this.freezeContentHeight();var t=this.view.type,e=this.view.queryScroll();this.clearView(),this.calcSize(),this.renderView(t,e),this.thawContentHeight(),this.ignoreWindowResize--},getSuggestedViewHeight:function(){return null===this.suggestedViewHeight&&this.calcSize(),this.suggestedViewHeight},isHeightAuto:function(){return"auto"===this.opt("contentHeight")||"auto"===this.opt("height")},updateSize:function(t){if(this.elementVisible())return t&&this._calcSize(),this.ignoreWindowResize++,this.view.updateSize(!0),this.ignoreWindowResize--,!0},calcSize:function(){this.elementVisible()&&this._calcSize()},_calcSize:function(){var t=this.opt("contentHeight"),e=this.opt("height");this.suggestedViewHeight="number"==typeof t?t:"function"==typeof t?t():"number"==typeof e?e-this.queryToolbarsHeight():"function"==typeof e?e()-this.queryToolbarsHeight():"parent"===e?this.el.parent().height()-this.queryToolbarsHeight():Math.round(this.contentEl.width()/Math.max(this.opt("aspectRatio"),.5))},windowResize:function(t){!this.ignoreWindowResize&&t.target===window&&this.view.renderRange&&this.updateSize(!0)&&this.view.publiclyTrigger("windowResize",this.el[0])},freezeContentHeight:function(){this.contentEl.css({width:"100%",height:this.contentEl.height(),overflow:"hidden"})},thawContentHeight:function(){this.contentEl.css({width:"",height:"",overflow:""})}}),Re.mixin({header:null,footer:null,toolbarsManager:null,initToolbars:function(){this.header=new Wt(this,this.computeHeaderOptions()),this.footer=new Wt(this,this.computeFooterOptions()),this.toolbarsManager=new _t([this.header,this.footer])},computeHeaderOptions:function(){return{extraClasses:"fc-header-toolbar",layout:this.opt("header")}},computeFooterOptions:function(){return{extraClasses:"fc-footer-toolbar",layout:this.opt("footer")}},renderHeader:function(){var t=this.header;t.setToolbarOptions(this.computeHeaderOptions()),t.render(),t.el&&this.el.prepend(t.el)},renderFooter:function(){var t=this.footer;t.setToolbarOptions(this.computeFooterOptions()),t.render(),t.el&&this.el.append(t.el)},setToolbarsTitle:function(t){this.toolbarsManager.proxyCall("updateTitle",t)},updateToolbarButtons:function(){var t=this.getNow(),e=this.view,n=e.buildDateProfile(t),i=e.buildPrevDateProfile(this.currentDate),r=e.buildNextDateProfile(this.currentDate);this.toolbarsManager.proxyCall(n.isValid&&!Z(t,e.currentRange)?"enableButton":"disableButton","today"),this.toolbarsManager.proxyCall(i.isValid?"enableButton":"disableButton","prev"),this.toolbarsManager.proxyCall(r.isValid?"enableButton":"disableButton","next")},queryToolbarsHeight:function(){return this.toolbarsManager.items.reduce(function(t,e){return t+(e.el?e.el.outerHeight(!0):0)},0)}}),Re.defaults={titleRangeSeparator:" – ",monthYearFormat:"MMMM YYYY",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",scrollTime:"06:00:00",minTime:"00:00:00",maxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,isRTL:!1,buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day"},buttonIcons:{prev:"left-single-arrow",next:"right-single-arrow",prevYear:"left-double-arrow",nextYear:"right-double-arrow"},allDayText:"all-day",theme:!1,themeButtonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e",prevYear:"seek-prev",nextYear:"seek-next"},dragOpacity:.75,dragRevertDuration:500,dragScroll:!0,unselectAuto:!0,dropAccept:"*",eventOrder:"title",eventLimit:!1,eventLimitText:"more",eventLimitClick:"popover",dayPopoverFormat:"LL",handleWindowResize:!0,windowResizeDelay:100,longPressDelay:1e3},Re.englishDefaults={dayPopoverFormat:"dddd, MMMM D"},Re.rtlDefaults={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}};var xe=Zt.locales={};Zt.datepickerLocale=function(e,n,i){var r=xe[e]||(xe[e]={});r.isRTL=i.isRTL,r.weekNumberTitle=i.weekHeader,t.each(Ie,function(t,e){r[t]=e(i)}),t.datepicker&&(t.datepicker.regional[n]=t.datepicker.regional[e]=i,t.datepicker.regional.en=t.datepicker.regional[""],t.datepicker.setDefaults(i))},Zt.locale=function(e,i){var r,s;r=xe[e]||(xe[e]={}),i&&(r=xe[e]=n([r,i])),s=qt(e),t.each(ke,function(t,e){null==r[t]&&(r[t]=e(s,r))}),Re.defaults.locale=e};var Ie={buttonText:function(t){return{prev:ct(t.prevText),next:ct(t.nextText),today:ct(t.currentText)}},monthYearFormat:function(t){return t.showMonthAfterYear?"YYYY["+t.yearSuffix+"] MMMM":"MMMM YYYY["+t.yearSuffix+"]"}},ke={dayOfMonthFormat:function(t,e){var n=t.longDateFormat("l");return n=n.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g,""),e.isRTL?n+=" ddd":n="ddd "+n,n},mediumTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"a")},smallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")},extraSmallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")},hourFormat:function(t){return t.longDateFormat("LT").replace(":mm","").replace(/(\Wmm)$/,"").replace(/\s*a$/i,"a")},noMeridiemTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"")}},Me={smallDayDateFormat:function(t){return t.isRTL?"D dd":"dd D"},weekFormat:function(t){return t.isRTL?"w[ "+t.weekNumberTitle+"]":"["+t.weekNumberTitle+" ]w"},smallWeekFormat:function(t){return t.isRTL?"w["+t.weekNumberTitle+"]":"["+t.weekNumberTitle+"]w"}};Zt.locale("en",Re.englishDefaults),Zt.sourceNormalizers=[],Zt.sourceFetchers=[];var Be={dataType:"json",cache:!1},Le=1;Re.prototype.mutateSeg=function(t,e){return this.mutateEvent(t.event,e)},Re.prototype.normalizeEvent=function(t){},Re.prototype.spanContainsSpan=function(t,e){var n=t.start.clone().stripZone(),i=this.getEventEnd(t).stripZone()
10
+ ;return e.start>=n&&e.end<=i},Re.prototype.getPeerEvents=function(t,e){var n,i,r=this.getEventCache(),s=[];for(n=0;n<r.length;n++)i=r[n],e&&e._id===i._id||s.push(i);return s},Re.prototype.isEventSpanAllowed=function(t,e){var n=e.source||{},i=this.opt("eventAllow"),r=ut(e.constraint,n.constraint,this.opt("eventConstraint")),s=ut(e.overlap,n.overlap,this.opt("eventOverlap"));return this.isSpanAllowed(t,r,s,e)&&(!i||!1!==i(t,e))},Re.prototype.isExternalSpanAllowed=function(e,n,i){var r,s;return i&&(r=t.extend({},i,n),s=this.expandEvent(this.buildEventFromInput(r))[0]),s?this.isEventSpanAllowed(e,s):this.isSelectionSpanAllowed(e)},Re.prototype.isSelectionSpanAllowed=function(t){var e=this.opt("selectAllow");return this.isSpanAllowed(t,this.opt("selectConstraint"),this.opt("selectOverlap"))&&(!e||!1!==e(t))},Re.prototype.isSpanAllowed=function(t,e,n,i){var r,s,o,a,l,u;if(null!=e&&(r=this.constraintToEvents(e))){for(s=!1,a=0;a<r.length;a++)if(this.spanContainsSpan(r[a],t)){s=!0;break}if(!s)return!1}for(o=this.getPeerEvents(t,i),a=0;a<o.length;a++)if(l=o[a],this.eventIntersectsRange(l,t)){if(!1===n)return!1;if("function"==typeof n&&!n(l,i))return!1;if(i){if(!1===(u=ut(l.overlap,(l.source||{}).overlap)))return!1;if("function"==typeof u&&!u(i,l))return!1}}return!0},Re.prototype.constraintToEvents=function(t){return"businessHours"===t?this.getCurrentBusinessHourEvents():"object"==typeof t?null!=t.start?this.expandEvent(this.buildEventFromInput(t)):null:this.clientEvents(t)},Re.prototype.eventIntersectsRange=function(t,e){var n=t.start.clone().stripZone(),i=this.getEventEnd(t).stripZone();return e.start<i&&e.end>n};var Ne={id:"_fcBusinessHours",start:"09:00",end:"17:00",dow:[1,2,3,4,5],rendering:"inverse-background"};Re.prototype.getCurrentBusinessHourEvents=function(t){return this.computeBusinessHourEvents(t,this.opt("businessHours"))},Re.prototype.computeBusinessHourEvents=function(e,n){return!0===n?this.expandBusinessHourEvents(e,[{}]):t.isPlainObject(n)?this.expandBusinessHourEvents(e,[n]):t.isArray(n)?this.expandBusinessHourEvents(e,n,!0):[]},Re.prototype.expandBusinessHourEvents=function(e,n,i){var r,s,o=this.getView(),a=[];for(r=0;r<n.length;r++)s=n[r],i&&!s.dow||(s=t.extend({},Ne,s),e&&(s.start=null,s.end=null),a.push.apply(a,this.expandEvent(this.buildEventFromInput(s),o.activeRange.start,o.activeRange.end)));return a};var ze=Zt.BasicView=Ce.extend({scroller:null,dayGridClass:De,dayGrid:null,dayNumbersVisible:!1,colWeekNumbersVisible:!1,cellWeekNumbersVisible:!1,weekNumberWidth:null,headContainerEl:null,headRowEl:null,initialize:function(){this.dayGrid=this.instantiateDayGrid(),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},instantiateDayGrid:function(){return new(this.dayGridClass.extend(Fe))(this)},buildRenderRange:function(t,e){var n=Ce.prototype.buildRenderRange.apply(this,arguments);return/^(year|month)$/.test(e)&&(n.start.startOf("week"),n.end.weekday()&&n.end.add(1,"week").startOf("week")),this.trimHiddenDays(n)},renderDates:function(){this.dayGrid.breakOnWeeks=/year|month|week/.test(this.currentRangeUnit),this.dayGrid.setRange(this.renderRange),this.dayNumbersVisible=this.dayGrid.rowCnt>1,this.opt("weekNumbers")&&(this.opt("weekNumbersWithinDays")?(this.cellWeekNumbersVisible=!0,this.colWeekNumbersVisible=!1):(this.cellWeekNumbersVisible=!1,this.colWeekNumbersVisible=!0)),this.dayGrid.numbersVisible=this.dayNumbersVisible||this.cellWeekNumbersVisible||this.colWeekNumbersVisible,this.el.addClass("fc-basic-view").html(this.renderSkeletonHtml()),this.renderHead(),this.scroller.render();var e=this.scroller.el.addClass("fc-day-grid-container"),n=t('<div class="fc-day-grid" />').appendTo(e);this.el.find(".fc-body > tr > td").append(e),this.dayGrid.setElement(n),this.dayGrid.renderDates(this.hasRigidRows())},renderHead:function(){this.headContainerEl=this.el.find(".fc-head-container").html(this.dayGrid.renderHeadHtml()),this.headRowEl=this.headContainerEl.find(".fc-row")},unrenderDates:function(){this.dayGrid.unrenderDates(),this.dayGrid.removeElement(),this.scroller.destroy()},renderBusinessHours:function(){this.dayGrid.renderBusinessHours()},unrenderBusinessHours:function(){this.dayGrid.unrenderBusinessHours()},renderSkeletonHtml:function(){return'<table><thead class="fc-head"><tr><td class="fc-head-container '+this.widgetHeaderClass+'"></td></tr></thead><tbody class="fc-body"><tr><td class="'+this.widgetContentClass+'"></td></tr></tbody></table>'},weekNumberStyleAttr:function(){return null!==this.weekNumberWidth?'style="width:'+this.weekNumberWidth+'px"':""},hasRigidRows:function(){var t=this.opt("eventLimit");return t&&"number"!=typeof t},updateWidth:function(){this.colWeekNumbersVisible&&(this.weekNumberWidth=u(this.el.find(".fc-week-number")))},setHeight:function(t,e){var n,s,o=this.opt("eventLimit");this.scroller.clear(),r(this.headRowEl),this.dayGrid.removeSegPopover(),o&&"number"==typeof o&&this.dayGrid.limitRows(o),n=this.computeScrollerHeight(t),this.setGridHeight(n,e),o&&"number"!=typeof o&&this.dayGrid.limitRows(o),e||(this.scroller.setHeight(n),s=this.scroller.getScrollbarWidths(),(s.left||s.right)&&(i(this.headRowEl,s),n=this.computeScrollerHeight(t),this.scroller.setHeight(n)),this.scroller.lockOverflow(s))},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},setGridHeight:function(t,e){e?l(this.dayGrid.rowEls):a(this.dayGrid.rowEls,t,!0)},computeInitialDateScroll:function(){return{top:0}},queryDateScroll:function(){return{top:this.scroller.getScrollTop()}},applyDateScroll:function(t){void 0!==t.top&&this.scroller.setScrollTop(t.top)},hitsNeeded:function(){this.dayGrid.hitsNeeded()},hitsNotNeeded:function(){this.dayGrid.hitsNotNeeded()},prepareHits:function(){this.dayGrid.prepareHits()},releaseHits:function(){this.dayGrid.releaseHits()},queryHit:function(t,e){return this.dayGrid.queryHit(t,e)},getHitSpan:function(t){return this.dayGrid.getHitSpan(t)},getHitEl:function(t){return this.dayGrid.getHitEl(t)},renderEvents:function(t){this.dayGrid.renderEvents(t),this.updateHeight()},getEventSegs:function(){return this.dayGrid.getEventSegs()},unrenderEvents:function(){this.dayGrid.unrenderEvents()},renderDrag:function(t,e){return this.dayGrid.renderDrag(t,e)},unrenderDrag:function(){this.dayGrid.unrenderDrag()},renderSelection:function(t){this.dayGrid.renderSelection(t)},unrenderSelection:function(){this.dayGrid.unrenderSelection()}}),Fe={renderHeadIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<th class="fc-week-number '+t.widgetHeaderClass+'" '+t.weekNumberStyleAttr()+"><span>"+ht(t.opt("weekNumberTitle"))+"</span></th>":""},renderNumberIntroHtml:function(t){var e=this.view,n=this.getCellDate(t,0);return e.colWeekNumbersVisible?'<td class="fc-week-number" '+e.weekNumberStyleAttr()+">"+e.buildGotoAnchorHtml({date:n,type:"week",forceOff:1===this.colCnt},n.format("w"))+"</td>":""},renderBgIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<td class="fc-week-number '+t.widgetContentClass+'" '+t.weekNumberStyleAttr()+"></td>":""},renderIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<td class="fc-week-number" '+t.weekNumberStyleAttr()+"></td>":""}},Ae=Zt.MonthView=ze.extend({buildRenderRange:function(){var t,e=ze.prototype.buildRenderRange.apply(this,arguments);return this.isFixedWeeks()&&(t=Math.ceil(e.end.diff(e.start,"weeks",!0)),e.end.add(6-t,"weeks")),e},setGridHeight:function(t,e){e&&(t*=this.rowCnt/6),a(this.dayGrid.rowEls,t,!e)},isFixedWeeks:function(){return this.opt("fixedWeekCount")}});$t.basic={class:ze},$t.basicDay={type:"basic",duration:{days:1}},$t.basicWeek={type:"basic",duration:{weeks:1}},$t.month={class:Ae,duration:{months:1},defaults:{fixedWeekCount:!0}};var Ge=Zt.AgendaView=Ce.extend({scroller:null,timeGridClass:Te,timeGrid:null,dayGridClass:De,dayGrid:null,axisWidth:null,headContainerEl:null,noScrollRowEls:null,bottomRuleEl:null,usesMinMaxTime:!0,initialize:function(){this.timeGrid=this.instantiateTimeGrid(),this.opt("allDaySlot")&&(this.dayGrid=this.instantiateDayGrid()),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},instantiateTimeGrid:function(){return new(this.timeGridClass.extend(Ve))(this)},instantiateDayGrid:function(){return new(this.dayGridClass.extend(Oe))(this)},renderDates:function(){this.timeGrid.setRange(this.renderRange),this.dayGrid&&this.dayGrid.setRange(this.renderRange),this.el.addClass("fc-agenda-view").html(this.renderSkeletonHtml()),this.renderHead(),this.scroller.render();var e=this.scroller.el.addClass("fc-time-grid-container"),n=t('<div class="fc-time-grid" />').appendTo(e);this.el.find(".fc-body > tr > td").append(e),this.timeGrid.setElement(n),this.timeGrid.renderDates(),this.bottomRuleEl=t('<hr class="fc-divider '+this.widgetHeaderClass+'"/>').appendTo(this.timeGrid.el),this.dayGrid&&(this.dayGrid.setElement(this.el.find(".fc-day-grid")),this.dayGrid.renderDates(),this.dayGrid.bottomCoordPadding=this.dayGrid.el.next("hr").outerHeight()),this.noScrollRowEls=this.el.find(".fc-row:not(.fc-scroller *)")},renderHead:function(){this.headContainerEl=this.el.find(".fc-head-container").html(this.timeGrid.renderHeadHtml())},unrenderDates:function(){this.timeGrid.unrenderDates(),this.timeGrid.removeElement(),this.dayGrid&&(this.dayGrid.unrenderDates(),this.dayGrid.removeElement()),this.scroller.destroy()},renderSkeletonHtml:function(){return'<table><thead class="fc-head"><tr><td class="fc-head-container '+this.widgetHeaderClass+'"></td></tr></thead><tbody class="fc-body"><tr><td class="'+this.widgetContentClass+'">'+(this.dayGrid?'<div class="fc-day-grid"/><hr class="fc-divider '+this.widgetHeaderClass+'"/>':"")+"</td></tr></tbody></table>"},axisStyleAttr:function(){return null!==this.axisWidth?'style="width:'+this.axisWidth+'px"':""},renderBusinessHours:function(){this.timeGrid.renderBusinessHours(),this.dayGrid&&this.dayGrid.renderBusinessHours()},unrenderBusinessHours:function(){this.timeGrid.unrenderBusinessHours(),this.dayGrid&&this.dayGrid.unrenderBusinessHours()},getNowIndicatorUnit:function(){return this.timeGrid.getNowIndicatorUnit()},renderNowIndicator:function(t){this.timeGrid.renderNowIndicator(t)},unrenderNowIndicator:function(){this.timeGrid.unrenderNowIndicator()},updateSize:function(t){this.timeGrid.updateSize(t),Ce.prototype.updateSize.call(this,t)},updateWidth:function(){this.axisWidth=u(this.el.find(".fc-axis"))},setHeight:function(t,e){var n,s,o;this.bottomRuleEl.hide(),this.scroller.clear(),r(this.noScrollRowEls),this.dayGrid&&(this.dayGrid.removeSegPopover(),n=this.opt("eventLimit"),n&&"number"!=typeof n&&(n=Pe),n&&this.dayGrid.limitRows(n)),e||(s=this.computeScrollerHeight(t),this.scroller.setHeight(s),o=this.scroller.getScrollbarWidths(),(o.left||o.right)&&(i(this.noScrollRowEls,o),s=this.computeScrollerHeight(t),this.scroller.setHeight(s)),this.scroller.lockOverflow(o),this.timeGrid.getTotalSlatHeight()<s&&this.bottomRuleEl.show())},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},computeInitialDateScroll:function(){var t=e.duration(this.opt("scrollTime")),n=this.timeGrid.computeTimeTop(t);return n=Math.ceil(n),n&&n++,{top:n}},queryDateScroll:function(){return{top:this.scroller.getScrollTop()}},applyDateScroll:function(t){void 0!==t.top&&this.scroller.setScrollTop(t.top)},hitsNeeded:function(){this.timeGrid.hitsNeeded(),this.dayGrid&&this.dayGrid.hitsNeeded()},hitsNotNeeded:function(){this.timeGrid.hitsNotNeeded(),this.dayGrid&&this.dayGrid.hitsNotNeeded()},prepareHits:function(){this.timeGrid.prepareHits(),this.dayGrid&&this.dayGrid.prepareHits()},releaseHits:function(){this.timeGrid.releaseHits(),this.dayGrid&&this.dayGrid.releaseHits()},queryHit:function(t,e){var n=this.timeGrid.queryHit(t,e);return!n&&this.dayGrid&&(n=this.dayGrid.queryHit(t,e)),n},getHitSpan:function(t){return t.component.getHitSpan(t)},getHitEl:function(t){return t.component.getHitEl(t)},renderEvents:function(t){var e,n=[],i=[];for(e=0;e<t.length;e++)t[e].allDay?n.push(t[e]):i.push(t[e]);this.timeGrid.renderEvents(i),this.dayGrid&&this.dayGrid.renderEvents(n),this.updateHeight()},getEventSegs:function(){return this.timeGrid.getEventSegs().concat(this.dayGrid?this.dayGrid.getEventSegs():[])},unrenderEvents:function(){this.timeGrid.unrenderEvents(),this.dayGrid&&this.dayGrid.unrenderEvents()},renderDrag:function(t,e){return t.start.hasTime()?this.timeGrid.renderDrag(t,e):this.dayGrid?this.dayGrid.renderDrag(t,e):void 0},unrenderDrag:function(){this.timeGrid.unrenderDrag(),this.dayGrid&&this.dayGrid.unrenderDrag()},renderSelection:function(t){t.start.hasTime()||t.end.hasTime()?this.timeGrid.renderSelection(t):this.dayGrid&&this.dayGrid.renderSelection(t)},unrenderSelection:function(){this.timeGrid.unrenderSelection(),this.dayGrid&&this.dayGrid.unrenderSelection()}}),Ve={renderHeadIntroHtml:function(){var t,e=this.view;return e.opt("weekNumbers")?(t=this.start.format(e.opt("smallWeekFormat")),'<th class="fc-axis fc-week-number '+e.widgetHeaderClass+'" '+e.axisStyleAttr()+">"+e.buildGotoAnchorHtml({date:this.start,type:"week",forceOff:this.colCnt>1},ht(t))+"</th>"):'<th class="fc-axis '+e.widgetHeaderClass+'" '+e.axisStyleAttr()+"></th>"},renderBgIntroHtml:function(){var t=this.view;return'<td class="fc-axis '+t.widgetContentClass+'" '+t.axisStyleAttr()+"></td>"},renderIntroHtml:function(){return'<td class="fc-axis" '+this.view.axisStyleAttr()+"></td>"}},Oe={renderBgIntroHtml:function(){var t=this.view;return'<td class="fc-axis '+t.widgetContentClass+'" '+t.axisStyleAttr()+"><span>"+t.getAllDayHtml()+"</span></td>"},renderIntroHtml:function(){return'<td class="fc-axis" '+this.view.axisStyleAttr()+"></td>"}},Pe=5,_e=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];$t.agenda={class:Ge,defaults:{allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0}},$t.agendaDay={type:"agenda",duration:{days:1}},$t.agendaWeek={type:"agenda",duration:{weeks:1}};var We=Ce.extend({grid:null,scroller:null,initialize:function(){this.grid=new Ye(this),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},renderSkeleton:function(){this.el.addClass("fc-list-view "+this.widgetContentClass),this.scroller.render(),this.scroller.el.appendTo(this.el),this.grid.setElement(this.scroller.scrollEl)},unrenderSkeleton:function(){this.scroller.destroy()},setHeight:function(t,e){this.scroller.setHeight(this.computeScrollerHeight(t))},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},renderDates:function(){this.grid.setRange(this.renderRange)},renderEvents:function(t){this.grid.renderEvents(t)},unrenderEvents:function(){this.grid.unrenderEvents()},isEventResizable:function(t){return!1},isEventDraggable:function(t){return!1}}),Ye=be.extend({segSelector:".fc-list-item",hasDayInteractions:!1,spanToSegs:function(t){for(var e,n=this.view,i=n.renderRange.start.clone().time(0),r=0,s=[];i<n.renderRange.end;)if(e=z(t,{start:i,end:i.clone().add(1,"day")}),e&&(e.dayIndex=r,s.push(e)),i.add(1,"day"),r++,e&&!e.isEnd&&t.end.hasTime()&&t.end<i.clone().add(this.view.nextDayThreshold)){e.end=t.end.clone(),e.isEnd=!0;break}return s},computeEventTimeFormat:function(){return this.view.opt("mediumTimeFormat")},handleSegClick:function(e,n){var i;be.prototype.handleSegClick.apply(this,arguments),t(n.target).closest("a[href]").length||(i=e.event.url)&&!n.isDefaultPrevented()&&(window.location.href=i)},renderFgSegs:function(t){return t=this.renderFgSegEls(t),t.length?this.renderSegList(t):this.renderEmptyMessage(),t},renderEmptyMessage:function(){this.el.html('<div class="fc-list-empty-wrap2"><div class="fc-list-empty-wrap1"><div class="fc-list-empty">'+ht(this.view.opt("noEventsMessage"))+"</div></div></div>")},renderSegList:function(e){var n,i,r,s=this.groupSegsByDay(e),o=t('<table class="fc-list-table"><tbody/></table>'),a=o.find("tbody");for(n=0;n<s.length;n++)if(i=s[n])for(a.append(this.dayHeaderHtml(this.view.renderRange.start.clone().add(n,"days"))),this.sortEventSegs(i),r=0;r<i.length;r++)a.append(i[r].el);this.el.empty().append(o)},groupSegsByDay:function(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],(i[n.dayIndex]||(i[n.dayIndex]=[])).push(n);return i},dayHeaderHtml:function(t){var e=this.view,n=e.opt("listDayFormat"),i=e.opt("listDayAltFormat");return'<tr class="fc-list-heading" data-date="'+t.format("YYYY-MM-DD")+'"><td class="'+e.widgetHeaderClass+'" colspan="3">'+(n?e.buildGotoAnchorHtml(t,{class:"fc-list-heading-main"},ht(t.format(n))):"")+(i?e.buildGotoAnchorHtml(t,{class:"fc-list-heading-alt"},ht(t.format(i))):"")+"</td></tr>"},fgSegHtml:function(t){var e,n=this.view,i=["fc-list-item"].concat(this.getSegCustomClasses(t)),r=this.getSegBackgroundColor(t),s=t.event,o=s.url;return e=s.allDay?n.getAllDayHtml():n.isMultiDayEvent(s)?t.isStart||t.isEnd?ht(this.getEventTimeText(t)):n.getAllDayHtml():ht(this.getEventTimeText(s)),o&&i.push("fc-has-url"),'<tr class="'+i.join(" ")+'">'+(this.displayEventTime?'<td class="fc-list-item-time '+n.widgetContentClass+'">'+(e||"")+"</td>":"")+'<td class="fc-list-item-marker '+n.widgetContentClass+'"><span class="fc-event-dot"'+(r?' style="background-color:'+r+'"':"")+'></span></td><td class="fc-list-item-title '+n.widgetContentClass+'"><a'+(o?' href="'+ht(o)+'"':"")+">"+ht(t.event.title||"")+"</a></td></tr>"}});return $t.list={class:We,buttonTextKey:"list",defaults:{buttonText:"list",listDayFormat:"LL",noEventsMessage:"No events to display"}},$t.listDay={type:"list",duration:{days:1},defaults:{listDayFormat:"dddd"}},$t.listWeek={type:"list",duration:{weeks:1},defaults:{listDayFormat:"dddd",listDayAltFormat:"LL"}},$t.listMonth={type:"list",duration:{month:1},defaults:{listDayAltFormat:"dddd"}},$t.listYear={type:"list",duration:{year:1},defaults:{listDayAltFormat:"dddd"}},Zt});
assets/lib/fullcalendar/fullcalendar.print.css ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Print Stylesheet
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+
7
+ /*
8
+ * Include this stylesheet on your page to get a more printer-friendly calendar.
9
+ * When including this stylesheet, use the media='print' attribute of the <link> tag.
10
+ * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
11
+ */
12
+
13
+ .fc {
14
+ max-width: 100% !important;
15
+ }
16
+
17
+
18
+ /* Global Event Restyling
19
+ --------------------------------------------------------------------------------------------------*/
20
+
21
+ .fc-event {
22
+ background: #fff !important;
23
+ color: #000 !important;
24
+ page-break-inside: avoid;
25
+ }
26
+
27
+ .fc-event .fc-resizer {
28
+ display: none;
29
+ }
30
+
31
+
32
+ /* Table & Day-Row Restyling
33
+ --------------------------------------------------------------------------------------------------*/
34
+
35
+ .fc th,
36
+ .fc td,
37
+ .fc hr,
38
+ .fc thead,
39
+ .fc tbody,
40
+ .fc-row {
41
+ border-color: #ccc !important;
42
+ background: #fff !important;
43
+ }
44
+
45
+ /* kill the overlaid, absolutely-positioned components */
46
+ /* common... */
47
+ .fc-bg,
48
+ .fc-bgevent-skeleton,
49
+ .fc-highlight-skeleton,
50
+ .fc-helper-skeleton,
51
+ /* for timegrid. within cells within table skeletons... */
52
+ .fc-bgevent-container,
53
+ .fc-business-container,
54
+ .fc-highlight-container,
55
+ .fc-helper-container {
56
+ display: none;
57
+ }
58
+
59
+ /* don't force a min-height on rows (for DayGrid) */
60
+ .fc tbody .fc-row {
61
+ height: auto !important; /* undo height that JS set in distributeHeight */
62
+ min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */
63
+ }
64
+
65
+ .fc tbody .fc-row .fc-content-skeleton {
66
+ position: static; /* undo .fc-rigid */
67
+ padding-bottom: 0 !important; /* use a more border-friendly method for this... */
68
+ }
69
+
70
+ .fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */
71
+ padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */
72
+ }
73
+
74
+ .fc tbody .fc-row .fc-content-skeleton table {
75
+ /* provides a min-height for the row, but only effective for IE, which exaggerates this value,
76
+ making it look more like 3em. for other browers, it will already be this tall */
77
+ height: 1em;
78
+ }
79
+
80
+
81
+ /* Undo month-view event limiting. Display all events and hide the "more" links
82
+ --------------------------------------------------------------------------------------------------*/
83
+
84
+ .fc-more-cell,
85
+ .fc-more {
86
+ display: none !important;
87
+ }
88
+
89
+ .fc tr.fc-limited {
90
+ display: table-row !important;
91
+ }
92
+
93
+ .fc td.fc-limited {
94
+ display: table-cell !important;
95
+ }
96
+
97
+ .fc-popover {
98
+ display: none; /* never display the "more.." popover in print mode */
99
+ }
100
+
101
+
102
+ /* TimeGrid Restyling
103
+ --------------------------------------------------------------------------------------------------*/
104
+
105
+ /* undo the min-height 100% trick used to fill the container's height */
106
+ .fc-time-grid {
107
+ min-height: 0 !important;
108
+ }
109
+
110
+ /* don't display the side axis at all ("all-day" and time cells) */
111
+ .fc-agenda-view .fc-axis {
112
+ display: none;
113
+ }
114
+
115
+ /* don't display the horizontal lines */
116
+ .fc-slats,
117
+ .fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */
118
+ display: none !important; /* important overrides inline declaration */
119
+ }
120
+
121
+ /* let the container that holds the events be naturally positioned and create real height */
122
+ .fc-time-grid .fc-content-skeleton {
123
+ position: static;
124
+ }
125
+
126
+ /* in case there are no events, we still want some height */
127
+ .fc-time-grid .fc-content-skeleton table {
128
+ height: 4em;
129
+ }
130
+
131
+ /* kill the horizontal spacing made by the event container. event margins will be done below */
132
+ .fc-time-grid .fc-event-container {
133
+ margin: 0 !important;
134
+ }
135
+
136
+
137
+ /* TimeGrid *Event* Restyling
138
+ --------------------------------------------------------------------------------------------------*/
139
+
140
+ /* naturally position events, vertically stacking them */
141
+ .fc-time-grid .fc-event {
142
+ position: static !important;
143
+ margin: 3px 2px !important;
144
+ }
145
+
146
+ /* for events that continue to a future day, give the bottom border back */
147
+ .fc-time-grid .fc-event.fc-not-end {
148
+ border-bottom-width: 1px !important;
149
+ }
150
+
151
+ /* indicate the event continues via "..." text */
152
+ .fc-time-grid .fc-event.fc-not-end:after {
153
+ content: "...";
154
+ }
155
+
156
+ /* for events that are continuations from previous days, give the top border back */
157
+ .fc-time-grid .fc-event.fc-not-start {
158
+ border-top-width: 1px !important;
159
+ }
160
+
161
+ /* indicate the event is a continuation via "..." text */
162
+ .fc-time-grid .fc-event.fc-not-start:before {
163
+ content: "...";
164
+ }
165
+
166
+ /* time */
167
+
168
+ /* undo a previous declaration and let the time text span to a second line */
169
+ .fc-time-grid .fc-event .fc-time {
170
+ white-space: normal !important;
171
+ }
172
+
173
+ /* hide the the time that is normally displayed... */
174
+ .fc-time-grid .fc-event .fc-time span {
175
+ display: none;
176
+ }
177
+
178
+ /* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */
179
+ .fc-time-grid .fc-event .fc-time:after {
180
+ content: attr(data-full);
181
+ }
182
+
183
+
184
+ /* Vertical Scroller & Containers
185
+ --------------------------------------------------------------------------------------------------*/
186
+
187
+ /* kill the scrollbars and allow natural height */
188
+ .fc-scroller,
189
+ .fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */
190
+ .fc-time-grid-container { /* */
191
+ overflow: visible !important;
192
+ height: auto !important;
193
+ }
194
+
195
+ /* kill the horizontal border/padding used to compensate for scrollbars */
196
+ .fc-row {
197
+ border: 0 !important;
198
+ margin: 0 !important;
199
+ }
200
+
201
+
202
+ /* Button Controls
203
+ --------------------------------------------------------------------------------------------------*/
204
+
205
+ .fc-button-group,
206
+ .fc button {
207
+ display: none; /* don't display any button-related controls */
208
+ }
assets/lib/fullcalendar/fullcalendar.print.min.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Print Stylesheet
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */.fc-bg,.fc-bgevent-container,.fc-bgevent-skeleton,.fc-business-container,.fc-event .fc-resizer,.fc-helper-container,.fc-helper-skeleton,.fc-highlight-container,.fc-highlight-skeleton{display:none}.fc tbody .fc-row,.fc-time-grid{min-height:0!important}.fc-time-grid .fc-event.fc-not-end:after,.fc-time-grid .fc-event.fc-not-start:before{content:"..."}.fc{max-width:100%!important}.fc-event{background:#fff!important;color:#000!important;page-break-inside:avoid}.fc hr,.fc tbody,.fc td,.fc th,.fc thead,.fc-row{border-color:#ccc!important;background:#fff!important}.fc tbody .fc-row{height:auto!important}.fc tbody .fc-row .fc-content-skeleton{position:static;padding-bottom:0!important}.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td{padding-bottom:1em}.fc tbody .fc-row .fc-content-skeleton table{height:1em}.fc-more,.fc-more-cell{display:none!important}.fc tr.fc-limited{display:table-row!important}.fc td.fc-limited{display:table-cell!important}.fc-agenda-view .fc-axis,.fc-popover{display:none}.fc-slats,.fc-time-grid hr{display:none!important}.fc button,.fc-button-group,.fc-time-grid .fc-event .fc-time span{display:none}.fc-time-grid .fc-content-skeleton{position:static}.fc-time-grid .fc-content-skeleton table{height:4em}.fc-time-grid .fc-event-container{margin:0!important}.fc-time-grid .fc-event{position:static!important;margin:3px 2px!important}.fc-time-grid .fc-event.fc-not-end{border-bottom-width:1px!important}.fc-time-grid .fc-event.fc-not-start{border-top-width:1px!important}.fc-time-grid .fc-event .fc-time{white-space:normal!important}.fc-time-grid .fc-event .fc-time:after{content:attr(data-full)}.fc-day-grid-container,.fc-scroller,.fc-time-grid-container{overflow:visible!important;height:auto!important}.fc-row{border:0!important;margin:0!important}
assets/lib/fullcalendar/gcal.js ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Google Calendar Plugin
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+
7
+ (function(factory) {
8
+ if (typeof define === 'function' && define.amd) {
9
+ define([ 'jquery' ], factory);
10
+ }
11
+ else if (typeof exports === 'object') { // Node/CommonJS
12
+ module.exports = factory(require('jquery'));
13
+ }
14
+ else {
15
+ factory(jQuery);
16
+ }
17
+ })(function($) {
18
+
19
+
20
+ var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
21
+ var FC = $.fullCalendar;
22
+ var applyAll = FC.applyAll;
23
+
24
+
25
+ FC.sourceNormalizers.push(function(sourceOptions) {
26
+ var googleCalendarId = sourceOptions.googleCalendarId;
27
+ var url = sourceOptions.url;
28
+ var match;
29
+
30
+ // if the Google Calendar ID hasn't been explicitly defined
31
+ if (!googleCalendarId && url) {
32
+
33
+ // detect if the ID was specified as a single string.
34
+ // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
35
+ if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
36
+ googleCalendarId = url;
37
+ }
38
+ // try to scrape it out of a V1 or V3 API feed URL
39
+ else if (
40
+ (match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
41
+ (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))
42
+ ) {
43
+ googleCalendarId = decodeURIComponent(match[1]);
44
+ }
45
+
46
+ if (googleCalendarId) {
47
+ sourceOptions.googleCalendarId = googleCalendarId;
48
+ }
49
+ }
50
+
51
+
52
+ if (googleCalendarId) { // is this a Google Calendar?
53
+
54
+ // make each Google Calendar source uneditable by default
55
+ if (sourceOptions.editable == null) {
56
+ sourceOptions.editable = false;
57
+ }
58
+
59
+ // We want removeEventSource to work, but it won't know about the googleCalendarId primitive.
60
+ // Shoehorn it into the url, which will function as the unique primitive. Won't cause side effects.
61
+ // This hack is obsolete since 2.2.3, but keep it so this plugin file is compatible with old versions.
62
+ sourceOptions.url = googleCalendarId;
63
+ }
64
+ });
65
+
66
+
67
+ FC.sourceFetchers.push(function(sourceOptions, start, end, timezone) {
68
+ if (sourceOptions.googleCalendarId) {
69
+ return transformOptions(sourceOptions, start, end, timezone, this); // `this` is the calendar
70
+ }
71
+ });
72
+
73
+
74
+ function transformOptions(sourceOptions, start, end, timezone, calendar) {
75
+ var url = API_BASE + '/' + encodeURIComponent(sourceOptions.googleCalendarId) + '/events?callback=?'; // jsonp
76
+ var apiKey = sourceOptions.googleCalendarApiKey || calendar.opt('googleCalendarApiKey');
77
+ var success = sourceOptions.success;
78
+ var data;
79
+ var timezoneArg; // populated when a specific timezone. escaped to Google's liking
80
+
81
+ function reportError(message, apiErrorObjs) {
82
+ var errorObjs = apiErrorObjs || [ { message: message } ]; // to be passed into error handlers
83
+
84
+ // call error handlers
85
+ (sourceOptions.googleCalendarError || $.noop).apply(calendar, errorObjs);
86
+ (calendar.opt('googleCalendarError') || $.noop).apply(calendar, errorObjs);
87
+
88
+ // print error to debug console
89
+ FC.warn.apply(null, [ message ].concat(apiErrorObjs || []));
90
+ }
91
+
92
+ if (!apiKey) {
93
+ reportError("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/");
94
+ return {}; // an empty source to use instead. won't fetch anything.
95
+ }
96
+
97
+ // The API expects an ISO8601 datetime with a time and timezone part.
98
+ // Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each
99
+ // side, guaranteeing we will receive all events in the desired range, albeit a superset.
100
+ // .utc() will set a zone and give it a 00:00:00 time.
101
+ if (!start.hasZone()) {
102
+ start = start.clone().utc().add(-1, 'day');
103
+ }
104
+ if (!end.hasZone()) {
105
+ end = end.clone().utc().add(1, 'day');
106
+ }
107
+
108
+ // when sending timezone names to Google, only accepts underscores, not spaces
109
+ if (timezone && timezone != 'local') {
110
+ timezoneArg = timezone.replace(' ', '_');
111
+ }
112
+
113
+ data = $.extend({}, sourceOptions.data || {}, {
114
+ key: apiKey,
115
+ timeMin: start.format(),
116
+ timeMax: end.format(),
117
+ timeZone: timezoneArg,
118
+ singleEvents: true,
119
+ maxResults: 9999
120
+ });
121
+
122
+ return $.extend({}, sourceOptions, {
123
+ googleCalendarId: null, // prevents source-normalizing from happening again
124
+ url: url,
125
+ data: data,
126
+ startParam: false, // `false` omits this parameter. we already included it above
127
+ endParam: false, // same
128
+ timezoneParam: false, // same
129
+ success: function(data) {
130
+ var events = [];
131
+ var successArgs;
132
+ var successRes;
133
+
134
+ if (data.error) {
135
+ reportError('Google Calendar API: ' + data.error.message, data.error.errors);
136
+ }
137
+ else if (data.items) {
138
+ $.each(data.items, function(i, entry) {
139
+ var url = entry.htmlLink || null;
140
+
141
+ // make the URLs for each event show times in the correct timezone
142
+ if (timezoneArg && url !== null) {
143
+ url = injectQsComponent(url, 'ctz=' + timezoneArg);
144
+ }
145
+
146
+ events.push({
147
+ id: entry.id,
148
+ title: entry.summary,
149
+ start: entry.start.dateTime || entry.start.date, // try timed. will fall back to all-day
150
+ end: entry.end.dateTime || entry.end.date, // same
151
+ url: url,
152
+ location: entry.location,
153
+ description: entry.description
154
+ });
155
+ });
156
+
157
+ // call the success handler(s) and allow it to return a new events array
158
+ successArgs = [ events ].concat(Array.prototype.slice.call(arguments, 1)); // forward other jq args
159
+ successRes = applyAll(success, this, successArgs);
160
+ if ($.isArray(successRes)) {
161
+ return successRes;
162
+ }
163
+ }
164
+
165
+ return events;
166
+ }
167
+ });
168
+ }
169
+
170
+
171
+ // Injects a string like "arg=value" into the querystring of a URL
172
+ function injectQsComponent(url, component) {
173
+ // inject it after the querystring but before the fragment
174
+ return url.replace(/(\?.*?)?(#|$)/, function(whole, qs, hash) {
175
+ return (qs ? qs + '&' : '?') + component + hash;
176
+ });
177
+ }
178
+
179
+
180
+ });
assets/lib/fullcalendar/gcal.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*!
2
+ * FullCalendar v3.4.0 Google Calendar Plugin
3
+ * Docs & License: https://fullcalendar.io/
4
+ * (c) 2017 Adam Shaw
5
+ */
6
+ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){function a(a,t,d,c,i){function s(o,r){var l=r||[{message:o}];(a.googleCalendarError||e.noop).apply(i,l),(i.opt("googleCalendarError")||e.noop).apply(i,l),n.warn.apply(null,[o].concat(r||[]))}var u,g,p=r+"/"+encodeURIComponent(a.googleCalendarId)+"/events?callback=?",m=a.googleCalendarApiKey||i.opt("googleCalendarApiKey"),f=a.success;return m?(t.hasZone()||(t=t.clone().utc().add(-1,"day")),d.hasZone()||(d=d.clone().utc().add(1,"day")),c&&"local"!=c&&(g=c.replace(" ","_")),u=e.extend({},a.data||{},{key:m,timeMin:t.format(),timeMax:d.format(),timeZone:g,singleEvents:!0,maxResults:9999}),e.extend({},a,{googleCalendarId:null,url:p,data:u,startParam:!1,endParam:!1,timezoneParam:!1,success:function(a){var r,n,t=[];if(a.error)s("Google Calendar API: "+a.error.message,a.error.errors);else if(a.items&&(e.each(a.items,function(e,a){var r=a.htmlLink||null;g&&null!==r&&(r=o(r,"ctz="+g)),t.push({id:a.id,title:a.summary,start:a.start.dateTime||a.start.date,end:a.end.dateTime||a.end.date,url:r,location:a.location,description:a.description})}),r=[t].concat(Array.prototype.slice.call(arguments,1)),n=l(f,this,r),e.isArray(n)))return n;return t}})):(s("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/"),{})}function o(e,a){return e.replace(/(\?.*?)?(#|$)/,function(e,o,r){return(o?o+"&":"?")+a+r})}var r="https://www.googleapis.com/calendar/v3/calendars",n=e.fullCalendar,l=n.applyAll;n.sourceNormalizers.push(function(e){var a,o=e.googleCalendarId,r=e.url;!o&&r&&(/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(r)?o=r:((a=/^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(r))||(a=/^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(r)))&&(o=decodeURIComponent(a[1])),o&&(e.googleCalendarId=o)),o&&(null==e.editable&&(e.editable=!1),e.url=o)}),n.sourceFetchers.push(function(e,o,r,n){if(e.googleCalendarId)return a(e,o,r,n,this)})});
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_50_3baae3_1x400.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-icons_2694e8_256x240.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-icons_3d80b3_256x240.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-icons_72a7cf_256x240.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/images/ui-icons_ffffff_256x240.png ADDED
Binary file
assets/lib/fullcalendar/lib/cupertino/jquery-ui.min.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.12.1 - 2016-09-14
2
+ * http://jqueryui.com
3
+ * Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande%2CLucida%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=highlight_soft&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=highlight_hard&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=glass&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=glass&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=flat&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=highlight_hard&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #aed0ea}.ui-widget-content{border:1px solid #ddd;background:#f2f5f7 url("images/ui-bg_highlight-hard_100_f2f5f7_1x100.png") 50% top repeat-x;color:#362b36}.ui-widget-content a{color:#362b36}.ui-widget-header{border:1px solid #aed0ea;background:#deedf7 url("images/ui-bg_highlight-soft_100_deedf7_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #aed0ea;background:#d7ebf9 url("images/ui-bg_glass_80_d7ebf9_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#2779aa}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#2779aa;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #74b2e2;background:#e4f1fb url("images/ui-bg_glass_100_e4f1fb_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#0070a3}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#0070a3;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #2694e8;background:#3baae3 url("images/ui-bg_glass_50_3baae3_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#2694e8;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #f9dd34;background:#ffef8f url("images/ui-bg_highlight-soft_25_ffef8f_1x100.png") 50% top repeat-x;color:#363636}.ui-state-checked{border:1px solid #f9dd34;background:#ffef8f}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#cd0a0a;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_2694e8_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_3d80b3_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:6px}.ui-widget-overlay{background:#eee url("images/ui-bg_diagonals-thick_90_eeeeee_40x40.png") 50% 50% repeat;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{-webkit-box-shadow:-7px -7px 7px #000;box-shadow:-7px -7px 7px #000}
assets/lib/fullcalendar/lib/jquery-ui.min.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.12.1 - 2016-09-14
2
+ * http://jqueryui.com
3
+ * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
4
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)
7
+ }}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
8
+ this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
9
+ }},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
10
+ },_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
11
+ },disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
12
+ },_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
13
+ this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o