fix: $Layout render problem
This commit is contained in:
defaultkavy 2024-05-20 00:55:44 +08:00
parent ec06a3f912
commit 33a588a3f5
5 changed files with 6 additions and 6 deletions

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -5,7 +5,7 @@
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Danbooru Viewer v0.1</title>
<script type="module" crossorigin src="/assets/index-D2JYqypC.js"></script>
<script type="module" crossorigin src="/assets/index-DMNcFlub.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bnhfn_iK.css">
</head>
<body>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Danbooru Viewer v0.1</title>
<title>Danbooru Viewer v0.2.5</title>
<link rel="stylesheet" href="/index.scss">
</head>
<body>

View File

@ -2,7 +2,7 @@
"name": "danbooru-viewer",
"module": "index.ts",
"type": "module",
"version": "0.2.4",
"version": "0.2.5",
"devDependencies": {
"@types/bun": "latest"
},

View File

@ -16,7 +16,7 @@ export const home_route = new Route((path) => {
filtered_posts.map(post => new $PostTile(post))
]).on('resize', () => { resizeCheck() });
resizeCheck();
let FIRST_POST = posts.at(1)!;
let FIRST_POST = posts.at(0)!;
let LAST_POST = posts.at(-1)!;
let SCROLL_LOADED = false;
let POST_ENDED = posts.length !== MAX_POST_LENGTH;
@ -42,7 +42,7 @@ export const home_route = new Route((path) => {
setInterval(async () => {
if (!$layout.inDOM()) return;
if (document.documentElement.scrollTop !== 0) return;
const posts = await Post.fetchMultiple(booru, tags.length ? {tags: tags, id: `${FIRST_POST.id + 2}..`} : {id: `${FIRST_POST.id + 2}..`}, MAX_POST_LENGTH)
const posts = await Post.fetchMultiple(booru, tags.length ? {tags: tags, id: `${FIRST_POST.id + 1}..`} : {id: `${FIRST_POST.id + 1}..`}, MAX_POST_LENGTH)
const filtered_posts = posts.filter(post => post.file_url)
if (posts.length) FIRST_POST = posts.at(0)!;
if (filtered_posts.length) $layout.insert(filtered_posts.map(post => new $PostTile(post)), 0).render();