From f39b6486bf6785767dcdf815c02199bed69bce84 Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Thu, 5 May 2016 18:05:57 -0400 Subject: [PATCH] changed "maximize" window button to fullscreen instead - this closes #46 --- static/js/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/static/js/index.js b/static/js/index.js index 0468a0c..66ec881 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -19,6 +19,18 @@ function attachListeners() { $('#continueReplaceApp').on('click', continueReplaceApp); $('#quitGameButton').on('click', stopGame); $(window).resize(fullscreenNaclModule); + chrome.app.window.current().onMaximized.addListener(fullscreenChromeWindow); +} + +function fullscreenChromeWindow() { + // when the user clicks the maximize button on the window, + // FIRST restore it to the previous size, then fullscreen it to the whole screen + // this prevents the previous window size from being 'maximized', + // and allows us to functionally retain two window sizes + // so that when the user hits `esc`, they go back to the "restored" size, + // instead of "maximized", which would immediately go to fullscreen + chrome.app.window.current().restore(); + chrome.app.window.current().fullscreen(); } function snackbarLog(givenMessage) {