Run npx prettier . --write

This commit is contained in:
tsumac 2025-06-15 22:22:28 +09:00
parent 3d93f64c92
commit 3a178acda0
7 changed files with 281 additions and 280 deletions

View File

@ -2,7 +2,10 @@
import linkCardScript from "./scripts/linkcard.inline" import linkCardScript from "./scripts/linkcard.inline"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
const LinkCardHandler: QuartzComponent = ({ displayClass: _displayClass, cfg:_cfg }: QuartzComponentProps) => { const LinkCardHandler: QuartzComponent = ({
displayClass: _displayClass,
cfg: _cfg,
}: QuartzComponentProps) => {
return <></> return <></>
} }

View File

@ -1,29 +1,29 @@
// Handle link card image failures // Handle link card image failures
function handleLinkCardImages() { function handleLinkCardImages() {
const linkCardImages = document.querySelectorAll('.rlc-image') const linkCardImages = document.querySelectorAll(".rlc-image")
linkCardImages.forEach((img: Element) => { linkCardImages.forEach((img: Element) => {
const imgElement = img as HTMLImageElement const imgElement = img as HTMLImageElement
const container = imgElement.closest('.rlc-image-container') const container = imgElement.closest(".rlc-image-container")
if (!container) return if (!container) return
// If the image has already failed to load (complete=true and naturalWidth=0) // If the image has already failed to load (complete=true and naturalWidth=0)
if (imgElement.complete && imgElement.naturalWidth === 0) { if (imgElement.complete && imgElement.naturalWidth === 0) {
container.classList.add('image-failed') container.classList.add("image-failed")
return return
} }
// Event listener for image load errors // Event listener for image load errors
const handleError = () => { const handleError = () => {
container.classList.add('image-failed') container.classList.add("image-failed")
} }
imgElement.addEventListener('error', handleError) imgElement.addEventListener("error", handleError)
window.addCleanup(() => imgElement.removeEventListener('error', handleError)) window.addCleanup(() => imgElement.removeEventListener("error", handleError))
}) })
} }
// Execute on page load and navigation events // Execute on page load and navigation events
document.addEventListener('nav', handleLinkCardImages) document.addEventListener("nav", handleLinkCardImages)
document.addEventListener('DOMContentLoaded', handleLinkCardImages) document.addEventListener("DOMContentLoaded", handleLinkCardImages)

View File

@ -119,7 +119,6 @@
.rlc-title { .rlc-title {
font-size: 0.95rem; font-size: 0.95rem;
} }
} }
} }

View File

@ -119,7 +119,6 @@
.rlc-title { .rlc-title {
font-size: 0.95rem; font-size: 0.95rem;
} }
} }
} }