mirror of
https://github.com/zen-browser/www.git
synced 2025-07-08 01:10:02 +02:00
This commit adds the Biome formatter and linter to replace Prettier, including: - Add biome.json config file - Add pre-commit hook with Husky - Configure GitHub Action to run Biome checks - Apply Biome formatting rules to codebase - Remove Prettier dependencies
33 lines
711 B
Text
33 lines
711 B
Text
---
|
|
const { src, class: className, ...rest } = Astro.props;
|
|
const type = src.split(".").pop() || "webm";
|
|
---
|
|
|
|
<video
|
|
class:list={['w-fit', className]}
|
|
data-src={src}
|
|
preload="none"
|
|
{...rest}
|
|
>
|
|
<source src="" type={`video/${type}`} />
|
|
</video>
|
|
|
|
<script>
|
|
const videos = document.querySelectorAll(
|
|
'video[data-src]',
|
|
) as NodeListOf<HTMLVideoElement>
|
|
|
|
const loadVideo = (video: HTMLVideoElement) => {
|
|
const source = video.querySelector('source')
|
|
const dataSrc = video.getAttribute('data-src')
|
|
if (dataSrc && source) {
|
|
source.src = dataSrc
|
|
video.removeAttribute('data-src')
|
|
video.load()
|
|
}
|
|
}
|
|
|
|
for (const video of videos) {
|
|
loadVideo(video)
|
|
}
|
|
</script>
|