account stuff & regex fix
This commit is contained in:
parent
f135e8de98
commit
417c3be99c
3 changed files with 68 additions and 13 deletions
|
@ -11,12 +11,21 @@
|
|||
<script language="JavaScript" type="text/javascript" src="https://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="margin: 0px; text-align: center;">
|
||||
<header>
|
||||
<h1>Account</h1>
|
||||
</header>
|
||||
<div>
|
||||
<p>Currently in progress.</p>
|
||||
<h2 class="Account"></h2>
|
||||
<p class="AccountDescription"></p>
|
||||
<div class="Posts">
|
||||
<p>Not implemented. Posts should populate here.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p class="Button Follow">Follow</p>
|
||||
<p class="Button Block">Block</p>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<p class="Button" onclick="history.back();"><b>Back</b></p>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
import * as MastodonAPI from "./MastodonAPI.js";
|
||||
import * as BlueskyAPI from "./BlueskyAPI.js";
|
||||
import * as TumblrAPI from "./TumblrAPI.js";
|
||||
import * as Variables from "./Variables.js";
|
||||
|
||||
let website = document.location.href.split("website=")[1];
|
||||
let post = JSON.parse(localStorage.getItem("post"));
|
||||
|
||||
// HTML elements.
|
||||
let AccountName = document.getElementsByClassName("Account")[0];
|
||||
let AccountDescription = document.getElementsByClassName("AccountDescription");
|
||||
let FollowButton = document.getElementsByClassName("Follow")[0];
|
||||
let BlockButton = document.getElementsByClassName("Block")[0];
|
||||
|
||||
GetAccount();
|
||||
|
||||
FollowButton.onclick = (event) => {
|
||||
console.log("Does nothing so far.");
|
||||
}
|
||||
|
||||
BlockButton.onclick = (event) => {
|
||||
console.log("Does nothing so far.");
|
||||
}
|
||||
|
||||
async function GetAccount() {
|
||||
if (website == "Mastodon") {
|
||||
// Check for a reblog.
|
||||
if (post.reblog != null) {
|
||||
AccountName = post.reblog.account.username;
|
||||
AccountDescription = post.reblog.account.note;
|
||||
} else {
|
||||
AccountName = post.account.username;
|
||||
AccountDescription = post.account.note;
|
||||
}
|
||||
} else if (website == "Bluesky") {
|
||||
|
||||
}
|
||||
}
|
|
@ -43,23 +43,32 @@ Reply.onclick = (event) => {
|
|||
window.location.href = "../../HTML/post.html?website=" + website;
|
||||
}
|
||||
|
||||
// Seleecting other posts
|
||||
// Other post stuff.
|
||||
for (let i of document.getElementsByClassName("Regular")) {
|
||||
if (i.classList.contains("Handle")) {
|
||||
window.location.href = "../../HTML/account.html?website=" + website;
|
||||
}
|
||||
}
|
||||
|
||||
// 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";
|
||||
window.location.href = "../../HTML/account.html?website=" + website;
|
||||
} else {
|
||||
SetThreadPost(Parentpost);
|
||||
document.location.href = "./expanded.html?website=" + website;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i of document.getElementsByClassName("GrandParent")) {
|
||||
i.onclick = (event) => {
|
||||
SetThreadPost(GrandParentpost);
|
||||
if (i.classList.contains("Handle")) {
|
||||
window.location.href = "../../HTML/account.html";
|
||||
window.location.href = "../../HTML/account.html?website=" + website;
|
||||
} else {
|
||||
SetThreadPost(GrandParentpost);
|
||||
document.location.href = "./expanded.html?website=" + website;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +81,6 @@ async function SetThreadPost(element) {
|
|||
element.post = Temp.posts[0];
|
||||
localStorage.setItem("post", JSON.stringify(element));
|
||||
}
|
||||
document.location.href = "./expanded.html?website=" + website;
|
||||
}
|
||||
|
||||
// Functions and things.
|
||||
|
@ -216,15 +224,15 @@ async function ApplyMedia(Media, Element, Author = undefined) {
|
|||
if (website == "Mastodon") {
|
||||
if (Media.type == "image") {
|
||||
if (Media.remote_url == null) {
|
||||
Element.innerHTML += "<img src=" + Media.url + " alt='" + EscapeRegExp(Media.description) + "'/>";
|
||||
Element.innerHTML += "<img src=" + Media.url + " alt=\"" + EscapeRegExp(Media.description) + "\"/>";
|
||||
} else {
|
||||
Element.innerHTML += "<img src=" + Media.remote_url + " alt='" + EscapeRegExp(Media.description) + "'/>";
|
||||
Element.innerHTML += "<img src=" + Media.remote_url + " alt=\"" + EscapeRegExp(Media.description) + "\"/>";
|
||||
}
|
||||
} else if (Media.type == "video" || Media.type == "gifv") {
|
||||
if (Media.remote_url == null) {
|
||||
Element.innerHTML += "<video controls src=" + Media.url + " alt='" + EscapeRegExp(Media.description) + "'></video>";
|
||||
Element.innerHTML += "<video controls src=" + Media.url + " alt=\"" + EscapeRegExp(Media.description) + "\"></video>";
|
||||
} else {
|
||||
Element.innerHTML += "<video controls src=" + Media.remote_url + " alt='" + EscapeRegExp(Media.description) + "'></video>";
|
||||
Element.innerHTML += "<video controls src=" + Media.remote_url + " alt=\"" + EscapeRegExp(Media.description) + "\"></video>";
|
||||
}
|
||||
}
|
||||
} else if (website == "Bluesky") {
|
||||
|
@ -261,7 +269,7 @@ async function BlueskyBlobEmbed(Blob, Element, Author) {
|
|||
for (let i of Blob.images) {
|
||||
var Blobby = await BlueskyAPI.GetBlob(Author, i.image.ref.$link);
|
||||
var ObjectURL = URL.createObjectURL(Blobby);
|
||||
Element.innerHTML += "<img src=" + ObjectURL + " alt='" + EscapeRegExp(i.alt) + "'/>";
|
||||
Element.innerHTML += "<img src=" + ObjectURL + " alt=\"" + EscapeRegExp(i.alt) + "\"/>";
|
||||
}
|
||||
// Video embed.
|
||||
} else if (Blob.$type == "app.bsky.embed.video") {
|
||||
|
|
Loading…
Add table
Reference in a new issue