diff --git a/JS/expanded.js b/JS/expanded.js
index 3aa028e..8f7b69c 100644
--- a/JS/expanded.js
+++ b/JS/expanded.js
@@ -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 += "
";
+ 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 += "
";
+ 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 += "
";
+ } else {
+ document.getElementsByClassName("Images")[0].innerHTML += "
";
+ }
+ } else if (Media.type == "video") {
+ if (Media.remote_url == null) {
+ document.getElementsByClassName("Images")[0].innerHTML += "";
+ } else {
+ document.getElementsByClassName("Images")[0].innerHTML += "";
+ }
+ }
+}
+
function SetFavorite() {
FavoriteFlipper = !(FavoriteFlipper);
if (FavoriteFlipper == false) {
diff --git a/JS/index.js b/JS/index.js
index a317e0a..e8e962d 100644
--- a/JS/index.js
+++ b/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!
";
+ if (MastodonLoadedFeed[CurrentThing + counter].reblog.media_attachments[0].type == "image") {
+ i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!
";
+ } else if (MastodonLoadedFeed[CurrentThing + counter].reblog.media_attachments[0].type == "video") {
+ i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!
";
+ }
}
} else {
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
- i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!
";
+ if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "image") {
+ i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!
";
+ } else if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "video") {
+ i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!
";
+ }
}
}
// Content warning. Don't show the content unless clicked!!!