Fixed image bugs, Mastodon video
This commit is contained in:
parent
f838a1c18e
commit
fd96902e77
2 changed files with 29 additions and 4 deletions
|
@ -50,7 +50,7 @@ async function GetPost() {
|
|||
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 + "'/>";
|
||||
CreateMedia(i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -59,7 +59,7 @@ async function GetPost() {
|
|||
// 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 + "'/>";
|
||||
CreateMedia(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,23 @@ async function GetPost() {
|
|||
}
|
||||
}
|
||||
|
||||
function CreateMedia(Media) {
|
||||
// Check to see if the image is on the same server.
|
||||
if (Media.type == "image") {
|
||||
if (Media.remote_url == null) {
|
||||
document.getElementsByClassName("Images")[0].innerHTML += "<img src=" + Media.url + " alt='" + Media.description + "'/>";
|
||||
} else {
|
||||
document.getElementsByClassName("Images")[0].innerHTML += "<img src=" + Media.remote_url + " alt='" + Media.description + "'/>";
|
||||
}
|
||||
} else if (Media.type == "video") {
|
||||
if (Media.remote_url == null) {
|
||||
document.getElementsByClassName("Images")[0].innerHTML += "<video controls src=" + Media.url + " alt='" + Media.description + "'></video>";
|
||||
} else {
|
||||
document.getElementsByClassName("Images")[0].innerHTML += "<video controls src=" + Media.remote_url + " alt='" + Media.description + "'></video>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetFavorite() {
|
||||
FavoriteFlipper = !(FavoriteFlipper);
|
||||
if (FavoriteFlipper == false) {
|
||||
|
|
12
JS/index.js
12
JS/index.js
|
@ -198,11 +198,19 @@ async function PosterContainerUpdate(Direction) {
|
|||
// 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/>";
|
||||
if (MastodonLoadedFeed[CurrentThing + counter].reblog.media_attachments[0].type == "image") {
|
||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
||||
} else if (MastodonLoadedFeed[CurrentThing + counter].reblog.media_attachments[0].type == "video") {
|
||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!<br/>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
|
||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
||||
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "image") {
|
||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
||||
} else if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "video") {
|
||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Content warning. Don't show the content unless clicked!!!
|
||||
|
|
Loading…
Add table
Reference in a new issue