diff --git a/public/js/display.js b/public/js/display.js index c17f5fa..0474e50 100644 --- a/public/js/display.js +++ b/public/js/display.js @@ -71,6 +71,27 @@ $(window).bind("resize", function () { fixImageSizes(); }); +if (isPreview === 0) { + document.addEventListener("keydown", function(e) { + if (e.keyCode == 13) { + toggleFullScreen(); + } + }, false); +} + +function toggleFullScreen() { + if (isPreview === 0) { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen(); + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } + } + } +} + + function getLayer(offset) { if (offset === undefined) offset = 0; diff --git a/public/js/displayLite.js b/public/js/displayLite.js index 9d0261a..c3949bc 100644 --- a/public/js/displayLite.js +++ b/public/js/displayLite.js @@ -94,10 +94,27 @@ $(function () { }); + $(window).bind("resize", function () { fixImageSizes(); }); +function toggleFullScreen() { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen(); + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } + } + } + + document.addEventListener("keydown", function(e) { + if (e.keyCode == 13) { + toggleFullScreen(); + } + }, false); + function getLayer(offset) { if (offset === undefined) offset = 0; diff --git a/routes/index.js b/routes/index.js index 16cfce8..25330de 100644 --- a/routes/index.js +++ b/routes/index.js @@ -35,11 +35,13 @@ module.exports = function (pluginManager, websocket, dispatcher) { router.get('/display/:id/lite', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); let idx = parseInt(req.params.id); - let volume = req.params.videoVolume || 1.; + let volume = req.query['videoVolume'] || 1.; + let extra = pluginManager.getDisplayAdditions(); res.render('liteDisplay', { config: config, display: availableDisplays[idx], displayId: idx, + extra: extra, videoVolume: volume }); }); @@ -47,9 +49,17 @@ module.exports = function (pluginManager, websocket, dispatcher) { router.get('/display/:id', function (req, res, next) { res.header('Access-Control-Allow-Origin', '*'); let idx = parseInt(req.params.id); - let volume = req.params.videoVolume || 1.; + let preview = parseInt(req.query['isPreview']) || 0; + let volume = parseFloat(req.query['videoVolume']) || 1.; let extra = pluginManager.getDisplayAdditions(); - res.render('display', { config: config, display: availableDisplays[idx], displayId: idx, videoVolume: volume, extra: extra }); + res.render('display', { + config: config, + display: availableDisplays[idx], + displayId: idx, + videoVolume: volume, + extra: extra, + isPreview: preview + }); }); router.get('/images/:dir/:name', function (req, res, next) { diff --git a/views/admin/dashboard.twig b/views/admin/dashboard.twig index cfd772e..59078f6 100644 --- a/views/admin/dashboard.twig +++ b/views/admin/dashboard.twig @@ -112,7 +112,7 @@