mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-28 07:19:11 +08:00
16 lines
604 B
JavaScript
Vendored
16 lines
604 B
JavaScript
Vendored
export default function getVideoAttributes(cooked) {
|
|
if (!cooked.classList.contains("lazy-video-container")) {
|
|
return {};
|
|
}
|
|
|
|
const url = cooked.querySelector("a")?.getAttribute("href");
|
|
const img = cooked.querySelector("img");
|
|
const thumbnail = img?.getAttribute("src");
|
|
const dominantColor = img?.dataset?.dominantColor;
|
|
const title = cooked.dataset.videoTitle;
|
|
const startTime = cooked.dataset.videoStartTime;
|
|
const providerName = cooked.dataset.providerName;
|
|
const id = cooked.dataset.videoId;
|
|
|
|
return { url, thumbnail, title, providerName, id, dominantColor, startTime };
|
|
}
|