moved back button into static HTML, and fixed bug where it would show in host selection menu

This commit is contained in:
R. Aidan Campbell 2016-08-27 09:22:58 -04:00
parent 8929f5840b
commit 6d432a0fb9
2 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,10 @@
<span class="mdl-layout-title">Moonlight</span> <span class="mdl-layout-title">Moonlight</span>
<!-- Add spacer, to align navigation to the right --> <!-- Add spacer, to align navigation to the right -->
<div class="mdl-layout-spacer"></div> <div class="mdl-layout-spacer"></div>
<div class="cancel-current" id="quitCurrentApp">
<img src="static\res\ic_remove_circle_white_24px.svg">
<span class="game-title">Quit Current App</span>
</div>
</div> </div>
</header> </header>
<main id="main-content" class="mdl-layout__content"> <main id="main-content" class="mdl-layout__content">

View File

@ -312,6 +312,7 @@ function showApps() {
console.log('Moved into showApps, but `api` did not initialize properly! Failing.'); console.log('Moved into showApps, but `api` did not initialize properly! Failing.');
return; return;
} }
$('#quitCurrentApp').show();
$("#game-grid").empty(); $("#game-grid").empty();
api.getAppList().then(function (appList) { api.getAppList().then(function (appList) {
// if game grid is populated, empty it // if game grid is populated, empty it
@ -336,11 +337,6 @@ function showApps() {
console.log(api.toString()); console.log(api.toString());
}); });
}); });
if($('#quitCurrentApp').length === 0) {
$(".mdl-layout__header-row").append($("<div>", {html:$("<img src=static\\res\\ic_remove_circle_white_24px.svg\>"), class: 'cancel-current', id: 'quitCurrentApp'}).append($("<span>", {html: 'Quit Current App', class:"game-title"})));
$('#quitCurrentApp').on('click', function() {api.quitApp(); api.refreshServerInfo(); });
}
}, function (failedAppList) { }, function (failedAppList) {
console.log('Failed to get applist from host: ' + api.address); console.log('Failed to get applist from host: ' + api.address);
console.log('failed API object: '); console.log('failed API object: ');
@ -354,6 +350,7 @@ function showApps() {
function showHostsAndSettingsMode() { function showHostsAndSettingsMode() {
console.log('entering show hosts and settings mode.'); console.log('entering show hosts and settings mode.');
$('#backIcon').hide(); $('#backIcon').hide();
$('#quitCurrentApp').hide();
$(".mdl-layout__header").show(); $(".mdl-layout__header").show();
$("#main-content").children().not("#listener, #loadingSpinner, #naclSpinner").show(); $("#main-content").children().not("#listener, #loadingSpinner, #naclSpinner").show();
$("#game-grid").hide(); $("#game-grid").hide();