diff --git a/JS/expanded.js b/JS/expanded.js index 1d0900e..63cee9d 100644 --- a/JS/expanded.js +++ b/JS/expanded.js @@ -55,34 +55,29 @@ for (let i of document.getElementsByClassName("Regular")) { // Selecting other posts. for (let i of document.getElementsByClassName("Parent")) { i.onclick = (event) => { - SetThreadPost(Parentpost); - if (i.classList.contains("Handle")) { - window.location.href = "../../HTML/account.html?website=" + website; - } else { - document.location.href = "./expanded.html?website=" + website; - } + SetThreadPost(Parentpost, i); } } for (let i of document.getElementsByClassName("GrandParent")) { i.onclick = (event) => { - SetThreadPost(GrandParentpost); - if (i.classList.contains("Handle")) { - window.location.href = "../../HTML/account.html?website=" + website; - } else { - document.location.href = "./expanded.html?website=" + website; - } + SetThreadPost(GrandParentpost, i); } } -async function SetThreadPost(element) { +async function SetThreadPost(element, i) { if (website == "Mastodon") { - localStorage.setItem("post", JSON.stringify(element)); - } else if (website == "Bluesky") { - let Temp = await BlueskyAPI.GetPosts(element.uri); - element.post = Temp.posts[0]; - localStorage.setItem("post", JSON.stringify(element)); - } + localStorage.setItem("post", JSON.stringify(element)); + } else if (website == "Bluesky") { + let Temp = await BlueskyAPI.GetPosts(element.uri); + element.post = Temp.posts[0]; + localStorage.setItem("post", JSON.stringify(element)); + } + if (i.classList.contains("Handle")) { + window.location.href = "../../HTML/account.html?website=" + website; + } else { + document.location.href = "./expanded.html?website=" + website; + } } // Functions and things.