894 lines
66 KiB
Text
894 lines
66 KiB
Text
/*!
|
|
* jQuery UI date range picker widget
|
|
* Copyright (c) 2017 Tamble, Inc.
|
|
* Licensed under MIT (https://github.com/tamble/jquery-ui-daterangepicker/raw/master/LICENSE.txt)
|
|
*
|
|
* Depends:
|
|
* - jQuery 1.8.3+
|
|
* - jQuery UI 1.9.0+ (widget factory, position utility, button, menu, datepicker)
|
|
* - moment.js 2.3.0+
|
|
*/
|
|
|
|
(function($, window, undefined) {
|
|
|
|
var uniqueId = 0; // used for unique ID generation within multiple plugin instances
|
|
|
|
$.widget('comiseo.daterangepicker', {
|
|
version: '0.6.0-beta.1',
|
|
|
|
options: {
|
|
// presetRanges: array of objects; each object describes an item in the presets menu
|
|
// and must have the properties: text, dateStart, dateEnd.
|
|
// dateStart, dateEnd are functions returning a moment object
|
|
presetRanges: [
|
|
{text: 'Today', dateStart: function() { return moment() }, dateEnd: function() { return moment() } },
|
|
{text: 'Yesterday', dateStart: function() { return moment().subtract('days', 1) }, dateEnd: function() { return moment().subtract('days', 1) } },
|
|
{text: 'Last 7 Days', dateStart: function() { return moment().subtract('days', 6) }, dateEnd: function() { return moment() } },
|
|
{text: 'Last Week (Mo-Su)', dateStart: function() { return moment().subtract('days', 7).isoWeekday(1) }, dateEnd: function() { return moment().subtract('days', 7).isoWeekday(7) } },
|
|
{text: 'Month to Date', dateStart: function() { return moment().startOf('month') }, dateEnd: function() { return moment() } },
|
|
{text: 'Previous Month', dateStart: function() { return moment().subtract('month', 1).startOf('month') }, dateEnd: function() { return moment().subtract('month', 1).endOf('month') } },
|
|
{text: 'Year to Date', dateStart: function() { return moment().startOf('year') }, dateEnd: function() { return moment() } }
|
|
],
|
|
initialText: 'Select date range...', // placeholder text - shown when nothing is selected
|
|
icon: 'ui-icon-triangle-1-s',
|
|
applyButtonText: 'Apply', // use '' to get rid of the button
|
|
clearButtonText: 'Clear', // use '' to get rid of the button
|
|
cancelButtonText: 'Cancel', // use '' to get rid of the button
|
|
rangeSplitter: ' - ', // string to use between dates
|
|
dateFormat: 'M d, yy', // displayed date format. Available formats: http://api.jqueryui.com/datepicker/#utility-formatDate
|
|
altFormat: 'yy-mm-dd', // submitted date format - inside JSON {"start":"...","end":"..."}
|
|
verticalOffset: 0, // offset of the dropdown relative to the closest edge of the trigger button
|
|
mirrorOnCollision: true, // reverse layout when there is not enough space on the right
|
|
autoFitCalendars: true, // override datepicker's numberOfMonths option in order to fit widget width
|
|
applyOnMenuSelect: true, // whether to auto apply menu selections
|
|
open: null, // callback that executes when the dropdown opens
|
|
close: null, // callback that executes when the dropdown closes
|
|
change: null, // callback that executes when the date range changes
|
|
clear: null, // callback that executes when the clear button is used
|
|
cancel: null, // callback that executes when the cancel button is used
|
|
onOpen: null, // @deprecated callback that executes when the dropdown opens
|
|
onClose: null, // @deprecated callback that executes when the dropdown closes
|
|
onChange: null, // @deprecated callback that executes when the date range changes
|
|
onClear: null, // @deprecated callback that executes when the clear button is used
|
|
datepickerOptions: { // object containing datepicker options. See http://api.jqueryui.com/datepicker/#options
|
|
numberOfMonths: 3,
|
|
// showCurrentAtPos: 1 // bug; use maxDate instead
|
|
maxDate: 0 // the maximum selectable date is today (also current month is displayed on the last position)
|
|
}
|
|
},
|
|
|
|
_create: function() {
|
|
this._dateRangePicker = buildDateRangePicker(this.element, this, this.options);
|
|
},
|
|
|
|
_destroy: function() {
|
|
this._dateRangePicker.destroy();
|
|
},
|
|
|
|
_setOptions: function(options) {
|
|
this._super(options);
|
|
this._dateRangePicker.enforceOptions();
|
|
},
|
|
|
|
open: function() {
|
|
this._dateRangePicker.open();
|
|
},
|
|
|
|
close: function() {
|
|
this._dateRangePicker.close();
|
|
},
|
|
|
|
setRange: function(range) {
|
|
this._dateRangePicker.setRange(range);
|
|
},
|
|
|
|
getRange: function() {
|
|
return this._dateRangePicker.getRange();
|
|
},
|
|
|
|
clearRange: function() {
|
|
this._dateRangePicker.clearRange();
|
|
},
|
|
|
|
widget: function() {
|
|
return this._dateRangePicker.getContainer();
|
|
}
|
|
});
|
|
|
|
/**
|
|
* factory for the trigger button (which visually replaces the original input form element)
|
|
*
|
|
* @param {jQuery} $originalElement jQuery object containing the input form element used to instantiate this widget instance
|
|
* @param {String} classnameContext classname of the parent container
|
|
* @param {Object} options
|
|
*/
|
|
function buildTriggerButton($originalElement, classnameContext, options) {
|
|
var $self, id;
|
|
|
|
function fixReferences() {
|
|
id = 'drp_autogen' + uniqueId++;
|
|
$('label[for="' + $originalElement.attr('id') + '"]')
|
|
.attr('for', id);
|
|
}
|
|
function fixButton() {
|
|
if ($.fn.button.noConflict) {
|
|
var btn = $.fn.button.noConflict(); // reverts $.fn.button to jqueryui btn
|
|
$.fn.btn = btn; // assigns bootstrap button functionality to $.fn.btn
|
|
}
|
|
}
|
|
|
|
function init() {
|
|
fixReferences();
|
|
fixButton();
|
|
$self = $('<button type="button"></button>')
|
|
.addClass(classnameContext + '-triggerbutton')
|
|
.attr({'title': $originalElement.attr('title'), 'tabindex': $originalElement.attr('tabindex'), id: id})
|
|
.button({
|
|
icons: {
|
|
secondary: options.icon
|
|
},
|
|
icon: options.icon,
|
|
iconPosition: 'end',
|
|
label: options.initialText
|
|
});
|
|
}
|
|
|
|
function getLabel() {
|
|
return $self.button('option', 'label');
|
|
}
|
|
|
|
function setLabel(value) {
|
|
$self.button('option', 'label', value);
|
|
}
|
|
|
|
function reset() {
|
|
$originalElement.val('').change();
|
|
setLabel(options.initialText);
|
|
}
|
|
|
|
function enforceOptions() {
|
|
$self.button('option', {
|
|
icons: {
|
|
secondary: options.icon
|
|
},
|
|
icon: options.icon,
|
|
iconPosition: 'end',
|
|
label: options.initialText
|
|
});
|
|
}
|
|
|
|
init();
|
|
return {
|
|
getElement: function() { return $self; },
|
|
getLabel: getLabel,
|
|
setLabel: setLabel,
|
|
reset: reset,
|
|
enforceOptions: enforceOptions
|
|
};
|
|
}
|
|
|
|
/**
|
|
* factory for the presets menu (containing built-in date ranges)
|
|
*
|
|
* @param {String} classnameContext classname of the parent container
|
|
* @param {Object} options
|
|
* @param {Function} onClick callback that executes when a preset is clicked
|
|
*/
|
|
function buildPresetsMenu(classnameContext, options, onClick) {
|
|
var $self,
|
|
$menu,
|
|
menuItemWrapper;
|
|
|
|
function init() {
|
|
$self = $('<div></div>')
|
|
.addClass(classnameContext + '-presets');
|
|
|
|
$menu = $('<ul></ul>');
|
|
|
|
if ($.ui.menu.prototype.options.items === undefined) {
|
|
menuItemWrapper = {start: '<li><a href="#">', end: '</a></li>'};
|
|
} else {
|
|
menuItemWrapper = {start: '<li><div>', end: '</div></li>'};
|
|
}
|
|
|
|
$.each(options.presetRanges, function() {
|
|
$(menuItemWrapper.start + this.text + menuItemWrapper.end)
|
|
.data('dateStart', this.dateStart)
|
|
.data('dateEnd', this.dateEnd)
|
|
.click(onClick)
|
|
.appendTo($menu);
|
|
});
|
|
|
|
$self.append($menu);
|
|
|
|
$menu.menu()
|
|
.data('ui-menu').delay = 0; // disable submenu delays
|
|
}
|
|
|
|
init();
|
|
return {
|
|
getElement: function() { return $self; }
|
|
};
|
|
}
|
|
|
|
/**
|
|
* factory for the multiple month date picker
|
|
*
|
|
* @param {String} classnameContext classname of the parent container
|
|
* @param {Object} options
|
|
*/
|
|
function buildCalendar(classnameContext, options) {
|
|
var $self,
|
|
range = {start: null, end: null}; // selected range
|
|
|
|
function init() {
|
|
$self = $('<div></div>', {'class': classnameContext + '-calendar ui-widget-content'});
|
|
|
|
$self.datepicker($.extend({}, options.datepickerOptions, {beforeShowDay: beforeShowDay, onSelect: onSelectDay}));
|
|
updateAtMidnight();
|
|
}
|
|
|
|
function enforceOptions() {
|
|
$self.datepicker('option', $.extend({}, options.datepickerOptions, {beforeShowDay: beforeShowDay, onSelect: onSelectDay}));
|
|
}
|
|
|
|
// called when a day is selected
|
|
function onSelectDay(dateText, instance) {
|
|
var dateFormat = options.datepickerOptions.dateFormat || $.datepicker._defaults.dateFormat,
|
|
selectedDate = $.datepicker.parseDate(dateFormat, dateText);
|
|
|
|
if (!range.start || range.end) { // start not set, or both already set
|
|
range.start = selectedDate;
|
|
range.end = null;
|
|
} else if (selectedDate < range.start) { // start set, but selected date is earlier
|
|
range.end = range.start;
|
|
range.start = selectedDate;
|
|
} else {
|
|
range.end = selectedDate;
|
|
}
|
|
if (options.datepickerOptions.hasOwnProperty('onSelect')) {
|
|
options.datepickerOptions.onSelect(dateText, instance);
|
|
}
|
|
}
|
|
|
|
// called for each day in the datepicker before it is displayed
|
|
function beforeShowDay(date) {
|
|
var result = [
|
|
true, // selectable
|
|
range.start && ((+date === +range.start) || (range.end && range.start <= date && date <= range.end)) ? 'ui-state-highlight' : '' // class to be added
|
|
],
|
|
userResult = [true, '', ''];
|
|
|
|
if (options.datepickerOptions.hasOwnProperty('beforeShowDay')) {
|
|
userResult = options.datepickerOptions.beforeShowDay(date);
|
|
}
|
|
return [
|
|
result[0] && userResult[0],
|
|
result[1] + ' ' + userResult[1],
|
|
userResult[2]
|
|
];
|
|
}
|
|
|
|
function updateAtMidnight() {
|
|
setTimeout(function() {
|
|
refresh();
|
|
updateAtMidnight();
|
|
}, moment().endOf('day') - moment());
|
|
}
|
|
|
|
function scrollToRangeStart() {
|
|
if (range.start) {
|
|
$self.datepicker('setDate', range.start);
|
|
}
|
|
}
|
|
|
|
function refresh() {
|
|
$self.datepicker('refresh');
|
|
$self.datepicker('setDate', null); // clear the selected date
|
|
}
|
|
|
|
function reset() {
|
|
range = {start: null, end: null};
|
|
refresh();
|
|
}
|
|
|
|
init();
|
|
return {
|
|
getElement: function() { return $self; },
|
|
scrollToRangeStart: function() { return scrollToRangeStart(); },
|
|
getRange: function() { return range; },
|
|
setRange: function(value) { range = value; refresh(); },
|
|
refresh: refresh,
|
|
reset: reset,
|
|
enforceOptions: enforceOptions
|
|
};
|
|
}
|
|
|
|
/**
|
|
* factory for the button panel
|
|
*
|
|
* @param {String} classnameContext classname of the parent container
|
|
* @param {Object} options
|
|
* @param {Object} handlers contains callbacks for each button
|
|
*/
|
|
function buildButtonPanel(classnameContext, options, handlers) {
|
|
var $self,
|
|
applyButton,
|
|
clearButton,
|
|
cancelButton;
|
|
|
|
function init() {
|
|
$self = $('<div></div>')
|
|
.addClass(classnameContext + '-buttonpanel');
|
|
|
|
if (options.applyButtonText) {
|
|
applyButton = $('<button type="button" class="ui-priority-primary"></button>')
|
|
.text(options.applyButtonText)
|
|
.button();
|
|
|
|
$self.append(applyButton);
|
|
}
|
|
|
|
if (options.clearButtonText) {
|
|
clearButton = $('<button type="button" class="ui-priority-secondary"></button>')
|
|
.text(options.clearButtonText)
|
|
.button();
|
|
|
|
$self.append(clearButton);
|
|
}
|
|
|
|
if (options.cancelButtonText) {
|
|
cancelButton = $('<button type="button" class="ui-priority-secondary"></button>')
|
|
.text(options.cancelButtonText)
|
|
.button();
|
|
|
|
$self.append(cancelButton);
|
|
}
|
|
|
|
bindEvents();
|
|
}
|
|
|
|
function enforceOptions() {
|
|
if (applyButton) {
|
|
applyButton.button('option', 'label', options.applyButtonText);
|
|
}
|
|
|
|
if (clearButton) {
|
|
clearButton.button('option', 'label', options.clearButtonText);
|
|
}
|
|
|
|
if (cancelButton) {
|
|
cancelButton.button('option', 'label', options.cancelButtonText);
|
|
}
|
|
}
|
|
|
|
function bindEvents() {
|
|
if (handlers) {
|
|
if (applyButton) {
|
|
applyButton.click(handlers.onApply);
|
|
}
|
|
|
|
if (clearButton) {
|
|
clearButton.click(handlers.onClear);
|
|
}
|
|
|
|
if (cancelButton) {
|
|
cancelButton.click(handlers.onCancel);
|
|
}
|
|
}
|
|
}
|
|
|
|
init();
|
|
return {
|
|
getElement: function() { return $self; },
|
|
enforceOptions: enforceOptions
|
|
};
|
|
}
|
|
|
|
/**
|
|
* factory for the widget
|
|
*
|
|
* @param {jQuery} $originalElement jQuery object containing the input form element used to instantiate this widget instance
|
|
* @param {Object} instance
|
|
* @param {Object} options
|
|
*/
|
|
function buildDateRangePicker($originalElement, instance, options) {
|
|
var classname = 'comiseo-daterangepicker',
|
|
$container, // the dropdown
|
|
$mask, // ui helper (z-index fix)
|
|
triggerButton,
|
|
presetsMenu,
|
|
calendar,
|
|
buttonPanel,
|
|
isOpen = false,
|
|
autoFitNeeded = false,
|
|
LEFT = 0,
|
|
RIGHT = 1,
|
|
TOP = 2,
|
|
BOTTOM = 3,
|
|
sides = ['left', 'right', 'top', 'bottom'],
|
|
hSide = RIGHT, // initialized to pick layout styles from CSS
|
|
vSide = null;
|
|
|
|
function init() {
|
|
triggerButton = buildTriggerButton($originalElement, classname, options);
|
|
presetsMenu = buildPresetsMenu(classname, options, usePreset);
|
|
calendar = buildCalendar(classname, options);
|
|
autoFit.numberOfMonths = options.datepickerOptions.numberOfMonths; // save initial option!
|
|
if (autoFit.numberOfMonths instanceof Array) { // not implemented
|
|
options.autoFitCalendars = false;
|
|
}
|
|
buttonPanel = buildButtonPanel(classname, options, {
|
|
onApply: function (event) {
|
|
close(event);
|
|
setRange(null, event);
|
|
},
|
|
onClear: function (event) {
|
|
close(event);
|
|
clearRange(event);
|
|
},
|
|
onCancel: function (event) {
|
|
instance._trigger('cancel', event, {instance: instance});
|
|
close(event);
|
|
reset();
|
|
}
|
|
});
|
|
render();
|
|
autoFit();
|
|
reset();
|
|
bindEvents();
|
|
}
|
|
|
|
function render() {
|
|
$container = $('<div></div>', {'class': classname + ' ' + classname + '-' + sides[hSide] + ' ui-widget ui-widget-content ui-corner-all ui-front'})
|
|
.append($('<div></div>', {'class': classname + '-main ui-widget-content'})
|
|
.append(presetsMenu.getElement())
|
|
.append(calendar.getElement()))
|
|
.append($('<div class="ui-helper-clearfix"></div>')
|
|
.append(buttonPanel.getElement()))
|
|
.hide();
|
|
$originalElement.hide().after(triggerButton.getElement());
|
|
$mask = $('<div></div>', {'class': 'ui-front ' + classname + '-mask'}).hide();
|
|
$('body').append($mask).append($container);
|
|
}
|
|
|
|
// auto adjusts the number of months in the date picker
|
|
function autoFit() {
|
|
if (options.autoFitCalendars) {
|
|
var maxWidth = $(window).width(),
|
|
initialWidth = $container.outerWidth(true),
|
|
$calendar = calendar.getElement(),
|
|
numberOfMonths = $calendar.datepicker('option', 'numberOfMonths'),
|
|
initialNumberOfMonths = numberOfMonths;
|
|
|
|
if (initialWidth > maxWidth) {
|
|
while (numberOfMonths > 1 && $container.outerWidth(true) > maxWidth) {
|
|
$calendar.datepicker('option', 'numberOfMonths', --numberOfMonths);
|
|
}
|
|
if (numberOfMonths !== initialNumberOfMonths) {
|
|
autoFit.monthWidth = (initialWidth - $container.outerWidth(true)) / (initialNumberOfMonths - numberOfMonths);
|
|
}
|
|
} else {
|
|
while (numberOfMonths < autoFit.numberOfMonths && (maxWidth - $container.outerWidth(true)) >= autoFit.monthWidth) {
|
|
$calendar.datepicker('option', 'numberOfMonths', ++numberOfMonths);
|
|
}
|
|
}
|
|
reposition();
|
|
autoFitNeeded = false;
|
|
}
|
|
}
|
|
|
|
function destroy() {
|
|
$container.remove();
|
|
triggerButton.getElement().remove();
|
|
$originalElement.show();
|
|
}
|
|
|
|
function bindEvents() {
|
|
triggerButton.getElement().click(toggle);
|
|
triggerButton.getElement().keydown(keyPressTriggerOpenOrClose);
|
|
$mask.click(function(event) {
|
|
close(event);
|
|
reset();
|
|
});
|
|
$(window).resize(function() { isOpen ? autoFit() : autoFitNeeded = true; });
|
|
}
|
|
|
|
function formatRangeForDisplay(range) {
|
|
var dateFormat = options.dateFormat;
|
|
return $.datepicker.formatDate(dateFormat, range.start) + (+range.end !== +range.start ? options.rangeSplitter + $.datepicker.formatDate(dateFormat, range.end) : '');
|
|
}
|
|
|
|
// formats a date range as JSON
|
|
function formatRange(range) {
|
|
var dateFormat = options.altFormat,
|
|
formattedRange = {};
|
|
formattedRange.start = $.datepicker.formatDate(dateFormat, range.start);
|
|
formattedRange.end = $.datepicker.formatDate(dateFormat, range.end);
|
|
return JSON.stringify(formattedRange);
|
|
}
|
|
|
|
// parses a date range in JSON format
|
|
function parseRange(text) {
|
|
var dateFormat = options.altFormat,
|
|
range = null;
|
|
if (text) {
|
|
try {
|
|
range = JSON.parse(text, function(key, value) {
|
|
return key ? $.datepicker.parseDate(dateFormat, value) : value;
|
|
});
|
|
} catch (e) {
|
|
}
|
|
}
|
|
return range;
|
|
}
|
|
|
|
function reset() {
|
|
var range = getRange();
|
|
if (range) {
|
|
triggerButton.setLabel(formatRangeForDisplay(range));
|
|
calendar.setRange(range);
|
|
} else {
|
|
calendar.reset();
|
|
}
|
|
}
|
|
|
|
function setRange(value, event) {
|
|
var range = value || calendar.getRange();
|
|
if (!range.start) {
|
|
return;
|
|
}
|
|
if (!range.end) {
|
|
range.end = range.start;
|
|
}
|
|
value && calendar.setRange(range);
|
|
triggerButton.setLabel(formatRangeForDisplay(range));
|
|
$originalElement.val(formatRange(range)).change();
|
|
if (options.onChange) {
|
|
options.onChange();
|
|
}
|
|
instance._trigger('change', event, {instance: instance});
|
|
}
|
|
|
|
function getRange() {
|
|
return parseRange($originalElement.val());
|
|
}
|
|
|
|
function clearRange(event) {
|
|
triggerButton.reset();
|
|
calendar.reset();
|
|
if (options.onClear) {
|
|
options.onClear();
|
|
}
|
|
instance._trigger('clear', event, {instance: instance});
|
|
}
|
|
|
|
// callback - used when the user clicks a preset range
|
|
function usePreset(event) {
|
|
var $this = $(this),
|
|
start = $this.data('dateStart')().startOf('day').toDate(),
|
|
end = $this.data('dateEnd')().startOf('day').toDate();
|
|
calendar.setRange({ start: start, end: end });
|
|
if (options.applyOnMenuSelect) {
|
|
close(event);
|
|
setRange(null, event);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// adjusts dropdown's position taking into account the available space
|
|
function reposition() {
|
|
$container.position({
|
|
my: 'left top',
|
|
at: 'left bottom' + (options.verticalOffset < 0 ? options.verticalOffset : '+' + options.verticalOffset),
|
|
of: triggerButton.getElement(),
|
|
collision : 'flipfit flipfit',
|
|
using: function(coords, feedback) {
|
|
var containerCenterX = feedback.element.left + feedback.element.width / 2,
|
|
triggerButtonCenterX = feedback.target.left + feedback.target.width / 2,
|
|
prevHSide = hSide,
|
|
last,
|
|
containerCenterY = feedback.element.top + feedback.element.height / 2,
|
|
triggerButtonCenterY = feedback.target.top + feedback.target.height / 2,
|
|
prevVSide = vSide,
|
|
vFit; // is the container fit vertically
|
|
|
|
hSide = (containerCenterX > triggerButtonCenterX) ? RIGHT : LEFT;
|
|
if (hSide !== prevHSide) {
|
|
if (options.mirrorOnCollision) {
|
|
last = (hSide === LEFT) ? presetsMenu : calendar;
|
|
$container.children().first().append(last.getElement());
|
|
}
|
|
$container.removeClass(classname + '-' + sides[prevHSide]);
|
|
$container.addClass(classname + '-' + sides[hSide]);
|
|
}
|
|
$container.css({
|
|
left: coords.left,
|
|
top: coords.top
|
|
});
|
|
|
|
vSide = (containerCenterY > triggerButtonCenterY) ? BOTTOM : TOP;
|
|
if (vSide !== prevVSide) {
|
|
if (prevVSide !== null) {
|
|
triggerButton.getElement().removeClass(classname + '-' + sides[prevVSide]);
|
|
}
|
|
triggerButton.getElement().addClass(classname + '-' + sides[vSide]);
|
|
}
|
|
vFit = vSide === BOTTOM && feedback.element.top - feedback.target.top !== feedback.target.height + options.verticalOffset
|
|
|| vSide === TOP && feedback.target.top - feedback.element.top !== feedback.element.height + options.verticalOffset;
|
|
triggerButton.getElement().toggleClass(classname + '-vfit', vFit);
|
|
}
|
|
});
|
|
}
|
|
|
|
function killEvent(event) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
|
|
function keyPressTriggerOpenOrClose(event) {
|
|
switch (event.which) {
|
|
case $.ui.keyCode.UP:
|
|
case $.ui.keyCode.DOWN:
|
|
killEvent(event);
|
|
open(event);
|
|
return;
|
|
case $.ui.keyCode.ESCAPE:
|
|
killEvent(event);
|
|
close(event);
|
|
reset();
|
|
return;
|
|
case $.ui.keyCode.TAB:
|
|
close(event);
|
|
return;
|
|
}
|
|
}
|
|
|
|
function open(event) {
|
|
if (!isOpen) {
|
|
triggerButton.getElement().addClass(classname + '-active');
|
|
$mask.show();
|
|
isOpen = true;
|
|
autoFitNeeded && autoFit();
|
|
calendar.scrollToRangeStart();
|
|
$container.show();
|
|
reposition();
|
|
}
|
|
if (options.onOpen) {
|
|
options.onOpen();
|
|
}
|
|
instance._trigger('open', event, {instance: instance});
|
|
}
|
|
|
|
function close(event) {
|
|
if (isOpen) {
|
|
$container.hide();
|
|
$mask.hide();
|
|
triggerButton.getElement().removeClass(classname + '-active');
|
|
isOpen = false;
|
|
}
|
|
if (options.onClose) {
|
|
options.onClose();
|
|
}
|
|
instance._trigger('close', event, {instance: instance});
|
|
}
|
|
|
|
function toggle(event) {
|
|
if (isOpen) {
|
|
close(event);
|
|
reset();
|
|
}
|
|
else {
|
|
open(event);
|
|
}
|
|
}
|
|
|
|
function getContainer(){
|
|
return $container;
|
|
}
|
|
|
|
function enforceOptions() {
|
|
var oldPresetsMenu = presetsMenu;
|
|
presetsMenu = buildPresetsMenu(classname, options, usePreset);
|
|
oldPresetsMenu.getElement().replaceWith(presetsMenu.getElement());
|
|
calendar.enforceOptions();
|
|
buttonPanel.enforceOptions();
|
|
triggerButton.enforceOptions();
|
|
var range = getRange();
|
|
if (range) {
|
|
triggerButton.setLabel(formatRangeForDisplay(range));
|
|
}
|
|
}
|
|
|
|
init();
|
|
return {
|
|
toggle: toggle,
|
|
destroy: destroy,
|
|
open: open,
|
|
close: close,
|
|
setRange: setRange,
|
|
getRange: getRange,
|
|
clearRange: clearRange,
|
|
reset: reset,
|
|
enforceOptions: enforceOptions,
|
|
getContainer: getContainer
|
|
};
|
|
}
|
|
|
|
})(jQuery, window);;
|
|
/**
|
|
|
|
|
|
* @author Kyle Florence <kyle[dot]florence[at]gmail[dot]com>
|
|
|
|
|
|
* @website https://github.com/kflorence/jquery-deserialize/
|
|
|
|
|
|
* @version 1.2.1
|
|
|
|
|
|
*
|
|
|
|
|
|
* Dual licensed under the MIT and GPLv2 licenses.
|
|
|
|
|
|
*/
|
|
|
|
|
|
(function( jQuery, undefined ) {
|
|
|
|
|
|
|
|
|
|
|
|
var push = Array.prototype.push,
|
|
|
|
|
|
rcheck = /^(?:radio|checkbox)$/i,
|
|
|
|
|
|
rplus = /\+/g,
|
|
|
|
|
|
rselect = /^(?:option|select-one|select-multiple)$/i,
|
|
|
|
|
|
rvalue = /^(?:button|color|date|datetime|datetime-local|email|hidden|month|number|password|range|reset|search|submit|tel|text|textarea|time|url|week)$/i;
|
|
|
|
|
|
|
|
|
|
|
|
function getElements( elements ) {
|
|
|
|
|
|
return elements.map(function() {
|
|
|
|
|
|
return this.elements ? jQuery.makeArray( this.elements ) : this;
|
|
|
|
|
|
}).filter( ":input:not(:disabled)" ).get();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getElementsByName( elements ) {
|
|
|
|
|
|
var current,
|
|
|
|
|
|
elementsByName = {};
|
|
|
|
|
|
|
|
|
|
|
|
jQuery.each( elements, function( i, element ) {
|
|
|
|
|
|
current = elementsByName[ element.name ];
|
|
|
|
|
|
elementsByName[ element.name ] = current === undefined ? element :
|
|
|
|
|
|
( jQuery.isArray( current ) ? current.concat( element ) : [ current, element ] );
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return elementsByName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
jQuery.fn.deserialize = function( data, options ) {
|
|
|
|
|
|
var i, length,
|
|
|
|
|
|
elements = getElements( this ),
|
|
|
|
|
|
normalized = [];
|
|
|
|
|
|
|
|
|
|
|
|
if ( !data || !elements.length ) {
|
|
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( jQuery.isArray( data ) ) {
|
|
|
|
|
|
normalized = data;
|
|
|
|
|
|
|
|
|
|
|
|
} else if ( jQuery.isPlainObject( data ) ) {
|
|
|
|
|
|
var key, value;
|
|
|
|
|
|
|
|
|
|
|
|
for ( key in data ) {
|
|
|
|
|
|
jQuery.isArray( value = data[ key ] ) ?
|
|
|
|
|
|
push.apply( normalized, jQuery.map( value, function( v ) {
|
|
|
|
|
|
return { name: key, value: v };
|
|
|
|
|
|
})) : push.call( normalized, { name: key, value: value } );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if ( typeof data === "string" ) {
|
|
|
|
|
|
var parts;
|
|
|
|
|
|
|
|
|
|
|
|
data = data.split( "&" );
|
|
|
|
|
|
|
|
|
|
|
|
for ( i = 0, length = data.length; i < length; i++ ) {
|
|
|
|
|
|
parts = data[ i ].split( "=" );
|
|
|
|
|
|
push.call( normalized, {
|
|
|
|
|
|
name: decodeURIComponent( parts[ 0 ].replace( rplus, "%20" ) ),
|
|
|
|
|
|
value: decodeURIComponent( parts[ 1 ].replace( rplus, "%20" ) )
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( !( length = normalized.length ) ) {
|
|
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var current, element, j, len, name, property, type, value,
|
|
|
|
|
|
change = jQuery.noop,
|
|
|
|
|
|
complete = jQuery.noop,
|
|
|
|
|
|
names = {};
|
|
|
|
|
|
|
|
|
|
|
|
options = options || {};
|
|
|
|
|
|
elements = getElementsByName( elements );
|
|
|
|
|
|
|
|
|
|
|
|
// Backwards compatible with old arguments: data, callback
|
|
|
|
|
|
if ( jQuery.isFunction( options ) ) {
|
|
|
|
|
|
complete = options;
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
change = jQuery.isFunction( options.change ) ? options.change : change;
|
|
|
|
|
|
complete = jQuery.isFunction( options.complete ) ? options.complete : complete;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < length; i++ ) {
|
|
|
|
|
|
current = normalized[ i ];
|
|
|
|
|
|
|
|
|
|
|
|
name = current.name;
|
|
|
|
|
|
value = current.value;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !( element = elements[ name ] ) ) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type = ( len = element.length ) ? element[ 0 ] : element;
|
|
|
|
|
|
type = ( type.type || type.nodeName ).toLowerCase();
|
|
|
|
|
|
property = null;
|
|
|
|
|
|
|
|
|
|
|
|
if ( rvalue.test( type ) ) {
|
|
|
|
|
|
if ( len ) {
|
|
|
|
|
|
j = names[ name ];
|
|
|
|
|
|
element = element[ names[ name ] = ( j == undefined ) ? 0 : ++j ];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
change.call( element, ( element.value = value ) );
|
|
|
|
|
|
|
|
|
|
|
|
} else if ( rcheck.test( type ) ) {
|
|
|
|
|
|
property = "checked";
|
|
|
|
|
|
|
|
|
|
|
|
} else if ( rselect.test( type ) ) {
|
|
|
|
|
|
property = "selected";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( property ) {
|
|
|
|
|
|
if ( !len ) {
|
|
|
|
|
|
element = [ element ];
|
|
|
|
|
|
len = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( j = 0; j < len; j++ ) {
|
|
|
|
|
|
current = element[ j ];
|
|
|
|
|
|
|
|
|
|
|
|
if ( current.value == value ) {
|
|
|
|
|
|
change.call( current, ( current[ property ] = true ) && value );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
complete.call( this );
|
|
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
})( jQuery );;
|
|
/*!
|
|
|
|
|
|
Chosen, a Select Box Enhancer for jQuery and Prototype
|
|
|
|
|
|
by Patrick Filler for Harvest, http://getharvest.com
|
|
|
|
|
|
|
|
|
|
|
|
Version 1.2.0
|
|
|
|
|
|
Full source at https://github.com/harvesthq/chosen
|
|
|
|
|
|
Copyright (c) 2011-2014 Harvest http://getharvest.com
|
|
|
|
|
|
|
|
|
|
|
|
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
|
|
|
|
|
This file is generated by `grunt build`, do not edit it by hand.
|
|
|
|
|
|
*/
|
|
(function(){var t,e,s,i,r={}.hasOwnProperty;i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,r,o,n;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:this.escapeExpression(t.label),children:0,disabled:t.disabled}),n=[],i=0,r=(o=t.childNodes).length;i<r;i++)s=o[i],n.push(this.add_option(s,e,t.disabled));return n},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t.prototype.escapeExpression=function(t){var e,s;return null==t||!1===t?"":/[\&\<\>\"\'\`]/.test(t)?(e={"<":"<",">":">",'"':""","'":"'","`":"`"},s=/&(?!\w+;)|[\<\>\"\'\`]/g,t.replace(s,(function(t){return e[t]||"&"}))):t},t}(),i.select_to_array=function(t){var e,s,r,o,n;for(s=new i,r=0,o=(n=t.childNodes).length;r<o;r++)e=n[r],s.add_node(e);return s.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return t.prototype.set_default_values=function(){var t=this;return this.click_test_action=function(e){return t.test_active_click(e)},this.activate_action=function(e){return t.activate_field(e)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-multiple_text")?this.default_text=this.form_field.getAttribute("data-multiple_text"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){var e=this;if(this.is_multiple){if(!this.active_field)return setTimeout((function(){return e.container_mousedown()}),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){var e=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout((function(){return e.blur_test()}),100)},t.prototype.results_option_build=function(t){var e,s,i,r,o;for(e="",i=0,r=(o=this.results_data).length;i<r;i++)(s=o[i]).group?e+=this.result_add_group(s):e+=this.result_add_option(s),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(s.text));return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),(s=document.createElement("li")).className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.search_text,this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e;return(t.search_match||t.group_match)&&t.active_options>0?((e=document.createElement("li")).className="group-result",e.innerHTML=t.search_text,this.outerHTML(e)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,r;for(r=[],e=0,s=(i=this.results_data).length;e<s;e++)(t=i[e]).selected?r.push(t.selected=!1):r.push(void 0);return r},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,r,o,n,h,l,c,a,_;for(this.no_results_clear(),i=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=new RegExp(t,"i"),s=this.get_search_regex(t),c=0,a=(_=this.results_data).length;c<a;c++)(e=_[c]).search_match=!1,r=null,this.include_option_in_results(e)&&(e.group&&(e.group_match=!1,e.active_options=0),null!=e.group_array_index&&this.results_data[e.group_array_index]&&(0===(r=this.results_data[e.group_array_index]).active_options&&r.search_match&&(i+=1),r.active_options+=1),e.group&&!this.group_search||(e.search_text=e.group?e.label:e.text,e.search_match=this.search_string_match(e.search_text,s),e.search_match&&!e.group&&(i+=1),e.search_match?(o.length&&(n=e.search_text.search(l),h=e.search_text.substr(0,n+o.length)+"</em>"+e.search_text.substr(n+o.length),e.search_text=h.substr(0,n)+"<em>"+h.substr(n)),null!=r&&(r.group_match=!0)):null!=e.group_array_index&&this.results_data[e.group_array_index].search_match&&(e.search_match=!0)));return this.result_clear_highlight(),i<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e;return e=this.search_contains?"":"^",new RegExp(e+t,"i")},t.prototype.search_string_match=function(t,e){var s,i,r,o;if(e.test(t))return!0;if(this.enable_split_word_search&&(t.indexOf(" ")>=0||0===t.indexOf("["))&&(i=t.replace(/\[|\]/g,"").split(" ")).length)for(r=0,o=i.length;r<o;r++)if(s=i[r],e.test(s))return!0},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keyup_checker=function(t){var e,s;switch(e=null!=(s=t.which)?s:t.keyCode,this.search_field_scale(),e){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(t.preventDefault(),this.results_showing)return this.result_select(t);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},t.prototype.clipboard_event_checker=function(t){var e=this;return setTimeout((function(){return e.results_search()}),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!/iP(od|hone)/i.test(window.navigator.userAgent)&&(!/Android/i.test(window.navigator.userAgent)||!/Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each((function(e){var r,o;o=(r=t(this)).data("chosen"),"destroy"===i&&o instanceof s?o.destroy():o instanceof s||r.data("chosen",new s(this,i))})):this}}),s=function(e){function s(){return s.__super__.constructor.apply(this,arguments)}return function(t,e){for(var s in e)r.call(e,s)&&(t[s]=e[s]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(s,e),s.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},s.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={class:e.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},s.prototype.register_observers=function(){var t=this;return this.container.bind("touchstart.chosen",(function(e){t.container_mousedown(e)})),this.container.bind("touchend.chosen",(function(e){t.container_mouseup(e)})),this.container.bind("mousedown.chosen",(function(e){t.container_mousedown(e)})),this.container.bind("mouseup.chosen",(function(e){t.container_mouseup(e)})),this.container.bind("mouseenter.chosen",(function(e){t.mouse_enter(e)})),this.container.bind("mouseleave.chosen",(function(e){t.mouse_leave(e)})),this.search_results.bind("mouseup.chosen",(function(e){t.search_results_mouseup(e)})),this.search_results.bind("mouseover.chosen",(function(e){t.search_results_mouseover(e)})),this.search_results.bind("mouseout.chosen",(function(e){t.search_results_mouseout(e)})),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",(function(e){t.search_results_mousewheel(e)})),this.search_results.bind("touchstart.chosen",(function(e){t.search_results_touchstart(e)})),this.search_results.bind("touchmove.chosen",(function(e){t.search_results_touchmove(e)})),this.search_results.bind("touchend.chosen",(function(e){t.search_results_touchend(e)})),this.form_field_jq.bind("chosen:updated.chosen",(function(e){t.results_update_field(e)})),this.form_field_jq.bind("chosen:activate.chosen",(function(e){t.activate_field(e)})),this.form_field_jq.bind("chosen:open.chosen",(function(e){t.container_mousedown(e)})),this.form_field_jq.bind("chosen:close.chosen",(function(e){t.input_blur(e)})),this.search_field.bind("blur.chosen",(function(e){t.input_blur(e)})),this.search_field.bind("keyup.chosen",(function(e){t.keyup_checker(e)})),this.search_field.bind("keydown.chosen",(function(e){t.keydown_checker(e)})),this.search_field.bind("focus.chosen",(function(e){t.input_focus(e)})),this.search_field.bind("cut.chosen",(function(e){t.clipboard_event_checker(e)})),this.search_field.bind("paste.chosen",(function(e){t.clipboard_event_checker(e)})),this.is_multiple?this.search_choices.bind("click.chosen",(function(e){t.choices_click(e)})):this.container.bind("click.chosen",(function(t){t.preventDefault()}))},s.prototype.destroy=function(){return t(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},s.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},s.prototype.container_mousedown=function(e){if(!this.is_disabled&&(e&&"mousedown"===e.type&&!this.results_showing&&e.preventDefault(),null==e||!t(e.target).hasClass("search-choice-close")))return this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field()},s.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},s.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},s.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},s.prototype.close_field=function(){return t(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},s.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},s.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},s.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},s.prototype.result_do_highlight=function(t){var e,s,i,r,o;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),r=(i=parseInt(this.search_results.css("maxHeight"),10))+(o=this.search_results.scrollTop()),(e=(s=this.result_highlight.position().top+this.search_results.scrollTop())+this.result_highlight.outerHeight())>=r)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<o)return this.search_results.scrollTop(s)}},s.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},s.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},s.prototype.update_results_content=function(t){return this.search_results.html(t)},s.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},s.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},s.prototype.set_label_behavior=function(){var e=this;if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.bind("click.chosen",(function(t){return e.is_multiple?e.container_mousedown(t):e.activate_field()}))},s.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},s.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},s.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},s.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result"))return this.result_clear_highlight()},s.prototype.choice_build=function(e){var s,i,r=this;return s=t("<li />",{class:"search-choice"}).html("<span>"+e.html+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{class:"search-choice-close","data-option-array-index":e.array_index})).bind("click.chosen",(function(t){return r.choice_destroy_link_click(t)})),s.append(i)),this.search_container.before(s)},s.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},s.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},s.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field)return this.results_hide()},s.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},s.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),(s=this.results_data[e[0].getAttribute("data-option-array-index")]).selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(s.text),(t.metaKey||t.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())},s.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(t)},s.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},s.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},s.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":t("<div/>").text(t.trim(this.search_field.val())).html()},s.prototype.winnow_results_set_highlight=function(){var t,e;if(null!=(t=(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result")).length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},s.prototype.no_results=function(e){var s;return(s=t('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>')).find("span").first().html(e),this.search_results.append(s),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},s.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},s.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},s.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},s.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},s.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},s.prototype.keydown_checker=function(t){var e,s;switch(e=null!=(s=t.which)?s:t.keyCode,this.search_field_scale(),8!==e&&this.pending_backstroke&&this.clear_backstroke(),e){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},s.prototype.search_field_scale=function(){var e,s,i,r,o,n,h,l;if(this.is_multiple){for(0,n=0,r="position:absolute; left: -1000px; top: -1000px; display:none;",h=0,l=(o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"]).length;h<l;h++)r+=(i=o[h])+":"+this.search_field.css(i)+";";return(e=t("<div />",{style:r})).text(this.search_field.val()),t("body").append(e),n=e.width()+25,e.remove(),n>(s=this.container.outerWidth())-10&&(n=s-10),this.search_field.css({width:n+"px"})}},s}(e)}).call(this);;
|
|
var EventAjaxFilters=function(){var e,t=[];return{init:function(){Common.logInfo("EventAjaxFilters.init..."),jQuery(this).closest("form").find(':input[name^="search_datetimes"]').not(':input[type="hidden"]').val(0).trigger("chosen:updated"),jQuery(".wpem-search-event-more-filter").length>0&&(jQuery(".wpem-event-advance-filter").hide(),jQuery(".wpem-search-event-more-filter").on("click",function(){jQuery(".wpem-event-advance-filter").slideToggle("slow")})),jQuery.isFunction(jQuery.fn.chosen)&&(1==event_manager_ajax_filters.is_rtl&&(jQuery('select[name^="search_datetimes"]').addClass("chosen-rtl"),jQuery('select[name^="search_categories"]').addClass("chosen-rtl"),jQuery('select[name^="search_event_types"]').addClass("chosen-rtl"),jQuery('select[name^="search_ticket_prices"]').addClass("chosen-rtl")),jQuery('select[name^="search_datetimes"]').chosen({search_contains:!0}),jQuery('select[name^="search_categories"]').chosen({search_contains:!0}),jQuery('select[name^="search_event_types"]').chosen({search_contains:!0}),jQuery('select[name^="search_ticket_prices"]').chosen({search_contains:!0})),e=!!window.history&&!!window.history.pushState,jQuery(document).ready(EventAjaxFilters.actions.windowLoad),jQuery(document.body).on("click",".load_more_events",EventAjaxFilters.actions.loadMoreEvents),jQuery(".event_filters").on("click",".reset",EventAjaxFilters.actions.eventAjaxFiltersReset),jQuery("div.event_listings").on("click",".event-manager-pagination a",EventAjaxFilters.actions.eventPagination),jQuery(".event_listings").on("update_event_listings",EventAjaxFilters.actions.getEventListings),jQuery("#search_keywords, #search_location, #search_datetimes, #search_categories, #search_event_types, #search_ticket_prices, .event-manager-filter").change(function(){var e=jQuery(this).closest("div.event_listings");e.triggerHandler("update_event_listings",[1,!1]),EventAjaxFilters.event_manager_store_state(e,1)}).on("keyup",function(e){13===e.which&&jQuery(this).trigger("change")})},event_manager_store_state:function(t,n){Common.logInfo("EventAjaxFilters.event_manager_store_state...");var a=document.location.href.split("#")[0];if(e){var i=jQuery(t.find(".event_filters")).serialize(),s=jQuery("div.event_listings").index(t);window.history.replaceState({id:"event_manager_state",page:n,data:i,index:s},"",a+"#events")}},actions:{windowLoad:function(e){Common.logInfo("EventAjaxFilters.actions.windowLoad..."),jQuery(".event_filters").each(function(){var e=jQuery(this).closest("div.event_listings"),t=e.find(".event_filters"),n=1,a=jQuery("div.event_listings").index(e);if(window.history.state&&window.location.hash){var i=window.history.state;i.id&&"event_manager_state"===i.id&&a==i.index&&(n=1,t.deserialize(i.data),t.find(':input[name^="search_datetimes"]').not(':input[type="hidden"]').trigger("chosen:updated"),t.find(':input[name^="search_categories"]').not(':input[type="hidden"]').trigger("chosen:updated"),t.find(':input[name^="search_event_types"]').not(':input[type="hidden"]').trigger("chosen:updated"),t.find(':input[name^="search_ticket_prices"]').not(':input[type="hidden"]').trigger("chosen:updated"))}e.triggerHandler("update_event_listings",[n,!1])})},eventAjaxFiltersReset:function(e){Common.logInfo("EventAjaxFilters.actions.eventAjaxFiltersReset...");var t=jQuery(this).closest("div.event_listings"),n=jQuery(this).closest("form");return n.find(':input[name="search_keywords"], :input[name="search_location"], .event-manager-filter').not(':input[type="hidden"]').val("").trigger("chosen:updated"),n.find(':input[name^="search_datetimes"]').not(':input[type="hidden"]').val(0).trigger("chosen:updated"),n.find(':input[name^="search_categories"]').not(':input[type="hidden"]').val("").trigger("chosen:updated"),n.find(':input[name^="search_event_types"]').not(':input[type="hidden"]').val(0).trigger("chosen:updated"),n.find(':input[name^="search_ticket_prices"]').not(':input[type="hidden"]').val(0).trigger("chosen:updated"),t.triggerHandler("reset"),t.triggerHandler("update_event_listings",[1,!1]),EventAjaxFilters.event_manager_store_state(t,1),!1},loadMoreEvents:function(e){Common.logInfo("EventAjaxFilters.actions.loadMoreEvents...");var t=jQuery(this).closest("div.event_listings"),n=parseInt(jQuery(this).data("page")||1);return jQuery(this).parent().addClass("wpem-loading"),n+=1,jQuery(this).data("page",n),EventAjaxFilters.event_manager_store_state(t,n),t.triggerHandler("update_event_listings",[n,!0,!1]),!1},eventPagination:function(e){Common.logInfo("EventAjaxFilters.actions.eventPagination...");var t=jQuery(this).closest("div.event_listings"),n=jQuery(this).data("page");return EventAjaxFilters.event_manager_store_state(t,n),t.triggerHandler("update_event_listings",[n,!1]),jQuery("body, html").animate({scrollTop:t.offset().top},600),!1},getEventListings:function(e,n,a,i){Common.logInfo("EventAjaxFilters.actions.getEventListings..."),jQuery(".load_more_events").hide();var s="",r=jQuery(this),o=r.find(".event_filters"),d=r.find(".showing_applied_filters"),l=r.find(".event_listings"),c=r.data("per_page"),g=r.data("orderby"),v=r.data("order"),p=r.data("featured"),h=r.data("cancelled"),m=r.data("event_online"),u=jQuery("div.event_listings").index(this);if(!(u<0)){if(t[u]&&t[u].abort(),a||(jQuery(l).parent().addClass("wpem-loading"),jQuery("div.event_listing, div.no_event_listings_found",l).css("visibility","hidden"),r.find(".load_more_events").data("page",n)),!0==r.data("show_filters")){var f=o.find(':input[name^="search_datetimes"]').map(function(){return jQuery(this).val()}).get();jQuery("input.date_range_picker").length>0&&jQuery("input.date_range_picker").daterangepicker();var y=o.find(':input[name^="search_categories"]').map(function(){return jQuery(this).val()}).get(),w=o.find(':input[name^="search_event_types"]').map(function(){return jQuery(this).val()}).get(),x=o.find(':input[name^="search_ticket_prices"]').map(function(){return jQuery(this).val()}).get(),E="",j="",k=o.find(':input[name="search_keywords"]'),A=o.find(':input[name="search_location"]');if(k.val()!==k.attr("placeholder")&&(E=k.val()),A.val()!==A.attr("placeholder")&&(j=A.val()),jQuery(':input[name="event_online"]').length>0){if(!0==jQuery(':input[name="event_online"]').prop("checked"))var m="true";else var m=""}s={lang:event_manager_ajax_filters.lang,search_keywords:E,search_location:j,search_datetimes:f,search_categories:y,search_event_types:w,search_ticket_prices:x,per_page:c,orderby:g,order:v,page:n,featured:p,cancelled:h,event_online:m,show_pagination:r.data("show_pagination"),form_data:o.serialize()}}else{var E=r.data("keywords"),j=r.data("location"),f=JSON.stringify(r.data("datetimes")),y=r.data("categories"),w=r.data("event_types"),x=r.data("ticket_prices");y&&(y=y.split(",")),w&&(w=w.split(",")),s={lang:event_manager_ajax_filters.lang,search_keywords:E,search_location:j,search_datetimes:f,search_categories:y,search_event_types:w,search_ticket_prices:x,per_page:c,orderby:g,order:v,page:n,featured:p,cancelled:h,event_online:m,show_pagination:r.data("show_pagination")}}t[u]=jQuery.ajax({type:"POST",url:event_manager_ajax_filters.ajax_url.toString().replace("%%endpoint%%","get_listings"),data:s,success:function(e){if(e)try{e.filter_value?jQuery(d).show().html("<span>"+e.filter_value+"</span>"+e.showing_links):jQuery(d).hide(),e.showing_applied_filters?jQuery(d).addClass("showing-applied-filters"):jQuery(d).removeClass("showing-applied-filters"),e.html&&(a&&i?(jQuery(l).prepend(e.html),jQuery("div.google-map-loadmore").length>0&&jQuery("div .google-map-loadmore").not("div.google-map-loadmore:first").remove()):a?(jQuery(l).append(e.html),jQuery("div.google-map-loadmore").length>0&&jQuery("div .google-map-loadmore").not("div.google-map-loadmore:first").remove()):jQuery(l).html(e.html)),!0==r.data("show_pagination")?(r.find(".event-manager-pagination").remove(),e.pagination&&r.append(e.pagination)):(localStorage.setItem("total_event_page",e.max_num_pages),localStorage.setItem("current_event_page",n),!e.found_events||e.max_num_pages<=n?jQuery(".load_more_events:not(.load_previous)",r).hide():i||jQuery(".load_more_events",r).show(),jQuery("#load_more_events_loader").removeClass("wpem-loading"),jQuery("li.event_listing",l).css("visibility","visible")),jQuery(l).parent().removeClass("wpem-loading"),r.triggerHandler("updated_results",e)}catch(t){window.console&&Common.logError(t)}},error:function(e,t,n){window.console&&"abort"!==t&&Common.logError(t+": "+n)},statusCode:{404:function(){window.console&&Common.logError("Error 404: Ajax Endpoint cannot be reached. Go to Settings > Permalinks and save to resolve.")}}}),e.preventDefault()}}}}};EventAjaxFilters=EventAjaxFilters(),jQuery(document).ready(function(e){EventAjaxFilters.init()});;
|
|
var ContentEventListing=function(){return{init:function(){Common.logInfo("ContentEventListing.init..."),jQuery(document).delegate("#wpem-event-list-layout","click",ContentEventListing.actions.lineLayoutIconClick),jQuery(document).delegate("#wpem-event-box-layout","click",ContentEventListing.actions.boxLayoutIconClick),(jQuery(".wpem-event-list-layout").length>0||jQuery(".wpem-event-box-layout").length>0)&&("line-layout"==localStorage.getItem("layout")?(jQuery(".wpem-event-box-col").show(),jQuery(".wpem-event-box-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-list-layout").addClass("wpem-active-layout"),jQuery(".wpem-event-listings").hasClass("wpem-row")&&jQuery(".wpem-event-listings").removeClass("wpem-row"),jQuery(".wpem-event-listings").removeClass("wpem-event-listing-box-view"),jQuery(".wpem-event-listings").addClass("wpem-event-listing-list-view")):"calendar-layout"==localStorage.getItem("layout")?(jQuery(".wpem-event-box-col").hide(),jQuery(".wpem-event-list-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-box-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-calendar-layout").addClass("wpem-active-layout"),jQuery(".wpem-event-listings").hasClass("wpem-row")||jQuery(".wpem-event-listings").addClass("wpem-row"),jQuery(".wpem-event-listings").removeClass("wpem-event-listing-list-view"),jQuery(".wpem-event-listings").removeClass("wpem-event-listing-box-view"),jQuery(".wpem-event-listings").addClass("wpem-event-listing-calendar-view")):(jQuery(".wpem-event-box-col").show(),jQuery(".wpem-event-list-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-box-layout").addClass("wpem-active-layout"),jQuery(".wpem-event-listings").hasClass("wpem-row")||jQuery(".wpem-event-listings").addClass("wpem-row"),jQuery(".wpem-event-listings").removeClass("wpem-event-listing-list-view"),jQuery(".wpem-event-listings").addClass("wpem-event-listing-box-view"))),setTimeout((function(){jQuery("input.date_range_picker").length>0&&jQuery("input.date_range_picker").daterangepicker({datepickerOptions:{numberOfMonths:2,minDate:null,maxDate:null,monthNames:event_manager_content_event_listing.i18n_monthNames},initialText:event_manager_content_event_listing.i18n_initialText,applyButtonText:event_manager_content_event_listing.i18n_applyButtonText,clearButtonText:event_manager_content_event_listing.i18n_clearButtonText,cancelButtonText:event_manager_content_event_listing.i18n_cancelButtonText,dateFormat:event_manager_content_event_listing.i18n_datepicker_format,altFormat:event_manager_content_event_listing.i18n_datepicker_format,clear:function(e,t){jQuery(".comiseo-daterangepicker-triggerbutton").click()},rangeSplitter:" : ",presetRanges:[{text:event_manager_content_event_listing.i18n_today,dateStart:function(){return moment()},dateEnd:function(){return moment()}},{text:event_manager_content_event_listing.i18n_tomorrow,dateStart:function(){return moment().add("days",1)},dateEnd:function(){return moment().add("days",1)}},{text:event_manager_content_event_listing.i18n_thisWeek,dateStart:function(){return moment().startOf("week")},dateEnd:function(){return moment().endOf("week")}},{text:event_manager_content_event_listing.i18n_nextWeek,dateStart:function(){return moment().add("weeks",1).startOf("week")},dateEnd:function(){return moment().add("weeks",1).endOf("week")}},{text:event_manager_content_event_listing.i18n_thisMonth,dateStart:function(){return moment().startOf("month")},dateEnd:function(){return moment().endOf("month")}},{text:event_manager_content_event_listing.i18n_nextMonth,dateStart:function(){return moment().add("months",1).startOf("month")},dateEnd:function(){return moment().add("months",1).endOf("month")}},{text:event_manager_content_event_listing.i18n_thisYear,dateStart:function(){return moment().startOf("year")},dateEnd:function(){return moment().endOf("year")}},{text:event_manager_content_event_listing.i18n_nextYear,dateStart:function(){return moment().add("years",1).startOf("year")},dateEnd:function(){return moment().add("years",1).endOf("year")}}]})}),500)},actions:{lineLayoutIconClick:function(e){Common.logInfo("ContentEventListing.actions.lineLayoutIconClick..."),jQuery(this).addClass("wpem-active-layout"),jQuery("#wpem-event-box-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-box-col").show(),jQuery(".wpem-event-listings").removeClass("wpem-row wpem-event-listing-box-view"),jQuery(".wpem-event-listings").addClass("wpem-event-listing-list-view"),localStorage.setItem("layout","line-layout"),e.preventDefault()},boxLayoutIconClick:function(e){Common.logInfo("ContentEventListing.actions.boxLayoutIconClick..."),jQuery(this).addClass("wpem-active-layout"),jQuery("#wpem-event-list-layout").hasClass("wpem-active-layout")&&jQuery("#wpem-event-list-layout").removeClass("wpem-active-layout"),jQuery(".wpem-event-box-col").show(),jQuery(".wpem-event-listings").removeClass("wpem-event-listing-list-view"),jQuery(".wpem-event-listings").addClass("wpem-row wpem-event-listing-box-view"),localStorage.setItem("layout","box-layout"),e.preventDefault()}}}};ContentEventListing=ContentEventListing(),jQuery(document).ready((function(e){ContentEventListing.init()}));;
|