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:
@@ -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
|
||||
|
||||
@@ -169,6 +169,9 @@ th {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
/* Youtube embeds */
|
||||
|
||||
|
||||
/* Spoilers */
|
||||
|
||||
.spoiler {
|
||||
|
||||
Reference in New Issue
Block a user