-
-
- ${await buildPosterHtml(asset)}
-
-
-
-
+
+
`;
return true;
}
-async function buildPosterHtml(asset: BuiltAsset): Promise
{
- // Pretend the asset is an image to re-use default picture build procedure.
- asset = { ...asset, syntax: { ...asset.syntax, url: "" } };
- await defaults.transform.build([asset]);
- return asset.html;
-}
-
/** Whether specified url is a valid YouTube video link. */
function isYouTube(url: string): boolean {
return url.includes("youtube.com/watch?v=");
@@ -75,7 +67,3 @@ async function resolveThumbnailUrl(id: string): Promise {
function buildThumbnailUrl(id: string, variant: string): string {
return `https://i.ytimg.com/vi_webp/${id}/${variant}.webp`;
}
-
-function handlePosterClick(event: Event) {
-
-}
diff --git a/docs/.vitepress/imgit/plugin/youtube/client.ts b/docs/.vitepress/imgit/plugin/youtube/client.ts
deleted file mode 100644
index fed29db17..000000000
--- a/docs/.vitepress/imgit/plugin/youtube/client.ts
+++ /dev/null
@@ -1 +0,0 @@
-import "./styles.css";
diff --git a/docs/.vitepress/imgit/plugin/youtube/index.ts b/docs/.vitepress/imgit/plugin/youtube/index.ts
deleted file mode 100644
index 867c2edab..000000000
--- a/docs/.vitepress/imgit/plugin/youtube/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import server from "./server";
-
-export default server;
diff --git a/docs/.vitepress/imgit/plugin/youtube/styles.css b/docs/.vitepress/imgit/plugin/youtube/styles.css
deleted file mode 100644
index 3b1ebb758..000000000
--- a/docs/.vitepress/imgit/plugin/youtube/styles.css
+++ /dev/null
@@ -1,54 +0,0 @@
-.imgit-youtube {
- display: block;
- position: relative;
- padding-bottom: 56.25%;
- height: 0;
- overflow: hidden;
-}
-
-.imgit-youtube iframe,
-.imgit-youtube object,
-.imgit-youtube embed {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- border: none;
-}
-
-.imgit-youtube-poster {
- contain: content;
- cursor: pointer;
- filter: none;
- transition: opacity 0.3s;
-}
-
-.imgit-youtube:hover .imgit-youtube-poster {
- opacity: 0.85;
-}
-
-.imgit-youtube-poster::before {
- content: '';
- position: absolute;
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);
- height: 100px;
- width: 100%;
-}
-
-.imgit-youtube-play-button {
- width: 85px;
- height: 60px;
- position: absolute;
- top: calc(50% - 30px);
- left: calc(50% - 43px);
- z-index: 1;
- background: url('data:image/svg+xml;utf8,') no-repeat center;
- filter: grayscale(100%) drop-shadow(0 0 20px black);
- transition: filter .1s cubic-bezier(0, 0, 0.2, 1), transform .1s cubic-bezier(0, 0, 0.2, 1);
-}
-
-.imgit-youtube:hover .imgit-youtube-play-button {
- filter: grayscale(0%) drop-shadow(0 0 10px red);
- transform: scale(1.04);
-}
diff --git a/docs/.vitepress/imgit/server/transform/6-build.ts b/docs/.vitepress/imgit/server/transform/6-build.ts
index 76c40f70e..af7098dd7 100644
--- a/docs/.vitepress/imgit/server/transform/6-build.ts
+++ b/docs/.vitepress/imgit/server/transform/6-build.ts
@@ -21,12 +21,12 @@ async function buildAsset(asset: BuiltAsset, merges: BuiltAsset[]): Promise {
+async function buildPicture(content: EncodedContent, asset: BuiltAsset, merges: BuiltAsset[]): Promise {
const size = buildSizeAttributes(content.info);
const lazy = asset.spec?.eager == null;
const load = lazy ? `loading="lazy" decoding="async"` : `decoding="sync"`;
let sourcesHtml = await buildPictureSources(content, asset);
- if (merges) for (const merge of merges)
+ for (const merge of merges)
if (merge.content) sourcesHtml += await buildPictureSources(merge.content, merge);
sourcesHtml += ``;
asset.html = `
@@ -68,10 +68,10 @@ async function buildVideo(content: EncodedContent, asset: BuiltAsset, merges: Bu
`;
}
-async function buildCover(asset: EncodedAsset, size: string, merges?: BuiltAsset[]): Promise