From 24692e632e2f7819c8c217b28161283284c671a8 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Mon, 11 Aug 2014 14:31:59 +0100 Subject: [PATCH] Game switching fixes. * Recording game data works correctly. * Global messages now get cleared from the UI. * Fixed undefined variable error. --- resources/report/js/script.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 7a15f49d..7de67a5e 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -224,7 +224,8 @@ function changeGame(evt) { index = i; } } - } else { + } + if (index == undefined) { for (var i = 0; i < loot.settings.games.length; ++i) { if (loot.settings.games[i].folder == loot.game.folder) { index = i; @@ -263,9 +264,13 @@ function changeGame(evt) { plugin.li.parentElement.removeChild(plugin.li); plugin.li = undefined; }); + var globalMessages = document.getElementById('generalMessages').getElementsByTagName('ul')[0]; + while (globalMessages.firstElementChild) { + globalMessages.removeChild(globalMessages.firstElementChild); + } /* Now update interface for new data. */ - updateInterfaceWithGameInfo(); + updateInterfaceWithGameInfo(response); /* Now update game menu to highlight the newly selected game. */ updateSelectedGame();