From 79f21eafa44c52eea39ee0d47e186cbd380fa72b Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Tue, 30 Nov 2021 02:42:47 +0900 Subject: [PATCH 1/5] Add `.editorconfig` (#107) --- .editorconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f909307 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true + +[src/] +indent_size = 4 +indent_style = space +insert_final_newline = true From 5dfa1abf9ec2fe5f03a81d78a6cf060a65af1bdb Mon Sep 17 00:00:00 2001 From: Aaron Gustafson Date: Thu, 27 Jan 2022 16:21:31 -0800 Subject: [PATCH 2/5] Actually use progressive enhancement with a link rather than button (#117) --- src/lite-yt-embed.css | 1 + src/lite-yt-embed.js | 3 ++- variants/pe.html | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lite-yt-embed.css b/src/lite-yt-embed.css index 78eb545..c06c23b 100644 --- a/src/lite-yt-embed.css +++ b/src/lite-yt-embed.css @@ -43,6 +43,7 @@ lite-youtube > iframe { /* play button */ lite-youtube > .lty-playbtn { + display: block; width: 68px; height: 48px; position: absolute; diff --git a/src/lite-yt-embed.js b/src/lite-yt-embed.js index b79adc8..6a2a777 100644 --- a/src/lite-yt-embed.js +++ b/src/lite-yt-embed.js @@ -95,8 +95,9 @@ class LiteYTEmbed extends HTMLElement { LiteYTEmbed.preconnected = true; } - addIframe() { + addIframe(e) { if (this.classList.contains('lyt-activated')) return; + e.preventDefault(); this.classList.add('lyt-activated'); const params = new URLSearchParams(this.getAttribute('params') || []); diff --git a/variants/pe.html b/variants/pe.html index 138ede7..b571fe8 100644 --- a/variants/pe.html +++ b/variants/pe.html @@ -7,14 +7,14 @@ -

progressively enhanced

+

Progressively Enhanced

After 2 seconds, the JS is executed and custom element defined.

...

- +