Simplified the stylizeBoxArt function

This commit is contained in:
Jorys_Paulin 2018-05-01 22:25:25 +02:00
parent 492ee0dc61
commit 447ab4a74c

View File

@ -436,17 +436,9 @@ function removeClicked(host) {
// the function was made like this so that we can remove duplicated code, but // the function was made like this so that we can remove duplicated code, but
// not do N*N stylizations of the box art, or make the code not flow very well // not do N*N stylizations of the box art, or make the code not flow very well
function stylizeBoxArt(freshApi, appIdToStylize) { function stylizeBoxArt(freshApi, appIdToStylize) {
if (freshApi.currentGame === appIdToStylize) { // stylize the currently running game // If the running game is the good one then style it
// destylize it, if it has the not-current-game style var el = document.querySelector("#game-" + appIdToStylize);
if ($('#game-' + appIdToStylize).hasClass("not-current-game")) $('#game-' + appIdToStylize).removeClass("not-current-game"); return (freshApi.currentGame === appIdToStylize) ? el.classList.add('current-game') : el.classList.remove('current-game')
// add the current-game style
$('#game-' + appIdToStylize).addClass("current-game");
} else {
// destylize it, if it has the current-game style
if ($('#game-' + appIdToStylize).hasClass("current-game")) $('#game-' + appIdToStylize).removeClass("current-game");
// add the not-current-game style
$('#game-' + appIdToStylize).addClass('not-current-game');
}
} }
function sortTitles(list, sortOrder) { function sortTitles(list, sortOrder) {