videos now work on Bsky

This commit is contained in:
CatAClock 2025-05-12 19:01:50 -07:00
parent d82ca66d12
commit a1b27d7549
2 changed files with 13 additions and 5 deletions

View file

@ -80,10 +80,14 @@ async function GetPost() {
document.getElementsByClassName("Handle")[0].innerHTML = post.post.author.handle; document.getElementsByClassName("Handle")[0].innerHTML = post.post.author.handle;
} }
// Show the image if it exists. // Show the image if it exists.
if (post.post.record.hasOwnProperty("embed") && post.post.record.embed.$type == "app.bsky.embed.images") { if (post.post.record.hasOwnProperty("embed")) {
if (post.post.record.embed.$type == "app.bsky.embed.images") {
for (let i of post.post.embed.images) { for (let i of post.post.embed.images) {
document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "<img src=" + i.fullsize + " alt='" + i.alt + "'/>"; document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "<img src=" + i.fullsize + " alt='" + i.alt + "'/>";
} }
} else if (post.post.record.embed.$type == "app.bsky.embed.video") {
document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "<video controls src=" + i.fullsize + " alt='" + i.alt + "'></video>";
}
} }
// We don't need to update the post with new information. The repos are seperate. // We don't need to update the post with new information. The repos are seperate.
// Set the texts. It's opposite because "setting" causes it to switch. // Set the texts. It's opposite because "setting" causes it to switch.

View file

@ -241,8 +241,12 @@ async function PosterContainerUpdate(Direction) {
BlueskyLoadedFeed = CheckForDups(BlueskyLoadedFeed, BlueskyPostsDup, counter); BlueskyLoadedFeed = CheckForDups(BlueskyLoadedFeed, BlueskyPostsDup, counter);
BlueskyPostsDup.push(BlueskyLoadedFeed[counter].post.uri); BlueskyPostsDup.push(BlueskyLoadedFeed[counter].post.uri);
// Check for an image // Check for an image
if (BlueskyLoadedFeed[CurrentThing + counter].post.record.hasOwnProperty("embed") && BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.images") { if (BlueskyLoadedFeed[CurrentThing + counter].post.record.hasOwnProperty("embed")) {
if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.images") {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>"; i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.video") {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!<br/>";
}
} }
// Labels // Labels
if (BlueskyLoadedFeed[CurrentThing + counter].post.labels.length != 0) { if (BlueskyLoadedFeed[CurrentThing + counter].post.labels.length != 0) {