| author | |
| committer | |
| log | b3b4d0c104c93d533b94d4e4f804ea7e48032893 |
| tree | 142eb8f047162bdff85879ffeec15791c37b4415 |
| parent | 16a49c71c15bdc3a8fc3a2d1a430c56a0035049e |
| signature | Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs |
5 files changed, 37 insertions(+), 44 deletions(-)
src/file-viewer/rules.ts-12| ... | ... | @@ -140,18 +140,6 @@ export function fileIcon( |
| 140 | 140 | return "file"; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | // -- viewer rules -- | |
| 144 | const pathToCanvas = new Map<string, string>(Object.entries({ | |
| 145 | "/2017": "2017", | |
| 146 | "/2018": "2018", | |
| 147 | "/2019": "2019", | |
| 148 | "/2020": "2020", | |
| 149 | "/2021": "2021", | |
| 150 | "/2022": "2022", | |
| 151 | "/2023": "2023", | |
| 152 | "/2024": "2024", | |
| 153 | })); | |
| 154 | ||
| 155 | 143 | import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts"; |
| 156 | 144 | import * as path from "node:path"; |
| 157 | 145 | import type * as highlight from "./highlight.ts"; |
src/file-viewer/tags/media-panel.marko+9-1| ... | ... | @@ -124,7 +124,15 @@ static const cotyledonEndingFile = "/2024/for everone"; |
| 124 | 124 | </else> |
| 125 | 125 | <else if=rules.extsReadContents.has(ext)> |
| 126 | 126 | <ContainerDiv kind="text"> |
| 127 | <view-text ...{ file } siblings=UNWRAP(file.parent).getPublicChildren()/> | |
| 127 | <view-text | |
| 128 | ...{ file } | |
| 129 | siblings=UNWRAP(file.getParent()).getPublicChildren() | |
| 130 | /> | |
| 131 | </ContainerDiv> | |
| 132 | </else> | |
| 133 | <else if=rules.extsImageLike.has(ext)> | |
| 134 | <ContainerDiv kind="image"> | |
| 135 | <view-image ...{ file }/> | |
| 128 | 136 | </ContainerDiv> |
| 129 | 137 | </else> |
| 130 | 138 | <else if=rules.extsVideo.has(ext)> |
src/file-viewer/tags/view-audio.marko+26-29| ... | ... | @@ -4,41 +4,38 @@ export interface Input { |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | <const/{ file, onlyAudio }=input> |
| 7 | <const/lyricsFile=() => { | |
| 8 | const parent = file.getParent(); | |
| 9 | if (parent && !onlyAudio) { | |
| 10 | const siblings = parent.getPublicChildren(); | |
| 11 | ||
| 12 | // show lyrics only if | |
| 13 | // - this media file is the only audio file | |
| 14 | // - there is lyrics.txt in the same directory | |
| 15 | const audioFiles = siblings.filter( | |
| 16 | (f) => | |
| 17 | f.kind === MediaFileKind.file && | |
| 18 | extensionToViewer[path.extname(f.basename)] === AudioView, | |
| 19 | ); | |
| 20 | if ( | |
| 21 | audioFiles.length === 1 && | |
| 22 | siblings.find((f) => f.basename === "lyrics.txt") | |
| 23 | ) { | |
| 24 | return siblings.find((f) => f.basename === "lyrics.txt")!; | |
| 25 | } | |
| 26 | } | |
| 27 | ||
| 28 | return null; | |
| 29 | }> | |
| 7 | //<const/lyricsFile=() => { | |
| 8 | // const parent = file.getParent(); | |
| 9 | // if (parent && !onlyAudio) { | |
| 10 | // const siblings = parent.getPublicChildren(); | |
| 11 | // | |
| 12 | // // show lyrics only if | |
| 13 | // // - this media file is the only audio file | |
| 14 | // // - there is lyrics.txt in the same directory | |
| 15 | // const audioFiles = siblings.filter( | |
| 16 | // (f) => f.kind === MediaFileKind.file && f.path.endsWith(".mp3"), | |
| 17 | // ); | |
| 18 | // if (audioFiles.length === 1) { | |
| 19 | // return siblings.find((f) => f.basename === "lyrics.txt") ?? null; | |
| 20 | // } | |
| 21 | // } | |
| 22 | // | |
| 23 | // return null; | |
| 24 | //}> | |
| 30 | 25 | <audio controls preload="none" style="width: 100%"> |
| 31 | 26 | <source |
| 32 | 27 | src="/file" + file.path |
| 33 | 28 | type=`audio/${path.extname(file.path).substring(1)}` |
| 34 | 29 | > |
| 35 | 30 | </audio> |
| 36 | <div class="lyrics"> | |
| 37 | <h2 style="margin-left:1rem;margin-bottom:-0.2rem;margin-top:0.5rem;"> | |
| 38 | lyrics | |
| 39 | </h2> | |
| 40 | <view-text file=lyricsFile siblings=[]/> | |
| 41 | </div> | |
| 31 | //<if=lyricsFile> | |
| 32 | // <div class="lyrics"> | |
| 33 | // <h2 style="margin-left:1rem;margin-bottom:-0.2rem;margin-top:0.5rem;"> | |
| 34 | // lyrics | |
| 35 | // </h2> | |
| 36 | // <view-text file=lyricsFile siblings=[]/> | |
| 37 | // </div> | |
| 38 | //</if> | |
| 42 | 39 | |
| 43 | 40 | import * as path from "node:path"; |
| 44 | 41 | import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts"; |
src/file-viewer/tags/view-download.marko+1-1| ... | ... | @@ -53,7 +53,7 @@ export interface Input { |
| 53 | 53 | <p> |
| 54 | 54 | Instead, you may download it: |
| 55 | 55 | <a href="/file" + file.path + "?dl" aria-label="download"> |
| 56 | {file.basename} | |
| 56 | ${file.basename} | |
| 57 | 57 | </a>. |
| 58 | 58 | </p> |
| 59 | 59 | </else> |
src/tags/photo-grid.css+1-1| ... | ... | @@ -23,7 +23,7 @@ photo-grid-item { |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | photo-grid + blockquote { |
| 26 | margin: 0 -4px; | |
| 26 | margin: 0 -4px 1rem -4px; | |
| 27 | 27 | border: none; |
| 28 | 28 | background-color: var(--primary); |
| 29 | 29 | color: black; |