mm. Maybe?
This commit is contained in:
parent
a88e4e625f
commit
9acc3c062c
2 changed files with 22 additions and 42 deletions
|
@ -12,29 +12,13 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<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. -->
|
<!-- The regular, clicked post. -->
|
||||||
<header>
|
<header>
|
||||||
<h1 class="Handle Regular"></h1>
|
<h1 class="Handle"></h1>
|
||||||
<h2 class="Origin Regular"></h2>
|
<h2 class="Origin"></h2>
|
||||||
</header>
|
</header>
|
||||||
<p class="PostText Regular"></p>
|
<p class="PostText"></p>
|
||||||
<div class="Images Regular"></div>
|
<div class="Images"></div>
|
||||||
<!-- Interactables. -->
|
<!-- Interactables. -->
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<p class="Favorite">Favorite!</p>
|
<p class="Favorite">Favorite!</p>
|
||||||
|
|
|
@ -72,19 +72,7 @@ for (let i of document.getElementsByClassName("Regular")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selecting other posts.
|
// Threads are the thing above the post you clicked.
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function SetThreadPost(element, i) {
|
async function SetThreadPost(element, i) {
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
localStorage.setItem("post", JSON.stringify(element));
|
localStorage.setItem("post", JSON.stringify(element));
|
||||||
|
@ -103,12 +91,12 @@ async function SetThreadPost(element, i) {
|
||||||
// Functions and things.
|
// Functions and things.
|
||||||
async function GetPost() {
|
async function GetPost() {
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.acct;
|
document.getElementsByClassName("Handle")[0].innerHTML = post.account.acct;
|
||||||
// Check for a reblog.
|
// Check for a reblog.
|
||||||
if (post.reblog != null) {
|
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.
|
// Set the texts. It's opposite because "setting" causes it to switch.
|
||||||
post = await MastodonAPI.GetStatus(post.id);
|
post = await MastodonAPI.GetStatus(post.id);
|
||||||
FavoriteFlipper = !(post.favourited);
|
FavoriteFlipper = !(post.favourited);
|
||||||
|
@ -118,7 +106,7 @@ async function GetPost() {
|
||||||
// Show the image if it exists.
|
// Show the image if it exists.
|
||||||
if (post.media_attachments.length != 0) {
|
if (post.media_attachments.length != 0) {
|
||||||
for (let i of post.media_attachments) {
|
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
|
// Now time to see if there are any parents
|
||||||
|
@ -134,21 +122,28 @@ async function GetPost() {
|
||||||
NumberOfThreads += 1;
|
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") {
|
} else if (website == "Bluesky") {
|
||||||
// Check for a reblog.
|
// Check for a reblog.
|
||||||
if (post.hasOwnProperty("reason") && post.reason.$type == "app.bsky.feed.defs#reasonRepost") {
|
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 {
|
} 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.
|
// Text. This will be modified later.
|
||||||
var Text = await BlueskyAPI.ApplyFacets(post.post.record, post.post.record.text);
|
var Text = await BlueskyAPI.ApplyFacets(post.post.record, post.post.record.text);
|
||||||
// Place the text.
|
// Place the text.
|
||||||
Text = Text.replace(/\r?\n|\r/g, "<br/>");
|
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.
|
// Show the image if it exists.
|
||||||
if (post.post.record.hasOwnProperty("embed")) {
|
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.
|
// 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.
|
// 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.
|
// 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) {
|
async function MastodonReplylFunction(id, post) {
|
||||||
let OtherPost = await MastodonAPI.GetStatus(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;
|
document.getElementsByTagName("body")[0] = ShitHTML + document.getElementsByTagName("body")[0].innerHTML;
|
||||||
if (OtherPost.spoiler_text != "") {
|
if (OtherPost.spoiler_text != "") {
|
||||||
document.getElementsByClassName("PostText").getElementById(id).innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
document.getElementsByClassName("PostText").getElementById(id).innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
||||||
|
@ -193,6 +188,7 @@ async function MastodonReplylFunction(id, post) {
|
||||||
return OtherPost;
|
return OtherPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
async function BlueskyReplyFunction(ClassName, 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;
|
document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website;
|
||||||
|
|
Loading…
Add table
Reference in a new issue