/** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ /** * Determines the full screen support of the browser running this Phaser Game instance. * These values are read-only and populated during the boot sequence of the game. * They are then referenced by internal game systems and are available for you to access * via `this.sys.game.device.fullscreen` from within any Scene. * * @typedef {object} Phaser.Device.Fullscreen * @since 3.0.0 * * @property {boolean} available - Does the browser support the Full Screen API? * @property {boolean} keyboard - Does the browser support access to the Keyboard during Full Screen mode? * @property {string} cancel - If the browser supports the Full Screen API this holds the call you need to use to cancel it. * @property {string} request - If the browser supports the Full Screen API this holds the call you need to use to activate it. */ var Fullscreen = { available: false, cancel: '', keyboard: false, request: '' }; /** * Checks for support of the Full Screen API. */ function init () { var i; var fs = [ 'requestFullscreen', 'requestFullScreen', 'webkitRequestFullscreen', 'webkitRequestFullScreen', 'msRequestFullscreen', 'msRequestFullScreen', 'mozRequestFullScreen', 'mozRequestFullscreen' ]; var element = document.createElement('div'); for (i = 0; i < fs.length; i++) { if (element[fs[i]]) { Fullscreen.available = true; Fullscreen.request = fs[i]; break; } } var cfs = [ 'cancelFullScreen', 'exitFullscreen', 'webkitCancelFullScreen', 'webkitExitFullscreen', 'msCancelFullScreen', 'msExitFullscreen', 'mozCancelFullScreen', 'mozExitFullscreen' ]; if (Fullscreen.available) { for (i = 0; i < cfs.length; i++) { if (document[cfs[i]]) { Fullscreen.cancel = cfs[i]; break; } } } // Keyboard Input? if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT']) { Fullscreen.keyboard = true; } return Fullscreen; } module.exports = init();