mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
Run npx prettier . --write
This commit is contained in:
parent
3d93f64c92
commit
3a178acda0
@ -2,7 +2,10 @@
|
||||
import linkCardScript from "./scripts/linkcard.inline"
|
||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
|
||||
const LinkCardHandler: QuartzComponent = ({ displayClass: _displayClass, cfg:_cfg }: QuartzComponentProps) => {
|
||||
const LinkCardHandler: QuartzComponent = ({
|
||||
displayClass: _displayClass,
|
||||
cfg: _cfg,
|
||||
}: QuartzComponentProps) => {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
// Handle link card image failures
|
||||
function handleLinkCardImages() {
|
||||
const linkCardImages = document.querySelectorAll('.rlc-image')
|
||||
const linkCardImages = document.querySelectorAll(".rlc-image")
|
||||
|
||||
linkCardImages.forEach((img: Element) => {
|
||||
const imgElement = img as HTMLImageElement
|
||||
const container = imgElement.closest('.rlc-image-container')
|
||||
const container = imgElement.closest(".rlc-image-container")
|
||||
|
||||
if (!container) return
|
||||
|
||||
// If the image has already failed to load (complete=true and naturalWidth=0)
|
||||
if (imgElement.complete && imgElement.naturalWidth === 0) {
|
||||
container.classList.add('image-failed')
|
||||
container.classList.add("image-failed")
|
||||
return
|
||||
}
|
||||
|
||||
// Event listener for image load errors
|
||||
const handleError = () => {
|
||||
container.classList.add('image-failed')
|
||||
container.classList.add("image-failed")
|
||||
}
|
||||
|
||||
imgElement.addEventListener('error', handleError)
|
||||
window.addCleanup(() => imgElement.removeEventListener('error', handleError))
|
||||
imgElement.addEventListener("error", handleError)
|
||||
window.addCleanup(() => imgElement.removeEventListener("error", handleError))
|
||||
})
|
||||
}
|
||||
|
||||
// Execute on page load and navigation events
|
||||
document.addEventListener('nav', handleLinkCardImages)
|
||||
document.addEventListener('DOMContentLoaded', handleLinkCardImages)
|
||||
document.addEventListener("nav", handleLinkCardImages)
|
||||
document.addEventListener("DOMContentLoaded", handleLinkCardImages)
|
||||
|
||||
@ -93,9 +93,9 @@
|
||||
object-position: center;
|
||||
min-width: 100%; // コンテナの幅は最低限埋める
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@media (max-width: 768px) {
|
||||
.rlc-container {
|
||||
flex-direction: column;
|
||||
min-height: auto;
|
||||
@ -119,11 +119,10 @@
|
||||
.rlc-title {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
@media (max-width: 480px) {
|
||||
.rlc-container {
|
||||
.rlc-info {
|
||||
padding: 12px;
|
||||
@ -145,4 +144,4 @@
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +93,9 @@
|
||||
object-position: center;
|
||||
min-width: 100%; // ensure container is at least filled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@media (max-width: 768px) {
|
||||
.rlc-container {
|
||||
flex-direction: column;
|
||||
min-height: auto;
|
||||
@ -119,11 +119,10 @@
|
||||
.rlc-title {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
@media (max-width: 480px) {
|
||||
.rlc-container {
|
||||
.rlc-info {
|
||||
padding: 12px;
|
||||
@ -145,4 +144,4 @@
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user