diff --git a/src/HTTP/HTML/expanded.html b/src/HTTP/HTML/expanded.html index df124eb..565ef3c 100644 --- a/src/HTTP/HTML/expanded.html +++ b/src/HTTP/HTML/expanded.html @@ -12,29 +12,13 @@ - -
-

-

-
-

-
-
- -
-

-

-
-

-
-
-

-

+

+

-

-
+

+

Favorite!

diff --git a/src/HTTP/JS/expanded.js b/src/HTTP/JS/expanded.js index 117cec0..c718ea4 100644 --- a/src/HTTP/JS/expanded.js +++ b/src/HTTP/JS/expanded.js @@ -72,19 +72,7 @@ for (let i of document.getElementsByClassName("Regular")) { } } -// Selecting other posts. -for (let i of document.getElementsByClassName("Parent")) { - i.onclick = (event) => { - SetThreadPost(Parentpost, i); - } -} - -for (let i of document.getElementsByClassName("GrandParent")) { - i.onclick = (event) => { - SetThreadPost(GrandParentpost, i); - } -} - +// Threads are the thing above the post you clicked. async function SetThreadPost(element, i) { if (website == "Mastodon") { localStorage.setItem("post", JSON.stringify(element)); @@ -103,12 +91,12 @@ async function SetThreadPost(element, i) { // Functions and things. async function GetPost() { if (website == "Mastodon") { - document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.acct; + document.getElementsByClassName("Handle")[0].innerHTML = post.account.acct; // Check for a reblog. if (post.reblog != null) { - document.getElementsByClassName("Handle Regular")[0].innerHTML += " ( R: " + post.reblog + " )"; + document.getElementsByClassName("Handle")[0].innerHTML += " ( R: " + post.reblog + " )"; } - document.getElementsByClassName("PostText Regular")[0].innerHTML = post.content; + document.getElementsByClassName("PostText")[0].innerHTML = post.content; // Set the texts. It's opposite because "setting" causes it to switch. post = await MastodonAPI.GetStatus(post.id); FavoriteFlipper = !(post.favourited); @@ -118,7 +106,7 @@ async function GetPost() { // Show the image if it exists. if (post.media_attachments.length != 0) { for (let i of post.media_attachments) { - ApplyMedia(i, document.getElementsByClassName("Images Regular")[0]); + ApplyMedia(i, document.getElementsByClassName("Images")[0]); } } // Now time to see if there are any parents @@ -134,21 +122,28 @@ async function GetPost() { NumberOfThreads += 1; } } + // Any replies? Give them the thing :3 + for (let i of document.getElementsByClassName("body").hasAttribute("id")) { + let TempID = i.getAttribute("id"); + i.onclick = (event) => { + SetThreadPost(ThreadedPost[TempID], i); + } + } } else if (website == "Bluesky") { // Check for a reblog. if (post.hasOwnProperty("reason") && post.reason.$type == "app.bsky.feed.defs#reasonRepost") { - document.getElementsByClassName("Handle Regular")[0].innerHTML = post.post.author.handle + " ( R: " + post.reason.by.handle + " )"; + document.getElementsByClassName("Handle")[0].innerHTML = post.post.author.handle + " ( R: " + post.reason.by.handle + " )"; } else { - document.getElementsByClassName("Handle Regular")[0].innerHTML = post.post.author.handle; + document.getElementsByClassName("Handle")[0].innerHTML = post.post.author.handle; } // Text. This will be modified later. var Text = await BlueskyAPI.ApplyFacets(post.post.record, post.post.record.text); // Place the text. Text = Text.replace(/\r?\n|\r/g, "
"); - document.getElementsByClassName("PostText Regular")[0].innerHTML = Text; + document.getElementsByClassName("PostText")[0].innerHTML = Text; // Show the image if it exists. if (post.post.record.hasOwnProperty("embed")) { - ApplyMedia(post.post.record.embed, document.getElementsByClassName("Images Regular")[0], post.post.author.did); + ApplyMedia(post.post.record.embed, document.getElementsByClassName("Images")[0], post.post.author.did); } // We don't need to update the post with new information. The repos are seperate. // Set the texts. It's opposite because "setting" causes it to switch. @@ -178,7 +173,7 @@ 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) { let OtherPost = await MastodonAPI.GetStatus(post); - let ShitHTML = "

" + website + "

" + OtherPost.account.acct + "


"; + let ShitHTML = "

" + website + "

" + OtherPost.account.acct + "


"; document.getElementsByTagName("body")[0] = ShitHTML + document.getElementsByTagName("body")[0].innerHTML; if (OtherPost.spoiler_text != "") { document.getElementsByClassName("PostText").getElementById(id).innerHTML = "WARNING: " + OtherPost.spoiler_text; @@ -193,6 +188,7 @@ async function MastodonReplylFunction(id, post) { return OtherPost; } +// TODO async function BlueskyReplyFunction(ClassName, post, OtherAuthor) { let OtherPost = await BlueskyAPI.GetRecord(post.uri.split("/")[2], post.uri.split("/")[3], post.uri.split("/")[4]); document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website;