release polish

This commit is contained in:
Nuno Coração
2026-01-01 23:56:30 +00:00
parent 949e367a01
commit e8d22f1f1b
14 changed files with 139 additions and 22 deletions
@@ -52,7 +52,7 @@ lite-youtube > iframe {
}
/* play button */
lite-youtube > .lty-playbtn {
lite-youtube > .lyt-playbtn {
display: block;
/* Make the button element cover the whole area for a large hover/click target… */
width: 100%;
@@ -69,8 +69,8 @@ lite-youtube > .lty-playbtn {
border: 0;
}
lite-youtube:hover > .lty-playbtn,
lite-youtube .lty-playbtn:focus {
lite-youtube:hover > .lyt-playbtn,
lite-youtube .lyt-playbtn:focus {
filter: none;
}
@@ -79,7 +79,7 @@ lite-youtube.lyt-activated {
cursor: unset;
}
lite-youtube.lyt-activated::before,
lite-youtube.lyt-activated > .lty-playbtn {
lite-youtube.lyt-activated > .lyt-playbtn {
opacity: 0;
pointer-events: none;
}
@@ -14,7 +14,7 @@ class LiteYTEmbed extends HTMLElement {
connectedCallback() {
this.videoId = this.getAttribute('videoid');
let playBtnEl = this.querySelector('.lty-playbtn');
let playBtnEl = this.querySelector('.lyt-playbtn,.lty-playbtn');
// A label for the button takes priority over a [playlabel] attribute on the custom-element
this.playLabel = (playBtnEl && playBtnEl.textContent.trim()) || this.getAttribute('playlabel') || 'Play';
@@ -34,7 +34,8 @@ class LiteYTEmbed extends HTMLElement {
if (!playBtnEl) {
playBtnEl = document.createElement('button');
playBtnEl.type = 'button';
playBtnEl.classList.add('lty-playbtn');
// Include the mispelled 'lty-' in case it's still being used. https://github.com/paulirish/lite-youtube-embed/issues/65
playBtnEl.classList.add('lyt-playbtn', 'lty-playbtn');
this.append(playBtnEl);
}
if (!playBtnEl.textContent) {
@@ -200,6 +201,8 @@ class LiteYTEmbed extends HTMLElement {
iframeEl.title = this.playLabel;
iframeEl.allow = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';
iframeEl.allowFullscreen = true;
// Required by Youtube to fix Error 153
iframeEl.referrerPolicy = 'strict-origin-when-cross-origin';
// AFAIK, the encoding here isn't necessary for XSS, but we'll do it only because this is a URL
// https://stackoverflow.com/q/64959723/89484
iframeEl.src = `https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${this.getParams().toString()}`;