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 @@