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.
729 lines
26 KiB
729 lines
26 KiB
<!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;
|
|
/*width: 120px;*/ /* Fixed width */
|
|
height: 180px; /* Fixed height */
|
|
}
|
|
.pokemon-cell.empty {
|
|
background-color: #e0e0e0;
|
|
cursor: default;
|
|
}
|
|
.pokemon-name {
|
|
font-weight: bold;
|
|
font-size: 0.8em;
|
|
margin-bottom: 5px;
|
|
height: 2.4em; /* Allows for 2 lines of text */
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 100%;
|
|
}
|
|
.pokemon-image {
|
|
width: 96px;
|
|
height: 96px;
|
|
object-fit: contain;
|
|
background-color: #f9f9f9; /* Light gray background for placeholder */
|
|
}
|
|
.pokemon-form {
|
|
min-height: 2.4em;
|
|
line-height: 1.2em;
|
|
font-style: italic;
|
|
font-size: 0.7em;
|
|
margin-top: 5px;
|
|
}
|
|
.pokemon-number {
|
|
color: #777;
|
|
font-size: 0.7em;
|
|
margin-top: 5px;
|
|
}
|
|
#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;
|
|
}
|
|
.pokemon-info {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 100%;
|
|
margin-top: 5px;
|
|
position: relative;
|
|
}
|
|
|
|
.pokemon-number {
|
|
color: #777;
|
|
font-size: 0.7em;
|
|
text-align: center;
|
|
width: 100%;
|
|
}
|
|
|
|
.origin-mark {
|
|
width: 20px;
|
|
height: 20px;
|
|
object-fit: contain;
|
|
filter: invert(100%);
|
|
}
|
|
|
|
/* Optional: Add a background circle for better visibility */
|
|
.origin-mark-container {
|
|
background-color: rgba(0, 0, 0, 0.1);
|
|
border-radius: 50%;
|
|
padding: 2px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0;
|
|
}
|
|
|
|
.pokeball-container {
|
|
position: absolute;
|
|
left: 0;
|
|
bottom: 0;
|
|
}
|
|
|
|
.pokeball-icon {
|
|
width: 20px;
|
|
height: 20px;
|
|
object-fit: contain;
|
|
cursor: pointer;
|
|
transition: filter 0.3s ease;
|
|
}
|
|
|
|
.pokeball-icon.grayscale {
|
|
filter: grayscale(100%);
|
|
}
|
|
|
|
.game-encounters {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.collapsible {
|
|
background-color: #f1f1f1;
|
|
color: #444;
|
|
cursor: pointer;
|
|
padding: 10px;
|
|
width: 100%;
|
|
text-align: left;
|
|
outline: none;
|
|
font-size: 15px;
|
|
transition: 0.4s;
|
|
border: none;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.active, .collapsible:hover {
|
|
background-color: #ccc;
|
|
}
|
|
|
|
.encounter-list {
|
|
display: none;
|
|
padding: 0 18px;
|
|
background-color: white;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.toggle-icon {
|
|
float: right;
|
|
}
|
|
|
|
.tabs {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-bottom: 20px;
|
|
gap: 10px;
|
|
}
|
|
|
|
.tab-button {
|
|
padding: 10px 20px;
|
|
border: none;
|
|
background-color: #f0f0f0;
|
|
cursor: pointer;
|
|
border-radius: 5px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.tab-button.active {
|
|
background-color: #4CAF50;
|
|
color: white;
|
|
}
|
|
|
|
.tab-content {
|
|
display: none;
|
|
}
|
|
|
|
.tab-content.active {
|
|
display: block;
|
|
}
|
|
|
|
.efficiency-plan {
|
|
background-color: white;
|
|
border: 2px solid #ccc;
|
|
border-radius: 10px;
|
|
margin: 0 10px 30px;
|
|
padding: 20px;
|
|
position: relative;
|
|
width: calc(100% - 20px);
|
|
min-width: 1050px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.games-accordion {
|
|
border: 1px solid #ddd;
|
|
border-radius: 5px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.game-section {
|
|
border-bottom: 1px solid #ddd;
|
|
}
|
|
|
|
.game-section:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.game-title {
|
|
background-color: #f5f5f5;
|
|
padding: 15px 20px;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.game-title-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.game-catch-total {
|
|
background-color: #4CAF50;
|
|
color: white;
|
|
padding: 4px 8px;
|
|
border-radius: 12px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.game-title:hover {
|
|
background-color: #e9e9e9;
|
|
}
|
|
|
|
.game-title.active {
|
|
background-color: #e0e0e0;
|
|
}
|
|
|
|
.game-content {
|
|
display: none;
|
|
padding: 20px;
|
|
background-color: white;
|
|
}
|
|
|
|
.game-content.show {
|
|
display: block;
|
|
}
|
|
|
|
.pokemon-entry {
|
|
margin: 15px 0;
|
|
border: 1px solid #eee;
|
|
border-radius: 5px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.pokemon-header {
|
|
background-color: #f9f9f9;
|
|
padding: 10px 15px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.pokemon-header:hover {
|
|
background-color: #f0f0f0;
|
|
}
|
|
|
|
.pokemon-header-content {
|
|
flex-grow: 1;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.pokemon-details {
|
|
display: none;
|
|
padding: 15px;
|
|
background-color: white;
|
|
}
|
|
|
|
.pokemon-details.show {
|
|
display: block;
|
|
}
|
|
|
|
.pokemon-thumbnail {
|
|
width: 48px;
|
|
height: 48px;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.catch-count {
|
|
color: #666;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.evolution-list, .breeding-list {
|
|
margin: 10px 0;
|
|
padding: 10px;
|
|
background-color: #fff;
|
|
border-radius: 3px;
|
|
border: 1px solid #eee;
|
|
}
|
|
|
|
.evolution-list h4, .breeding-list h4 {
|
|
margin-top: 0;
|
|
color: #666;
|
|
}
|
|
|
|
.evolution-item, .breeding-item {
|
|
margin: 5px 0;
|
|
padding: 8px 12px;
|
|
background-color: #f5f5f5;
|
|
border-radius: 3px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.pokemon-targets-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
gap: 15px;
|
|
padding: 15px;
|
|
}
|
|
|
|
.target-card {
|
|
background-color: #f9f9f9;
|
|
border: 1px solid #eee;
|
|
border-radius: 8px;
|
|
padding: 10px;
|
|
text-align: center;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.target-name {
|
|
font-weight: bold;
|
|
font-size: 0.9em;
|
|
line-height: 1.2;
|
|
margin: 0;
|
|
}
|
|
|
|
.target-image {
|
|
width: 64px;
|
|
height: 64px;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.target-method {
|
|
font-size: 0.8em;
|
|
color: #666;
|
|
background-color: #e9e9e9;
|
|
padding: 3px 8px;
|
|
border-radius: 12px;
|
|
}
|
|
|
|
.target-count {
|
|
font-size: 0.8em;
|
|
color: #4CAF50;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="main-content">
|
|
<h1 style="width: 100%; text-align: center;">OriginDex</h1>
|
|
|
|
<div class="tabs">
|
|
<button class="tab-button active" onclick="switchTab('storage')">Storage</button>
|
|
<button class="tab-button" onclick="switchTab('efficiency')">Efficiency Plan</button>
|
|
</div>
|
|
|
|
<div id="storage-tab" class="tab-content active">
|
|
{% 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 %}
|
|
{% if pokemon %}
|
|
<div class="pokemon-cell" onclick="showDetails('{{ pokemon.ID }}', '{{ pokemon.Form }}', '{{ pokemon.pfic }}', event)" data-dex-number="{{ pokemon.ID }}">
|
|
<div class="pokemon-name">{{ pokemon.Name }}</div>
|
|
<img data-src="{{ url_for('static', filename=pokemon.Image) }}" alt="{{ pokemon.Name }} {{ pokemon.Form }}" class="pokemon-image lazy-load" src="{{ url_for('static', filename='images/placeholder.png') }}">
|
|
<div class="pokemon-form">
|
|
{% if pokemon.Form != 'Default' %}
|
|
{{ pokemon.Form }}
|
|
{% else %}
|
|
-----
|
|
{% endif %}
|
|
</div>
|
|
<div class="pokemon-info">
|
|
<div class="pokeball-container">
|
|
<img src="{{ url_for('static', filename='images/pokeball_color.png') }}" alt="Pokeball" class="pokeball-icon grayscale" onclick="togglePokeball(event, this)">
|
|
</div>
|
|
<div class="pokemon-number">#{{ '%04d'|format(pokemon.ID) }}</div>
|
|
{% if pokemon.MarkIcon %}
|
|
<div class="origin-mark-container">
|
|
<img src="{{ url_for('static', filename=pokemon.MarkIcon) }}" alt="Origin Mark" class="origin-mark" title="{{ pokemon.EarliestGame }}">
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="pokemon-cell empty"></div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<div id="efficiency-tab" class="tab-content">
|
|
<div class="efficiency-plan">
|
|
<div class="games-accordion">
|
|
{% for game in efficiency_plan %}
|
|
<div class="game-section">
|
|
<div class="game-title" onclick="toggleGameContent(this)">
|
|
{{ game.game_name }}
|
|
<div class="game-title-right">
|
|
<span class="game-catch-total">
|
|
Catch: {{ game.pokemon|sum(attribute='catch_count') }}
|
|
</span>
|
|
<span class="toggle-icon">▼</span>
|
|
</div>
|
|
</div>
|
|
<div class="game-content">
|
|
{% for pokemon in game.pokemon %}
|
|
<div class="pokemon-entry">
|
|
<div class="pokemon-header" onclick="togglePokemonDetails(this)">
|
|
<img src="{{ url_for('static', filename='images/pokemon/' + pokemon.pfic + '.png') }}"
|
|
alt="{{ pokemon.name }}"
|
|
class="pokemon-thumbnail">
|
|
<div class="pokemon-header-content">
|
|
<h3 style="margin: 0;">
|
|
{{ pokemon.name }}{% if pokemon.form_name %} ({{ pokemon.form_name }}){% endif %}
|
|
</h3>
|
|
<span class="catch-count">Catch: {{ pokemon.catch_count }}</span>
|
|
<span class="toggle-icon">▼</span>
|
|
</div>
|
|
</div>
|
|
<div class="pokemon-details">
|
|
{% if pokemon.evolve_to or pokemon.breed_for %}
|
|
<div class="pokemon-targets-grid">
|
|
{% if pokemon.evolve_to %}
|
|
{% for evolution in pokemon.evolve_to %}
|
|
<div class="target-card">
|
|
<div class="target-name">
|
|
{{ evolution.name }}
|
|
{% if evolution.form_name %}({{ evolution.form_name }}){% endif %}
|
|
</div>
|
|
<img src="{{ url_for('static', filename='images/pokemon/' + evolution.pfic + '.png') }}"
|
|
alt="{{ evolution.name }}"
|
|
class="target-image">
|
|
<span class="target-method">{{ evolution.method }}</span>
|
|
<span class="target-count">Need: {{ evolution.count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if pokemon.breed_for %}
|
|
{% for breeding in pokemon.breed_for %}
|
|
<div class="target-card">
|
|
<div class="target-name">
|
|
{{ breeding.name }}
|
|
{% if breeding.form_name %}({{ breeding.form_name }}){% endif %}
|
|
</div>
|
|
<img src="{{ url_for('static', filename='images/pokemon/' + breeding.pfic + '.png') }}"
|
|
alt="{{ breeding.name }}"
|
|
class="target-image">
|
|
<span class="target-method">Breed</span>
|
|
<span class="target-count">Need: {{ breeding.count }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="details-panel"></div>
|
|
|
|
<script>
|
|
const detailsPanel = document.getElementById('details-panel');
|
|
const mainContent = document.getElementById('main-content');
|
|
|
|
function showDetails(dexNumber, formName, pfic, event) {
|
|
event.stopPropagation();
|
|
fetch(`/pokemon/${pfic}`)
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const encountersByGame = groupEncountersByGame(data);
|
|
detailsPanel.innerHTML = `
|
|
<h2>Pokémon #${dexNumber} - ${formName} Form</h2>
|
|
<h3>Encounters:</h3>
|
|
${generateEncounterHTML(encountersByGame)}
|
|
`;
|
|
detailsPanel.classList.add('open');
|
|
mainContent.classList.add('main-content-shifted');
|
|
addCollapsibleListeners();
|
|
});
|
|
}
|
|
|
|
function groupEncountersByGame(encounters) {
|
|
return encounters.reduce((acc, encounter) => {
|
|
if (!acc[encounter.game]) {
|
|
acc[encounter.game] = {
|
|
game_id: encounter.game_id,
|
|
encounters: []
|
|
};
|
|
}
|
|
acc[encounter.game].encounters.push(encounter);
|
|
return acc;
|
|
}, {});
|
|
}
|
|
|
|
function generateEncounterHTML(encountersByGame) {
|
|
return Object.entries(encountersByGame)
|
|
.sort((a, b) => a[1].game_id - b[1].game_id)
|
|
.map(([game, data]) => `
|
|
<div class="game-encounters">
|
|
<h4 class="collapsible">${game} <span class="toggle-icon">▼</span></h4>
|
|
<div class="encounter-list">
|
|
${data.encounters.map(encounter => `
|
|
<p>${encounter.location}
|
|
${encounter.day ? `(${encounter.day})` : ''}
|
|
${encounter.time ? `(${encounter.time})` : ''}
|
|
${encounter.static_encounter ? '(Static)' : ''}
|
|
${encounter.fishing ? '(Fishing)' : ''}
|
|
${encounter.starter ? '(Starter)' : ''}
|
|
</p>
|
|
`).join('')}
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
}
|
|
|
|
function addCollapsibleListeners() {
|
|
const collapsibles = document.querySelectorAll('.collapsible');
|
|
collapsibles.forEach(item => {
|
|
item.addEventListener('click', function() {
|
|
this.classList.toggle('active');
|
|
const content = this.nextElementSibling;
|
|
if (content.style.display === 'block') {
|
|
content.style.display = 'none';
|
|
this.querySelector('.toggle-icon').textContent = '▼';
|
|
} else {
|
|
content.style.display = 'block';
|
|
this.querySelector('.toggle-icon').textContent = '▲';
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
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();
|
|
});
|
|
|
|
function togglePokeball(event, element) {
|
|
event.stopPropagation();
|
|
element.classList.toggle('grayscale');
|
|
}
|
|
|
|
// Lazy loading for images
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
var lazyloadImages;
|
|
|
|
if ("IntersectionObserver" in window) {
|
|
lazyloadImages = document.querySelectorAll(".lazy-load");
|
|
var imageObserver = new IntersectionObserver(function(entries, observer) {
|
|
entries.forEach(function(entry) {
|
|
if (entry.isIntersecting) {
|
|
var image = entry.target;
|
|
image.src = image.dataset.src;
|
|
image.classList.remove("lazy-load");
|
|
imageObserver.unobserve(image);
|
|
}
|
|
});
|
|
});
|
|
|
|
lazyloadImages.forEach(function(image) {
|
|
imageObserver.observe(image);
|
|
});
|
|
} else {
|
|
var lazyloadThrottleTimeout;
|
|
lazyloadImages = document.querySelectorAll(".lazy-load");
|
|
|
|
function lazyload () {
|
|
if(lazyloadThrottleTimeout) {
|
|
clearTimeout(lazyloadThrottleTimeout);
|
|
}
|
|
|
|
lazyloadThrottleTimeout = setTimeout(function() {
|
|
var scrollTop = window.pageYOffset;
|
|
lazyloadImages.forEach(function(img) {
|
|
if(img.offsetTop < (window.innerHeight + scrollTop)) {
|
|
img.src = img.dataset.src;
|
|
img.classList.remove('lazy-load');
|
|
}
|
|
});
|
|
if(lazyloadImages.length == 0) {
|
|
document.removeEventListener("scroll", lazyload);
|
|
window.removeEventListener("resize", lazyload);
|
|
window.removeEventListener("orientationChange", lazyload);
|
|
}
|
|
}, 20);
|
|
}
|
|
|
|
document.addEventListener("scroll", lazyload);
|
|
window.addEventListener("resize", lazyload);
|
|
window.addEventListener("orientationChange", lazyload);
|
|
}
|
|
});
|
|
|
|
function toggleGameContent(titleElement) {
|
|
const content = titleElement.nextElementSibling;
|
|
const icon = titleElement.querySelector('.toggle-icon');
|
|
|
|
if (content.classList.contains('show')) {
|
|
content.classList.remove('show');
|
|
icon.textContent = '▼';
|
|
} else {
|
|
content.classList.add('show');
|
|
icon.textContent = '▲';
|
|
}
|
|
}
|
|
|
|
function switchTab(tabName) {
|
|
// Update tab buttons
|
|
document.querySelectorAll('.tab-button').forEach(button => {
|
|
button.classList.remove('active');
|
|
});
|
|
document.querySelector(`[onclick="switchTab('${tabName}')"]`).classList.add('active');
|
|
|
|
// Update tab content
|
|
document.querySelectorAll('.tab-content').forEach(content => {
|
|
content.classList.remove('active');
|
|
});
|
|
document.getElementById(`${tabName}-tab`).classList.add('active');
|
|
|
|
// Show first game content when switching to efficiency tab
|
|
if (tabName === 'efficiency') {
|
|
const firstGame = document.querySelector('.game-content');
|
|
const firstGameTitle = document.querySelector('.game-title');
|
|
if (firstGame && firstGameTitle) {
|
|
firstGame.classList.add('show');
|
|
firstGameTitle.querySelector('.toggle-icon').textContent = '▲';
|
|
}
|
|
}
|
|
}
|
|
|
|
function togglePokemonDetails(headerElement) {
|
|
const detailsElement = headerElement.nextElementSibling;
|
|
const icon = headerElement.querySelector('.toggle-icon');
|
|
|
|
if (detailsElement.classList.contains('show')) {
|
|
detailsElement.classList.remove('show');
|
|
icon.textContent = '▼';
|
|
} else {
|
|
detailsElement.classList.add('show');
|
|
icon.textContent = '▲';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|