diff --git a/src/HTTP/JS/expanded.js b/src/HTTP/JS/expanded.js index fc0d0fc..6df7125 100644 --- a/src/HTTP/JS/expanded.js +++ b/src/HTTP/JS/expanded.js @@ -111,26 +111,18 @@ async function GetPost() { } // Now time to see if there are any parents let NumberOfThreads = 0; - if (post.in_reply_to_id != null) { - let TemporaryPost = await MastodonReplylFunction(NumberOfThreads, post.in_reply_to_id); + let TemporaryPost = post; + while (TemporaryPost.in_reply_to_id != null) { + TemporaryPost = await MastodonReplylFunction(NumberOfThreads, TemporaryPost.in_reply_to_id); ThreadedPost.push(TemporaryPost); - NumberOfThreads += 1; - // Now time to see if there are any grandparents - while (TemporaryPost.in_reply_to_id != null) { - TemporaryPost = await MastodonReplylFunction(NumberOfThreads, TemporaryPost.in_reply_to_id); - ThreadedPost.push(TemporaryPost); - NumberOfThreads += 1; - } - } - // Any replies? Give them the thing :3 - let TempID = 0; - while (TempID != (NumberOfThreads - 1)) { + // Any replies? Give them the thing :3 for (let i of document.getElementsByClassName(NumberOfThreads)) { + let TempID = NumberOfThreads; i.onclick = (event) => { SetThreadPost(ThreadedPost[TempID], i); } } - TempID += 1; + NumberOfThreads += 1; } } else if (website == "Bluesky") { // Check for a reblog.