- new - PWA supported.
- fix - touch scroll not working when scroll on $SlideViewer.
This commit is contained in:
defaultkavy 2024-10-25 18:47:27 +08:00
parent 473ae64295
commit 396b67a9b3
Signed by: defaultkavy
GPG Key ID: DFBB22C4E69D7826
15 changed files with 71 additions and 11 deletions

1
dist/assets/index-C_mg4_Pk.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
dist/index.html vendored
View File

@ -2,7 +2,8 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> --> <link rel="manifest" href="/statics/manifest.json" />
<link rel="icon" type="image/svg+xml" href="/statics/danbooru-viewer-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Danbooru Viewer</title> <title>Danbooru Viewer</title>
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script> <script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
@ -16,8 +17,8 @@
gtag('config', 'G-59HBGP98WR'); gtag('config', 'G-59HBGP98WR');
</script> </script>
<script type="module" crossorigin src="/assets/index-DUv7nhbW.js"></script> <script type="module" crossorigin src="/assets/index-C_mg4_Pk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bmz9OSnh.css"> <link rel="stylesheet" crossorigin href="/assets/index-g15FC_9F.css">
</head> </head>
<body> <body>
</body> </body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
dist/statics/danbooru-viewer-icon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

27
dist/statics/manifest.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"lang": "en",
"name": "Danbooru Viewer",
"theme_color": "#1E1E2C",
"background_color": "#1E1E2C",
"short_name": "Danbooru Viewer",
"description": "Danbooru images viewer, modern style user interface.",
"start_url": "/",
"dir": "ltr",
"orientation": "any",
"display": "standalone",
"categories": [
"photo"
],
"icons": [
{
"src": "/statics/danbooru-viewer-icon.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/statics/danbooru-viewer-app-icon@2x.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@ -2,7 +2,8 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> --> <link rel="manifest" href="/statics/manifest.json" />
<link rel="icon" type="image/svg+xml" href="/statics/danbooru-viewer-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Danbooru Viewer</title> <title>Danbooru Viewer</title>
<link rel="stylesheet" href="/index.scss"> <link rel="stylesheet" href="/index.scss">

View File

@ -2,7 +2,7 @@
"name": "danbooru-viewer", "name": "danbooru-viewer",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",
"version": "0.12.1", "version": "0.13.0",
"scripts": { "scripts": {
"dev": "bun x vite", "dev": "bun x vite",
"build": "bun x vite build", "build": "bun x vite build",

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,27 @@
{
"lang": "en",
"name": "Danbooru Viewer",
"theme_color": "#1E1E2C",
"background_color": "#1E1E2C",
"short_name": "Danbooru Viewer",
"description": "Danbooru images viewer, modern style user interface.",
"start_url": "/",
"dir": "ltr",
"orientation": "any",
"display": "standalone",
"categories": [
"photo"
],
"icons": [
{
"src": "/statics/danbooru-viewer-icon.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/statics/danbooru-viewer-app-icon@2x.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@ -74,12 +74,15 @@ const app = new Elysia()
return data return data
}) })
}) })
.get('/statics/*', (res => {
return Bun.file(`./dist/${res.path}`)
}))
.listen(3030); .listen(3030);
console.log('Start listening: 3030') console.log('Start listening: 3030')
export type Server = typeof app; export type Server = typeof app;
function og(property: string, content: string) { function og(property: string, content: string | undefined) {
return `<meta property=${property} content="${content}">` return `<meta property=${property} content="${content ?? ''}">`
} }
export function digitalUnit(bytes: number) { export function digitalUnit(bytes: number) {

View File

@ -1,4 +1,4 @@
import { $Container, $Element, $Node, $Pointer, $PointerManager, type $ContainerContentType, type $ContainerEventMap, type $EventMap } from "elexis"; import { $Container, $Element, $Node, $Pointer, $PointerDirection, $PointerManager, type $ContainerContentType, type $ContainerEventMap, type $EventMap } from "elexis";
export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap> { export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap> {
pointers = new $PointerManager(this); pointers = new $PointerManager(this);
@ -28,6 +28,7 @@ export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap>
containerStartLeft = this.$container.offsetLeft; containerStartLeft = this.$container.offsetLeft;
}) })
this.pointers.on('move', ($pointer, e) => { this.pointers.on('move', ($pointer, e) => {
if ($pointer.direction !== $PointerDirection.Horizontal) return;
e.preventDefault(); e.preventDefault();
containerLeft = containerStartLeft + $pointer.move_x; containerLeft = containerStartLeft + $pointer.move_x;
if (containerLeft > containerStartLeft && this.slideList.at(0)?.slideId() === this.slideId) return; if (containerLeft > containerStartLeft && this.slideList.at(0)?.slideId() === this.slideId) return;

View File

@ -12,7 +12,7 @@
margin: 1rem; margin: 1rem;
position: relative; position: relative;
transition: all 0.3s ease; transition: all 0.3s ease;
touch-action: none; touch-action: pan-y;
@media (max-width: 800px) { @media (max-width: 800px) {
width: 100%; width: 100%;