added anime entries from extensions
This commit is contained in:
@@ -10,9 +10,25 @@ tag.src = "https://www.youtube.com/iframe_api";
|
||||
var firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
|
||||
let extensionName;
|
||||
|
||||
async function loadAnime() {
|
||||
try {
|
||||
const res = await fetch(`/api/anime/${animeId}`);
|
||||
const path = window.location.pathname;
|
||||
const parts = path.split("/").filter(Boolean);
|
||||
let animeId;
|
||||
|
||||
if (parts.length === 3) {
|
||||
extensionName = parts[1];
|
||||
animeId = parts[2];
|
||||
} else {
|
||||
animeId = parts[1];
|
||||
}
|
||||
|
||||
const fetchUrl = extensionName
|
||||
? `/api/anime/${animeId.slice(0,40)}?ext=${extensionName}`
|
||||
: `/api/anime/${animeId}`;
|
||||
const res = await fetch(fetchUrl);
|
||||
const data = await res.json();
|
||||
|
||||
if(data.error) {
|
||||
@@ -35,6 +51,13 @@ async function loadAnime() {
|
||||
document.getElementById('genres').innerText = data.genres?.length > 0 ? data.genres.slice(0, 3).join(' • ') : '';
|
||||
document.getElementById('format').innerText = data.format || 'TV';
|
||||
document.getElementById('status').innerText = data.status || 'Unknown';
|
||||
const extensionPill = document.getElementById('extension-pill');
|
||||
if (extensionName && extensionPill) {
|
||||
extensionPill.textContent = `${extensionName.charAt(0).toUpperCase() + extensionName.slice(1).toLowerCase()}`;
|
||||
extensionPill.style.display = 'inline-flex';
|
||||
} else if (extensionPill) {
|
||||
extensionPill.style.display = 'none';
|
||||
}
|
||||
|
||||
let seasonText = '';
|
||||
if (data.season && data.seasonYear) {
|
||||
@@ -180,7 +203,9 @@ function createEpisodeButton(num, container) {
|
||||
const btn = document.createElement('div');
|
||||
btn.className = 'episode-btn';
|
||||
btn.innerText = `Ep ${num}`;
|
||||
btn.onclick = () => window.location.href = `/watch/${animeId}/${num}`;
|
||||
btn.onclick = () =>
|
||||
window.location.href = `/watch/${animeId}/${num}` + (extensionName ? `?${extensionName}` : "");
|
||||
|
||||
container.appendChild(btn);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user