add thumbhash use `github.com/galdor/go-thumbhash` and `github.com/evanw/thumbhash`
database:
add `thumbhash` column for `files` table
image:
add `EncodeThumbHash()` function use `go.n16f.net/thumbhash`
router:
add `/api/task/files/thumbhash` endpoint to check thumbhask
task:
add `CheckThumbHash()` function
web/scripts:
add thumbhash logic for `load_*` scripts
add `thumbhash.js` from `https://github.com/evanw/thumbhash/blob/main/js/thumbhash.js`, edited
web/styles/gallery:
add thumbhash transition when thumbnail loaded
adjust style for wrapped imgs
web/templates:
add `role="main"` for gallery and artwork id pages
render thumbhash script for gallery pages
78 lines
1.2 KiB
CSS
78 lines
1.2 KiB
CSS
#gallery {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
#gallery::after {
|
|
content: '';
|
|
flex-grow: 999999999;
|
|
min-width: 200px;
|
|
height: 0;
|
|
}
|
|
|
|
#gallery div {
|
|
position: relative;
|
|
margin: .1em;
|
|
}
|
|
|
|
#gallery i {
|
|
display: block;
|
|
}
|
|
|
|
#gallery #imgs,
|
|
#gallery img {
|
|
position: absolute;
|
|
top: 0;
|
|
height: 100%;
|
|
width: 100%;
|
|
vertical-align: bottom;
|
|
background-color: rgb(50, 50, 50);
|
|
}
|
|
|
|
#gallery a:focus-visible > img,
|
|
#gallery img:focus-visible {
|
|
outline: .5em solid rgba(0, 0, 0, 0.5);
|
|
outline-offset: -.5em;
|
|
}
|
|
|
|
#gallery i span {
|
|
background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent 1.8em);
|
|
position: absolute;
|
|
pointer-events: none;
|
|
width: 100%;
|
|
height: 100%;
|
|
z-index: 1;
|
|
padding: .05em;
|
|
}
|
|
|
|
#gallery i p {
|
|
position: absolute;
|
|
bottom: 0;
|
|
right: 0;
|
|
padding: .4em;
|
|
margin: 0;
|
|
font-size: .8em;
|
|
font-style: normal;
|
|
line-height: 1em;
|
|
overflow: hidden;
|
|
color: white;
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
html {
|
|
color: white;
|
|
}
|
|
#gallery #imgs {
|
|
mask-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7));
|
|
}
|
|
}
|
|
|
|
#gallery span#deleted {
|
|
position: absolute;
|
|
top: 0;
|
|
}
|
|
|
|
#gallery #thumbhash {
|
|
transition: all ease-in-out .3s;
|
|
}
|