images now work for mastodon boosts
This commit is contained in:
parent
bd6ad4a0aa
commit
f838a1c18e
2 changed files with 19 additions and 8 deletions
|
@ -48,14 +48,19 @@ async function GetPost() {
|
||||||
if (post.reblog != null) {
|
if (post.reblog != null) {
|
||||||
document.getElementsByClassName("PostText")[0].innerHTML = post.reblog.content;
|
document.getElementsByClassName("PostText")[0].innerHTML = post.reblog.content;
|
||||||
document.getElementsByClassName("Handle")[0].innerHTML = post.reblog.account.username + " ( R: " + post.account.username + " )";
|
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 {
|
} else {
|
||||||
document.getElementsByClassName("PostText")[0].innerHTML = post.content;
|
document.getElementsByClassName("PostText")[0].innerHTML = post.content;
|
||||||
document.getElementsByClassName("Handle")[0].innerHTML = post.account.username;
|
document.getElementsByClassName("Handle")[0].innerHTML = post.account.username;
|
||||||
}
|
|
||||||
// Show the image if it exists.
|
// Show the image if it exists.
|
||||||
if (post.media_attachments.length != 0) {
|
if (post.media_attachments.length != 0) {
|
||||||
for (let i of post.media_attachments) {
|
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 + "'/>";
|
document.getElementsByClassName("Images")[0].innerHTML += "<img src=" + i.remote_url + " alt='" + i.description + "'/>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update the post to see if there is new information.
|
// Update the post to see if there is new information.
|
||||||
|
|
|
@ -195,10 +195,16 @@ async function PosterContainerUpdate(Direction) {
|
||||||
let TempFeed = await MastodonAPI.GetTimeline(MastodonLoadedFeed[CurrentThing + counter - 1].id);
|
let TempFeed = await MastodonAPI.GetTimeline(MastodonLoadedFeed[CurrentThing + counter - 1].id);
|
||||||
MastodonLoadedFeed = MastodonLoadedFeed.concat(TempFeed);
|
MastodonLoadedFeed = MastodonLoadedFeed.concat(TempFeed);
|
||||||
}
|
}
|
||||||
// Check for images.
|
// 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) {
|
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
|
||||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Content warning. Don't show the content unless clicked!!!
|
// Content warning. Don't show the content unless clicked!!!
|
||||||
if (MastodonLoadedFeed[CurrentThing + counter].spoiler_text != "") {
|
if (MastodonLoadedFeed[CurrentThing + counter].spoiler_text != "") {
|
||||||
i.getElementsByClassName("PostContent")[0].innerHTML += "<b>WARNING: " + MastodonLoadedFeed[CurrentThing + counter].spoiler_text + "</b>";
|
i.getElementsByClassName("PostContent")[0].innerHTML += "<b>WARNING: " + MastodonLoadedFeed[CurrentThing + counter].spoiler_text + "</b>";
|
||||||
|
|
Loading…
Add table
Reference in a new issue