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>
|
<script language="JavaScript" type="text/javascript" src="https://kjur.github.io/jsrsasign/jsrsasign-latest-all-min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="margin: 0px; text-align: center;">
|
||||||
<header>
|
<header>
|
||||||
<h1>Account</h1>
|
<h1>Account</h1>
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<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>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<p class="Button" onclick="history.back();"><b>Back</b></p>
|
<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;
|
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")) {
|
for (let i of document.getElementsByClassName("Parent")) {
|
||||||
i.onclick = (event) => {
|
i.onclick = (event) => {
|
||||||
if (i.classList.contains("Handle")) {
|
|
||||||
window.location.href = "../../HTML/account.html";
|
|
||||||
} else {
|
|
||||||
SetThreadPost(Parentpost);
|
SetThreadPost(Parentpost);
|
||||||
|
if (i.classList.contains("Handle")) {
|
||||||
|
window.location.href = "../../HTML/account.html?website=" + website;
|
||||||
|
} else {
|
||||||
|
document.location.href = "./expanded.html?website=" + website;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i of document.getElementsByClassName("GrandParent")) {
|
for (let i of document.getElementsByClassName("GrandParent")) {
|
||||||
i.onclick = (event) => {
|
i.onclick = (event) => {
|
||||||
if (i.classList.contains("Handle")) {
|
|
||||||
window.location.href = "../../HTML/account.html";
|
|
||||||
} else {
|
|
||||||
SetThreadPost(GrandParentpost);
|
SetThreadPost(GrandParentpost);
|
||||||
|
if (i.classList.contains("Handle")) {
|
||||||
|
window.location.href = "../../HTML/account.html?website=" + website;
|
||||||
|
} else {
|
||||||
|
document.location.href = "./expanded.html?website=" + website;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +81,6 @@ async function SetThreadPost(element) {
|
||||||
element.post = Temp.posts[0];
|
element.post = Temp.posts[0];
|
||||||
localStorage.setItem("post", JSON.stringify(element));
|
localStorage.setItem("post", JSON.stringify(element));
|
||||||
}
|
}
|
||||||
document.location.href = "./expanded.html?website=" + website;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions and things.
|
// Functions and things.
|
||||||
|
@ -216,15 +224,15 @@ async function ApplyMedia(Media, Element, Author = undefined) {
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
if (Media.type == "image") {
|
if (Media.type == "image") {
|
||||||
if (Media.remote_url == null) {
|
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 {
|
} 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") {
|
} else if (Media.type == "video" || Media.type == "gifv") {
|
||||||
if (Media.remote_url == null) {
|
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 {
|
} 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") {
|
} else if (website == "Bluesky") {
|
||||||
|
@ -261,7 +269,7 @@ async function BlueskyBlobEmbed(Blob, Element, Author) {
|
||||||
for (let i of Blob.images) {
|
for (let i of Blob.images) {
|
||||||
var Blobby = await BlueskyAPI.GetBlob(Author, i.image.ref.$link);
|
var Blobby = await BlueskyAPI.GetBlob(Author, i.image.ref.$link);
|
||||||
var ObjectURL = URL.createObjectURL(Blobby);
|
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.
|
// Video embed.
|
||||||
} else if (Blob.$type == "app.bsky.embed.video") {
|
} else if (Blob.$type == "app.bsky.embed.video") {
|
||||||
|
|
Loading…
Add table
Reference in a new issue