diff --git a/static/css/style.css b/static/css/style.css index 4571b93..93920dd 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -169,5 +169,5 @@ main { height: 100%; } .current-game { - border: 1px solid red; + border: 3px solid green; } diff --git a/static/js/index.js b/static/js/index.js index 6706a14..7d5d98e 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -19,7 +19,6 @@ function attachListeners() { $('#continueAddHost').on('click', continueAddHost); $('#forgetHost').on('click', forgetHost); $('#cancelPairingDialog').on('click', pairingPopupCanceled); - $('#selectGame').on('change', gameSelectUpdated); $('#cancelReplaceApp').on('click', cancelReplaceApp); $('#continueReplaceApp').on('click', continueReplaceApp); $('#quitGameButton').on('click', stopGame); @@ -99,18 +98,6 @@ function moduleDidLoad() { } } -// because the user can change the host at any time, we continually have to check -function updateHost() { - host = $('#GFEHostIPField').val(); - if (host == null || host == "") { - host = $("#selectHost option:selected").val(); - } - - if(api && api.address != host) { - api = new NvHTTP(host, myUniqueid); - } -} - // pair to the given hostname or IP. Returns whether pairing was successful. function pairTo(host, onSuccess, onFailure) { if(!pairingCert) { @@ -146,19 +133,6 @@ function pairTo(host, onSuccess, onFailure) { snackbarLog('Pairing successful'); pairingDialog.close(); - var hostSelect = $('#selectHost')[0]; - for(var i = 0; i < hostSelect.length; i++) { // check if we already have the host. - if (hostSelect.options[i].value == host) onSuccess(); - } - - // old code for the drop down menu - var opt = document.createElement('option'); - opt.appendChild(document.createTextNode(host)); - opt.value = host; - $('#selectHost').append(opt); - hosts.push(host); - - // new code for grid layout var cell = document.createElement('div'); cell.className += 'mdl-cell mdl-cell--3-col'; cell.id = 'hostgrid-' + hosts[i]; @@ -181,9 +155,6 @@ function hostChosen(sourceEvent) { if(sourceEvent && sourceEvent.srcElement) { console.log('parsing host from grid element.'); host = sourceEvent.srcElement.innerText; - } else { - console.log('falling back to old host selection'); - updateHost(); } @@ -196,14 +167,12 @@ function hostChosen(sourceEvent) { pairTo(host); } if(hosts.indexOf(host) < 0) { // we don't have this host in our list. add it, and save it. - var opt = document.createElement('option'); - opt.appendChild(document.createTextNode(host)); - opt.value = host; - $('#selectHost').append(opt); - hosts.push(host); - saveHosts(); - $('#GFEHostIPField').val(''); // eat the contents of the textbox - $('#GFEHostIPField').parent().removeClass('is-dirty'); + var cell = document.createElement('div'); + cell.className += 'mdl-cell mdl-cell--3-col'; + cell.id = 'hostgrid-' + hosts[i]; + cell.innerHTML = hosts[i]; + $('#host-grid').append(cell); + cell.onclick = hostChosen; } showApps(); }, function (failedRefreshInfo) { @@ -239,8 +208,7 @@ function continueAddHost() { // TODO: use the chrome context menu to add right-click support to remove the host in grid-ui // https://github.com/GoogleChrome/chrome-app-samples/blob/master/samples/context-menu/main.js function forgetHost() { - updateHost(); - $("#selectHost option:selected").remove(); + snackbarLog('Feature not yet ported to grid-ui'); hosts.splice(hosts.indexOf(host), 1); // remove the host from the array; saveHosts(); } @@ -260,14 +228,14 @@ function showApps() { // if game grid is populated, empty it if($("#game-grid").children().length > 0) { - $("game-grid").empty(); + $("#game-grid").empty(); } appList.forEach(function (app) { api.getBoxArt(app.id).then(function (resolvedPromise) { var imageBlob = new Blob([resolvedPromise], {type: "image/png"}); - $("#game-grid").append($("