enhanced list modal and fixes
This commit is contained in:
@@ -64,7 +64,7 @@ async function loadAnime() {
|
||||
}
|
||||
|
||||
animeData = data;
|
||||
|
||||
animeData.entry_type = 'ANIME';
|
||||
const metadata = MediaMetadataUtils.formatAnimeData(data, !!extensionName);
|
||||
|
||||
updatePageTitle(metadata.title);
|
||||
|
||||
@@ -92,6 +92,7 @@ function startHeroCycle() {
|
||||
|
||||
async function updateHeroUI(anime) {
|
||||
if(!anime) return;
|
||||
anime.entry_type = 'ANIME';
|
||||
|
||||
const title = anime.title.english || anime.title.romaji || "Unknown Title";
|
||||
const score = anime.averageScore ? anime.averageScore + '% Match' : 'N/A';
|
||||
|
||||
@@ -69,7 +69,8 @@ async function loadBookMetadata() {
|
||||
bookData = raw;
|
||||
|
||||
const metadata = MediaMetadataUtils.formatBookData(raw, !!extensionName);
|
||||
|
||||
bookData.entry_type =
|
||||
metadata.format === 'MANGA' ? 'MANGA' : 'NOVEL';
|
||||
updatePageTitle(metadata.title);
|
||||
updateMetadata(metadata);
|
||||
updateExtensionPill();
|
||||
|
||||
@@ -55,7 +55,8 @@ function startHeroCycle() {
|
||||
|
||||
async function updateHeroUI(book) {
|
||||
if(!book) return;
|
||||
|
||||
book.entry_type =
|
||||
book.format === 'MANGA' ? 'MANGA' : 'NOVEL';
|
||||
const title = book.title.english || book.title.romaji;
|
||||
const desc = book.description || "No description available.";
|
||||
const poster = (book.coverImage && (book.coverImage.extraLarge || book.coverImage.large)) || '';
|
||||
|
||||
@@ -299,7 +299,7 @@ async function searchGallery(isLoadMore = false) {
|
||||
const msg = favoritesMode
|
||||
? (query ? 'No favorites found matching your search' : 'You don\'t have any favorite images yet')
|
||||
: 'No results found';
|
||||
resultsContainer.innerHTML = `<p style="text-align:center;color:var(--text-secondary);padding:4rem;font-size:1.1rem;">${msg}</p>`;
|
||||
resultsContainer.innerHTML = `<p style="text-align:center;color:var(--color-text-secondary);padding:4rem;font-size:1.1rem;">${msg}</p>`;
|
||||
}
|
||||
|
||||
if (msnry) msnry.layout();
|
||||
|
||||
@@ -284,7 +284,7 @@ function createListItem(item) {
|
||||
|
||||
const itemLink = getEntryLink(item);
|
||||
|
||||
const posterUrl = item.poster || '/public/assets/placeholder.png';
|
||||
const posterUrl = item.poster || '/public/assets/placeholder.svg';
|
||||
const progress = item.progress || 0;
|
||||
|
||||
const totalUnits = item.entry_type === 'ANIME' ?
|
||||
|
||||
@@ -83,7 +83,7 @@ const ListModalManager = {
|
||||
document.getElementById('progress-label');
|
||||
|
||||
if (this.isInList && this.currentEntry) {
|
||||
document.getElementById('entry-status').value = this.currentEntry.status || 'PLANNING';
|
||||
document.getElementById('entry-status').value = this.normalizeStatus(this.currentEntry.status);
|
||||
document.getElementById('entry-progress').value = this.currentEntry.progress || 0;
|
||||
document.getElementById('entry-score').value = this.currentEntry.score || '';
|
||||
document.getElementById('entry-start-date').value = this.currentEntry.start_date?.split('T')[0] || '';
|
||||
@@ -131,6 +131,12 @@ const ListModalManager = {
|
||||
document.getElementById('add-list-modal').classList.add('active');
|
||||
},
|
||||
|
||||
normalizeStatus(status) {
|
||||
if (!status) return 'PLANNING';
|
||||
if (status === 'WATCHING' || status === 'READING') return 'CURRENT';
|
||||
return status;
|
||||
},
|
||||
|
||||
close() {
|
||||
document.getElementById('add-list-modal').classList.remove('active');
|
||||
},
|
||||
@@ -212,15 +218,21 @@ const ListModalManager = {
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
async function loadListModal() {
|
||||
if (document.getElementById('add-list-modal')) return;
|
||||
|
||||
const res = await fetch('/views/components/list-modal.html');
|
||||
const html = await res.text();
|
||||
document.body.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
const modal = document.getElementById('add-list-modal');
|
||||
if (modal) {
|
||||
modal.addEventListener('click', (e) => {
|
||||
if (e.target.id === 'add-list-modal') {
|
||||
ListModalManager.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
modal.addEventListener('click', (e) => {
|
||||
if (e.target.id === 'add-list-modal') {
|
||||
ListModalManager.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', loadListModal);
|
||||
|
||||
window.ListModalManager = ListModalManager;
|
||||
Reference in New Issue
Block a user