Permalink
Browse files

Hide "dead" trainer Pokémon by default, add option to show all (#366)

* Hide dead trainer pokemon by default, add option to show all

* Add DE/EN translations

* Fix scrutinizer issue
  • Loading branch information...
michikrug authored and Obihoernchen committed Apr 18, 2018
1 parent 56b2b91 commit ae48fe70d4013f9c78b38c02f19e6eb0909cb504
View
@@ -152,30 +152,33 @@ function printTrainer(trainer, trainerIndex, pokeimg_suffix, iv_numbers, locale)
trainersInfos.append($('<td>', { id: 'trainerLevel_' + trainer.name, text: trainer.level }));
trainersInfos.append($('<td>', { id: 'trainerGyms_' + trainer.name, text: trainer.gyms }));
trainersInfos.append($('<td>', { id: 'trainerLastSeen_' + trainer.name, text: trainer.last_seen }));
trainersInfos.append($('<td>', { id: 'trainerShowAll_' + trainer.name }).append('<input type="checkbox" id="showAll">'));
$('#trainersContainer').append(trainersInfos);
var trainersPokemonsRow = $('<tr>', { id: 'trainerPokemons_' + trainer.name });
var trainersPokemons = $('<td>', { colspan: 6 });
var trainersPokemons = $('<td>', { colspan: 7 });
var trainersPokemonsContainer = $('<div>', { class: '' });
for (var pokeIndex = 0; pokeIndex < trainer.pokemons.length; pokeIndex++) {
var pokemon = trainer.pokemons[pokeIndex];
trainersPokemonsContainer.append(printPokemon(pokemon, pokeimg_suffix, iv_numbers, locale));
}
trainersInfos.find('#showAll').click(function() {
trainersPokemonsContainer.find('div.pokemon-single.unseen').fadeToggle();
});
trainersPokemons.append(trainersPokemonsContainer);
trainersPokemonsRow.append(trainersPokemons);
$('#trainersContainer').append(trainersPokemonsRow);
}
function printPokemon(pokemon, pokeimg_suffix, iv_numbers, locale) {
var trainerPokemon = $('<div>', { id: 'trainerPokemon_' + pokemon.pokemon_uid, class: 'col-md-1 col-xs-4 pokemon-single', style: 'text-align: center' });
var gymClass = '';
if (pokemon.gym_id === null) {
gymClass = 'unseen';
var gymClass = pokemon.gym_id === null ? ' unseen' : '';
var trainerPokemon = $('<div>', { id: 'trainerPokemon_' + pokemon.pokemon_uid, class: 'col-md-1 col-xs-4 pokemon-single' + gymClass, style: 'text-align: center' });
if (gymClass) {
trainerPokemon.hide();
}
trainerPokemon.append(
$('<a>', { href: 'pokemon/' + pokemon.pokemon_id }).append($('<img />', {
src: 'core/pokemons/' + pokemon.pokemon_id + pokeimg_suffix,
'class': 'img-responsive ' + gymClass
'class': 'img-responsive' + gymClass
}))
);
trainerPokemon.append($('<p>', { class: 'pkmn-name' }).append(pokemon.cp));
@@ -153,6 +153,7 @@
"TRAINERS_TABLE_LEVEL" : "Level",
"TRAINERS_TABLE_NAME" : "Name",
"TRAINERS_TABLE_SAME_LEVEL" : "Gleiches Level",
"TRAINERS_TABLE_SHOW_ALL" : "Zeige alle",
"TRAINERS_TITLE": "Finde den wahren <strong>Pokémon-Meister</strong><br><small>Trainer und deren Pokémon in Arenen</small>",
"UNSEEN": "nicht gesehen",
"VALOR": "Wagemut",
@@ -154,6 +154,7 @@
"TRAINERS_TABLE_LEVEL" : "Level",
"TRAINERS_TABLE_NAME" : "Name",
"TRAINERS_TABLE_SAME_LEVEL" : "Same Level",
"TRAINERS_TABLE_SHOW_ALL" : "Show All",
"TRAINERS_TITLE": "Find the real <strong>Pokémon Master</strong><br><small>Trainers and their Pokémon in gyms</small>",
"UNSEEN": "unseen",
"VALOR": "Valor",
View
@@ -82,17 +82,18 @@
<th><?= $locales->TRAINERS_TABLE_LEVEL ?></th>
<th><?= $locales->TRAINERS_TABLE_GYMS ?></th>
<th><?= $locales->TRAINERS_TABLE_LAST_SEEN ?></th>
<th><?= $locales->TRAINERS_TABLE_SHOW_ALL ?></th>
</tr>
</thead>
<tbody id="trainersContainer">
</tbody>
<tfoot>
<tr class="loadMore text-center">
<td colspan="6"><button id="loadMoreButton" class="btn btn-default hidden"><?= $locales->TRAINERS_LOAD_MORE ?></button></td>
<td colspan="7"><button id="loadMoreButton" class="btn btn-default hidden"><?= $locales->TRAINERS_LOAD_MORE ?></button></td>
</tr>
<tr class="trainerLoader">
<td colspan="6"><div class="loader"></div></td>
<td colspan="7"><div class="loader"></div></td>
</tr>
</tfoot>
</table>

0 comments on commit ae48fe7

Please sign in to comment.