forked from mirrors/easyappointments
Added fullscreen toggle button to table view.
This commit is contained in:
parent
a636d4510a
commit
d78710f60b
2 changed files with 59 additions and 0 deletions
|
@ -101,6 +101,10 @@
|
|||
<span class="glyphicon glyphicon-repeat"></span>
|
||||
<?php echo $this->lang->line('reload'); ?>
|
||||
</button>
|
||||
|
||||
<button id="toggle-fullscreen" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-fullscreen"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -22,6 +22,59 @@ window.BackendCalendar = window.BackendCalendar || {};
|
|||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
// var exitFullScreen = element.exitFullScreen
|
||||
// || element.msExitFullscreen
|
||||
// || element.mozCancelFullScreen
|
||||
// || element.webkitExitFullscreen;
|
||||
|
||||
// exitFullScreen.call(element);
|
||||
|
||||
if (document.exitFullscreen)
|
||||
document.exitFullscreen();
|
||||
else if (document.msExitFullscreen)
|
||||
document.msExitFullscreen();
|
||||
else if (document.mozCancelFullScreen)
|
||||
document.mozCancelFullScreen();
|
||||
else if (document.webkitExitFullscreen)
|
||||
document.webkitExitFullscreen()
|
||||
|
||||
$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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Module
|
||||
*
|
||||
|
@ -41,6 +94,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
|||
BackendCalendarGoogleSync.initialize();
|
||||
BackendCalendarAppointmentsModal.initialize();
|
||||
BackendCalendarUnavailabilitiesModal.initialize();
|
||||
|
||||
_bindEventHandlers();
|
||||
};
|
||||
|
||||
})(window.BackendCalendar);
|
||||
|
|
Loading…
Reference in a new issue