jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/fullscreen/fullscreenmanager.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2016-09-03 10:58:23 -07:00
define([], function () {
2016-10-17 22:06:48 -07:00
'use strict';
2016-09-03 10:58:23 -07:00
function fullscreenManager() {
}
fullscreenManager.prototype.requestFullscreen = function (element) {
element = element || document.documentElement;
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
};
fullscreenManager.prototype.exitFullscreen = function () {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.webkitCancelFullscreen) {
document.webkitCancelFullscreen();
}
};
fullscreenManager.prototype.isFullScreen = function () {
return document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement ? true : false;
};
2017-01-04 14:25:15 -07:00
fullscreenManager.prototype.toggleFullscreen = function () {
if (this.isFullScreen()) {
this.exitFullscreen();
} else {
this.requestFullscreen();
}
};
2016-09-03 10:58:23 -07:00
return new fullscreenManager();
});