Add Youtube embeds

This will embed a youtube video inline on the page. Hopefully it works!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-29 19:59:10 -07:00
parent b7cc4c5681
commit b84ca6d84f
4 changed files with 56 additions and 3 deletions

View File

@@ -345,6 +345,27 @@ $(window).on("load", () => {
$(e.target).attr("src", thumbUrl);
}
});
$(".youtube_embed_link").on("click", (e) => {
e.preventDefault();
let fullEnt = $(e.target).parents(".youtube_embed");
let frame = fullEnt.find(".youtube_embed_frame");
if (frame.length) {
frame.remove();
} else {
let hash = $(e.target).attr("data-yt-hash");
let embed = $("<span>")
.attr("class", "youtube_embed_frame")
.append("<br/>")
.append(
$("<iframe>")
.attr("src", "https://www.youtube.com/embed/" + hash)
.attr("frameborder", "0")
.attr("allow", "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture")
);
fullEnt.find(".youtube_embed_container").append(embed);
}
});
});
// Load event that actually does stuff

View File

@@ -169,6 +169,9 @@ th {
right: 0px;
}
/* Youtube embeds */
/* Spoilers */
.spoiler {