mm. Maybe?

This commit is contained in:
CatAClock 2025-07-16 12:35:38 -07:00
parent a88e4e625f
commit 9acc3c062c
2 changed files with 22 additions and 42 deletions

View file

@ -12,29 +12,13 @@
</head>
<body>
<!-- Grandparent is a reply post above the reply post above the regular, clicked post. -->
<header>
<h1 class="Handle GrandParent"></h1>
<h2 class="Origin GrandParent"></h2>
</header>
<p class="PostText GrandParent"></p>
<div class="Images GrandParent"></div>
<hr/>
<!-- Parent is a reply post above the regular, clicked post. -->
<header>
<h1 class="Handle Parent"></h1>
<h2 class="Origin Parent"></h2>
</header>
<p class="PostText Parent"></p>
<div class="Images Parent"></div>
<hr/>
<!-- The regular, clicked post. -->
<header>
<h1 class="Handle Regular"></h1>
<h2 class="Origin Regular"></h2>
<h1 class="Handle"></h1>
<h2 class="Origin"></h2>
</header>
<p class="PostText Regular"></p>
<div class="Images Regular"></div>
<p class="PostText"></p>
<div class="Images"></div>
<!-- Interactables. -->
<div style="display: flex;">
<p class="Favorite">Favorite!</p>

View file

@ -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, "<br/>");
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 = "<header> <h1 class=\"Handle\"> " + website + "</h1> <h1 class=\"Origin\"> " + OtherPost.account.acct + "</h1> </header> <p id=" + id + " class=\"PostText\"></p> <div id=" + id + " class=\"Images\"></div> <hr/>";
let ShitHTML = "<header> <h1 id=" + id + " class=\"Handle\"> " + website + "</h1> <h1 id=" + id + " class=\"Origin\"> " + OtherPost.account.acct + "</h1> </header> <p id=" + id + " class=\"PostText\"></p> <div id=" + id + " class=\"Images\"></div> <hr/>";
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;