mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 18:08:11 +08:00
Modernize and fix website build tooling deps and utilize JS type checking (#3348)
* Modernize and fix website build tooling deps and utilize JS type checking * Upgrade to the latest Node.js
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll("[data-youtube-embed]").forEach((placeholder) => {
|
||||
if (!(placeholder instanceof HTMLElement)) return;
|
||||
placeholder.addEventListener("click", () => {
|
||||
const videoId = placeholder.attributes["data-youtube-embed"].value;
|
||||
const timestamp = placeholder.attributes["data-youtube-timestamp"]?.value
|
||||
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>`;
|
||||
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(`\\`, "");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user