From 324c6df1ab878aa0c34f80c58f730e01aca1f4e9 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Sun, 19 Oct 2025 17:02:23 +0700 Subject: feat: have toolbar on the top by default (only return to left if the screen is short on height) feat: center the layout by default feat: switch font to Andika feat: switch masonry to use rem units feat: fit masonry to center --- internal/glightbox/html_renderer.go | 14 ++++++---- internal/tailwind/transformer.go | 16 +++++------ static/input.css | 44 +++++++++++-------------------- views/index.html | 10 +++---- views/layouts/general-page.html | 24 +++++++---------- views/pages/blog-page.html | 6 ++--- views/pages/global-map.html | 7 ++--- views/pages/home-page.html | 8 +++--- views/partials/blog-page-like-button.html | 2 +- views/partials/general-page-footer.html | 2 +- views/partials/general-page-header.html | 6 ++--- 11 files changed, 59 insertions(+), 80 deletions(-) diff --git a/internal/glightbox/html_renderer.go b/internal/glightbox/html_renderer.go index aad7984..8974ab4 100644 --- a/internal/glightbox/html_renderer.go +++ b/internal/glightbox/html_renderer.go @@ -147,25 +147,29 @@ func (r *GLightboxHTMLRenderer) renderGLightbox(w util.BufWriter, source []byte, var msnry_%s = new Masonry('.masonry-grid-%s', { itemSelector: '.grid-item-%s', columnWidth: '.grid-sizer-%s', - percentPosition: true + percentPosition: false, + fitWidth: true }); var imgLoad_%s_timer; var imgLoad_%s = imagesLoaded('.masonry-grid-%s'); - function initMasonryLayout_%s() { + function initMasonryLayout_%s(tm) { clearTimeout(imgLoad_%s_timer); - imgLoad_%s_timer = setTimeout(() => msnry_%s.layout(), 500); + imgLoad_%s_timer = setTimeout(() => msnry_%s.layout(), 300); } imgLoad_%s.on('progress', initMasonryLayout_%s); + window.addEventListener('resize', initMasonryLayout_%s); + document.addEventListener('popout', (e) => { + window.removeEventListener('resize', initMasonryLayout_%s); imgLoad_%s.off('progress', initMasonryLayout_%s); initMasonryLayout_%s = null; imgLoad_%s = null; - }); -`, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID)) + }, {once: true}); +`, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID, galleryID)) } return ast.WalkContinue, nil diff --git a/internal/tailwind/transformer.go b/internal/tailwind/transformer.go index 23ba1a3..d4d908c 100644 --- a/internal/tailwind/transformer.go +++ b/internal/tailwind/transformer.go @@ -20,19 +20,19 @@ func (t *TailwindTransformer) Transform(node *ast.Document, reader text.Reader, switch node := n.(type) { case *ast.Heading: classes := map[int]string{ - 1: "font-patua text-4xl font-bold text-main-dark mb-3 tracking-[.0125rem]", - 2: "font-spectral text-3xl font-bold text-main-dark mb-1 tracking-[.0125rem]", - 3: "font-spectral text-2xl font-medium text-main-dark mb-0.8 tracking-[.0125rem]", - 4: "font-spectral text-xl font-medium text-main-medium mb-0.5 tracking-[.0125rem]", - 5: "font-spectral text-base font-medium text-main-medium mb-0.5 italic tracking-[.0125rem]", - 6: "font-spectral text-base font-medium text-secondary mb-0.5", + 1: "font-andika text-4xl font-bold text-main-dark mb-3 tracking-[.0125rem]", + 2: "font-andika text-3xl font-bold text-main-dark mb-1 tracking-[.0125rem]", + 3: "font-andika text-2xl font-medium text-main-dark mb-0.8 tracking-[.0125rem]", + 4: "font-andika text-xl font-medium text-main-medium mb-0.5 tracking-[.0125rem]", + 5: "font-andika text-base font-medium text-main-medium mb-0.5 italic tracking-[.0125rem]", + 6: "font-andika text-base font-medium text-secondary mb-0.5", } if class, ok := classes[node.Level]; ok { node.SetAttribute([]byte("class"), []byte(class)) } case *ast.Paragraph: - node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem] -indent-8 ml-4 mb-8")) + node.SetAttribute([]byte("class"), []byte("text-base/[2] font-andika tracking-[.0125rem] -indent-8 ml-4 mb-8")) case *ast.List: if node.IsOrdered() { @@ -42,7 +42,7 @@ func (t *TailwindTransformer) Transform(node *ast.Document, reader text.Reader, } case *ast.ListItem: - node.SetAttribute([]byte("class"), []byte("text-base/[2] font-spectral tracking-[.0125rem]")) + node.SetAttribute([]byte("class"), []byte("text-base/[2] font-andika tracking-[.0125rem]")) case *ast.Blockquote: node.SetAttribute([]byte("class"), []byte("border-l-2 border-main-medium bg-background-dark p-1 mb-2 italic")) diff --git a/static/input.css b/static/input.css index c308796..2a3b96f 100644 --- a/static/input.css +++ b/static/input.css @@ -1,8 +1,9 @@ +@import url('https://fonts.googleapis.com/css2?family=Andika:ital,wght@0,400;0,700;1,400;1,700&display=swap'); + @import "tailwindcss"; @theme { - --font-spectral: Spectral, serif; - --font-patua: "Patua One", cursive; + --font-andika: "Andika", sans-serif; --breakpoint-xs: 32rem; } @@ -242,15 +243,6 @@ a:hover, .linklike:hover { background-size: calc(var(--squares-and-triangles-background-width-coef) * 1rem) calc(var(--squares-and-triangles-background-height-coef) * 1rem); } -.logo-custom { - width: 3.5rem; - height: 20rem; - font-size: 2.5rem; - -webkit-text-stroke: 0.1rem var(--sidebar-stroke-color); - writing-mode: sideways-lr; - text-orientation: mixed; -} - .inset-shadow { box-shadow: inset 0dvh 1dvh 1dvh -1dvh rgba(75, 81, 58, 0.5), inset 1dvh 0dvh 1dvh -1dvh rgba(75, 81, 58, 0.5), @@ -399,7 +391,7 @@ a:hover, .linklike:hover { .grid-item, .grid-sizer { position: relative; display: inline-block; - width: 50%; + width: 10rem; } .grid-item-index { @@ -422,36 +414,36 @@ a:hover, .linklike:hover { } .grid-item-2x { - width: 100%; + width: 20rem; } -@container main (width >= 32rem) { +@container main (width >= 40rem) { .grid-item, .grid-sizer { - width: 33%; + width: 12rem; } .grid-item-2x { - width: 66%; + width: 24rem; } } -@container main (width >= 56rem) { +@container main (width >= 76rem) { .grid-item, .grid-sizer { - width: 25%; + width: 18rem; } .grid-item-2x { - width: 50%; + width: 36rem; } } -@container main (width >= 96rem) { +@container main (width >= 128rem) { .grid-item, .grid-sizer { - width: 20%; + width: 24rem; } .grid-item-2x { - width: 40%; + width: 48rem; } } @@ -466,7 +458,7 @@ a:hover, .linklike:hover { } .glightbox-clean .gslide-title { - font-family: var(--font-spectral) !important; + font-family: var(--font-andika) !important; font-weight: 600 !important; color: var(--main-light-color) !important; padding-bottom: 1rem !important; @@ -475,7 +467,7 @@ a:hover, .linklike:hover { .glightbox-clean .gslide-desc { font-size: 1rem !important; - font-family: var(--font-spectral) !important; + font-family: var(--font-andika) !important; font-weight: 400; color: var(--main-medium-color) !important; } @@ -540,10 +532,6 @@ body[data-theme~="ram"] .leaflet-tile { } @media (max-aspect-ratio: 0.8/1) { - .bg-sidebar { - background-size: calc(var(--squares-and-triangles-background-width-coef) * 1.6dvh) calc(var(--squares-and-triangles-background-height-coef) * 1.6dvh); - } - .ar-lt-0\.8\:bg-background-light { background-color: var(--background-light-color); } diff --git a/views/index.html b/views/index.html index 2633894..3f727ee 100644 --- a/views/index.html +++ b/views/index.html @@ -4,10 +4,6 @@ Choose Language // SAYA TODAY - - - - - +
*
*
@@ -103,13 +99,13 @@ -