diff --git a/src/HTTP/JS/MastodonAPI.js b/src/HTTP/JS/MastodonAPI.js
index 0680fc4..b950692 100644
--- a/src/HTTP/JS/MastodonAPI.js
+++ b/src/HTTP/JS/MastodonAPI.js
@@ -93,6 +93,14 @@ export async function GetStatus(ID) {
.then((response) => response.json());
}
+export async function GetContexts(ID) {
+ if (Token == null || TokenType == null) {
+ return "";
+ }
+ return await fetch(localStorage.getItem(Variables.MastodonWebsite) + "/api/v1/statuses/" + ID + "/context", {method: "GET", headers: {"Authorization": TokenType + " " + Token}})
+ .then((response) => response.json());
+}
+
// Get your own account by verifying your credentials.
export async function GetOwnAccount() {
if (Token == null || TokenType == null) {
diff --git a/src/HTTP/JS/expanded.js b/src/HTTP/JS/expanded.js
index 5325dfb..801fa97 100644
--- a/src/HTTP/JS/expanded.js
+++ b/src/HTTP/JS/expanded.js
@@ -114,9 +114,9 @@ async function GetPost() {
let NumberOfThreads = 0;
let TemporaryPost = post;
while (TemporaryPost.in_reply_to_id != null) {
- TemporaryPost = await MastodonReplylFunction(NumberOfThreads, TemporaryPost.in_reply_to_id);
+ TemporaryPost = await MastodonThreadFunction(NumberOfThreads, TemporaryPost.in_reply_to_id);
ThreadedPost.push(TemporaryPost);
- // Any replies? Give them the thing :3
+ // Any posts? Give them the thing :3
for (let i of document.getElementsByClassName(NumberOfThreads)) {
let TempID = NumberOfThreads;
i.onclick = (event) => {
@@ -125,6 +125,20 @@ async function GetPost() {
}
NumberOfThreads += 1;
}
+ // Replies, anyone?
+ let Context = await GetContexts(post.id);
+ for (let i of Context.descendants) {
+ TemporaryPost = await MastodonReplyFunction(NumberOfThreads, i);
+ ThreadedPost.push(TemporaryPost);
+ // Any posts? Give them the thing :3
+ for (let j of document.getElementsByClassName(NumberOfThreads)) {
+ let TempID = NumberOfThreads;
+ j.onclick = (event) => {
+ SetThreadPost(ThreadedPost[TempID], j);
+ }
+ }
+ NumberOfThreads += 1;
+ }
} else if (website == "Bluesky") {
// Check for a reblog.
if (post.hasOwnProperty("reason") && post.reason.$type == "app.bsky.feed.defs#reasonRepost") {
@@ -157,9 +171,9 @@ async function GetPost() {
let NumberOfThreads = 0;
let TemporaryPost = post;
while (TemporaryPost.hasOwnProperty("reply")) {
- TemporaryPost = await BlueskyReplyFunction(NumberOfThreads, TemporaryPost.reply.parent);
+ TemporaryPost = await BlueskyThreadFunction(NumberOfThreads, TemporaryPost.reply.parent);
ThreadedPost.push(TemporaryPost);
- // Any replies? Give them the thing :3
+ // Any posts? Give them the thing :3
for (let i of document.getElementsByClassName(NumberOfThreads)) {
let TempID = NumberOfThreads;
i.onclick = (event) => {
@@ -173,8 +187,8 @@ async function GetPost() {
}
}
-// Because of repeat code, we can put it into it's own function. Hell, more of a thread can be added later.
-async function MastodonReplylFunction(Id, post) {
+// Because of repeat code, we can put it into it's own function. It grabs posts "above" it.
+async function MastodonThreadFunction(Id, post) {
let OtherPost = await MastodonAPI.GetStatus(post);
let ShitHTML = " " + OtherPost.account.acct + "
" + website + "