Files
Graphite/website/static/js/component/youtube-embed.js
Keavon Chambers 7af60e02a3 Add the auto-generated node catalog to the website's user manual (#3662)
* Generate the MVP node catalog in the manual (with some placeholders)

* Implement nearly the rest of everything

* Move to the tools directory and make it generate nicer default values

* Add category descriptions

* Organize file structure and improve type naming

* Improve book table of contents code

* Add collapsing chapter navigation to the book template

* Add to build workflow

* Clean up site structure
2026-01-20 22:52:03 -08:00

25 lines
857 B
JavaScript

window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-youtube-embed]").forEach((placeholder) => {
if (!(placeholder instanceof HTMLElement)) return;
placeholder.addEventListener("click", () => {
const videoId = placeholder.getAttribute("data-youtube-embed") || "";
const timestamp = placeholder.getAttribute("data-youtube-timestamp") || "";
placeholder.outerHTML = `
<iframe \\
width="1280" \\
height="720" \\
src="https://www.youtube.com/embed/${videoId}?${timestamp ? `start=${timestamp}&` : ""}autoplay=1" \\
frameborder="0" \\
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" \\
allowfullscreen\\
>\\
</iframe>\\
`
.split("\n")
.map((line) => line.trim())
.join("")
.replaceAll(`\\`, "");
});
});
});