@justinribeiro/lite-youtube
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -40,2 +40,3 @@ /** | ||
get posterQuality(): string; | ||
get posterLoading(): string; | ||
get params(): string; | ||
@@ -42,0 +43,0 @@ /** |
@@ -71,2 +71,5 @@ /** | ||
} | ||
get posterLoading() { | ||
return this.getAttribute('posterloading') || 'lazy'; | ||
} | ||
get params() { | ||
@@ -252,2 +255,3 @@ return `start=${this.videoStartAt}&${this.getAttribute('params')}`; | ||
const posterUrlJpeg = `https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`; | ||
this.domRefImg.fallback.loading = this.posterLoading; | ||
this.domRefImg.webp.srcset = posterUrlWebp; | ||
@@ -254,0 +258,0 @@ this.domRefImg.jpeg.srcset = posterUrlJpeg; |
@@ -28,3 +28,3 @@ { | ||
"license": "MIT", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": "lite-youtube.js", | ||
@@ -31,0 +31,0 @@ "module": "lite-youtube.js", |
[![npm version](https://badge.fury.io/js/@justinribeiro%2Flite-youtube.svg)](https://badge.fury.io/js/@justinribeiro%2Flite-youtube) [![min+gzip](https://badgen.net/bundlephobia/minzip/@justinribeiro/lite-youtube)](https://bundlephobia.com/result?p=@justinribeiro/lite-youtube) [![](https://data.jsdelivr.com/v1/package/npm/@justinribeiro/lite-youtube/badge)](https://www.jsdelivr.com/package/npm/@justinribeiro/lite-youtube) | ||
![Statements](https://img.shields.io/badge/statements-97.67%25-brightgreen.svg) ![Branches](https://img.shields.io/badge/branches-86.2%25-yellow.svg) ![Functions](https://img.shields.io/badge/functions-88%25-yellow.svg) ![Lines](https://img.shields.io/badge/lines-97.67%25-brightgreen.svg) | ||
![Statements](https://img.shields.io/badge/statements-97.7%25-brightgreen.svg?style=flat) ![Branches](https://img.shields.io/badge/branches-86.66%25-yellow.svg?style=flat) ![Functions](https://img.shields.io/badge/functions-88.46%25-yellow.svg?style=flat) ![Lines](https://img.shields.io/badge/lines-97.7%25-brightgreen.svg?style=flat) | ||
@@ -20,2 +20,5 @@ # \<lite-youtube\> | ||
- Loads placeholder image as WebP with a Jpeg fallback | ||
- _new in v1.1_: Adds `nocookie` attr for use with use youtube-nocookie.com as iframe embed uri | ||
- _new in v1.2_: Adds `playlistid` for playlist loading interface support | ||
- _new in v1.3_: Adds `loading=lazy` to image placeholder for more perf with `posterloading` attr if you'd like to use eager | ||
@@ -46,3 +49,3 @@ ## Install | ||
```html | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.2.0/lite-youtube.js"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.3.0/lite-youtube.js"></script> | ||
``` | ||
@@ -129,2 +132,3 @@ | ||
| `posterquality`| Set thumbnail poster quality (maxresdefault, sddefault, mqdefault, hqdefault) | `hqdefault` | | ||
| `posterloading`| Set img lazy load attr `loading` for poster image | `lazy` | | ||
| `nocookie` | Use youtube-nocookie.com as iframe embed uri | `false` | | ||
@@ -131,0 +135,0 @@ | `autoload` | Use Intersection Observer to load iframe when scrolled into view | `false` | |
Sorry, the diff of this file is not supported yet
41577
414
142