From 617afd2d4f40249418d870456c9ac44cbfa9b3ce Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Sat, 12 Mar 2016 19:06:33 -0500 Subject: [PATCH] now with a proper UI reset after closing a stream. this closes #19 --- static/js/index.js | 11 ++++++----- static/js/messages.js | 7 +++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 344965c..bbbc25c 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -147,10 +147,10 @@ function showAppsPushed() { function showAppsMode() { console.log("entering show apps mode."); - $('#streamSettings').css('display', 'none'); - $('#hostSettings').css('display', 'none'); - $('#gameSelection').css('display', 'inline-block'); - $("#main-content").children().not("#listener").css('display', 'inline-block'); + $(".mdl-layout__header").show(); + $("#main-content").children().not("#listener").show(); + $("#main-content").removeClass("fullscreen"); + $("#listener").removeClass("fullscreen"); $("body").css('backgroundColor', 'white'); } @@ -202,12 +202,13 @@ function startSelectedGame() { } function playGameMode() { + console.log("entering play game mode"); $(".mdl-layout__header").hide(); $("#main-content").children().not("#listener").hide(); $("#main-content").addClass("fullscreen"); $("#listener").addClass("fullscreen"); fullscreenNaclModule(); - document.body.style.backgroundColor = "black"; + $("body").css('backgroundColor', 'black'); } // Maximize the size of the nacl module by scaling and resizing appropriately diff --git a/static/js/messages.js b/static/js/messages.js index 9989ed4..3ed43fc 100644 --- a/static/js/messages.js +++ b/static/js/messages.js @@ -15,10 +15,13 @@ var sendMessage = function(method, params) { } function handleMessage(msg) { - if (msg.data.callbackId && callbacks[msg.data.callbackId]) { + if (msg.data.callbackId && callbacks[msg.data.callbackId]) { // if it's a callback, treat it as such callbacks[msg.data.callbackId][msg.data.type](msg.data.ret); delete callbacks[msg.data.callbackId] - } else { + } else { // else, it's just info, or an event console.log(msg.data); + if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function + showAppsMode(); + } } } \ No newline at end of file