test this later idk
This commit is contained in:
parent
9e1c507a8a
commit
a88e4e625f
1 changed files with 15 additions and 11 deletions
|
@ -16,8 +16,7 @@ let Boostable = false;
|
||||||
// Variables
|
// Variables
|
||||||
let website = document.location.href.split("website=")[1];
|
let website = document.location.href.split("website=")[1];
|
||||||
let post = JSON.parse(localStorage.getItem("post"));
|
let post = JSON.parse(localStorage.getItem("post"));
|
||||||
let Parentpost;
|
let ThreadedPost = [];
|
||||||
let GrandParentpost;
|
|
||||||
|
|
||||||
document.getElementsByClassName("Origin Regular")[0].innerHTML = website;
|
document.getElementsByClassName("Origin Regular")[0].innerHTML = website;
|
||||||
GetPost();
|
GetPost();
|
||||||
|
@ -123,11 +122,16 @@ async function GetPost() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now time to see if there are any parents
|
// Now time to see if there are any parents
|
||||||
|
let NumberOfThreads = 0;
|
||||||
if (post.in_reply_to_id != null) {
|
if (post.in_reply_to_id != null) {
|
||||||
Parentpost = await MastodonReplylFunction("Parent", post.in_reply_to_id);
|
let TemporaryPost = await MastodonReplylFunction(NumberOfThreads, post.in_reply_to_id);
|
||||||
|
ThreadedPost.push(TemporaryPost);
|
||||||
|
NumberOfThreads += 1;
|
||||||
// Now time to see if there are any grandparents
|
// Now time to see if there are any grandparents
|
||||||
if (Parentpost != undefined && Parentpost.in_reply_to_id != null) {
|
while (TemporaryPost.in_reply_to_id != null) {
|
||||||
GrandParentpost = await MastodonReplylFunction("GrandParent", Parentpost.in_reply_to_id);
|
TemporaryPost = await MastodonReplylFunction(NumberOfThreads, TemporaryPost.in_reply_to_id);
|
||||||
|
ThreadedPost.push(TemporaryPost);
|
||||||
|
NumberOfThreads += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (website == "Bluesky") {
|
} else if (website == "Bluesky") {
|
||||||
|
@ -172,17 +176,17 @@ 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.
|
// 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(ClassName, post) {
|
async function MastodonReplylFunction(id, post) {
|
||||||
let OtherPost = await MastodonAPI.GetStatus(post);
|
let OtherPost = await MastodonAPI.GetStatus(post);
|
||||||
document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website;
|
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/>";
|
||||||
document.getElementsByClassName("Handle " + ClassName)[0].innerHTML = OtherPost.account.acct;
|
document.getElementsByTagName("body")[0] = ShitHTML + document.getElementsByTagName("body")[0].innerHTML;
|
||||||
if (OtherPost.spoiler_text != "") {
|
if (OtherPost.spoiler_text != "") {
|
||||||
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
document.getElementsByClassName("PostText").getElementById(id).innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
||||||
} else {
|
} else {
|
||||||
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = OtherPost.content;
|
document.getElementsByClassName("PostText").getElementById(id).innerHTML = OtherPost.content;
|
||||||
if (OtherPost.media_attachments.length != 0) {
|
if (OtherPost.media_attachments.length != 0) {
|
||||||
for (let i of OtherPost.media_attachments) {
|
for (let i of OtherPost.media_attachments) {
|
||||||
ApplyMedia(i, document.getElementsByClassName("Images " + ClassName)[0]);
|
ApplyMedia(i, document.getElementsByClassName("Images").getElementById(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue