From d6b509e98a6a9286fcabc483821fa9fedfec8a71 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 20 May 2020 16:15:08 +0200 Subject: [PATCH] Replaced fullscreen auto logic with button toggle --- .../backend/http/static/js/application.js | 26 +------------------ platypush/backend/http/static/js/utils.js | 13 ++++++++++ platypush/backend/http/templates/nav.html | 4 +++ 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/platypush/backend/http/static/js/application.js b/platypush/backend/http/static/js/application.js index be96f0272..b8f02e77a 100644 --- a/platypush/backend/http/static/js/application.js +++ b/platypush/backend/http/static/js/application.js @@ -25,26 +25,8 @@ window.vm = new Vue({ }, methods: { - enterFullScreen: function() { - const self = this; - enterFullScreen().then(() => { - self.fullscreen = true; - }); - }, - - exitFullScreen: function() { - const self = this; - exitFullscreen().finally(() => { - self.fullscreen = false; - }); - }, - toggleFullScreen: function() { - if (this.fullscreen) { - this.exitFullScreen(); - } else { - this.enterFullScreen(); - } + toggleFullScreen(); }, }, @@ -54,12 +36,6 @@ window.vm = new Vue({ this.selectedPlugin = m[1]; } - m = window.location.href.match('[?&]fs=([01])'); - if (m) { - this.fullscreen = !parseInt(m[1]); - this.toggleFullScreen(); - } - const self = this; setInterval(() => { self.now = new Date(); diff --git a/platypush/backend/http/static/js/utils.js b/platypush/backend/http/static/js/utils.js index 6f0262394..0f6c9c46e 100644 --- a/platypush/backend/http/static/js/utils.js +++ b/platypush/backend/http/static/js/utils.js @@ -32,3 +32,16 @@ function exitFullScreen() { } } +function toggleFullScreen() { + const elem = document.fullscreenElement + || document.webkitFullscreenElement + || document.msFullscreenElement + || document.mozFullScreenElement; + + if (elem) { + exitFullScreen(); + } else { + enterFullScreen(); + } +} + diff --git a/platypush/backend/http/templates/nav.html b/platypush/backend/http/templates/nav.html index 4ad0d55eb..9d6845a06 100644 --- a/platypush/backend/http/templates/nav.html +++ b/platypush/backend/http/templates/nav.html @@ -41,6 +41,10 @@
+ + + +