From 10431bd8f5ff71690ae4e5444e8d7894fd401ae5 Mon Sep 17 00:00:00 2001 From: eltrac Date: Tue, 7 Apr 2026 14:53:17 +0800 Subject: chore: move templates out of site repo --- assets/css/_markdown.scss | 275 -------------------------------------- assets/css/components/_libra.scss | 42 ------ assets/css/components/_toc.scss | 53 -------- assets/css/main.scss | 7 - assets/css/utils/_reset.scss | 53 -------- assets/css/utils/_utility.scss | 62 --------- assets/css/utils/_variables.scss | 48 ------- assets/js/back2top.js | 60 --------- assets/js/darkmode.js | 36 ----- assets/js/fediform.js | 42 ------ assets/js/instantpage.min.js | 2 - assets/js/toc.js | 40 ------ assets/js/tooltip.js | 54 -------- 13 files changed, 774 deletions(-) delete mode 100644 assets/css/_markdown.scss delete mode 100644 assets/css/components/_libra.scss delete mode 100644 assets/css/components/_toc.scss delete mode 100644 assets/css/main.scss delete mode 100644 assets/css/utils/_reset.scss delete mode 100644 assets/css/utils/_utility.scss delete mode 100644 assets/css/utils/_variables.scss delete mode 100644 assets/js/back2top.js delete mode 100644 assets/js/darkmode.js delete mode 100644 assets/js/fediform.js delete mode 100644 assets/js/instantpage.min.js delete mode 100644 assets/js/toc.js delete mode 100644 assets/js/tooltip.js (limited to 'assets') diff --git a/assets/css/_markdown.scss b/assets/css/_markdown.scss deleted file mode 100644 index 09089996..00000000 --- a/assets/css/_markdown.scss +++ /dev/null @@ -1,275 +0,0 @@ -.markdown-body { - max-width: 100%; - - p { - hyphens: auto; - text-justify: ideographic; - margin-bottom: 1em; - } - - strong:is([lang="zh-CN"] strong) { - text-emphasis: filled dot; - text-emphasis-position: under; - } - - img:not(p > img) { - max-width: 100%; - display: block; - margin: 1rem auto; - } - - p > img { - width: 1.5rem; - height: auto; - transition: transform .1s; - &:hover { - transform: scale(1.2) - } - } - - ul { - list-style-type: square; - } - - ul, ol { - padding-inline-start: 1.75rem; - li { - padding-left: 0.25rem; - } - ::marker { - color: var(--secondary-text-color); - } - } - - mark { - color: var(--text-color); - background-color: rgba(255, 235, 0, .25); - text-decoration: underline; - text-decoration-color: rgb(255, 235, 0); - text-underline-offset: 5px; - } - - del { - opacity: 0.5 - } - - iframe { - max-width: 100%; - } - - a:not(.footnote-backref, .footnote-ref) { - // color and underline - text-decoration: underline; - text-decoration-style: wavy; - text-decoration-thickness: 1px; - text-underline-offset: 0.25em; - text-decoration-color: var(--border-color); - color: var(--link-color); - - // link hover effects - transition: text-decoration-color 0.1s ease-in-out; - &:hover { - text-decoration-color: var(--secondary-text-color); - } - - // icons with pseudo-elements - &::before, &::after { - display: inline-block; - font-size: 70%; - color: var(--secondary-text-color); - vertical-align: middle; - font-weight: 800; - } - - &::after { - margin-left: 0.05em; - } - - &::before { - --size: 1.25em; - margin-right: 0.25em; - background-size: var(--size); - height: var(--size); - width: var(--size); - border-radius: 3px; - - } - - // external link icon - &.external-link::after { - content: ''; - background-image: url('/icons/external.svg'); - background-size: cover; - opacity: 0.65; - height: 1em; - width: 1em; - @media (prefers-color-scheme: dark) { - filter: invert(1) - } - } - - // icons for specific domains - &:not(.no-icon) { - &[href*="wikipedia.org"]::before { - content: ''; - background-color: #fff; - background-image: url('/icons/wikipedia.svg'); - } - &[href*="wiktionary.org"]::before { - content: ''; - background-color: #fff; - background-image: url('/icons/enwiktionary.svg'); - } - &[href*="etymonline.com"]::before { - content: ''; - background-image: url('/icons/etymonline.jpg'); - } - &[href*="codeberg.org"]::before { - content: ''; - background-image: url('/icons/codeberg.svg'); - } - &[href*="github.com"]::before { - content: ''; - background-image: url('/icons/github.svg'); - .dark & { - filter: invert(1); - } - } - } - } - - a.footnote-ref { - color: var(--secondary-text-color); - margin-right: 0.25rem; - } - - code { - font-size: 90%; - color: var(--secondary-text-color); - font-weight: 600; - } - - pre { - padding: 0.5rem 1rem; - font-size: 1rem; - border-radius: 5px; - border-top-right-radius: 0; - position: relative; - - & > code { - padding: 0; - color: unset; - background-color: inherit; - border: 0; - overflow: auto; - display: block; - line-height: 1.5; - - &:not([data-lang="fallback"])::before { - --width: 1rem; - content: attr(data-lang); - display: block; - box-sizing: border-box; - line-height: 1rem; - - position: absolute; - top: 0; - right: -1rem; - width: var(--width); - min-height: 2.5rem; - writing-mode: vertical-rl; - text-align: center; - - font-size: 0.75em; - background: #333; - color: #fff; - padding: 0.5rem 0; - border-radius: 0 4px 4px 0; - } - } - } - - figure { - display: block; - margin: 0; - figcaption { - max-width: 100%; - h4 { - font-size: 0.9rem; - color: var(--secondary-text-color); - font-weight: 400; - text-align: center; - white-space: normal; - } - } - } - - /* footnotes */ - - .inline-footnote { - p { margin: 0 } - } - - sup[id*="fnref"]:target { - background-color: rgba(255, 235, 0, .25); - } -} - -/* gallery shortcode */ - -.gallery { - display: flex; - overflow-x: auto; - scroll-behavior: smooth; - gap: 0.5rem; - white-space: nowrap; - - & > figure, & > a:has(> figure) { - margin: 0; - flex-shrink: 0; - display: inline-block; - position: relative; - box-shadow: inset 0 -2rem 2rem -2rem rgba(0, 0, 0, 0.1); - img { - height: 20rem; - display: block; - border-radius: 4px; - margin: 0; - } - figcaption { - position: absolute; - bottom: 0; - left: 0; - padding: 0.35rem; - h4 { - font-size: 0.8rem; - margin: 0; - text-align: left; - width: fit-content; - color: var(--text-color); - background-color: oklch(from var(--block-background-color) l c h / calc(alpha - 0.25)); - backdrop-filter: blur(0.5rem); - padding: 0.2rem 0.35rem; - border-radius: 3px; - line-height: 1.2; - } - } - } - & > p { display: none } - - &.center { - justify-content: center; - } - &.full-width { - & > figure { - flex-shrink: unset; - img { - width: 100%; - } - } - } -} - -.webmention-body { - .h-cite { display: none } -} diff --git a/assets/css/components/_libra.scss b/assets/css/components/_libra.scss deleted file mode 100644 index 2912012b..00000000 --- a/assets/css/components/_libra.scss +++ /dev/null @@ -1,42 +0,0 @@ -.libra-overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - padding: 1rem; - transition: opacity ease-in-out; - - backdrop-filter: blur(2rem); - background-color: rgba(255, 255, 255, 0.75); - - display: flex; - justify-content: center; - align-items: center; -} - -.libra-overlay.libra-visible { - opacity: 1; - z-index: 900; -} - -.libra-overlay.libra-hidden { - opacity: 0; - z-index: -100; -} - -@media (prefers-color-scheme: dark) { - .libra-overlay { - background-color: rgba(0, 0, 0, 0.75); - } -} - -.libra-shadow { - position: absolute; - transition-property: transform; - z-index: 1000; -} - -.libra-shadow.open { - box-shadow: 0 0 1rem rgba(0, 0, 0, 0.5); -} diff --git a/assets/css/components/_toc.scss b/assets/css/components/_toc.scss deleted file mode 100644 index e8486557..00000000 --- a/assets/css/components/_toc.scss +++ /dev/null @@ -1,53 +0,0 @@ -#toc { - ul { - margin-block-start: 0; - margin-block-end: 0; - padding-inline-start: 1rem; - - overflow: hidden; - position: relative; - li { - list-style: none; - - & > a { - color: var(--secondary-text-color); - text-decoration: none; - transition: color .3s; - display: inline-flex; - align-items: center; - gap: .5rem; - text-overflow: ellipsis; - white-space: nowrap; - &::before { - content: ''; - display: inline-block; - width: 1rem; - height: .3rem; - background-color: var(--block-background-color); - border-radius: .2rem; - transition: background .3s; - flex-shrink: 0; - } - } - - /* nested list */ - ul { - max-height: 25rem; - overflow-y: auto - } - - /* active styles */ - &:not(.active) ul { - max-height: 0 - } - a:hover, - &.active > a { - color: var(--text-color); - } - - &.active > a::before { - background-color: var(--secondary-text-color); - } - } - } -} diff --git a/assets/css/main.scss b/assets/css/main.scss deleted file mode 100644 index 0bc8d722..00000000 --- a/assets/css/main.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "utils/variables"; -@import "utils/reset"; -@import "utils/utility"; -@import "markdown"; - -@import "components/libra"; -@import "components/toc"; diff --git a/assets/css/utils/_reset.scss b/assets/css/utils/_reset.scss deleted file mode 100644 index 568d8b5b..00000000 --- a/assets/css/utils/_reset.scss +++ /dev/null @@ -1,53 +0,0 @@ -html { - scroll-behavior: smooth; - scroll-padding-top: 3rem; -} - -@view-transition { - navigation: auto; -} - -body { - font-family: var(--serif-font-family); - -webkit-font-smoothing: antialiased; - color: var(--text-color); - position: relative; - - /* background */ - background-color: var(--background-color); - background-size: 5rem; - background-image: url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M82.42 180h-1.415L0 98.995v-2.827L6.167 90 0 83.833V81.004L81.005 0h2.827L90 6.167 96.167 0H98.996L180 81.005v2.827L173.833 90 180 96.167V98.996L98.995 180h-2.827L90 173.833 83.833 180H82.42zm0-1.414L1.413 97.58 8.994 90l-7.58-7.58L82.42 1.413 90 8.994l7.58-7.58 81.006 81.005-7.58 7.58 7.58 7.58-81.005 81.006-7.58-7.58-7.58 7.58zM175.196 0h-25.832c1.033 2.924 2.616 5.59 4.625 7.868C152.145 9.682 151 12.208 151 15c0 5.523 4.477 10 10 10 1.657 0 3 1.343 3 3v4h16V0h-4.803c.51.883.803 1.907.803 3 0 3.314-2.686 6-6 6s-6-2.686-6-6c0-1.093.292-2.117.803-3h10.394-13.685C161.18.938 161 1.948 161 3v4c-4.418 0-8 3.582-8 8s3.582 8 8 8c2.76 0 5 2.24 5 5v2h4v-4h2v4h4v-4h2v4h2V0h-4.803zm-15.783 0c-.27.954-.414 1.96-.414 3v2.2c-1.25.254-2.414.74-3.447 1.412-1.716-1.93-3.098-4.164-4.054-6.612h7.914zM180 17h-3l2.143-10H180v10zm-30.635 163c-.884-2.502-1.365-5.195-1.365-8 0-13.255 10.748-24 23.99-24H180v32h-30.635zm12.147 0c.5-1.416 1.345-2.67 2.434-3.66l-1.345-1.48c-1.498 1.364-2.62 3.136-3.186 5.14H151.5c-.97-2.48-1.5-5.177-1.5-8 0-12.15 9.84-22 22-22h8v30h-18.488zm13.685 0c-1.037-1.793-2.976-3-5.197-3-2.22 0-4.16 1.207-5.197 3h10.394zM0 148h8.01C21.26 148 32 158.742 32 172c0 2.805-.48 5.498-1.366 8H0v-32zm0 2h8c12.15 0 22 9.847 22 22 0 2.822-.53 5.52-1.5 8h-7.914c-.567-2.004-1.688-3.776-3.187-5.14l-1.346 1.48c1.09.99 1.933 2.244 2.434 3.66H0v-30zm15.197 30c-1.037-1.793-2.976-3-5.197-3-2.22 0-4.16 1.207-5.197 3h10.394zM0 32h16v-4c0-1.657 1.343-3 3-3 5.523 0 10-4.477 10-10 0-2.794-1.145-5.32-2.992-7.134C28.018 5.586 29.6 2.924 30.634 0H0v32zm0-2h2v-4h2v4h4v-4h2v4h4v-2c0-2.76 2.24-5 5-5 4.418 0 8-3.582 8-8s-3.582-8-8-8V3c0-1.052-.18-2.062-.512-3H0v30zM28.5 0c-.954 2.448-2.335 4.683-4.05 6.613-1.035-.672-2.2-1.16-3.45-1.413V3c0-1.04-.144-2.046-.414-3H28.5zM0 17h3L.857 7H0v10zM15.197 0c.51.883.803 1.907.803 3 0 3.314-2.686 6-6 6S4 6.314 4 3c0-1.093.292-2.117.803-3h10.394zM109 115c-1.657 0-3 1.343-3 3v4H74v-4c0-1.657-1.343-3-3-3-5.523 0-10-4.477-10-10 0-2.793 1.145-5.318 2.99-7.132C60.262 93.638 58 88.084 58 82c0-13.255 10.748-24 23.99-24h16.02C111.26 58 122 68.742 122 82c0 6.082-2.263 11.636-5.992 15.866C117.855 99.68 119 102.206 119 105c0 5.523-4.477 10-10 10zm0-2c-2.76 0-5 2.24-5 5v2h-4v-4h-2v4h-4v-4h-2v4h-4v-4h-2v4h-4v-4h-2v4h-4v-2c0-2.76-2.24-5-5-5-4.418 0-8-3.582-8-8s3.582-8 8-8v-4c0-2.64 1.136-5.013 2.946-6.66L72.6 84.86C70.39 86.874 69 89.775 69 93v2.2c-1.25.254-2.414.74-3.447 1.412C62.098 92.727 60 87.61 60 82c0-12.15 9.84-22 22-22h16c12.15 0 22 9.847 22 22 0 5.61-2.097 10.728-5.55 14.613-1.035-.672-2.2-1.16-3.45-1.413V93c0-3.226-1.39-6.127-3.6-8.14l-1.346 1.48C107.864 87.987 109 90.36 109 93v4c4.418 0 8 3.582 8 8s-3.582 8-8 8zM90.857 97L93 107h-6l2.143-10h1.714zM80 99c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zm20 0c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6z' fill='var(--block-background-color)' fill-opacity='0.018' fill-rule='evenodd'/%3E%3C/svg%3E"); - - .dark & { - background-image: url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M82.42 180h-1.415L0 98.995v-2.827L6.167 90 0 83.833V81.004L81.005 0h2.827L90 6.167 96.167 0H98.996L180 81.005v2.827L173.833 90 180 96.167V98.996L98.995 180h-2.827L90 173.833 83.833 180H82.42zm0-1.414L1.413 97.58 8.994 90l-7.58-7.58L82.42 1.413 90 8.994l7.58-7.58 81.006 81.005-7.58 7.58 7.58 7.58-81.005 81.006-7.58-7.58-7.58 7.58zM175.196 0h-25.832c1.033 2.924 2.616 5.59 4.625 7.868C152.145 9.682 151 12.208 151 15c0 5.523 4.477 10 10 10 1.657 0 3 1.343 3 3v4h16V0h-4.803c.51.883.803 1.907.803 3 0 3.314-2.686 6-6 6s-6-2.686-6-6c0-1.093.292-2.117.803-3h10.394-13.685C161.18.938 161 1.948 161 3v4c-4.418 0-8 3.582-8 8s3.582 8 8 8c2.76 0 5 2.24 5 5v2h4v-4h2v4h4v-4h2v4h2V0h-4.803zm-15.783 0c-.27.954-.414 1.96-.414 3v2.2c-1.25.254-2.414.74-3.447 1.412-1.716-1.93-3.098-4.164-4.054-6.612h7.914zM180 17h-3l2.143-10H180v10zm-30.635 163c-.884-2.502-1.365-5.195-1.365-8 0-13.255 10.748-24 23.99-24H180v32h-30.635zm12.147 0c.5-1.416 1.345-2.67 2.434-3.66l-1.345-1.48c-1.498 1.364-2.62 3.136-3.186 5.14H151.5c-.97-2.48-1.5-5.177-1.5-8 0-12.15 9.84-22 22-22h8v30h-18.488zm13.685 0c-1.037-1.793-2.976-3-5.197-3-2.22 0-4.16 1.207-5.197 3h10.394zM0 148h8.01C21.26 148 32 158.742 32 172c0 2.805-.48 5.498-1.366 8H0v-32zm0 2h8c12.15 0 22 9.847 22 22 0 2.822-.53 5.52-1.5 8h-7.914c-.567-2.004-1.688-3.776-3.187-5.14l-1.346 1.48c1.09.99 1.933 2.244 2.434 3.66H0v-30zm15.197 30c-1.037-1.793-2.976-3-5.197-3-2.22 0-4.16 1.207-5.197 3h10.394zM0 32h16v-4c0-1.657 1.343-3 3-3 5.523 0 10-4.477 10-10 0-2.794-1.145-5.32-2.992-7.134C28.018 5.586 29.6 2.924 30.634 0H0v32zm0-2h2v-4h2v4h4v-4h2v4h4v-2c0-2.76 2.24-5 5-5 4.418 0 8-3.582 8-8s-3.582-8-8-8V3c0-1.052-.18-2.062-.512-3H0v30zM28.5 0c-.954 2.448-2.335 4.683-4.05 6.613-1.035-.672-2.2-1.16-3.45-1.413V3c0-1.04-.144-2.046-.414-3H28.5zM0 17h3L.857 7H0v10zM15.197 0c.51.883.803 1.907.803 3 0 3.314-2.686 6-6 6S4 6.314 4 3c0-1.093.292-2.117.803-3h10.394zM109 115c-1.657 0-3 1.343-3 3v4H74v-4c0-1.657-1.343-3-3-3-5.523 0-10-4.477-10-10 0-2.793 1.145-5.318 2.99-7.132C60.262 93.638 58 88.084 58 82c0-13.255 10.748-24 23.99-24h16.02C111.26 58 122 68.742 122 82c0 6.082-2.263 11.636-5.992 15.866C117.855 99.68 119 102.206 119 105c0 5.523-4.477 10-10 10zm0-2c-2.76 0-5 2.24-5 5v2h-4v-4h-2v4h-4v-4h-2v4h-4v-4h-2v4h-4v-4h-2v4h-4v-2c0-2.76-2.24-5-5-5-4.418 0-8-3.582-8-8s3.582-8 8-8v-4c0-2.64 1.136-5.013 2.946-6.66L72.6 84.86C70.39 86.874 69 89.775 69 93v2.2c-1.25.254-2.414.74-3.447 1.412C62.098 92.727 60 87.61 60 82c0-12.15 9.84-22 22-22h16c12.15 0 22 9.847 22 22 0 5.61-2.097 10.728-5.55 14.613-1.035-.672-2.2-1.16-3.45-1.413V93c0-3.226-1.39-6.127-3.6-8.14l-1.346 1.48C107.864 87.987 109 90.36 109 93v4c4.418 0 8 3.582 8 8s-3.582 8-8 8zM90.857 97L93 107h-6l2.143-10h1.714zM80 99c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zm20 0c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6z' fill='var(--block-background-color)' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E"); - } -} - -article { - max-width: var(--page-width); - margin: 0 auto; - padding: 0 1rem; -} - -a { - color: var(--text-color); - text-decoration: none; - text-underline-offset: 0.25rem; - &:hover { - text-decoration: underline; - } -} - -button { - border: none; - outline: none; - color: var(--text-color); - font-size: 1rem; - font-family: var(--serif-font-family); - cursor: pointer -} - -hr { - margin: 2.5rem auto; - border: 0.05rem dashed var(--border-color); -} diff --git a/assets/css/utils/_utility.scss b/assets/css/utils/_utility.scss deleted file mode 100644 index b37cc742..00000000 --- a/assets/css/utils/_utility.scss +++ /dev/null @@ -1,62 +0,0 @@ -/* container that extends the page width */ -.outbox { - display: flex; - justify-content: center; - width: 100%; - z-index: 10; - position: relative; - - @media screen and (min-width: 768px) { - width: calc(var(--page-width) + 10rem); - margin: 0 -5rem; - } - - @media screen and (min-width: 1200px) { - width: calc(var(--page-width) + 20rem); - margin: 0 -10rem; - } - - &.small { - @media screen and (min-width: 768px) { - width: calc(var(--page-width) + 4rem); - margin: 0 -2rem; - } - - @media screen and (min-width: 1200px) { - width: calc(var(--page-width) + 10rem); - margin: 0 -5rem; - } - } -} - -/* filter that gives element a printed look */ -.xerox { - filter: url(#x); -} - -.writing-vertical { - writing-mode: vertical-lr; -} - -@media (min-width: 768px) { - .md\:writing-vertical { - writing-mode: vertical-lr; - } -} - -details.no-mark summary::marker { content: "" } - -.lazy-render { - content-visibility: auto; - contain-intrinsic-size: auto 500px; -} - -/* Dynamic rotation for webmention avatars */ -.group:hover img[style*="--rotate-amount"] { - transform: rotate(var(--rotate-amount)); -} - -/* Dynamic rotation for fiction section items */ -div[style*="--rotation-deg"]:hover { - transform: rotate(0deg) scale(1.1) !important; -} diff --git a/assets/css/utils/_variables.scss b/assets/css/utils/_variables.scss deleted file mode 100644 index cead160f..00000000 --- a/assets/css/utils/_variables.scss +++ /dev/null @@ -1,48 +0,0 @@ -:root { - /* colors */ - --background-color: oklch(0.9707 0.0027 286.35); - --bright-background-color: oklch(0.9851 0 0); - --block-background-color: oklch(0.933 0.007 295.445); - --border-color: oklch(0.8758 0.0123 247.97); - --text-color: oklch(0.2316 0.0038 286.1); - --secondary-text-color: oklch(0.5399 0.0077 286.14); - --link-color: oklch(0.3147 0.0071 285.99); - - /* fonts */ - --serif-font-family: - "Noto Serif", - "Noto Serif SC", - "Noto Serif TC", - "Noto Serif CJK SC", - "Noto Serif CJK TC", - "Source Han Serif SC", - "Source Han Serif TC", - "Songti SC", - "Times New Roman", - Times, - serif; - - --page-width: 650px; - --page-margin-y: 3rem; - @media screen and (min-width: 768) { - --page-margin-y: 5rem; - } - - /* pagefind custom css */ - --pagefind-ui-primary: var(--text-color); - --pagefind-ui-text: var(--text-color); - --pagefind-ui-background: var(--background-color); - --pagefind-ui-border: var(--border-color); - --pagefind-ui-tag: var(--border-color); -} - -.dark { - --background-color: oklch(0.2408 0.0049 219.67); - --block-background-color: oklch(0.216 0.004 228.978); - --border-color: rgba(255, 255, 255, 0.2); - --text-color: oklch(0.8532 0.0082 73.73); - --secondary-text-color: oklch(0.6863 0.0196 78.19); - --link-color: oklch(0.9054 0.0081 73.74); - --bright-background-color: oklch(0.5103 0 0); -} - diff --git a/assets/js/back2top.js b/assets/js/back2top.js deleted file mode 100644 index 6d7501e1..00000000 --- a/assets/js/back2top.js +++ /dev/null @@ -1,60 +0,0 @@ -// Back2top, the Batrick -// author: Eltrac - -const backToTop = document.getElementById("back2top") -const backToTopButton = document.getElementById("back2top-button") -const backToTopInstruction = document.getElementById("back2top-instruction") -const seenAndUsedBat = localStorage.getItem("geedeapro.ui.seenAndUsedBat") - -if (backToTopInstruction && backToTopButton) { - function hideInstruction() { - backToTopInstruction.remove() - } - if (seenAndUsedBat) hideInstruction() - - // listen to button click and scroll to top - backToTopButton.addEventListener("click", () => { - window.scrollTo({ top: 0, behavior: "smooth" }) - if (!seenAndUsedBat) { - localStorage.setItem("geedeapro.ui.seenAndUsedBat", true); - hideInstruction(); - } - }) - - // listen to scroll and toggle button visibility - let lastOffset = window.scrollY - - window.addEventListener("scroll", () => { - const offset = window.scrollY - const batIsHidden = backToTop.classList.contains("-top-25") - const enoughHeight = offset >= 2000 - const isScrollingUp = offset < lastOffset - const isScrollingDown = offset > lastOffset - - function hide() { - backToTop.classList.remove("top-0") - backToTop.classList.add("-top-25") - backToTop.classList.remove("animate-head-shake") - } - - function show() { - backToTop.classList.remove("-top-25") - backToTop.classList.add("top-0") - backToTop.classList.add("animate-head-shake") - } - - if (enoughHeight && isScrollingUp && batIsHidden) { - // show only when scrolling up - show() - } else if (isScrollingDown && !batIsHidden) { - // hide as soon as user scrolls down again - hide() - } - - // hide no matter what if too close to top - if (!enoughHeight) hide() - - lastOffset = offset - }) -} - diff --git a/assets/js/darkmode.js b/assets/js/darkmode.js deleted file mode 100644 index 6057f357..00000000 --- a/assets/js/darkmode.js +++ /dev/null @@ -1,36 +0,0 @@ -(() => { - const THEME = 'geedeapro.theme' // auto | light | dakr - const mql = window.matchMedia('(prefers-color-scheme: dark)') - - function useDarkMode(store) { - document.documentElement.classList.add('dark') - if (localStorage.getItem(THEME) != 'auto') mql.onchange = null - if (store) localStorage.setItem(THEME, 'dark') - } - - function useLightMode(store) { - document.documentElement.classList.remove('dark') - if (localStorage.getItem(THEME) != 'auto') mql.onchange = null - if (store) localStorage.setItem(THEME, 'light') - } - - function useSystem(store) { - if (mql.matches) useDarkMode() - else useLightMode() - mql.onchange = e => { - console.log("changed when system changed") - if (e.matches) useDarkMode() - else useLightMode() - } - if (store) localStorage.setItem(THEME, 'auto') - } - - window.switchTheme = (theme, store) => { - if (!theme || theme === 'auto') useSystem(store) - else if (theme === 'dark') useDarkMode(store) - else if (theme === 'light') useLightMode(store) - } - - // use preferred theme immediately upon DOM loaded - window.switchTheme(localStorage.getItem(THEME), false) -})(); diff --git a/assets/js/fediform.js b/assets/js/fediform.js deleted file mode 100644 index 30c2815c..00000000 --- a/assets/js/fediform.js +++ /dev/null @@ -1,42 +0,0 @@ -document.addEventListener("DOMContentLoaded", () => { - // open toot in fediverse - const instanceInput = document.getElementById('fediverse-instance') - if (instanceInput) { - const savedInstance = localStorage.getItem("geedeapro.fediInstance") - if (savedInstance) instanceInput.value = savedInstance - - function openInFediverse() { - const instance = instanceInput.value.trim(); - - let url = tootUrl - if (instance) { - url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl); - // save instance url to localStorage - localStorage.setItem("geedeapro.fediInstance", instance) - } - window.open(url, '_blank'); - } - - const fediformButton = document.getElementById('fediform-button'); - fediformButton.addEventListener("click", openInFediverse) - - instanceInput.addEventListener('keypress', function(event) { - if (event.key === 'Enter') { - event.preventDefault(); - openInFediverse(); - } - }); - } - - - // copy toot link: - const copyBtn = document.getElementById("fediform-copy-button") - if (copyBtn) { - function copyTootLink() { - navigator.clipboard.writeText(tootUrl) - copyBtn.innerText = 'βœ…' - setTimeout(() => copyBtn.innerText = 'πŸ“‹', 3000) - } - copyBtn.addEventListener("click", copyTootLink) - } -}) diff --git a/assets/js/instantpage.min.js b/assets/js/instantpage.min.js deleted file mode 100644 index 761f9d34..00000000 --- a/assets/js/instantpage.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! instant.page v5.2.0 - (C) 2019-2025 Alexandre Dieulot - https://instant.page/license */ -let t,e,n,o,i,r,a=null,s=65,c=new Set;function u(t){i=t;const e=t.target.closest("a");g(e)&&v(e.href,"high")}function d(t){i=t}function l(t){if(h(t))return;if(!("closest"in t.target))return;const e=t.target.closest("a");g(e)&&(e.addEventListener("mouseout",p,{passive:!0}),r=setTimeout(()=>{v(e.href,"high"),r=null},s))}function f(t){if(h(t))return;const e=t.target.closest("a");g(e)&&v(e.href,"high")}function p(t){t.relatedTarget&&t.target.closest("a")==t.relatedTarget.closest("a")||r&&(clearTimeout(r),r=null)}function m(t){if(h(t))return;const e=t.target.closest("a");if(t.which>1||t.metaKey||t.ctrlKey)return;if(!e)return;e.addEventListener("click",function(t){1337!=t.detail&&t.preventDefault()},{capture:!0,passive:!1,once:!0});const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});e.dispatchEvent(n)}function h(t){if(!i||!t)return!1;if(t.target!=i.target)return!1;return t.timeStamp-i.timeStamp<2500}function g(t){if(t&&t.href&&(!o||"instant"in t.dataset)){if(t.origin!=location.origin){if(!(n||"instant"in t.dataset)||!a)return}if(["http:","https:"].includes(t.protocol)&&("http:"!=t.protocol||"https:"!=location.protocol)&&(e||!t.search||"instant"in t.dataset)&&!(t.hash&&t.pathname+t.search==location.pathname+location.search||"noInstant"in t.dataset))return!0}}function v(e,n="auto"){c.has(e)||("none"!=t?function(e){const n=document.createElement("script");n.type="speculationrules",n.textContent=JSON.stringify({[t]:[{source:"list",urls:[e]}]}),document.head.appendChild(n)}(e):function(t,e="auto"){const n=document.createElement("link");n.rel="prefetch",n.href=t,n.fetchPriority=e,n.as="document",document.head.appendChild(n)}(e,n),c.add(e))}!function(){const i=document.createElement("link").relList;if(!i.supports("prefetch"))return;const r="throwIfAborted"in AbortSignal.prototype,c=i.supports("modulepreload"),p=Intl.PluralRules&&"selectRange"in Intl.PluralRules.prototype;if(!r||!c&&!p)return;const h="instantVaryAccept"in document.body.dataset||"Shopify"in window,y=navigator.userAgent.indexOf("Chrome/");y>-1&&(a=parseInt(navigator.userAgent.substring(y+"Chrome/".length)));if(h&&a&&a<110)return;if(t="none",HTMLScriptElement.supports&&HTMLScriptElement.supports("speculationrules")){const e=document.body.dataset.instantSpecrules;"prerender"==e?t="prerender":"no"!=e&&(t="prefetch")}const w="instantMousedownShortcut"in document.body.dataset;e="instantAllowQueryString"in document.body.dataset,n="instantAllowExternalLinks"in document.body.dataset,o="instantWhitelist"in document.body.dataset;let b=!1,E=!1,S=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if("mousedown"!=t||w||(b=!0),"mousedown-only"!=t||w||(b=!0,E=!0),"viewport"==t){const t=document.documentElement.clientWidth*document.documentElement.clientHeight<45e4,e=navigator.connection&&navigator.connection.saveData,n=navigator.connection&&navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g"),o=!e&&!n;t&&o&&(S=!0)}"viewport-all"==t&&(S=!0);const e=parseInt(t);isNaN(e)||(s=e)}const I={capture:!0,passive:!0};E?document.addEventListener("touchstart",d,I):document.addEventListener("touchstart",u,I);b||document.addEventListener("mouseover",l,I);b&&document.addEventListener("mousedown",f,I);w&&document.addEventListener("mousedown",m,I);if(S){let t=window.requestIdleCallback;t||(t=(t=>{t()})),t(function(){const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),v(n.href)}})});document.querySelectorAll("a").forEach(e=>{g(e)&&t.observe(e)})},{timeout:1500})}}(); \ No newline at end of file diff --git a/assets/js/toc.js b/assets/js/toc.js deleted file mode 100644 index ec0028db..00000000 --- a/assets/js/toc.js +++ /dev/null @@ -1,40 +0,0 @@ -// Animate Hugo-built TOC -// author: Eltrac - -document.addEventListener('DOMContentLoaded', () => { - const toc = document.getElementById('toc'); - if (!toc) return; - - const headings = document.querySelectorAll('h2, h3'); - const observer = new IntersectionObserver(entries => { - entries.forEach(entry => { - if (!entry.isIntersecting) return; - - const id = entry.target.id; - const tocLink = toc.querySelector(`a[href="#${id}"]`); - if (!tocLink) return; - - const listItem = tocLink.parentElement; - const isH2 = entry.target.tagName === 'H2'; - - // Clear all active states when a new H2 is encountered - if (isH2) { - toc.querySelectorAll('li.active').forEach(el => el.classList.remove('active')); - } - - // Set current item as active - listItem.classList.add('active'); - - // If this is an H3, find and activate its parent H2 - if (!isH2) { - const parentH2Item = listItem.closest('ul').previousElementSibling?.closest('li'); - if (parentH2Item) parentH2Item.classList.add('active'); - } - }); - }, { - rootMargin: '0px 0px -50% 0px', - threshold: 0.5 - }); - - headings.forEach(heading => observer.observe(heading)); -}); diff --git a/assets/js/tooltip.js b/assets/js/tooltip.js deleted file mode 100644 index eea5b350..00000000 --- a/assets/js/tooltip.js +++ /dev/null @@ -1,54 +0,0 @@ -(() => { - const allTooltipped = document.querySelectorAll('[data-tooltip]'); - - const createOrUpdateTooltip = (element) => { - const tooltipText = element.getAttribute('data-tooltip') || element.getAttribute('title'); - - if (!tooltipText) return; - - let tooltipElement = element.querySelector('.__generated-tooltip'); - if (!tooltipElement) { - element.classList.add('group', 'relative', 'tooltipped'); - - tooltipElement = document.createElement('div'); - tooltipElement.classList.add( - '__generated-tooltip', - ...'absolute bottom-full left-1/2 transform -translate-x-1/2 translate-y-1 bg-black/80 text-white px-2.5 py-1.5 rounded text-xs whitespace-nowrap opacity-0 invisible transition-all duration-300 pointer-events-none mb-2 z-1000 group-hover:opacity-100 group-hover:visible group-hover:translate-y-0 dark:bg-white/90 dark:text-black'.split(' ') - ); - element.appendChild(tooltipElement); - } - - tooltipElement.textContent = tooltipText; - }; - - const observer = new IntersectionObserver((entries, obs) => { - entries.forEach(entry => { - if (!entry.isIntersecting) return; - - const element = entry.target; - createOrUpdateTooltip(element); - - // listen to tooltip text changes - const mutationObserver = new MutationObserver(mutations => { - for (const mutation of mutations) { - if (mutation.type === 'attributes' && - (mutation.attributeName === 'title' || mutation.attributeName === 'data-tooltip')) { - createOrUpdateTooltip(element); - } - } - }); - - mutationObserver.observe(element, { - attributes: true, - attributeFilter: ['title', 'data-tooltip'], - }); - - obs.unobserve(element); // δΈε†ιœ€θ¦ Intersection 监听 - }); - }, { - rootMargin: '100px', - threshold: 0.1, - }); - - allTooltipped.forEach(el => observer.observe(el)); -})(); -- cgit v1.2.3