Skip to content

Commit a758cda

Browse files
committed
Release v0.5.1
- If embedParams.start is provided, its timestamp will be used in the "Watch on YouTube" link
1 parent b667d48 commit a758cda

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

YouTube.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ let gradientStyle = `.gradient{width:100%;height:49px;padding-bottom:50px;positi
115115
let linkStyle = noLink ? '' : '.wiyt{z-index:2;background:rgba(23,23,23,.8);border-bottom-right-radius:2px;border-top-right-radius:2px;bottom:5px;height:47px;position:absolute;}.wiyt-text{color:#fff;float:left;font:500 16px/16px "YouTube Noto",Roboto,Arial,Helvetica,sans-serif;margin-left:12px;margin-top:16px;}.wiyt-logo{float:right;height:16px;margin-left:9px;margin-right:12px;margin-top:16px;width:72px;}'
116116
let style = `<style>*{padding:0;margin:0;overflow:hidden}html,body{height:100%;background:#000}img{position:absolute;width:100%;top:0;bottom:0;margin:auto}.button{position:absolute;left:50%;top:50%;width:68px;height:48px;margin-left:-34px;margin-top:-24px}.top{position:absolute;top:18px;left:18px;right:18px;display:flex;flex-wrap:nowrap}.title{color:#fff;font-size:18px;white-space:nowrap;word-wrap:normal;text-shadow:0 0 2px rgba(0,0,0,.5);font-family:"YouTube Noto",Roboto,Arial,Helvetica,sans-serif;line-height:1.3;text-overflow:ellipsis;overflow:hidden}${gradientStyle}${linkStyle}</style>`
117117
118-
let watchInYouTube = noLink ? '' : `<a href="https://www.youtube.com/watch?v=${videoId}" target="_blank" aria-label="Watch on YouTube" class="wiyt"><div aria-hidden="true"><div class="wiyt-text">Watch on</div><div class="wiyt-logo">${linkSvg}</div></div></a>`
119-
let srcdoc = `${style}${watchInYouTube}<a href="${embedUrl}"><img src="${thumbnailUrl}" alt="${title}" loading="${loading}"><div class="gradient"></div><div class="top"><div class="title">${title}</div></div><div class="button">${playButtonSvg}</div></a>`
118+
let watchOnYouTube = noLink ? '' : `<a href="https://www.youtube.com/watch?v=${videoId}${params.start ? `&t=${params.start}s` : ''}" target="_blank" aria-label="Watch on YouTube" class="wiyt"><div aria-hidden="true"><div class="wiyt-text">Watch on</div><div class="wiyt-logo">${linkSvg}</div></div></a>`
119+
let srcdoc = `${style}${watchOnYouTube}<a href="${embedUrl}"><img src="${thumbnailUrl}" alt="${title}" loading="${loading}"><div class="gradient"></div><div class="top"><div class="title">${title}</div></div><div class="button">${playButtonSvg}</div></a>`
120120
---
121121
<iframe
122122
loading={loading}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "astro-lazy-youtube-embed",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Embed YouTube videos with a static placeholder which only embeds when you click",
55
"type": "module",
66
"license": "MIT",

0 commit comments

Comments
 (0)