images now work for mastodon boosts

This commit is contained in:
CatAClock 2025-05-11 20:02:04 -07:00
parent bd6ad4a0aa
commit f838a1c18e
2 changed files with 19 additions and 8 deletions

View file

@ -48,14 +48,19 @@ async function GetPost() {
if (post.reblog != null) {
document.getElementsByClassName("PostText")[0].innerHTML = post.reblog.content;
document.getElementsByClassName("Handle")[0].innerHTML = post.reblog.account.username + " ( R: " + post.account.username + " )";
if (post.reblog.media_attachments.length != 0) {
for (let i of post.reblog.media_attachments) {
document.getElementsByClassName("Images")[0].innerHTML += "<img src=" + i.remote_url + " alt='" + i.description + "'/>";
}
}
} else {
document.getElementsByClassName("PostText")[0].innerHTML = post.content;
document.getElementsByClassName("Handle")[0].innerHTML = post.account.username;
}
// Show the image if it exists.
if (post.media_attachments.length != 0) {
for (let i of post.media_attachments) {
document.getElementsByClassName("Images")[0].innerHTML = document.getElementsByClassName("Images")[0].innerHTML + "<img src=" + i.remote_url + " alt='" + i.description + "'/>";
// Show the image if it exists.
if (post.media_attachments.length != 0) {
for (let i of post.media_attachments) {
document.getElementsByClassName("Images")[0].innerHTML += "<img src=" + i.remote_url + " alt='" + i.description + "'/>";
}
}
}
// Update the post to see if there is new information.

View file

@ -195,9 +195,15 @@ async function PosterContainerUpdate(Direction) {
let TempFeed = await MastodonAPI.GetTimeline(MastodonLoadedFeed[CurrentThing + counter - 1].id);
MastodonLoadedFeed = MastodonLoadedFeed.concat(TempFeed);
}
// Check for images.
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
// Check for images. Reblog roundabout fix included.
if (MastodonLoadedFeed[CurrentThing + counter].reblog != null) {
if (MastodonLoadedFeed[CurrentThing + counter].reblog.media_attachments.length != 0) {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
}
} else {
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
}
}
// Content warning. Don't show the content unless clicked!!!
if (MastodonLoadedFeed[CurrentThing + counter].spoiler_text != "") {