now on my list page, source dropdown only shows anime and book extensions
This commit is contained in:
@@ -29,20 +29,32 @@ async function populateSourceFilter() {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/extensions`);
|
const [animeRes, bookRes] = await Promise.all([
|
||||||
if (response.ok) {
|
fetch(`${API_BASE}/extensions/anime`),
|
||||||
const data = await response.json();
|
fetch(`${API_BASE}/extensions/book`)
|
||||||
const extensions = data.extensions || [];
|
]);
|
||||||
|
|
||||||
|
const extensions = new Set();
|
||||||
|
|
||||||
|
if (animeRes.ok) {
|
||||||
|
const data = await animeRes.json();
|
||||||
|
(data.extensions || []).forEach(ext => extensions.add(ext));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bookRes.ok) {
|
||||||
|
const data = await bookRes.json();
|
||||||
|
(data.extensions || []).forEach(ext => extensions.add(ext));
|
||||||
|
}
|
||||||
|
|
||||||
extensions.forEach(extName => {
|
extensions.forEach(extName => {
|
||||||
if (extName.toLowerCase() !== 'anilist' && extName.toLowerCase() !== 'local') {
|
const lower = extName.toLowerCase();
|
||||||
|
if (lower !== 'anilist' && lower !== 'local') {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = extName;
|
option.value = extName;
|
||||||
option.textContent = extName.charAt(0).toUpperCase() + extName.slice(1);
|
option.textContent = extName.charAt(0).toUpperCase() + extName.slice(1);
|
||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading extensions:', error);
|
console.error('Error loading extensions:', error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,20 +29,32 @@ async function populateSourceFilter() {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/extensions`);
|
const [animeRes, bookRes] = await Promise.all([
|
||||||
if (response.ok) {
|
fetch(`${API_BASE}/extensions/anime`),
|
||||||
const data = await response.json();
|
fetch(`${API_BASE}/extensions/book`)
|
||||||
const extensions = data.extensions || [];
|
]);
|
||||||
|
|
||||||
|
const extensions = new Set();
|
||||||
|
|
||||||
|
if (animeRes.ok) {
|
||||||
|
const data = await animeRes.json();
|
||||||
|
(data.extensions || []).forEach(ext => extensions.add(ext));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bookRes.ok) {
|
||||||
|
const data = await bookRes.json();
|
||||||
|
(data.extensions || []).forEach(ext => extensions.add(ext));
|
||||||
|
}
|
||||||
|
|
||||||
extensions.forEach(extName => {
|
extensions.forEach(extName => {
|
||||||
if (extName.toLowerCase() !== 'anilist' && extName.toLowerCase() !== 'local') {
|
const lower = extName.toLowerCase();
|
||||||
|
if (lower !== 'anilist' && lower !== 'local') {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = extName;
|
option.value = extName;
|
||||||
option.textContent = extName.charAt(0).toUpperCase() + extName.slice(1);
|
option.textContent = extName.charAt(0).toUpperCase() + extName.slice(1);
|
||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading extensions:', error);
|
console.error('Error loading extensions:', error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user