V1.0.1 #63

Merged
CatAClock merged 14 commits from PostReleaseChanges into main 2025-06-29 02:26:42 +00:00
8 changed files with 81 additions and 34 deletions

View file

@ -2,6 +2,10 @@ html {
background: linear-gradient(to right, #00FFFF, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #00FFFF);
}
h2 {
word-wrap: break-word;
}
.Button {
margin-top: 30px;

View file

@ -23,6 +23,8 @@ body {
/* Classes */
.Handle {
background-color: white;
word-wrap: break-word;
}
.Origin {

View file

@ -180,6 +180,13 @@ html {
top: 35vh;
}
audio {
position: absolute;
z-index=1;
width: max(60px, 10%);
}
.PostContainer {
position: absolute;
display: flex;
@ -224,6 +231,8 @@ html {
font-size: min(2vw, 2ch);
margin-top: max(-5px, -0.5vw);
word-wrap: break-word;
}
.PostContent {

View file

@ -349,14 +349,17 @@ export function ApplyFacets(record, text) {
SplitAreas.push(i.index.byteStart);
SplitAreas.push(i.index.byteEnd);
Hrefs.push(i.features[0].uri);
Hrefs.push("");
}
if (i.features[0].$type == "app.bsky.richtext.facet#tag") {
SplitAreas.push(i.index.byteStart);
SplitAreas.push(i.index.byteEnd);
Hrefs.push("https://bsky.app/hashtag/" + i.features[0].tag);
}
}
// Last minute append.
SplitAreas.push(text.length);
// Remove emoji regex
let EmojiRegex = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu;
let EmojiObjects = text.match(EmojiRegex);
let EmojiObjects = text.match(/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu);
let SubtractNumber = 0;
if (EmojiObjects != null) {
SubtractNumber = EmojiObjects.length * 2;
@ -366,8 +369,12 @@ export function ApplyFacets(record, text) {
StringArray.push(text.slice(SplitAreas[i - 1] - SubtractNumber, SplitAreas[i] - SubtractNumber));
}
// Finally, we append the string with <a>
for (let i = 1; i < StringArray.length; i += 2) {
TempText += StringArray[i - 1] + "<a href='" + Hrefs[i - 1] + "'>" + StringArray[i] + "</a>";
for (let i = 0; i < StringArray.length; i += 2) {
if (Hrefs[(i / 2)] != undefined && Hrefs[(i / 2)].split("https://").length != 1) {
TempText += StringArray[i] + "<a href=\"" + Hrefs[(i / 2)] + "\">" + StringArray[i + 1] + "</a>";
} else {
TempText += StringArray[i];
}
}
}
if (TempText == "") {

View file

@ -86,7 +86,7 @@ async function GetAccount() {
Blocking = !(Relations[0].blocking);
SetFollow();
SetBlock();
AccountName.innerHTML = post.account.username;
AccountName.innerHTML = post.account.acct;
AccountDescription.innerHTML = post.account.note;
AccountImage.setAttribute("src", post.account.avatar);
// Build the fields
@ -133,7 +133,7 @@ async function GetAccount() {
} else {
FollowButton.setAttribute("hidden", "");
BlockButton.setAttribute("hidden", "");
AlternateAccountImage.setAttribute("hidden", false);
AlternateAccountImage.removeAttribute("hidden");
// This is meant for the regular account. A big ol' you :3
let Token = localStorage.getItem(Variables.MastodonAccessToken);
if (Token != null) {

View file

@ -10,6 +10,8 @@ let Reply = document.getElementsByClassName("Reply")[0];
let FavoriteFlipper = false;
let BoostFlipper = false;
let Favoritable = false;
let Boostable = false;
// Variables
let website = document.location.href.split("website=")[1];
@ -25,19 +27,35 @@ let EmbedCounter = 0;
// Button stuff
Favorite.onclick = (event) => {
if (Favoritable == false) {
return;
}
Favoritee();
}
async function Favoritee() {
Favoritable = false;
if (website == "Mastodon") {
MastodonAPI.CreateFavorite(post.id, post.favourited);
await MastodonAPI.CreateFavorite(post.id, post.favourited);
} else if (website == "Bluesky") {
BlueskyAPI.CreateLike(localStorage.getItem(Variables.BlueskyDID), post.post.uri, post.post.cid);
await BlueskyAPI.CreateLike(localStorage.getItem(Variables.BlueskyDID), post.post.uri, post.post.cid);
}
SetFavorite();
}
Boost.onclick = (event) => {
if (Boostable == false) {
return;
}
Boostee();
}
async function Boostee() {
Boostable = false;
if (website == "Mastodon") {
MastodonAPI.CreateReblog(post.id, post.reblogged);
await MastodonAPI.CreateReblog(post.id, post.reblogged);
} else if (website == "Bluesky") {
BlueskyAPI.CreateRepost(localStorage.getItem(Variables.BlueskyDID), post.post.uri, post.post.cid);
await BlueskyAPI.CreateRepost(localStorage.getItem(Variables.BlueskyDID), post.post.uri, post.post.cid);
}
SetBoost();
}
@ -86,11 +104,10 @@ async function SetThreadPost(element, i) {
// Functions and things.
async function GetPost() {
if (website == "Mastodon") {
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.acct;
// Check for a reblog.
if (post.reblog != null) {
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.username + " ( R: " + post.reblog + " )";
} else {
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.username;
document.getElementsByClassName("Handle Regular")[0].innerHTML += " ( R: " + post.reblog + " )";
}
document.getElementsByClassName("PostText Regular")[0].innerHTML = post.content;
// Set the texts. It's opposite because "setting" causes it to switch.
@ -158,15 +175,14 @@ async function GetPost() {
async function MastodonReplylFunction(ClassName, post) {
let OtherPost = await MastodonAPI.GetStatus(post);
document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website;
document.getElementsByClassName("Handle " + ClassName)[0].innerHTML = OtherPost.account.username;
document.getElementsByClassName("Handle " + ClassName)[0].innerHTML = post.account.acct;
if (OtherPost.spoiler_text != "") {
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "WARNING: " + OtherPost.spoiler_text;
} else {
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = OtherPost.content;
}
if (OtherPost.media_attachments.length != 0) {
for (let i of OtherPost.media_attachments) {
ApplyMedia(i, document.getElementsByClassName("Images " + ClassName)[0]);
if (OtherPost.media_attachments.length != 0) {
for (let i of OtherPost.media_attachments) {
ApplyMedia(i, document.getElementsByClassName("Images " + ClassName)[0]);
}
}
return OtherPost;
@ -271,6 +287,7 @@ function SetFavorite() {
} else {
Favorite.innerHTML = "Unfavorite...";
}
Favoritable = true;
}
function SetBoost() {
@ -280,6 +297,7 @@ function SetBoost() {
} else {
Boost.innerHTML = "Unboost...";
}
Boostable = true;
}
// Functions stolen form elsewhere

View file

@ -24,7 +24,6 @@ let TimeAccountButton = document.getElementsByClassName("Time")[0];
// Sounds
const ButtonSound = new Audio("Audio/button-305770.mp3");
const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
// Discoverability
let Discover = false;
@ -77,22 +76,17 @@ Warning.onclick = (event) => {
setTimeout(() => {
Main.classList.remove("MainFadeInAnimation");
Main.classList.add("MainAfter");
Music();
}, 5000);
Main = document.getElementsByClassName("MainFadeInAnimation")[0];
PosterContainerUpdate();
}
function Music() {
BackgroundMusic.play();
setTimeout(() => {
Music();
}, 180000);
}
let ArrowRunning = false;
// Clicking the next button
ArrowsButton[1].onclick = (event) => {
if (!ContainerContainer.classList.contains("NextAnimation")) {
if (!ContainerContainer.classList.contains("NextAnimation") && ArrowRunning == false) {
ArrowRunning = true;
UpdateOtherContainers(1);
ContainerContainer.classList.add("NextAnimation");
ButtonSound.play();
@ -100,12 +94,14 @@ ArrowsButton[1].onclick = (event) => {
ContainerContainer.classList.remove("NextAnimation");
}, 1000);
PosterContainerUpdate("Forward");
ArrowRunning = false;
}
}
// Clicking the back button
ArrowsButton[0].onclick = (event) => {
if (!ContainerContainer.classList.contains("BackAnimation")) {
if (!ContainerContainer.classList.contains("BackAnimation") && ArrowRunning == false) {
ArrowRunning = true;
UpdateOtherContainers(3);
ContainerContainer.classList.add("BackAnimation");
ButtonSound.play();
@ -113,6 +109,7 @@ ArrowsButton[0].onclick = (event) => {
ContainerContainer.classList.remove("BackAnimation");
}, 1000);
PosterContainerUpdate("Backward");
ArrowRunning = false;
}
}
@ -216,6 +213,8 @@ async function PosterContainerUpdate(Direction) {
// Begin by having the website we are using get pushed to the expanded view array and clean out the HTML.
WebsiteAPIType.push("Mastodon");
i.getElementsByClassName("PostContent")[0].innerHTML = "";
i.getElementsByClassName("Username")[0].innerHTML = "";
// Public stuff
if (MastodonLoadedFeed[CurrentThing + counter + 1] == undefined) {
let TempFeed;
if (Discover == true) {
@ -230,15 +229,17 @@ async function PosterContainerUpdate(Direction) {
MastodonLoadedFeed = await MastodonLoadedFeed.concat(TempFeed);
}
// put the reblog into the regular post; Make changes as necessary.
if (MastodonLoadedFeed[CurrentThing + counter].reblog != null) {
i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].reblog.account.username + " ( R: " + MastodonLoadedFeed[CurrentThing + counter].account.username + " )";
if (MastodonLoadedFeed[CurrentThing + counter].reblog != null && typeof MastodonLoadedFeed[CurrentThing + counter].reblog != "string") {
// Fix a reblog issue.
let ReblogFix = MastodonLoadedFeed[CurrentThing + counter].account.username;
let ReblogFix = MastodonLoadedFeed[CurrentThing + counter].account.acct;
MastodonLoadedFeed[CurrentThing + counter] = MastodonLoadedFeed[CurrentThing + counter].reblog;
MastodonLoadedFeed[CurrentThing + counter].reblog = ReblogFix;
} else {
i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].account.username
i.getElementsByClassName("Username")[0].innerHTML = " ( R: " + MastodonLoadedFeed[CurrentThing + counter].reblog + " )";
} else if (MastodonLoadedFeed[CurrentThing + counter].reblog != null && typeof MastodonLoadedFeed[CurrentThing + counter].reblog == "string") {
// this function is if the changes are already made.
i.getElementsByClassName("Username")[0].innerHTML = " ( R: " + MastodonLoadedFeed[CurrentThing + counter].reblog + " )";
}
i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].account.acct + i.getElementsByClassName("Username")[0].innerHTML
// Check for images.
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "image") {
@ -282,6 +283,10 @@ async function PosterContainerUpdate(Direction) {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.video") {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!<br/>";
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.record") {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an embeded record!<br/>";
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.recordWithMedia") {
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image and an embeded record!<br/>";
}
}
// Check for a thread.

View file

@ -307,5 +307,7 @@
<p class="Posting">Posting</p>
</footer>
</section>
<audio controls src="Audio/soft-piano-music-312509.mp3" loop=true preload=auto>Lmao you can't hear music XD</audio>
</body>
</html>