diff --git a/index.html b/index.html
index 9447e57..c211285 100644
--- a/index.html
+++ b/index.html
@@ -48,7 +48,16 @@
-
+
+
@@ -870,6 +872,7 @@
icon = ``
break
case 'tv series':
+ case 'tv_series':
icon = ``
break
case 'video':
@@ -903,18 +906,6 @@
})
return torrentsFrag
}
- function showLatestTorrents() {
- // render latest torrent when available
- getTorrents().then(allTorrents => {
- allTorrents = allTorrents.reverse().slice(0, 8)
- getRef('torrent_container').innerHTML = ``
- getRef('torrent_container').append(renderTorrents(allTorrents))
- })
- .catch(err => {
- console.log(err)
- })
-
- }
function getSearchParams() {
const urlSearchParams = new URLSearchParams(window.location.search);
@@ -986,6 +977,8 @@
let params = getSearchParams()
let page = target.includes('#') ? target.split('#')[1] : target
switch (page) {
+ case 'loading_page':
+ break;
case 'search':
if (params.query) {
if (params.category) {
@@ -1019,8 +1012,11 @@
break;
default:
page = 'homepage'
- history.replaceState(null, null, ' ')
- showLatestTorrents()
+ history.replaceState(null, null, '#homepage')
+ let allTorrents = await getDataFromIDB()
+ allTorrents = allTorrents.reverse().slice(0, 8)
+ getRef('torrent_container').innerHTML = ``
+ getRef('torrent_container').append(renderTorrents(allTorrents))
}
document.querySelector('.page:not(.hide-completely)')?.classList.add('hide-completely')
getRef(page).classList.remove('hide-completely')
@@ -1104,7 +1100,13 @@
// Event listeners
window.addEventListener('load', e => {
- showPage(window.location.hash)
+ showPage('loading_page')
+ getTorrents().then(allTorrents => {
+ showPage(window.location.hash)
+ })
+ .catch(err => {
+ console.log(err)
+ })
})
window.addEventListener('hashchange', e => {
showPage(window.location.hash)