From a1b27d7549d5d2b3c53533a0f7dc429f339466bb Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 12 May 2025 19:01:50 -0700 Subject: [PATCH] videos now work on Bsky --- JS/expanded.js | 10 +++++++--- JS/index.js | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/JS/expanded.js b/JS/expanded.js index 8f7b69c..7354656 100644 --- a/JS/expanded.js +++ b/JS/expanded.js @@ -80,9 +80,13 @@ async function GetPost() { document.getElementsByClassName("Handle")[0].innerHTML = post.post.author.handle; } // Show the image if it exists. - if (post.post.record.hasOwnProperty("embed") && post.post.record.embed.$type == "app.bsky.embed.images") { - for (let i of post.post.embed.images) { - document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "" + i.alt + ""; + if (post.post.record.hasOwnProperty("embed")) { + if (post.post.record.embed.$type == "app.bsky.embed.images") { + for (let i of post.post.embed.images) { + document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "" + i.alt + ""; + } + } else if (post.post.record.embed.$type == "app.bsky.embed.video") { + document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + ""; } } // We don't need to update the post with new information. The repos are seperate. diff --git a/JS/index.js b/JS/index.js index e8e962d..21b84a6 100644 --- a/JS/index.js +++ b/JS/index.js @@ -241,8 +241,12 @@ async function PosterContainerUpdate(Direction) { BlueskyLoadedFeed = CheckForDups(BlueskyLoadedFeed, BlueskyPostsDup, counter); BlueskyPostsDup.push(BlueskyLoadedFeed[counter].post.uri); // Check for an image - if (BlueskyLoadedFeed[CurrentThing + counter].post.record.hasOwnProperty("embed") && BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.images") { - i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!
"; + 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!
"; + } else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.video") { + i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!
"; + } } // Labels if (BlueskyLoadedFeed[CurrentThing + counter].post.labels.length != 0) {