Removed Jquery from game list generation

This commit is contained in:
Jorys_Paulin 2018-06-03 17:10:16 +02:00
parent 0dfc4e6a61
commit 84e1cb80e1

View File

@ -506,32 +506,24 @@ function showApps(host) {
// double clicking the button will cause multiple box arts to appear. // double clicking the button will cause multiple box arts to appear.
// to mitigate this we ensure we don't add a duplicate. // to mitigate this we ensure we don't add a duplicate.
// This isn't perfect: there's lots of RTTs before the logic prevents anything // This isn't perfect: there's lots of RTTs before the logic prevents anything
var outerDiv = $("<div>", { var gameCard = document.createElement('div')
class: 'game-container mdl-card mdl-shadow--4dp', gameCard.id = 'game-' + app.id
id: 'game-' + app.id, gameCard.className = 'game-container mdl-card mdl-shadow--4dp'
role: 'link', gameCard.setAttribute('role', 'link')
tabindex: 0, gameCard.tabIndex = 0
title: app.title, gameCard.title = app.title
'aria-label': app.title
});
$(outerDiv).append($("<div>", { gameCard.innerHTML = `<div class="game-title">${app.title}</div>`
class: "game-title",
html: $("<span>", {
html: app.title
})
}));
$("#game-grid").append(outerDiv);
$('#game-' + app.id).on('click', function() { gameCard.addEventListener('click', e => {
startGame(host, app.id); startGame(host, app.id)
}); })
$('#game-' + app.id).keypress(function(e) { gameCard.addEventListener('keydown', e => {
if (e.keyCode == 13) { if(e.key == "Enter") {
startGame(host, app.id); startGame(host, app.id);
} }
}); })
document.querySelector('#game-grid').appendChild(gameCard);
// apply CSS stylization to indicate whether the app is active // apply CSS stylization to indicate whether the app is active
stylizeBoxArt(host, app.id); stylizeBoxArt(host, app.id);
} }
@ -543,7 +535,7 @@ function showApps(host) {
img.src = 'static/res/placeholder_error.svg' img.src = 'static/res/placeholder_error.svg'
}); });
img.onload = e => img.classList.add('fade-in'); img.onload = e => img.classList.add('fade-in');
$(outerDiv).append(img); $(gameCard).append(img);
}); });
}, function(failedAppList) { }, function(failedAppList) {
$('#naclSpinner').hide(); $('#naclSpinner').hide();