From 9efacc4d2519c50dc89c4fed1049e4de3921b675 Mon Sep 17 00:00:00 2001 From: Kelsey Martens Date: Wed, 17 Oct 2018 10:19:47 -0500 Subject: [PATCH] v2.0.7 --- CHANGELOG.md | 15 ++++++ composer.json | 4 +- src/Controllers/CalendarsController.php | 3 ++ src/Controllers/EventsController.php | 8 ++- src/Elements/Db/EventQuery.php | 51 +++++++++++-------- src/Elements/Event.php | 37 ++++++++++---- src/Library/DateHelper.php | 51 ++++++++++++++++++- src/Library/Duration/DayDuration.php | 4 +- src/Library/Duration/HourDuration.php | 4 +- src/Library/Duration/MonthDuration.php | 2 +- src/Library/Duration/WeekDuration.php | 4 +- src/Library/Export/AbstractExportCalendar.php | 18 ++++++- src/Library/Export/ExportCalendarToIcs.php | 21 +++++--- src/Models/CalendarModel.php | 13 +++++ src/Records/CalendarRecord.php | 1 + src/Resources/Bundles/EventIndexBundle.php | 22 ++++++++ .../js/lib/qtip/imagesloaded.pkg.min.js | 1 - src/Resources/js/lib/qtip/jquery.qtip.min.js | 1 - .../js/src/calendar-fullcalendar-methods.js | 2 +- src/Resources/js/src/calendar.js | 2 +- src/Resources/js/src/event-index.js | 1 + src/Resources/js/src/widget/agenda.js | 2 +- src/Resources/js/src/widget/month.js | 2 +- src/Services/CalendarsService.php | 4 +- src/Services/ViewDataService.php | 4 +- src/Variables/CalendarVariable.php | 5 +- src/codepack/templates/export.html | 10 ++-- src/migrations/Install.php | 1 + ...180921_124711_AddIcsTimezoneToCalendar.php | 36 +++++++++++++ src/templates/_widgets/agenda/body.html | 1 + src/templates/_widgets/month/body.html | 1 + src/templates/calendars/_edit.html | 8 +++ src/templates/events/_edit.html | 4 +- src/templates/events/_index.html | 5 ++ src/templates/field/_event.html | 2 +- src/templates/layouts/_eventLayout.html | 30 ----------- src/templates/view/calendar.html | 2 + src/translations/en-US/calendar.php | 29 ++++++----- 38 files changed, 300 insertions(+), 111 deletions(-) create mode 100644 src/Resources/Bundles/EventIndexBundle.php create mode 100644 src/Resources/js/src/event-index.js create mode 100644 src/migrations/m180921_124711_AddIcsTimezoneToCalendar.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2454260..2b76c23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Solspace Calendar Changelog +## 2.0.7 - 2018-10-17 +### Added +- Added `timezone` parameter for `calendar.export` function, allowing users to simulate a localized timezone, more-so as a workaround for Google Calendar not correctly supporting floating timezones. + +### Changed +- Updated Events list CP page to only show available calendars when switching Sites, and to always append Site handle in URL when creating new events. + +### Fixed +- Fixed a bug where CP and front end templates (month/week/day functions) were not localizing correctly for today's date. +- Fixed a bug where the End Repeat on Date input was incorrectly localizing the selected date when editing events. +- Fixed a bug where disabling the "Display Mini Calendar" setting for Calendar Month/Week/Day CP views would gives a JS error on those pages. +- Fixed a bug where CP Month/Week/Day views were looking for `jquery.qtip.min.map` and resulted in a JS error. +- Fixed a bug where CP Month/Week/Day views were not loading correctly if Fruit Studios Linkit fields were being used. +- Fixed a bug where querying manually for a list of events in a month was not always including all events that overlapped before the current month. + ## 2.0.6 - 2018-09-06 ### Fixed - Fixed a bug where the `readableRepeatRule` was using the currently viewed occurrence of the event as the "starting from..." date, and not the original main start date of the event. diff --git a/composer.json b/composer.json index 198ff16..40296de 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "solspace/craft3-calendar", "description": "The most powerful event management plugin for Craft.", - "version": "2.0.6", + "version": "2.0.7", "type": "craft-plugin", "minimum-stability": "dev", "authors": [ @@ -26,7 +26,7 @@ } }, "extra": { - "schemaVersion": "2.0.4", + "schemaVersion": "2.0.5", "handle": "calendar", "class": "Solspace\\Calendar\\Calendar", "name": "Calendar", diff --git a/src/Controllers/CalendarsController.php b/src/Controllers/CalendarsController.php index a7881b1..c1e3e94 100644 --- a/src/Controllers/CalendarsController.php +++ b/src/Controllers/CalendarsController.php @@ -5,6 +5,7 @@ use craft\records\Field; use Solspace\Calendar\Calendar; use Solspace\Calendar\Elements\Event; +use Solspace\Calendar\Library\DateHelper; use Solspace\Calendar\Models\CalendarModel; use Solspace\Calendar\Models\CalendarSiteSettingsModel; use Solspace\Calendar\Resources\Bundles\CalendarEditBundle; @@ -110,6 +111,7 @@ public function actionSaveCalendar(): Response $calendar->titleFormat = $request->post('titleFormat'); $calendar->titleLabel = $request->post('titleLabel'); $calendar->hasTitleField = (bool) $request->post('hasTitleField'); + $calendar->icsTimezone = $request->post('icsTimezone'); // Site-specific settings $allSiteSettings = []; @@ -285,6 +287,7 @@ private function renderEditTemplate(CalendarModel $calendar, string $title): Res 'calendar' => $calendar, 'continueEditingUrl' => 'calendar/calendars/{handle}', 'customFields' => $customFieldData, + 'timezoneOptions' => DateHelper::getTimezoneOptions(), ] ); } diff --git a/src/Controllers/EventsController.php b/src/Controllers/EventsController.php index ad5d719..accca07 100644 --- a/src/Controllers/EventsController.php +++ b/src/Controllers/EventsController.php @@ -19,6 +19,7 @@ use Solspace\Calendar\Models\ExceptionModel; use Solspace\Calendar\Models\SelectDateModel; use Solspace\Calendar\Resources\Bundles\EventEditBundle; +use Solspace\Calendar\Resources\Bundles\EventIndexBundle; use yii\db\Exception; use yii\helpers\FormatConverter; use yii\web\HttpException; @@ -40,6 +41,8 @@ public function actionEventsIndex(): Response { $this->requireEventPermission(); + \Craft::$app->view->registerAssetBundle(EventIndexBundle::class); + return $this->renderTemplate( 'calendar/events/_index', [ @@ -415,6 +418,8 @@ private function renderEditForm(Event $event, string $title): Response ); } + $siteHandle = $event->getSite()->handle; + $variables = [ 'name' => self::EVENT_FIELD_NAME, 'event' => $event, @@ -436,13 +441,14 @@ private function renderEditForm(Event $event, string $title): Response 'timeFormat' => $timeFormat, 'showPreviewBtn' => $showPreviewButton, 'shareUrl' => $shareUrl, + 'site' => $event->getSite(), 'crumbs' => [ ['label' => Calendar::t('calendar'), 'url' => UrlHelper::cpUrl('calendar')], ['label' => Calendar::t('Events'), 'url' => UrlHelper::cpUrl('calendar/events')], [ 'label' => $title, 'url' => UrlHelper::cpUrl( - 'calendar/events/' . ($event->id ?: 'new/' . $calendar->handle) + 'calendar/events/' . ($event->id ?: 'new/' . $calendar->handle) . '/' . $siteHandle ), ], ], diff --git a/src/Elements/Db/EventQuery.php b/src/Elements/Db/EventQuery.php index 74ce71c..52c9784 100644 --- a/src/Elements/Db/EventQuery.php +++ b/src/Elements/Db/EventQuery.php @@ -582,8 +582,8 @@ protected function beforePrepare(): bool // join in the products table $this->joinElementTable($table); $hasCalendarsJoined = false; - $hasRelations = false; - $hasUsers = false; + $hasRelations = false; + $hasUsers = false; if (!empty($this->join)) { foreach ($this->join as $join) { @@ -618,23 +618,23 @@ protected function beforePrepare(): bool } $select = [ - $table . '.[[calendarId]]', - $table . '.[[authorId]]', - $table . '.[[startDate]]', - $table . '.[[endDate]]', - $table . '.[[allDay]]', - $table . '.[[rrule]]', - $table . '.[[freq]]', - $table . '.[[interval]]', - $table . '.[[count]]', - $table . '.[[until]]', - $table . '.[[byMonth]]', - $table . '.[[byYearDay]]', - $table . '.[[byMonthDay]]', - $table . '.[[byDay]]', - '{{%users}}.[[username]]', - $calendarTable . '.[[name]]', - ]; + $table . '.[[calendarId]]', + $table . '.[[authorId]]', + $table . '.[[startDate]]', + $table . '.[[endDate]]', + $table . '.[[allDay]]', + $table . '.[[rrule]]', + $table . '.[[freq]]', + $table . '.[[interval]]', + $table . '.[[count]]', + $table . '.[[until]]', + $table . '.[[byMonth]]', + $table . '.[[byYearDay]]', + $table . '.[[byMonthDay]]', + $table . '.[[byDay]]', + '{{%users}}.[[username]]', + $calendarTable . '.[[name]]', + ]; if ($hasRelations) { $select[] = '[[relations.sortOrder]]'; @@ -811,7 +811,7 @@ protected function beforePrepare(): bool } if (\is_array($this->orderBy) && isset($this->orderBy['dateCreated'])) { - $sortDirection = $this->orderBy['dateCreated']; + $sortDirection = $this->orderBy['dateCreated']; $this->orderBy['[[calendar_events.dateCreated]]'] = $sortDirection; unset($this->orderBy['dateCreated']); @@ -1227,11 +1227,20 @@ private function cacheEvents() $endDate = $event->getEndDate(); $diffInDays = DateHelper::carbonDiffInDays($startDate, $endDate); - $month = $startDate->format(self::FORMAT_MONTH); + $month = $startDate->format(self::FORMAT_MONTH); + $endMonth = $endDate->format(self::FORMAT_MONTH); $this->addEventToCache($eventsByMonth, $month, $event); + if ($month !== $endMonth) { + $this->addEventToCache($eventsByMonth, $endMonth, $event); + } + $week = DateHelper::getCacheWeekNumber($startDate); + $endWeek = DateHelper::getCacheWeekNumber($endDate); $this->addEventToCache($eventsByWeek, $week, $event); + if ($week !== $endWeek) { + $this->addEventToCache($eventsByWeek, $endWeek, $event); + } $day = $startDate->copy(); for ($i = 0; $i <= $diffInDays; $i++) { diff --git a/src/Elements/Event.php b/src/Elements/Event.php index ac77996..5f19518 100644 --- a/src/Elements/Event.php +++ b/src/Elements/Event.php @@ -21,6 +21,7 @@ use Solspace\Calendar\Models\ExceptionModel; use Solspace\Calendar\Models\SelectDateModel; use Symfony\Component\PropertyAccess\PropertyAccessor; +use yii\base\Model; class Event extends Element implements \JsonSerializable { @@ -233,6 +234,13 @@ protected static function defineSources(string $context = null): array 'key' => 'calendar:' . $calendar->id, 'label' => $calendar->name, 'criteria' => ['calendarId' => $calendar->id], + 'sites' => array_keys($calendar->getSiteSettings()), + 'data' => [ + 'id' => $calendar->id, + 'name' => $calendar->name, + 'handle' => $calendar->handle, + 'color' => $calendar->color, + ], ]; } @@ -270,13 +278,13 @@ protected static function defineTableAttributes(): array protected static function defineSortOptions(): array { return [ - 'title' => Calendar::t('Title'), - 'name' => Calendar::t('Calendar'), - 'startDate' => Calendar::t('Start Date'), - 'endDate' => Calendar::t('End Date'), - 'allDay' => Calendar::t('All Day'), - 'username' => Calendar::t('Author'), - 'dateCreated' => Calendar::t('Post Date'), + 'title' => Calendar::t('Title'), + 'name' => Calendar::t('Calendar'), + 'startDate' => Calendar::t('Start Date'), + 'endDate' => Calendar::t('End Date'), + 'allDay' => Calendar::t('All Day'), + 'username' => Calendar::t('Author'), + 'dateCreated' => Calendar::t('Post Date'), ]; } @@ -450,9 +458,9 @@ public function getCpEditUrl() return false; } - $siteHandle = static::isLocalized() ? '/' . $this->getSite()->handle : ''; + $siteHandle = $this->getSite()->handle; - return UrlHelper::cpUrl('calendar/events/' . $this->id . $siteHandle); + return UrlHelper::cpUrl('calendar/events/' . $this->id . '/' . $siteHandle); } /** @@ -1295,7 +1303,16 @@ public function jsonSerialize(): array 'textColor' => $this->getCalendar()->getContrastColor(), ]; - return array_merge($object, $this->getFieldValues()); + $fieldValues = []; + foreach ($this->getFieldValues() as $key => $value) { + if (is_a($value, 'fruitstudios\linkit\base\Link')) { + $value = $value->getLink([], false); + } + + $fieldValues[$key] = $value; + } + + return array_merge($object, $fieldValues); } public function rules() diff --git a/src/Library/DateHelper.php b/src/Library/DateHelper.php index a8764fd..9c497d4 100644 --- a/src/Library/DateHelper.php +++ b/src/Library/DateHelper.php @@ -8,7 +8,8 @@ class DateHelper { - const UTC = 'utc'; + const FLOATING_TIMEZONE = 'floating'; + const UTC = 'utc'; /** @var array */ private static $weekDays = [ @@ -412,6 +413,54 @@ public static function getRelativeEventDates(Carbon $startDate, Carbon $endDate, return [$occurrenceStartDate, $occurrenceEndDate]; } + /** + * @return array + */ + public static function getTimezoneOptions(): array + { + // Assemble the timezone options array (Technique adapted from http://stackoverflow.com/a/7022536/1688568) + $timezoneOptions = []; + + $utc = new \DateTime(); + $offsets = []; + $timezoneIds = []; + + foreach (\DateTimeZone::listIdentifiers() as $timezoneId) { + $timezone = new \DateTimeZone($timezoneId); + $transition = $timezone->getTransitions($utc->getTimestamp(), $utc->getTimestamp()); + $abbr = $transition[0]['abbr']; + + $offset = round($timezone->getOffset($utc) / 60); + + if ($offset) { + $hour = floor($offset / 60); + $minutes = floor(abs($offset) % 60); + + $format = sprintf('%+d', $hour); + + if ($minutes) { + $format .= ':' . sprintf('%02u', $minutes); + } + } else { + $format = ''; + } + + $offsets[] = $offset; + $timezoneIds[] = $timezoneId; + $timezoneOptions[] = [ + 'value' => $timezoneId, + 'label' => 'UTC' . $format . ($abbr !== 'UTC' ? " ({$abbr})" : '') . ($timezoneId !== 'UTC' ? ' – ' . $timezoneId : ''), + ]; + } + + array_multisort($offsets, $timezoneIds, $timezoneOptions); + + $appended = [self::FLOATING_TIMEZONE => 'Floating Timezone (recommended)']; + $timezoneOptions = array_merge($appended, $timezoneOptions); + + return $timezoneOptions; + } + /** * @param array $array * @param int $keyOffset - reorders the array putting $keyOffset amount of elements at the end diff --git a/src/Library/Duration/DayDuration.php b/src/Library/Duration/DayDuration.php index 8b41fb2..ec13822 100644 --- a/src/Library/Duration/DayDuration.php +++ b/src/Library/Duration/DayDuration.php @@ -14,12 +14,12 @@ class DayDuration extends AbstractDuration */ protected function init(Carbon $targetDate) { - $startDate = Carbon::createFromTimestampUTC($targetDate->getTimestamp()); + $startDate = Carbon::createFromTimestamp($targetDate->getTimestamp()); $startDate->setTime(0, 0, 0); $endDate = $startDate->copy(); $endDate->setTime(23, 59, 59); - + $this->startDate = $startDate; $this->endDate = $endDate; } diff --git a/src/Library/Duration/HourDuration.php b/src/Library/Duration/HourDuration.php index 6047d2f..12fd4d6 100644 --- a/src/Library/Duration/HourDuration.php +++ b/src/Library/Duration/HourDuration.php @@ -14,14 +14,14 @@ class HourDuration extends AbstractDuration */ protected function init(Carbon $targetDate) { - $startDate = Carbon::createFromTimestampUTC($targetDate->getTimestamp()); + $startDate = Carbon::createFromTimestamp($targetDate->getTimestamp()); $startDate->minute = 0; $startDate->second = 0; $endDate = $startDate->copy(); $endDate->minute = 59; $endDate->second = 59; - + $this->startDate = $startDate; $this->endDate = $endDate; } diff --git a/src/Library/Duration/MonthDuration.php b/src/Library/Duration/MonthDuration.php index cff539f..5472724 100644 --- a/src/Library/Duration/MonthDuration.php +++ b/src/Library/Duration/MonthDuration.php @@ -11,7 +11,7 @@ class MonthDuration extends AbstractDuration */ protected function init(Carbon $targetDate) { - $startDate = Carbon::createFromTimestampUTC($targetDate->getTimestamp()); + $startDate = Carbon::createFromTimestamp($targetDate->getTimestamp()); $startDate->startOfMonth(); $endDate = $startDate->copy(); diff --git a/src/Library/Duration/WeekDuration.php b/src/Library/Duration/WeekDuration.php index 92862d4..c350de6 100644 --- a/src/Library/Duration/WeekDuration.php +++ b/src/Library/Duration/WeekDuration.php @@ -11,12 +11,12 @@ class WeekDuration extends AbstractDuration */ protected function init(Carbon $targetDate) { - $startDate = Carbon::createFromTimestampUTC($targetDate->getTimestamp()); + $startDate = Carbon::createFromTimestamp($targetDate->getTimestamp()); $startDate->startOfWeek(); $endDate = $startDate->copy(); $endDate->endOfWeek(); - + $this->startDate = $startDate; $this->endDate = $endDate; } diff --git a/src/Library/Export/AbstractExportCalendar.php b/src/Library/Export/AbstractExportCalendar.php index e0948db..b59adc2 100644 --- a/src/Library/Export/AbstractExportCalendar.php +++ b/src/Library/Export/AbstractExportCalendar.php @@ -9,12 +9,17 @@ abstract class AbstractExportCalendar implements ExportCalendarInterface /** @var EventQuery */ private $eventQuery; + /** @var array */ + private $options; + /** * @param EventQuery $events + * @param array $options */ - final public function __construct(EventQuery $events) + final public function __construct(EventQuery $events, array $options = []) { $this->eventQuery = $events; + $this->options = $options; } /** @@ -60,6 +65,17 @@ final protected function getEventQuery(): EventQuery return $this->eventQuery; } + /** + * @param string $key + * @param mixed $defaultValue + * + * @return mixed + */ + final protected function getOption($key, $defaultValue = null) + { + return $this->options[$key] ?? $defaultValue; + } + /** * @param string $string * diff --git a/src/Library/Export/ExportCalendarToIcs.php b/src/Library/Export/ExportCalendarToIcs.php index a8cc552..e0ed147 100644 --- a/src/Library/Export/ExportCalendarToIcs.php +++ b/src/Library/Export/ExportCalendarToIcs.php @@ -32,7 +32,7 @@ protected function prepareStringForExport(): string foreach ($events as $event) { $startDate = $event->getStartDate(); $exportString .= $this->combineExportString($event, $startDate); - + if ($event->getSelectDatesAsDates()) { foreach ($event->getSelectDatesAsDates() as $date) { $dateCarbon = Carbon::createFromTimestampUTC($date->getTimestamp()); @@ -41,7 +41,7 @@ protected function prepareStringForExport(): string $startDate->minute, $startDate->second ); - + $exportString .= $this->combineExportString($event, $dateCarbon); } } @@ -63,6 +63,7 @@ private function combineExportString(Event $event, Carbon $date): string $eventId = $event->getId(); $exportString = ''; + $timezone = $this->getOption('timezone', $event->getCalendar()->getIcsTimezone()); $dateDiff = $event->getStartDate()->diff($event->getEndDate()); $startDate = $date->copy(); @@ -71,15 +72,15 @@ private function combineExportString(Event $event, Carbon $date): string $event->getStartDate()->minute, $event->getStartDate()->second ); - $endDate = $startDate->copy()->add($dateDiff); + $endDate = $startDate->copy()->add($dateDiff); - $description = null; + $description = null; $descriptionFieldHandle = $event->getCalendar()->descriptionFieldHandle; if (isset($event->{$descriptionFieldHandle})) { $description = $event->{$descriptionFieldHandle}; } - $location = null; + $location = null; $locationFieldHandle = $event->getCalendar()->locationFieldHandle; if (isset($event->{$locationFieldHandle})) { $location = $event->{$locationFieldHandle}; @@ -104,9 +105,15 @@ private function combineExportString(Event $event, Carbon $date): string "DTEND;VALUE=DATE:%s\r\n", $endDate->copy()->addDay()->format(self::DATE_FORMAT) ); - } else { + } else if ($timezone === 'UTC') { + $exportString .= sprintf("DTSTART:%sZ\r\n", $startDate->format(self::DATE_TIME_FORMAT)); + $exportString .= sprintf("DTEND:%sZ\r\n", $endDate->format(self::DATE_TIME_FORMAT)); + } else if ($timezone === DateHelper::FLOATING_TIMEZONE) { $exportString .= sprintf("DTSTART:%s\r\n", $startDate->format(self::DATE_TIME_FORMAT)); $exportString .= sprintf("DTEND:%s\r\n", $endDate->format(self::DATE_TIME_FORMAT)); + } else { + $exportString .= sprintf("DTSTART;TZID=%s:%s\r\n", $timezone, $startDate->format(self::DATE_TIME_FORMAT)); + $exportString .= sprintf("DTEND;TZID=%s:%s\r\n", $timezone, $endDate->format(self::DATE_TIME_FORMAT)); } $selectDates = $event->getSelectDates(); @@ -116,7 +123,7 @@ private function combineExportString(Event $event, Carbon $date): string $exportString .= sprintf("%s\r\n", $rrule); - $exceptionDatesValues = array(); + $exceptionDatesValues = []; foreach ($event->getExceptionDateStrings() as $exceptionDate) { $exceptionDate = new Carbon($exceptionDate, DateHelper::UTC); if ($event->isAllDay()) { diff --git a/src/Models/CalendarModel.php b/src/Models/CalendarModel.php index b59fbdc..246cb4c 100644 --- a/src/Models/CalendarModel.php +++ b/src/Models/CalendarModel.php @@ -9,6 +9,7 @@ use Solspace\Calendar\Calendar; use Solspace\Calendar\Elements\Event; use Solspace\Calendar\Library\ColorHelper; +use Solspace\Calendar\Library\DateHelper; class CalendarModel extends Model implements \JsonSerializable { @@ -51,6 +52,9 @@ class CalendarModel extends Model implements \JsonSerializable /** @var string */ public $icsHash; + /** @var string */ + public $icsTimezone; + /** @var CalendarSiteSettingsModel[] */ private $siteSettings; @@ -66,6 +70,7 @@ public static function create(): CalendarModel $model->color = ColorHelper::randomColor(); $model->titleLabel = 'Title'; $model->hasTitleField = true; + $model->icsTimezone = DateHelper::FLOATING_TIMEZONE; return $model; } @@ -134,6 +139,14 @@ public function getIcsUrl() return str_replace($cpTrigger . '/', '', $url); } + /** + * @return string + */ + public function getIcsTimezone(): string + { + return $this->icsTimezone ?: DateHelper::FLOATING_TIMEZONE; + } + /** * @return array */ diff --git a/src/Records/CalendarRecord.php b/src/Records/CalendarRecord.php index a139452..693301b 100644 --- a/src/Records/CalendarRecord.php +++ b/src/Records/CalendarRecord.php @@ -19,6 +19,7 @@ * @property string $descriptionFieldHandle * @property string $locationFieldHandle * @property string $icsHash + * @property string $icsTimezone */ class CalendarRecord extends ActiveRecord { diff --git a/src/Resources/Bundles/EventIndexBundle.php b/src/Resources/Bundles/EventIndexBundle.php new file mode 100644 index 0000000..70bff9a --- /dev/null +++ b/src/Resources/Bundles/EventIndexBundle.php @@ -0,0 +1,22 @@ +d;d++)b.push(a[d]);else b.push(a);return b}function e(a,c){function e(a,c,g){if(!(this instanceof e))return new e(a,c);"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=d(a),this.options=b({},this.options),"function"==typeof c?g=c:b(this.options,c),g&&this.on("always",g),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var h=this;setTimeout(function(){h.check()})}function i(a){this.img=a}e.prototype=new a,e.prototype.options={},e.prototype.getImages=function(){this.images=[];for(var a=0,b=this.elements.length;b>a;a++){var c=this.elements[a];"IMG"===c.nodeName&&this.addImage(c);for(var d=c.querySelectorAll("img"),e=0,f=d.length;f>e;e++){var g=d[e];this.addImage(g)}}},e.prototype.addImage=function(a){var b=new i(a);this.images.push(b)},e.prototype.check=function(){function a(a,e){return b.options.debug&&h&&g.log("confirm",a,e),b.progress(a),c++,c===d&&b.complete(),!0}var b=this,c=0,d=this.images.length;if(this.hasAnyBroken=!1,!d)return void this.complete();for(var e=0;d>e;e++){var f=this.images[e];f.on("confirm",a),f.check()}},e.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded,this.emit("progress",this,a),this.jqDeferred&&this.jqDeferred.notify(this,a)},e.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emit(a,this),this.emit("always",this),this.jqDeferred){var b=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[b](this)}},f&&(f.fn.imagesLoaded=function(a,b){var c=new e(this,a,b);return c.jqDeferred.promise(f(this))});var j={};return i.prototype=new a,i.prototype.check=function(){var a=j[this.img.src];if(a)return void this.useCached(a);if(j[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var b=this.proxyImage=new Image;c.bind(b,"load",this),c.bind(b,"error",this),b.src=this.img.src},i.prototype.useCached=function(a){if(a.isConfirmed)this.confirm(a.isLoaded,"cached was confirmed");else{var b=this;a.on("confirm",function(a){return b.confirm(a.isLoaded,"cache emitted confirmed"),!0})}},i.prototype.confirm=function(a,b){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,b)},i.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},i.prototype.unbindProxyEvents=function(){c.unbind(this.proxyImage,"load",this),c.unbind(this.proxyImage,"error",this)},e}var f=a.jQuery,g=a.console,h="undefined"!=typeof g,i=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter","eventie"],e):a.imagesLoaded=e(a.EventEmitter,a.eventie)}(window); -//# sourceMappingURL=imagesloaded.pkg.min.js.map \ No newline at end of file diff --git a/src/Resources/js/lib/qtip/jquery.qtip.min.js b/src/Resources/js/lib/qtip/jquery.qtip.min.js index 73db762..956b056 100644 --- a/src/Resources/js/lib/qtip/jquery.qtip.min.js +++ b/src/Resources/js/lib/qtip/jquery.qtip.min.js @@ -2,4 +2,3 @@ !function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=F,this.elements={target:a},this._id=S+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:E,attr:e,onTooltip:E,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=E}function f(a){return a===F||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr||a.length||"object"===d.type(a)&&(a.jquery||a.then))}function h(a){var b,c,e,h;return f(a)?E:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?(c=g(b)?E:b,b=a.content={text:c}):c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==E,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,F,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||E)&&(b.title=E))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===D?{ready:D}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(R,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass(aa)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(D,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass(aa)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(W)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(E,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass(aa)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+S+" "))+"."+S,function(){var a=y.api[d.attr(this,U)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):F,p="html5"===f.metadata.type&&o?o[f.metadata.name]:F,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(D,{},y.defaults,f,"object"==typeof q?h(q):F,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===E||!j)return E;k.content.text=j}if(i.container.length||(i.container=m),i.target===E&&(i.target=n),k.show.target===E&&(k.show.target=n),k.show.solo===D&&(k.show.solo=i.container.closest("body")),k.hide.target===E&&(k.hide.target=n),k.position.viewport===D&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new A(i.at,D),i.my=new A(i.my),a.data(S))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===E)return E;return a.attr(T,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(ca,l).attr("title",""),g=new e(a,k,c,!!j),a.data(S,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+va.join(f+" ")+f).split(" "),h=0;if(ua[b])return a.css(ua[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return ua[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.qtip=a,this.init(a)}function w(a,b){this.options=b,this._ns="-modal",this.qtip=a,this.init(a)}function x(a){this._ns="ie6",this.qtip=a,this.init(a)}var y,z,A,B,C,D=!0,E=!1,F=null,G="x",H="y",I="width",J="height",K="top",L="left",M="bottom",N="right",O="center",P="flipinvert",Q="shift",R={},S="qtip",T="data-hasqtip",U="data-qtip-id",V=["ui-widget","ui-tooltip"],W="."+S,X="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),Y=S+"-fixed",Z=S+"-default",$=S+"-focus",_=S+"-hover",aa=S+"-disabled",ba="_replacedByqTip",ca="oldtitle",da={ie:function(){var a,c;for(a=4,c=b.createElement("div");(c.innerHTML="")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||E};z=e.prototype,z._when=function(a){return d.when.apply(d,a)},z.render=function(a){if(this.rendered||this.destroyed)return this;var b=this,c=this.options,e=this.cache,f=this.elements,g=c.content.text,h=c.content.title,i=c.content.button,j=c.position,k=[];return d.attr(this.target[0],"aria-describedby",this._id),e.posClass=this._createPosClass((this.position={my:j.my,at:j.at}).my),this.tooltip=f.tooltip=d("
",{id:this._id,"class":[S,Z,c.style.classes,e.posClass].join(" "),width:c.style.width||"",height:c.style.height||"",tracking:"mouse"===j.target&&j.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":E,"aria-describedby":this._id+"-content","aria-hidden":D}).toggleClass(aa,this.disabled).attr(U,this.id).data(S,this).appendTo(j.container).append(f.content=d("
",{"class":S+"-content",id:this._id+"-content","aria-atomic":D})),this.rendered=-1,this.positioning=D,h&&(this._createTitle(),d.isFunction(h)||k.push(this._updateTitle(h,E))),i&&this._createButton(),d.isFunction(g)||k.push(this._updateContent(g,E)),this.rendered=D,this._setWidget(),d.each(R,function(a){var c;"render"===this.initialize&&(c=this(b))&&(b.plugins[a]=c)}),this._unassignEvents(),this._assignEvents(),this._when(k).then(function(){b._trigger("render"),b.positioning=E,b.hiddenDuringWait||!c.show.ready&&!a||b.toggle(D,e.event,E),b.hiddenDuringWait=E}),y.api[this.id]=this,this},z.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=D;var a,b=this.target,c=b.attr(ca);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)this.timers.hasOwnProperty(a)&&clearTimeout(this.timers[a]);b.removeData(S).removeAttr(U).removeAttr(T).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(ca),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=F,delete y.api[this.id]}}return this.destroyed?this.target:(a===D&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},B=z.checks={builtin:{"^id$":function(a,b,c,e){var f=c===D?y.nextid:c,g=S+"-"+f;f!==E&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new A(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(D)||this.toggle(D))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(Z,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},z.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var ea=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,fa=/^prerender|show\.ready/i;z.set=function(a,b){if(this.destroyed)return this;var c,e=this.rendered,f=E,g=this.options;return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&fa.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=ea.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=D,d.each(a,d.proxy(j,this)),this.positioning=E,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?F:this.cache.event),this},z._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=D,a.then(function(a){return e.waiting=E,c._update(a,b)},F,function(a){return c._update(a,b)})):a===E||!a&&""!==a?E:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):E},z._waitForContent=function(a){var b=this.cache;return b.waiting=D,(d.fn.imagesLoaded?a.imagesLoaded():(new d.Deferred).resolve([])).done(function(){b.waiting=E}).promise()},z._updateContent=function(a,b){this._update(a,this.elements.content,b)},z._updateTitle=function(a,b){this._update(a,this.elements.title,b)===E&&this._removeTitle(E)},z._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("
",{"class":S+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("
",{id:b,"class":S+"-title","aria-atomic":D})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},z._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=F,a!==E&&this.reposition())},z._createPosClass=function(a){return S+"-pos-"+(a||this.options.position.my).abbrev()},z.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=D;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(E),u=k.outerHeight(E),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,B=d(a),C=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:L,y:K},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:L,y:K},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),C.body.offsetWidth!==(a.innerWidth||C.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-B.scrollLeft(),y.top-=(F.scrollY||0)-B.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=da.iOS?a.innerWidth:m.width(),w=da.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):R.imagemap&&m.is("area")?f=R.imagemap(this,m,o,R.viewport?s:E):R.svg&&m&&m[0].ownerSVGElement?f=R.svg(this,m,o,R.viewport?s:E):(v=m.outerWidth(E),w=m.outerHeight(E),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(da.iOS>3.1&&da.iOS<4.1||da.iOS>=4.3&&da.iOS<4.33||!da.iOS&&"fixed"===x)&&(y.left-=B.scrollLeft(),y.top-=B.scrollTop()),(!f||f&&f.adjustable!==E)&&(y.left+=o.x===N?v:o.x===O?v/2:0,y.top+=o.y===M?w:o.y===O?w/2:0)}return y.left+=r.x+(n.x===N?-t:n.x===O?-t/2:0),y.top+=r.y+(n.y===M?-u:n.y===O?-u/2:0),R.viewport?(h=y.adjusted=R.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&(j.posClass=i,k.removeClass(j.posClass).addClass(i)),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===E||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),da.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=E,this):this},z.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!da.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var ga=(A=z.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,O).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?H:G}).prototype;ga.invert=function(a,b){this[a]=this[a]===L?N:this[a]===N?L:b||this[a]},ga.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===H||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},ga.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},ga.clone=function(){return new A(this.string(),this.forceY)},z.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=D),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=this.options.position,n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?F:!!this._trigger(k,[90]),this.destroyed?this:(i!==E&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,E),d.isFunction(n.title)&&this._updateTitle(n.title,E),!C&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+S,this._storeMouse),C=D),o||g.css("width",g.outerWidth(E)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(W,l.solo)).not(g).not(l.target).qtip("hide",new d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,C&&!d(W+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+S),C=E),this.blur(c)),j=d.proxy(function(){a?(da.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===E||q===E?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},z.show=function(a){return this.toggle(D,a)},z.hide=function(a){return this.toggle(E,a)},z.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(W),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=y.zindex+b.length;return c.hasClass($)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+$).qtip("blur",a)),c.addClass($)[0].style.zIndex=f),this},z.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass($),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},z.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass(aa):this.disabled):"boolean"!=typeof a&&(a=D),this.rendered&&this.tooltip.toggleClass(aa,a).attr("aria-disabled",a),this.disabled=!!a,this)},z.enable=function(){return this.disable(E)},z._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),e.jquery?b.button=e:b.button=d("",{"class":"qtip-close "+(this.options.style.widget?"":S+"-icon"),title:g,"aria-label":g}).prepend(d("",{"class":"ui-icon ui-icon-close",html:"×"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass(aa)||a.hide(b),E})},z._updateButton=function(a){if(!this.rendered)return E;var b=this.elements.button;a?this._createButton():b.remove()},z._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass(aa);c.removeClass(aa),aa=a?"ui-state-disabled":"qtip-disabled",c.toggleClass(aa,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(Z,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(S+"-icon",!a)},z._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},z._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},z._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},z._trigger=function(a,b,c){var e=new d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||F,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=E,!e.isDefaultPrevented()},z._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},z._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?E:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=D}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):E}),(c.show.ready||c.prerender)&&b.call(this,a)},z._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=d(a),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(Y)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0,e=b.parents(W).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),y.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):E}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(aa)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},z._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(W,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(Y)&&!c.hasClass(aa)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(_,b)}),q("["+U+"]",X,o)}),y=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=F,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],S):F;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,S);if(!a)return D;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),E;a.set(b,e)}}),g!==F?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(D,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===E||c.length<1||y.api[c]?y.nextid++:c,b=r(d(this),c,k),b===E?D:(y.api[c]=b,d.each(R,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,y.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&f.options&&"object"==typeof f&&"object"==typeof f.options&&f.options.suppress)return arguments.length<2?d.attr(c,ca):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(ca,b))}return d.fn["attr"+ba].apply(this,arguments)},clone:function(a){var b=d.fn["clone"+ba].apply(this,arguments);return a||b.filter("["+ca+"]").attr("title",function(){return d.attr(this,ca)}).removeAttr(ca),b}},function(a,b){if(!b||d.fn[a+ba])return D;var c=d.fn[a+ba]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+ba]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(T))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+ba].apply(this,arguments)}),y.version="3.0.3",y.nextid=0,y.inactiveEvents=X,y.zindex=15e3,y.defaults={prerender:E,id:E,overwrite:D,suppress:D,content:{text:D,attr:"title",title:E,button:E},position:{my:"top left",at:"bottom right",target:E,container:E,viewport:E,adjust:{x:0,y:0,mouse:D,scroll:D,resize:D,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:E})}},show:{target:E,event:"mouseenter",effect:D,delay:90,solo:E,ready:E,autofocus:E},hide:{target:E,event:"mouseleave",effect:D,delay:0,fixed:E,inactive:E,leave:"window",distance:E},style:{classes:"",widget:E,width:E,height:E,def:D},events:{render:F,move:F,show:F,hide:F,toggle:F,visible:F,hidden:F,focus:F,blur:F}};var ha,ia,ja,ka,la,ma="margin",na="border",oa="color",pa="background-color",qa="transparent",ra=" !important",sa=!!b.createElement("canvas").getContext,ta=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,ua={},va=["Webkit","O","Moz","ms"];sa?(ka=a.devicePixelRatio||1,la=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),ja=ka/la):ia=function(a,b,c){return"'},d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("
",{"class":S+"-tip"}).prependTo(a.tooltip),sa?(b=d("").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=ia("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===K||a.y===O&&this.element.position().top+this.size[1]/2+this.options.offsetl&&!ta.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==D?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===H?[s(r.x===L?l:r.x===N?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===K?k[1]-q[1]:0)]:[s(r.x===L?k[0]-q[0]:0),s(r.y===K?l:r.y===M?k[1]-q[1]-l:(k[1]-q[1])/2)],sa?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,ja),i=this._calculateTip(r,this.size,ja),o.attr(I,k[0]*ja).attr(J,k[1]*ja),o.css(I,k[0]).css(J,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*ja,j[1]*ja),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===da.ie?2:1:0,o.css({coordsize:k[0]+l+" "+k[1]+l,antialias:""+(r.string().indexOf(O)>-1),left:j[0]-j[2]*Number(f===G),top:j[1]-j[2]*Number(f===H),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+k[1]+l,path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(ia("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==E&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return E;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j={}; return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===G&&e.reverse(),d.each(e,function(d,e){var h,k,l;e===O?(h=c===H?L:K,j[h]="50%",j[ma+"-"+h]=-Math.round(b[c===H?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h)))}),j[a[c]]-=b[c===G?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===Q&&j.precedance===b&&k[d]&&j[c]!==O?j.precedance=j.precedance===G?H:G:a!==Q&&k[d]&&(j[b]=j[b]===O?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===O?p[ma+"-"+b]=o[a]=g[ma+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=E),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:E,top:E,x:0,y:0},p={};this.corner.fixed!==D&&(e(m,G,H,L,N),e(n,H,G,K,M),j.string()===i.corner.string()&&i.cornerTop===k.top&&i.cornerLeft===k.left||this.update(j,E)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,o.left=m===Q&&!!k.left,o.left&&f(G,L,N),o.top=n===Q&&!!k.top,o.top&&f(H,K,M),this.element.css(p).toggle(!(o.x&&o.y||j.x===O&&o.y||j.y===O&&o.x)),d.left-=g.left.charAt?g.user:m!==Q||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==Q||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),ha=R.tip=function(a){return new v(a,a.options.style.tip)},ha.initialize="render",ha.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=D)}},B.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(D,y.defaults,{style:{tip:{corner:D,mimic:E,width:6,height:6,border:D,offset:0}}});var wa,xa,ya="qtip-modal",za="."+ya;xa=function(){function a(a){if(d.expr[":"].focusable)return d.expr[":"].focusable;var b,c,e,f=!isNaN(d.attr(a,"tabindex")),g=a.nodeName&&a.nodeName.toLowerCase();return"area"===g?(b=a.parentNode,c=b.name,a.href&&c&&"map"===b.nodeName.toLowerCase()?(e=d("img[usemap=#"+c+"]")[0],!!e&&e.is(":visible")):!1):/input|select|textarea|button|object/.test(g)?!a.disabled:"a"===g?a.href||f:f}function c(a){j.length<1&&a.length?a.not("body").blur():j.first().focus()}function e(a){if(h.is(":visible")){var b,e=d(a.target),g=f.tooltip,i=e.closest(W);b=i.length<1?E:parseInt(i[0].style.zIndex,10)>parseInt(g[0].style.zIndex,10),b||e.closest(W)[0]===g[0]||c(e)}}var f,g,h,i=this,j={};d.extend(i,{init:function(){return h=i.elem=d("
",{id:"qtip-overlay",html:"
",mousedown:function(){return E}}).hide(),d(b.body).bind("focusin"+za,e),d(b).bind("keydown"+za,function(a){f&&f.options.show.modal.escape&&27===a.keyCode&&f.hide(a)}),h.bind("click"+za,function(a){f&&f.options.show.modal.blur&&f.hide(a)}),i},update:function(b){f=b,j=b.options.show.modal.stealfocus!==E?b.tooltip.find("*").filter(function(){return a(this)}):[]},toggle:function(a,e,j){var k=a.tooltip,l=a.options.show.modal,m=l.effect,n=e?"show":"hide",o=h.is(":visible"),p=d(za).filter(":visible:not(:animated)").not(k);return i.update(a),e&&l.stealfocus!==E&&c(d(":focus")),h.toggleClass("blurs",l.blur),e&&h.appendTo(b.body),h.is(":animated")&&o===e&&g!==E||!e&&p.length?i:(h.stop(D,E),d.isFunction(m)?m.call(h,e):m===E?h[n]():h.fadeTo(parseInt(j,10)||90,e?1:0,function(){e||h.hide()}),e||h.queue(function(a){h.css({left:"",top:""}),d(za).length||h.detach(),a()}),g=e,f.destroyed&&(f=F),i)}}),i.init()},xa=new xa,d.extend(w.prototype,{init:function(a){var b=a.tooltip;return this.options.on?(a.elements.overlay=xa.elem,b.addClass(ya).css("z-index",y.modal_zindex+d(za).length),a._bind(b,["tooltipshow","tooltiphide"],function(a,c,e){var f=a.originalEvent;if(a.target===b[0])if(f&&"tooltiphide"===a.type&&/mouse(leave|enter)/.test(f.type)&&d(f.relatedTarget).closest(xa.elem[0]).length)try{a.preventDefault()}catch(g){}else(!f||f&&"tooltipsolo"!==f.type)&&this.toggle(a,"tooltipshow"===a.type,e)},this._ns,this),a._bind(b,"tooltipfocus",function(a,c){if(!a.isDefaultPrevented()&&a.target===b[0]){var e=d(za),f=y.modal_zindex+e.length,g=parseInt(b[0].style.zIndex,10);xa.elem[0].style.zIndex=f-1,e.each(function(){this.style.zIndex>g&&(this.style.zIndex-=1)}),e.filter("."+$).qtip("blur",a.originalEvent),b.addClass($)[0].style.zIndex=f,xa.update(c);try{a.preventDefault()}catch(h){}}},this._ns,this),void a._bind(b,"tooltiphide",function(a){a.target===b[0]&&d(za).filter(":visible").not(b).last().qtip("focus",a)},this._ns,this)):this},toggle:function(a,b,c){return a&&a.isDefaultPrevented()?this:void xa.toggle(this.qtip,!!b,c)},destroy:function(){this.qtip.tooltip.removeClass(ya),this.qtip._unbind(this.qtip.tooltip,this._ns),xa.toggle(this.qtip,E),delete this.qtip.elements.overlay}}),wa=R.modal=function(a){return new w(a,a.options.show.modal)},wa.sanitize=function(a){a.show&&("object"!=typeof a.show.modal?a.show.modal={on:!!a.show.modal}:"undefined"==typeof a.show.modal.on&&(a.show.modal.on=D))},y.modal_zindex=y.zindex-200,wa.initialize="render",B.modal={"^show.modal.(on|blur)$":function(){this.destroy(),this.init(),this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}},d.extend(D,y.defaults,{show:{modal:{on:E,effect:D,blur:D,stealfocus:D,escape:D}}}),R.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===Q,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===I?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===O?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===I?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===P?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===O?-C:C)+e,l.invert(a,g)),d[f]B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,C={left:0,top:0};return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||C,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(E),p=A[0]===a?A.height():A.outerHeight(E),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||C,"shift"===y&&"shift"===z||(l=u.clone()),C={left:"none"!==y?j(G,H,y,w.x,L,N,I,f,h):0,top:"none"!==z?j(H,G,z,w.y,K,M,J,g,i):0,my:l}):C},R.polys={polygon:function(a,b){var c,d,e,f={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:E},g=0,h=[],i=1,j=1,k=0,l=0;for(g=a.length;g--;)c=[parseInt(a[--g],10),parseInt(a[g+1],10)],c[0]>f.position.right&&(f.position.right=c[0]),c[0]f.position.bottom&&(f.position.bottom=c[1]),c[1]0&&e>0&&i>0&&j>0;)for(d=Math.floor(d/2),e=Math.floor(e/2),b.x===L?i=d:b.x===N?i=f.width-d:i+=Math.floor(d/2),b.y===K?j=e:b.y===M?j=f.height-e:j+=Math.floor(e/2),g=h.length;g--&&!(h.length<2);)k=h[g][0]-f.position.left,l=h[g][1]-f.position.top,(b.x===L&&k>=i||b.x===N&&i>=k||b.x===O&&(i>k||k>f.width-i)||b.y===K&&l>=j||b.y===M&&j>=l||b.y===O&&(j>l||l>f.height-j))&&h.splice(g,1);f.position={left:h[0][0],top:h[0][1]}}return f},rect:function(a,b,c,d){return{width:Math.abs(c-a),height:Math.abs(d-b),position:{left:Math.min(a,c),top:Math.min(b,d)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(a,b,c,d,e){var f=R.polys._angles[e.abbrev()],g=0===f?0:c*Math.cos(f*Math.PI),h=d*Math.sin(f*Math.PI);return{width:2*c-Math.abs(g),height:2*d-Math.abs(h),position:{left:a+g,top:b+h},adjustable:E}},circle:function(a,b,c,d){return R.polys.ellipse(a,b,c,c,d)}},R.svg=function(a,c,e){for(var f,g,h,i,j,k,l,m,n,o=c[0],p=d(o.ownerSVGElement),q=o.ownerDocument,r=(parseInt(c.css("stroke-width"),10)||0)/2;!o.getBBox;)o=o.parentNode;if(!o.getBBox||!o.parentNode)return E;switch(o.nodeName){case"ellipse":case"circle":m=R.polys.ellipse(o.cx.baseVal.value,o.cy.baseVal.value,(o.rx||o.r).baseVal.value+r,(o.ry||o.r).baseVal.value+r,e);break;case"line":case"polygon":case"polyline":for(l=o.points||[{x:o.x1.baseVal.value,y:o.y1.baseVal.value},{x:o.x2.baseVal.value,y:o.y2.baseVal.value}],m=[],k=-1,i=l.numberOfItems||l.length;++k';d.extend(x.prototype,{_scroll:function(){var b=this.qtip.elements.overlay;b&&(b[0].style.top=d(a).scrollTop()+"px")},init:function(c){var e=c.tooltip;d("select, object").length<1&&(this.bgiframe=c.elements.bgiframe=d(Ba).appendTo(e),c._bind(e,"tooltipmove",this.adjustBGIFrame,this._ns,this)),this.redrawContainer=d("
",{id:S+"-rcontainer"}).appendTo(b.body),c.elements.overlay&&c.elements.overlay.addClass("qtipmodal-ie6fix")&&(c._bind(a,["scroll","resize"],this._scroll,this._ns,this),c._bind(e,["tooltipshow"],this._scroll,this._ns,this)),this.redraw()},adjustBGIFrame:function(){var a,b,c=this.qtip.tooltip,d={height:c.outerHeight(E),width:c.outerWidth(E)},e=this.qtip.plugins.tip,f=this.qtip.elements.tip;b=parseInt(c.css("borderLeftWidth"),10)||0,b={left:-b,top:-b},e&&f&&(a="x"===e.corner.precedance?[I,L]:[J,K],b[a[1]]-=f[a[0]]()),this.bgiframe.css(b).css(d)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var a,b,c,d,e=this.qtip.tooltip,f=this.qtip.options.style,g=this.qtip.options.position.container;return this.qtip.drawing=1,f.height&&e.css(J,f.height),f.width?e.css(I,f.width):(e.css(I,"").appendTo(this.redrawContainer),b=e.width(),1>b%2&&(b+=1),c=e.css("maxWidth")||"",d=e.css("minWidth")||"",a=(c+d).indexOf("%")>-1?g.width()/100:0,c=(c.indexOf("%")>-1?a:1*parseInt(c,10))||b,d=(d.indexOf("%")>-1?a:1*parseInt(d,10))||0,b=c+d?Math.min(Math.max(b,d),c):b,e.css(I,Math.round(b)).appendTo(g)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove(),this.qtip._unbind([a,this.qtip.tooltip],this._ns)}}),Aa=R.ie6=function(a){return 6===da.ie?new x(a):E},Aa.initialize="render",B.ie6={"^content|style$":function(){this.redraw()}}})}(window,document); -//# sourceMappingURL=jquery.qtip.min.map \ No newline at end of file diff --git a/src/Resources/js/src/calendar-fullcalendar-methods.js b/src/Resources/js/src/calendar-fullcalendar-methods.js index 2d4c934..2fc9d7a 100644 --- a/src/Resources/js/src/calendar-fullcalendar-methods.js +++ b/src/Resources/js/src/calendar-fullcalendar-methods.js @@ -1 +1 @@ -"use strict";function _defineProperty(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}var _slicedToArray=function(){function e(e,n){var a=[],t=!0,r=!1,i=void 0;try{for(var l,o=e[Symbol.iterator]();!(t=(l=o.next()).done)&&(a.push(l.value),!n||a.length!==n);t=!0);}catch(d){r=!0,i=d}finally{try{!t&&o["return"]&&o["return"]()}finally{if(r)throw i}}return a}return function(n,a){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),$solspaceCalendar=$("#solspace-calendar"),$solspaceCalendarSpinner=null,renderEvent=function(e,n){if(e.allDay&&n.addClass("fc-event-all-day"),e.end){if(e.multiDay||e.allDay)n.addClass("fc-event-multi-day");else{n.addClass("fc-event-single-day");var a=$("").addClass("fc-color-icon").css("background-color",e.backgroundColor).css("border-color",e.borderColor);$(".fc-content",n).prepend(a)}e.enabled||n.addClass("fc-event-disabled"),n.addClass("fc-color-"+e.textColor),buildEventPopup(e,n)}},today=new moment,renderDay=function(e,n){var a=n.parents(".fc-bg:first").siblings(".fc-content-skeleton").find("thead > tr > td:eq("+n.index()+")"),t=getDayViewLink(e),r=$("").attr("href",t).html(a.html());a.html(r)},renderView=function(e,n){var a=new moment;if("agendaWeek"===e.name){var t=$(".fc-day-header.fc-widget-header",n);t.each(function(){var e=$(this).html(),n=e.split(" ");e=n[0]+" "+n[1]+"";var t=new moment($(this).data("date")),r=getDayViewLink(t),i=$("").attr("href",r).html(e);a.format("YYYYMMDD")===t.format("YYYYMMDD")&&i.addClass("fc-title-today"),$(this).html(i)})}$(".fc-localeButton-button",$solspaceCalendar).addClass("menubtn btn"),"agendaDay"===e.name&&$("thead.fc-head",n).remove()},eventRepositioned=function(e,n,a,t){$.ajax({url:Craft.getCpUrl("calendar/events/api/modify-"+e),type:"post",dataType:"json",data:_defineProperty({eventId:n.id,siteId:n.site.id,isAllDay:n.allDay,startDate:n.start.toISOString(),endDate:n.end?n.end.toISOString():null,deltaSeconds:a.as("seconds")},Craft.csrfTokenName,Craft.csrfTokenValue),success:function(e){e.error?t():n.repeats&&$calendar.fullCalendar("refetchEvents")},error:function(){t()}})},eventDateChange=function(e,n,a){eventRepositioned("date",e,n,a)},eventDurationChange=function(e,n,a){eventRepositioned("duration",e,n,a)},eventClick=function(e){window.location.href=Craft.getCpUrl("calendar/events/"+e.id+"/"+e.site.handle)},getDayViewLink=function(e){if(e.isValid()){var n=e.format("YYYY"),a=e.format("MM"),t=e.format("DD");return Craft.getCpUrl("calendar/view/day/"+n+"/"+a+"/"+t)}return""},getEvents=function(e,n,a,t){getSpinner().fadeIn("fast");var r=$("ul.calendar-list"),i="*";r.length&&(i=$("input:checked",r).map(function(){return $(this).val()}).get().join());var l=$calendar.data(),o=l.currentSiteId;$.ajax({url:Craft.getCpUrl("calendar/month"),data:_defineProperty({rangeStart:e.toISOString(),rangeEnd:n.toISOString(),calendars:i,siteId:o},Craft.csrfTokenName,Craft.csrfTokenValue),type:"post",dataType:"json",success:function(e){var n=!0,a=!1,r=void 0;try{for(var i,l=e.entries()[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var o=_slicedToArray(i.value,2),d=o[0],s=o[1];s.allDay&&(e[d].end=moment(s.end).add(2,"s").utc().format())}}catch(c){a=!0,r=c}finally{try{!n&&l["return"]&&l["return"]()}finally{if(a)throw r}}t(e),getSpinner().fadeOut("fast")}})},closeAllQTips=function(){qTipsEnabled=!1,$("div.qtip:visible").qtip("hide")},enableQTips=function(){qTipsEnabled=!0},getSpinner=function(){return $solspaceCalendarSpinner||($solspaceCalendar.find(".fc-right").prepend(''),$solspaceCalendarSpinner=$("#solspace-calendar-spinner")),$solspaceCalendarSpinner}; \ No newline at end of file +"use strict";function _defineProperty(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}var _slicedToArray=function(){function e(e,a){var n=[],t=!0,r=!1,i=void 0;try{for(var l,d=e[Symbol.iterator]();!(t=(l=d.next()).done)&&(n.push(l.value),!a||n.length!==a);t=!0);}catch(o){r=!0,i=o}finally{try{!t&&d["return"]&&d["return"]()}finally{if(r)throw i}}return n}return function(a,n){if(Array.isArray(a))return a;if(Symbol.iterator in Object(a))return e(a,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),$solspaceCalendar=$("#solspace-calendar"),$solspaceCalendarSpinner=null,renderEvent=function(e,a){if(e.allDay&&a.addClass("fc-event-all-day"),e.end){if(e.multiDay||e.allDay)a.addClass("fc-event-multi-day");else{a.addClass("fc-event-single-day");var n=$("").addClass("fc-color-icon").css("background-color",e.backgroundColor).css("border-color",e.borderColor);$(".fc-content",a).prepend(n)}e.enabled||a.addClass("fc-event-disabled"),a.addClass("fc-color-"+e.textColor),buildEventPopup(e,a)}},today=new moment,renderDay=function(e,a){var n=a.parents(".fc-bg:first").siblings(".fc-content-skeleton").find("thead > tr > td:eq("+a.index()+")"),t=getDayViewLink(e),r=$("").attr("href",t).html(n.html());n.html(r)},renderView=function(e,a){var n=a.parents("#solspace-calendar"),t=new moment(n.data("current-day"));if("agendaWeek"===e.name){var r=$(".fc-day-header.fc-widget-header",a);r.each(function(){var e=$(this).html(),a=e.split(" ");e=a[0]+" "+a[1]+"";var n=new moment($(this).data("date")),r=getDayViewLink(n),i=$("").attr("href",r).html(e);t.format("YYYYMMDD")===n.format("YYYYMMDD")&&i.addClass("fc-title-today"),$(this).html(i)})}$(".fc-localeButton-button",$solspaceCalendar).addClass("menubtn btn"),"agendaDay"===e.name&&$("thead.fc-head",a).remove()},eventRepositioned=function(e,a,n,t){$.ajax({url:Craft.getCpUrl("calendar/events/api/modify-"+e),type:"post",dataType:"json",data:_defineProperty({eventId:a.id,siteId:a.site.id,isAllDay:a.allDay,startDate:a.start.toISOString(),endDate:a.end?a.end.toISOString():null,deltaSeconds:n.as("seconds")},Craft.csrfTokenName,Craft.csrfTokenValue),success:function(e){e.error?t():a.repeats&&$calendar.fullCalendar("refetchEvents")},error:function(){t()}})},eventDateChange=function(e,a,n){eventRepositioned("date",e,a,n)},eventDurationChange=function(e,a,n){eventRepositioned("duration",e,a,n)},eventClick=function(e){window.location.href=Craft.getCpUrl("calendar/events/"+e.id+"/"+e.site.handle)},getDayViewLink=function(e){if(e.isValid()){var a=e.format("YYYY"),n=e.format("MM"),t=e.format("DD");return Craft.getCpUrl("calendar/view/day/"+a+"/"+n+"/"+t)}return""},getEvents=function(e,a,n,t){getSpinner().fadeIn("fast");var r=$("ul.calendar-list"),i="*";r.length&&(i=$("input:checked",r).map(function(){return $(this).val()}).get().join());var l=$calendar.data(),d=l.currentSiteId;$.ajax({url:Craft.getCpUrl("calendar/month"),data:_defineProperty({rangeStart:e.toISOString(),rangeEnd:a.toISOString(),calendars:i,siteId:d},Craft.csrfTokenName,Craft.csrfTokenValue),type:"post",dataType:"json",success:function(e){var a=!0,n=!1,r=void 0;try{for(var i,l=e.entries()[Symbol.iterator]();!(a=(i=l.next()).done);a=!0){var d=_slicedToArray(i.value,2),o=d[0],s=d[1];s.allDay&&(e[o].end=moment(s.end).add(2,"s").utc().format())}}catch(c){n=!0,r=c}finally{try{!a&&l["return"]&&l["return"]()}finally{if(n)throw r}}t(e),getSpinner().fadeOut("fast")}})},closeAllQTips=function(){qTipsEnabled=!1,$("div.qtip:visible").qtip("hide")},enableQTips=function(){qTipsEnabled=!0},getSpinner=function(){return $solspaceCalendarSpinner||($solspaceCalendar.find(".fc-right").prepend(''),$solspaceCalendarSpinner=$("#solspace-calendar-spinner")),$solspaceCalendarSpinner}; \ No newline at end of file diff --git a/src/Resources/js/src/calendar.js b/src/Resources/js/src/calendar.js index c326595..561c730 100644 --- a/src/Resources/js/src/calendar.js +++ b/src/Resources/js/src/calendar.js @@ -1 +1 @@ -"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},viewSpecificOptions={week:{titleFormat:"MMMM D, YYYY",columnFormat:"ddd D",timeFormat:"LT",slotLabelFormat:"LT"},day:{titleFormat:"dddd, MMMM D, YYYY",columnFormat:"",timeFormat:"LT",slotLabelFormat:"LT"}},selectedCalendarsStorageKey="calendar-selectedCalendars",qTipsEnabled=!0,$calendar=$("#solspace-calendar"),$miniCal=$("#calendar-mini-cal");$(function(){var e=$calendar.data(),a=e.currentDay,t=e.siteMap,n=e.overlapThreshold,r=e.language,l=e.firstDayOfWeek,d=$calendar.data(),i=d.currentSiteId,c=d.canEditEvents,o=d.canQuickCreate,s=d.isMultiSite;c=void 0!==c,o=void 0!==o,s=void 0!==s;var u=new moment;void 0!==("undefined"==typeof a?"undefined":_typeof(a))&&(u=new moment(a));var f={refresh:{text:Craft.t("calendar","Refresh"),click:function(){$calendar.fullCalendar("refetchEvents")}},Today:{text:Craft.t("calendar","Today"),click:function(){$calendar.fullCalendar("today")}}};s&&(f.siteButton={text:t[i],click:function(e){var a=$(".fc-siteButton-button",$calendar);if(void 0===a.data("initialized")){var n=$("
",{"class":"menu"}).insertAfter(e.currentTarget),r=$("