let's do bsky now

This commit is contained in:
CatAClock 2025-07-16 19:11:18 -07:00
parent b7efe26143
commit 12ecdce421

View file

@ -154,10 +154,10 @@ async function GetPost() {
SetBoost(); SetBoost();
// Now time to see if there are any parents. // Now time to see if there are any parents.
if (post.hasOwnProperty("reply")) { if (post.hasOwnProperty("reply")) {
Parentpost = await BlueskyReplyFunction("Parent", post.reply.parent, post.reply.parent.author); Parentpost = await BlueskyReplyFunction("0", post.reply.parent, post.reply.parent.author);
// Now time to see if there are any grandparents. // Now time to see if there are any grandparents.
if (Parentpost.value.hasOwnProperty("reply")) { if (Parentpost.value.hasOwnProperty("reply")) {
GrandParentpost = await BlueskyReplyFunction("GrandParent", Parentpost.value.reply.parent, post.reply.grandparentAuthor); GrandParentpost = await BlueskyReplyFunction("1", Parentpost.value.reply.parent, post.reply.grandparentAuthor);
} }
} }
} else { } else {
@ -183,23 +183,23 @@ async function MastodonReplylFunction(Id, post) {
return OtherPost; return OtherPost;
} }
// TODO async function BlueskyReplyFunction(Id, post, OtherAuthor) {
async function BlueskyReplyFunction(ClassName, post, OtherAuthor) {
let OtherPost = await BlueskyAPI.GetRecord(post.uri.split("/")[2], post.uri.split("/")[3], post.uri.split("/")[4]); let OtherPost = await BlueskyAPI.GetRecord(post.uri.split("/")[2], post.uri.split("/")[3], post.uri.split("/")[4]);
document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website; console.log(OtherPost);
document.getElementsByClassName("Handle " + ClassName)[0].innerHTML = OtherAuthor.handle; let ShitHTML = "<header> <h1 class=\"Handle " + Id + "\"> " + OtherAuthor.handle + "</h1> <h2 class=\"Origin " + Id + "\"> " + website + "</h2> </header> <p class=\"PostText " + Id + "\"></p> <div class=\"Images " + Id + "\"></div> <hr/>";
document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin", ShitHTML);
Text = BlueskyAPI.ApplyFacets(OtherPost.value, OtherPost.value.text); Text = BlueskyAPI.ApplyFacets(OtherPost.value, OtherPost.value.text);
Text = Text.replace(/\r?\n|\r/g, "<br/>"); Text = Text.replace(/\r?\n|\r/g, "<br/>");
// Sensitive topic :3 // Sensitive topic :3
if (OtherPost.value.hasOwnProperty("labels") && OtherPost.value.labels.length != 0) { if (OtherPost.value.hasOwnProperty("labels") && OtherPost.value.labels.length != 0) {
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "LABELS APPLIED: "; document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "LABELS APPLIED: ";
for (let lab of OtherPost.value.labels.values) { for (let lab of OtherPost.value.labels.values) {
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML += lab.val + " "; document.getElementsByClassName("PostText " + Id)[0].innerHTML += lab.val + " ";
} }
} else { } else {
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = Text; document.getElementsByClassName("PostText " + Id)[0].innerHTML = Text;
if (OtherPost.value.hasOwnProperty("embed")) { if (OtherPost.value.hasOwnProperty("embed")) {
ApplyMedia(OtherPost.value.embed, document.getElementsByClassName("Images " + ClassName)[0], OtherAuthor.did); ApplyMedia(OtherPost.value.embed, document.getElementsByClassName("Images " + Id)[0], OtherAuthor.did);
} }
} }
return OtherPost; return OtherPost;