Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauzanmhr committed Oct 21, 2024
1 parent d802a58 commit 9a9d56d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions services/animeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ export const fetchAnimeDetails = async (slug) => {
console.error('Error fetching anime details:', error);
return null;
}
};

// Add other service methods as needed
};
9 changes: 2 additions & 7 deletions views/episode.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,28 @@
const spinner = document.getElementById('loading-spinner');
// Show the spinner and hide the iframe
spinner.style.display = 'flex';
spinner.classList.remove('d-none');
iframe.classList.add('d-none');
if (selectedValue === "default") {
// Use the default streaming URL
iframe.src = "<%= episode.defaultStreamingUrl %>";
} else {
// Fetch the server URL
const response = await fetch(`/server-url?serverId=${selectedValue}`);
const data = await response.json();
if (data.url) {
// Update iframe source
iframe.src = data.url;
} else {
console.error('Error fetching server URL');
}
}
});
// Listen for iframe load event to hide spinner
document.getElementById('streaming-iframe').addEventListener('load', function() {
const spinner = document.getElementById('loading-spinner');
const iframe = document.getElementById('streaming-iframe');
// Hide the spinner and show the iframe once loaded
spinner.style.display = 'none';
spinner.classList.add('d-none');
iframe.classList.remove('d-none');
});
</script>
Expand Down

0 comments on commit 9a9d56d

Please sign in to comment.