You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
5.3 KiB
158 lines
5.3 KiB
|
1 year ago
|
<!DOCTYPE html>
|
||
|
|
<html lang="en">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
<title>OriginDex</title>
|
||
|
|
<style>
|
||
|
|
body {
|
||
|
|
font-family: Arial, sans-serif;
|
||
|
|
margin: 0;
|
||
|
|
padding: 0;
|
||
|
|
background-color: #f0f0f0;
|
||
|
|
}
|
||
|
|
#main-content {
|
||
|
|
padding: 20px;
|
||
|
|
transition: margin-right 0.3s ease-in-out;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
align-items: center;
|
||
|
|
}
|
||
|
|
.pokemon-box {
|
||
|
|
background-color: white;
|
||
|
|
border: 2px solid #ccc;
|
||
|
|
border-radius: 10px;
|
||
|
|
margin: 0 10px 30px;
|
||
|
|
padding: 20px;
|
||
|
|
position: relative;
|
||
|
|
width: calc(100% - 20px);
|
||
|
|
max-width: 800px;
|
||
|
|
box-sizing: border-box;
|
||
|
|
}
|
||
|
|
.box-title {
|
||
|
|
background-color: #4CAF50;
|
||
|
|
color: white;
|
||
|
|
padding: 5px 15px;
|
||
|
|
border-radius: 15px 15px 0 0;
|
||
|
|
position: absolute;
|
||
|
|
top: -30px;
|
||
|
|
left: 20px;
|
||
|
|
font-weight: bold;
|
||
|
|
}
|
||
|
|
.pokemon-grid {
|
||
|
|
display: grid;
|
||
|
|
grid-template-columns: repeat(6, 1fr);
|
||
|
|
gap: 10px;
|
||
|
|
}
|
||
|
|
.pokemon-cell {
|
||
|
|
background-color: #f9f9f9;
|
||
|
|
border: 1px solid #ddd;
|
||
|
|
border-radius: 10px;
|
||
|
|
padding: 10px;
|
||
|
|
text-align: center;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: space-between;
|
||
|
|
cursor: pointer;
|
||
|
|
}
|
||
|
|
.pokemon-name {
|
||
|
|
font-weight: bold;
|
||
|
|
font-size: 0.8em;
|
||
|
|
margin-bottom: 5px;
|
||
|
|
}
|
||
|
|
.pokemon-image {
|
||
|
|
width: 96px;
|
||
|
|
height: 96px;
|
||
|
|
object-fit: contain;
|
||
|
|
}
|
||
|
|
.pokemon-form {
|
||
|
|
font-style: italic;
|
||
|
|
font-size: 0.7em;
|
||
|
|
margin-top: 5px;
|
||
|
|
}
|
||
|
|
.pokemon-number {
|
||
|
|
color: #777;
|
||
|
|
font-size: 0.7em;
|
||
|
|
}
|
||
|
|
#details-panel {
|
||
|
|
width: 300px;
|
||
|
|
background-color: white;
|
||
|
|
padding: 20px;
|
||
|
|
box-shadow: -2px 0 5px rgba(0,0,0,0.1);
|
||
|
|
overflow-y: auto;
|
||
|
|
position: fixed;
|
||
|
|
top: 0;
|
||
|
|
right: -340px;
|
||
|
|
bottom: 0;
|
||
|
|
transition: right 0.3s ease-in-out;
|
||
|
|
}
|
||
|
|
#details-panel.open {
|
||
|
|
right: 0;
|
||
|
|
}
|
||
|
|
.main-content-shifted {
|
||
|
|
margin-right: 340px;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="main-content">
|
||
|
|
<h1 style="width: 100%; text-align: center;">OriginDex</h1>
|
||
|
|
|
||
|
|
{% for group in grouped_pokemon %}
|
||
|
|
<div class="pokemon-box">
|
||
|
|
<div class="box-title">Box {{ '%03d' | format(loop.index) }}</div>
|
||
|
|
<div class="pokemon-grid">
|
||
|
|
{% for pokemon in group %}
|
||
|
|
<div class="pokemon-cell" onclick="showDetails({{ pokemon.ID }}, '{{ pokemon.Form }}', event)" data-dex-number="{{ pokemon.ID }}">
|
||
|
|
<div class="pokemon-name">{{ pokemon.Name }}</div>
|
||
|
|
<img src="{{ url_for('static', filename=pokemon.Image) }}" alt="{{ pokemon.Name }} {{ pokemon.Form }}" class="pokemon-image">
|
||
|
|
{% if pokemon.Form != 'Default' %}
|
||
|
|
<div class="pokemon-form">{{ pokemon.Form }}</div>
|
||
|
|
{% endif %}
|
||
|
|
<div class="pokemon-number">#{{ '%04d'|format(pokemon.ID) }}</div>
|
||
|
|
</div>
|
||
|
|
{% endfor %}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endfor %}
|
||
|
|
</div>
|
||
|
|
<div id="details-panel"></div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
const detailsPanel = document.getElementById('details-panel');
|
||
|
|
const mainContent = document.getElementById('main-content');
|
||
|
|
|
||
|
|
function showDetails(dexNumber, formName, event) {
|
||
|
|
event.stopPropagation();
|
||
|
|
fetch(`/pokemon/${dexNumber}`)
|
||
|
|
.then(response => response.json())
|
||
|
|
.then(data => {
|
||
|
|
const formData = data.filter(encounter => encounter.form === formName);
|
||
|
|
detailsPanel.innerHTML = `<h2>Pokémon #${dexNumber} - ${formName} Form</h2>`;
|
||
|
|
detailsPanel.innerHTML += '<h3>Encounters:</h3>';
|
||
|
|
detailsPanel.innerHTML += formData.map(encounter =>
|
||
|
|
`<p><strong>${encounter.game}</strong>: ${encounter.location} (${encounter.method})</p>`
|
||
|
|
).join('');
|
||
|
|
detailsPanel.classList.add('open');
|
||
|
|
mainContent.classList.add('main-content-shifted');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
function closeDetailsPanel() {
|
||
|
|
detailsPanel.classList.remove('open');
|
||
|
|
mainContent.classList.remove('main-content-shifted');
|
||
|
|
}
|
||
|
|
|
||
|
|
document.body.addEventListener('click', function(event) {
|
||
|
|
if (!detailsPanel.contains(event.target) && !event.target.closest('.pokemon-cell')) {
|
||
|
|
closeDetailsPanel();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
detailsPanel.addEventListener('click', function(event) {
|
||
|
|
event.stopPropagation();
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|