From 43f464cf9c143b3446624d9cf1fb247c2361611e Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Sun, 10 Jul 2016 14:14:13 -0400 Subject: [PATCH] fixed bug where current app wasn't bordered --- static/js/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index e413947..86ec45c 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -237,6 +237,16 @@ function showApps() { var imageBlob = new Blob([resolvedPromise], {type: "image/png"}); $("#game-grid").append($("
", {html:$("", {src: URL.createObjectURL(imageBlob), id: 'game-'+app.id, name: app.title }), class: 'box-art mdl-cell mdl-cell--3-col'})); $('#game-'+app.id).on('click', startGame); + + if (api.currentGame === app.id){ // stylize the currently running game + $('#game-'+ api.currentGame).addClass("current-game"); + } else { + if ($('#game-'+ api.id).hasClass("current-game")) { // destylize it otherwise + console.log('stripping now inactive game: ' + app.title); + $('#game-'+ api.id).removeClass("current-game"); + } + } + }, function (failedPromise) { console.log('Error! Failed to retrieve box art for app ID: ' + app.id + '. Returned value was: ' + failedPromise) }); @@ -253,9 +263,6 @@ function showApps() { function showAppsMode() { console.log("entering show apps mode."); - if (api.currentGame != 0) - $('#game-'+ api.currentGame).addClass(".current-game"); - $("#streamSettings").hide(); $("#hostSettings").hide();