diff --git a/platypush/backend/http/static/js/application.js b/platypush/backend/http/static/js/application.js index be96f027..b8f02e77 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 6f026239..0f6c9c46 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 4ad0d55e..9d6845a0 100644 --- a/platypush/backend/http/templates/nav.html +++ b/platypush/backend/http/templates/nav.html @@ -41,6 +41,10 @@