diff --git a/src/HTTP/JS/expanded.js b/src/HTTP/JS/expanded.js index 8213bf1..c4c5705 100644 --- a/src/HTTP/JS/expanded.js +++ b/src/HTTP/JS/expanded.js @@ -109,7 +109,7 @@ async function GetPost() { ApplyMedia(i, document.getElementsByClassName("Images")[0]); } } - // Now time to see if there are any parents + // Now time to see if there are any parents. let NumberOfThreads = 0; let TemporaryPost = post; while (TemporaryPost.in_reply_to_id != null) { @@ -153,12 +153,19 @@ async function GetPost() { SetFavorite(); SetBoost(); // Now time to see if there are any parents. - if (post.hasOwnProperty("reply")) { - let TemporaryPost = await BlueskyReplyFunction("0", post.reply.parent, post.reply.parent.author); - // Now time to see if there are any grandparents. - if (TemporaryPost.value.hasOwnProperty("reply")) { - TemporaryPost = await BlueskyReplyFunction("1", TemporaryPost.value.reply.parent, post.reply.grandparentAuthor); + let NumberOfThreads = 0; + let TemporaryPost = post; + while (TemporaryPost.reply.parent != null) { + TemporaryPost = await BlueskyReplyFunction("0", TemporaryPost.reply.parent, TemporaryPost.reply.parent.author).posts[0]; + ThreadedPost.push(TemporaryPost); + // Any replies? Give them the thing :3 + for (let i of document.getElementsByClassName(NumberOfThreads)) { + let TempID = NumberOfThreads; + i.onclick = (event) => { + SetThreadPost(ThreadedPost[TempID], i); + } } + NumberOfThreads += 1; } } else { document.getElementsByClassName("PostText")[0].innerHTML = "Nothing to load.";