2015-07-20 22:41:24 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
2015-10-06 00:30:56 +03:00
|
|
|
*
|
2015-07-20 22:41:24 +03:00
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2016-01-02 15:47:04 +02:00
|
|
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
2015-10-06 00:30:56 +03:00
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
2015-07-20 22:41:24 +03:00
|
|
|
* @link http://easyappointments.org
|
|
|
|
* @since v1.0.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2013-06-12 18:31:16 +03:00
|
|
|
/**
|
2016-04-02 13:25:29 +03:00
|
|
|
* Backend Calendar
|
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* This module contains functions that are used by the backend calendar page.
|
2015-10-06 00:30:56 +03:00
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* @module BackendCalendar
|
2013-06-12 18:31:16 +03:00
|
|
|
*/
|
2016-04-02 13:25:29 +03:00
|
|
|
window.BackendCalendar = window.BackendCalendar || {};
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2016-04-02 13:25:29 +03:00
|
|
|
(function(exports) {
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2016-04-02 13:25:29 +03:00
|
|
|
'use strict';
|
2015-10-06 00:30:56 +03:00
|
|
|
|
2016-07-24 14:26:20 +03:00
|
|
|
/**
|
|
|
|
* Bind common event handlers.
|
|
|
|
*/
|
|
|
|
function _bindEventHandlers() {
|
|
|
|
var $calendarPage = $('#calendar-page');
|
|
|
|
|
|
|
|
$calendarPage.on('click', '#toggle-fullscreen', function() {
|
|
|
|
var $target = $(this);
|
|
|
|
var element = document.documentElement;
|
|
|
|
var isFullScreen = (document.fullScreenElement && document.fullScreenElement !== null)
|
|
|
|
|| document.mozFullScreen
|
|
|
|
|| document.webkitIsFullScreen;
|
|
|
|
|
|
|
|
if (isFullScreen) {
|
|
|
|
// Exit fullscreen mode.
|
|
|
|
if (document.exitFullscreen)
|
|
|
|
document.exitFullscreen();
|
|
|
|
else if (document.msExitFullscreen)
|
|
|
|
document.msExitFullscreen();
|
|
|
|
else if (document.mozCancelFullScreen)
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
else if (document.webkitExitFullscreen)
|
2016-10-10 19:29:48 +03:00
|
|
|
document.webkitExitFullscreen();
|
2016-07-24 14:26:20 +03:00
|
|
|
|
|
|
|
$target
|
|
|
|
.removeClass('btn-success')
|
|
|
|
.addClass('btn-default');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Switch to fullscreen mode.
|
|
|
|
if (element.requestFullscreen)
|
|
|
|
element.requestFullscreen();
|
|
|
|
else if (element.msRequestFullscreen)
|
|
|
|
element.msRequestFullscreen();
|
|
|
|
else if (element.mozRequestFullScreen)
|
|
|
|
element.mozRequestFullScreen();
|
|
|
|
else if (element.webkitRequestFullscreen)
|
|
|
|
element.webkitRequestFullscreen();
|
|
|
|
|
|
|
|
$target
|
|
|
|
.removeClass('btn-default')
|
|
|
|
.addClass('btn-success');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-04-02 13:25:29 +03:00
|
|
|
/**
|
2016-05-15 14:05:28 +03:00
|
|
|
* Initialize Module
|
|
|
|
*
|
|
|
|
* This function makes the necessary initialization for the default backend calendar page. If this module
|
|
|
|
* is used in another page then this function might not be needed.
|
2016-04-02 13:25:29 +03:00
|
|
|
*
|
2016-07-17 14:46:38 +03:00
|
|
|
* @param {String} view Optional (default), the calendar view to be loaded.
|
2016-04-02 13:25:29 +03:00
|
|
|
*/
|
2016-07-17 14:46:38 +03:00
|
|
|
exports.initialize = function(view) {
|
|
|
|
// Load and initialize the calendar view.
|
|
|
|
if (view === 'table') {
|
|
|
|
BackendCalendarTableView.initialize();
|
|
|
|
} else {
|
|
|
|
BackendCalendarDefaultView.initialize();
|
2016-04-02 13:25:29 +03:00
|
|
|
}
|
|
|
|
|
2016-07-17 15:23:18 +03:00
|
|
|
BackendCalendarGoogleSync.initialize();
|
2016-07-17 15:43:50 +03:00
|
|
|
BackendCalendarAppointmentsModal.initialize();
|
|
|
|
BackendCalendarUnavailabilitiesModal.initialize();
|
2016-07-24 14:26:20 +03:00
|
|
|
|
|
|
|
_bindEventHandlers();
|
2016-04-02 13:25:29 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
})(window.BackendCalendar);
|