|
|
@ -451,6 +451,14 @@ |
|
|
justify-content: space-between; |
|
|
justify-content: space-between; |
|
|
gap: 10px; |
|
|
gap: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.catch-count-pokeball.grayscale { |
|
|
|
|
|
filter: grayscale(100%); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.target-image.grayscale { |
|
|
|
|
|
filter: grayscale(100%); |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
</head> |
|
|
</head> |
|
|
<body> |
|
|
<body> |
|
|
@ -481,7 +489,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="pokemon-info"> |
|
|
<div class="pokemon-info"> |
|
|
<div class="pokeball-container"> |
|
|
<div class="pokeball-container"> |
|
|
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" alt="Pokeball" class="pokeball-icon grayscale" onclick="togglePokeball(event, this)"> |
|
|
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" alt="Pokeball" class="pokeball-icon grayscale" data-pfic="{{ pokemon.pfic }}" onclick="togglePokeball(event, this)"> |
|
|
</div> |
|
|
</div> |
|
|
<div class="pokemon-number">#{{ '%04d'|format(pokemon.ID) }}</div> |
|
|
<div class="pokemon-number">#{{ '%04d'|format(pokemon.ID) }}</div> |
|
|
{% if pokemon.MarkIcon %} |
|
|
{% if pokemon.MarkIcon %} |
|
|
@ -529,7 +537,8 @@ |
|
|
<div class="catch-count-container"> |
|
|
<div class="catch-count-container"> |
|
|
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" |
|
|
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" |
|
|
alt="Catch count" |
|
|
alt="Catch count" |
|
|
class="catch-count-pokeball"> |
|
|
class="catch-count-pokeball grayscale" |
|
|
|
|
|
data-pfic="{{ pokemon.pfic }}"> |
|
|
<span class="catch-count">{{ pokemon.catch_count }}</span> |
|
|
<span class="catch-count">{{ pokemon.catch_count }}</span> |
|
|
</div> |
|
|
</div> |
|
|
{% if (pokemon.evolve_to|length > 0) or (pokemon.breed_for|length > 0) %} |
|
|
{% if (pokemon.evolve_to|length > 0) or (pokemon.breed_for|length > 0) %} |
|
|
@ -675,7 +684,72 @@ |
|
|
|
|
|
|
|
|
function togglePokeball(event, element) { |
|
|
function togglePokeball(event, element) { |
|
|
event.stopPropagation(); |
|
|
event.stopPropagation(); |
|
|
element.classList.toggle('grayscale'); |
|
|
const pfic = element.dataset.pfic; |
|
|
|
|
|
|
|
|
|
|
|
fetch(`/toggle_catch/${pfic}`, { |
|
|
|
|
|
method: 'POST', |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/json', |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.then(response => response.json()) |
|
|
|
|
|
.then(data => { |
|
|
|
|
|
if (data.status === 'caught') { |
|
|
|
|
|
element.classList.remove('grayscale'); |
|
|
|
|
|
} else { |
|
|
|
|
|
element.classList.add('grayscale'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Update the efficiency plan display |
|
|
|
|
|
updateEfficiencyPlan(pfic, data.status === 'caught'); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(error => console.error('Error:', error)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateEfficiencyPlan(pfic, isCaught) { |
|
|
|
|
|
const planTab = document.getElementById('efficiency-tab'); |
|
|
|
|
|
planTab.querySelectorAll('.pokemon-entry').forEach(entry => { |
|
|
|
|
|
// Update for direct matches |
|
|
|
|
|
if (entry.dataset.pfic === pfic) { |
|
|
|
|
|
updateEntryDisplay(entry, isCaught); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Update for evolution targets |
|
|
|
|
|
entry.querySelectorAll('.target-card').forEach(card => { |
|
|
|
|
|
if (card.dataset.pfic === pfic) { |
|
|
|
|
|
updateTargetDisplay(card, entry, isCaught); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateEntryDisplay(entry, isCaught) { |
|
|
|
|
|
const catchCount = entry.querySelector('.catch-count'); |
|
|
|
|
|
let count = parseInt(catchCount.textContent); |
|
|
|
|
|
count += isCaught ? -1 : 1; |
|
|
|
|
|
catchCount.textContent = count; |
|
|
|
|
|
|
|
|
|
|
|
const pokeball = entry.querySelector('.catch-count-pokeball'); |
|
|
|
|
|
pokeball.classList.toggle('grayscale', count === 0); |
|
|
|
|
|
|
|
|
|
|
|
updateGameTotal(entry, isCaught); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateTargetDisplay(card, parentEntry, isCaught) { |
|
|
|
|
|
const targetImage = card.querySelector('.target-image'); |
|
|
|
|
|
targetImage.classList.toggle('grayscale', isCaught); |
|
|
|
|
|
updateEntryDisplay(parentEntry, true); // Always decrease parent count |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateGameTotal(entry, isCaught) { |
|
|
|
|
|
const gameSection = entry.closest('.game-content'); |
|
|
|
|
|
if (gameSection) { |
|
|
|
|
|
const gameTitle = gameSection.previousElementSibling; |
|
|
|
|
|
const totalElement = gameTitle.querySelector('.game-catch-total'); |
|
|
|
|
|
let total = parseInt(totalElement.textContent.split(': ')[1]); |
|
|
|
|
|
total += isCaught ? -1 : 1; |
|
|
|
|
|
totalElement.textContent = `Catch: ${total}`; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Lazy loading for images |
|
|
// Lazy loading for images |
|
|
@ -778,6 +852,25 @@ |
|
|
icon.textContent = '▲'; |
|
|
icon.textContent = '▲'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
// Load caught Pokemon on page load |
|
|
|
|
|
fetch('/get_caught_pokemon') |
|
|
|
|
|
.then(response => response.json()) |
|
|
|
|
|
.then(caught => { |
|
|
|
|
|
caught.forEach(pfic => { |
|
|
|
|
|
const pokeball = document.querySelector(`.pokeball-icon[data-pfic="${pfic}"]`); |
|
|
|
|
|
if (pokeball) { |
|
|
|
|
|
pokeball.classList.remove('grayscale'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const planPokeball = document.querySelector(`.catch-count-pokeball[data-pfic="${pfic}"]`); |
|
|
|
|
|
if (planPokeball) { |
|
|
|
|
|
planPokeball.classList.remove('grayscale'); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |
|
|
|