V1.0.1 #63
8 changed files with 81 additions and 34 deletions
|
@ -2,6 +2,10 @@ html {
|
||||||
background: linear-gradient(to right, #00FFFF, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #00FFFF);
|
background: linear-gradient(to right, #00FFFF, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #dcdcdc, #00FFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
.Button {
|
.Button {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ body {
|
||||||
/* Classes */
|
/* Classes */
|
||||||
.Handle {
|
.Handle {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Origin {
|
.Origin {
|
||||||
|
|
|
@ -180,6 +180,13 @@ html {
|
||||||
top: 35vh;
|
top: 35vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audio {
|
||||||
|
position: absolute;
|
||||||
|
z-index=1;
|
||||||
|
|
||||||
|
width: max(60px, 10%);
|
||||||
|
}
|
||||||
|
|
||||||
.PostContainer {
|
.PostContainer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -224,6 +231,8 @@ html {
|
||||||
font-size: min(2vw, 2ch);
|
font-size: min(2vw, 2ch);
|
||||||
|
|
||||||
margin-top: max(-5px, -0.5vw);
|
margin-top: max(-5px, -0.5vw);
|
||||||
|
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.PostContent {
|
.PostContent {
|
||||||
|
|
|
@ -349,14 +349,17 @@ export function ApplyFacets(record, text) {
|
||||||
SplitAreas.push(i.index.byteStart);
|
SplitAreas.push(i.index.byteStart);
|
||||||
SplitAreas.push(i.index.byteEnd);
|
SplitAreas.push(i.index.byteEnd);
|
||||||
Hrefs.push(i.features[0].uri);
|
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.
|
// Last minute append.
|
||||||
SplitAreas.push(text.length);
|
SplitAreas.push(text.length);
|
||||||
// Remove emoji regex
|
// Remove emoji regex
|
||||||
let EmojiRegex = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu;
|
let EmojiObjects = text.match(/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu);
|
||||||
let EmojiObjects = text.match(EmojiRegex);
|
|
||||||
let SubtractNumber = 0;
|
let SubtractNumber = 0;
|
||||||
if (EmojiObjects != null) {
|
if (EmojiObjects != null) {
|
||||||
SubtractNumber = EmojiObjects.length * 2;
|
SubtractNumber = EmojiObjects.length * 2;
|
||||||
|
@ -366,8 +369,12 @@ export function ApplyFacets(record, text) {
|
||||||
StringArray.push(text.slice(SplitAreas[i - 1] - SubtractNumber, SplitAreas[i] - SubtractNumber));
|
StringArray.push(text.slice(SplitAreas[i - 1] - SubtractNumber, SplitAreas[i] - SubtractNumber));
|
||||||
}
|
}
|
||||||
// Finally, we append the string with <a>
|
// Finally, we append the string with <a>
|
||||||
for (let i = 1; i < StringArray.length; i += 2) {
|
for (let i = 0; i < StringArray.length; i += 2) {
|
||||||
TempText += StringArray[i - 1] + "<a href='" + Hrefs[i - 1] + "'>" + StringArray[i] + "</a>";
|
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 == "") {
|
if (TempText == "") {
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function GetAccount() {
|
||||||
Blocking = !(Relations[0].blocking);
|
Blocking = !(Relations[0].blocking);
|
||||||
SetFollow();
|
SetFollow();
|
||||||
SetBlock();
|
SetBlock();
|
||||||
AccountName.innerHTML = post.account.username;
|
AccountName.innerHTML = post.account.acct;
|
||||||
AccountDescription.innerHTML = post.account.note;
|
AccountDescription.innerHTML = post.account.note;
|
||||||
AccountImage.setAttribute("src", post.account.avatar);
|
AccountImage.setAttribute("src", post.account.avatar);
|
||||||
// Build the fields
|
// Build the fields
|
||||||
|
@ -133,7 +133,7 @@ async function GetAccount() {
|
||||||
} else {
|
} else {
|
||||||
FollowButton.setAttribute("hidden", "");
|
FollowButton.setAttribute("hidden", "");
|
||||||
BlockButton.setAttribute("hidden", "");
|
BlockButton.setAttribute("hidden", "");
|
||||||
AlternateAccountImage.setAttribute("hidden", false);
|
AlternateAccountImage.removeAttribute("hidden");
|
||||||
// This is meant for the regular account. A big ol' you :3
|
// This is meant for the regular account. A big ol' you :3
|
||||||
let Token = localStorage.getItem(Variables.MastodonAccessToken);
|
let Token = localStorage.getItem(Variables.MastodonAccessToken);
|
||||||
if (Token != null) {
|
if (Token != null) {
|
||||||
|
|
|
@ -10,6 +10,8 @@ let Reply = document.getElementsByClassName("Reply")[0];
|
||||||
|
|
||||||
let FavoriteFlipper = false;
|
let FavoriteFlipper = false;
|
||||||
let BoostFlipper = false;
|
let BoostFlipper = false;
|
||||||
|
let Favoritable = false;
|
||||||
|
let Boostable = false;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
let website = document.location.href.split("website=")[1];
|
let website = document.location.href.split("website=")[1];
|
||||||
|
@ -25,19 +27,35 @@ let EmbedCounter = 0;
|
||||||
|
|
||||||
// Button stuff
|
// Button stuff
|
||||||
Favorite.onclick = (event) => {
|
Favorite.onclick = (event) => {
|
||||||
|
if (Favoritable == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Favoritee();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function Favoritee() {
|
||||||
|
Favoritable = false;
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
MastodonAPI.CreateFavorite(post.id, post.favourited);
|
await MastodonAPI.CreateFavorite(post.id, post.favourited);
|
||||||
} else if (website == "Bluesky") {
|
} 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();
|
SetFavorite();
|
||||||
}
|
}
|
||||||
|
|
||||||
Boost.onclick = (event) => {
|
Boost.onclick = (event) => {
|
||||||
|
if (Boostable == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Boostee();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function Boostee() {
|
||||||
|
Boostable = false;
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
MastodonAPI.CreateReblog(post.id, post.reblogged);
|
await MastodonAPI.CreateReblog(post.id, post.reblogged);
|
||||||
} else if (website == "Bluesky") {
|
} 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();
|
SetBoost();
|
||||||
}
|
}
|
||||||
|
@ -86,11 +104,10 @@ 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;
|
||||||
// Check for a reblog.
|
// Check for a reblog.
|
||||||
if (post.reblog != null) {
|
if (post.reblog != null) {
|
||||||
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.username + " ( R: " + post.reblog + " )";
|
document.getElementsByClassName("Handle Regular")[0].innerHTML += " ( R: " + post.reblog + " )";
|
||||||
} else {
|
|
||||||
document.getElementsByClassName("Handle Regular")[0].innerHTML = post.account.username;
|
|
||||||
}
|
}
|
||||||
document.getElementsByClassName("PostText Regular")[0].innerHTML = post.content;
|
document.getElementsByClassName("PostText Regular")[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.
|
||||||
|
@ -158,15 +175,14 @@ async function GetPost() {
|
||||||
async function MastodonReplylFunction(ClassName, post) {
|
async function MastodonReplylFunction(ClassName, post) {
|
||||||
let OtherPost = await MastodonAPI.GetStatus(post);
|
let OtherPost = await MastodonAPI.GetStatus(post);
|
||||||
document.getElementsByClassName("Origin " + ClassName)[0].innerHTML = website;
|
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 != "") {
|
if (OtherPost.spoiler_text != "") {
|
||||||
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = "WARNING: " + OtherPost.spoiler_text;
|
||||||
} else {
|
} else {
|
||||||
document.getElementsByClassName("PostText " + ClassName)[0].innerHTML = OtherPost.content;
|
document.getElementsByClassName("PostText " + ClassName)[0].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 " + ClassName)[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OtherPost;
|
return OtherPost;
|
||||||
|
@ -271,6 +287,7 @@ function SetFavorite() {
|
||||||
} else {
|
} else {
|
||||||
Favorite.innerHTML = "Unfavorite...";
|
Favorite.innerHTML = "Unfavorite...";
|
||||||
}
|
}
|
||||||
|
Favoritable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetBoost() {
|
function SetBoost() {
|
||||||
|
@ -280,6 +297,7 @@ function SetBoost() {
|
||||||
} else {
|
} else {
|
||||||
Boost.innerHTML = "Unboost...";
|
Boost.innerHTML = "Unboost...";
|
||||||
}
|
}
|
||||||
|
Boostable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions stolen form elsewhere
|
// Functions stolen form elsewhere
|
||||||
|
|
35
JS/index.js
35
JS/index.js
|
@ -24,7 +24,6 @@ let TimeAccountButton = document.getElementsByClassName("Time")[0];
|
||||||
// Sounds
|
// Sounds
|
||||||
const ButtonSound = new Audio("Audio/button-305770.mp3");
|
const ButtonSound = new Audio("Audio/button-305770.mp3");
|
||||||
const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
|
const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
|
||||||
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
|
|
||||||
|
|
||||||
// Discoverability
|
// Discoverability
|
||||||
let Discover = false;
|
let Discover = false;
|
||||||
|
@ -77,22 +76,17 @@ Warning.onclick = (event) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Main.classList.remove("MainFadeInAnimation");
|
Main.classList.remove("MainFadeInAnimation");
|
||||||
Main.classList.add("MainAfter");
|
Main.classList.add("MainAfter");
|
||||||
Music();
|
|
||||||
}, 5000);
|
}, 5000);
|
||||||
Main = document.getElementsByClassName("MainFadeInAnimation")[0];
|
Main = document.getElementsByClassName("MainFadeInAnimation")[0];
|
||||||
PosterContainerUpdate();
|
PosterContainerUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Music() {
|
let ArrowRunning = false;
|
||||||
BackgroundMusic.play();
|
|
||||||
setTimeout(() => {
|
|
||||||
Music();
|
|
||||||
}, 180000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clicking the next button
|
// Clicking the next button
|
||||||
ArrowsButton[1].onclick = (event) => {
|
ArrowsButton[1].onclick = (event) => {
|
||||||
if (!ContainerContainer.classList.contains("NextAnimation")) {
|
if (!ContainerContainer.classList.contains("NextAnimation") && ArrowRunning == false) {
|
||||||
|
ArrowRunning = true;
|
||||||
UpdateOtherContainers(1);
|
UpdateOtherContainers(1);
|
||||||
ContainerContainer.classList.add("NextAnimation");
|
ContainerContainer.classList.add("NextAnimation");
|
||||||
ButtonSound.play();
|
ButtonSound.play();
|
||||||
|
@ -100,12 +94,14 @@ ArrowsButton[1].onclick = (event) => {
|
||||||
ContainerContainer.classList.remove("NextAnimation");
|
ContainerContainer.classList.remove("NextAnimation");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
PosterContainerUpdate("Forward");
|
PosterContainerUpdate("Forward");
|
||||||
|
ArrowRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clicking the back button
|
// Clicking the back button
|
||||||
ArrowsButton[0].onclick = (event) => {
|
ArrowsButton[0].onclick = (event) => {
|
||||||
if (!ContainerContainer.classList.contains("BackAnimation")) {
|
if (!ContainerContainer.classList.contains("BackAnimation") && ArrowRunning == false) {
|
||||||
|
ArrowRunning = true;
|
||||||
UpdateOtherContainers(3);
|
UpdateOtherContainers(3);
|
||||||
ContainerContainer.classList.add("BackAnimation");
|
ContainerContainer.classList.add("BackAnimation");
|
||||||
ButtonSound.play();
|
ButtonSound.play();
|
||||||
|
@ -113,6 +109,7 @@ ArrowsButton[0].onclick = (event) => {
|
||||||
ContainerContainer.classList.remove("BackAnimation");
|
ContainerContainer.classList.remove("BackAnimation");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
PosterContainerUpdate("Backward");
|
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.
|
// Begin by having the website we are using get pushed to the expanded view array and clean out the HTML.
|
||||||
WebsiteAPIType.push("Mastodon");
|
WebsiteAPIType.push("Mastodon");
|
||||||
i.getElementsByClassName("PostContent")[0].innerHTML = "";
|
i.getElementsByClassName("PostContent")[0].innerHTML = "";
|
||||||
|
i.getElementsByClassName("Username")[0].innerHTML = "";
|
||||||
|
// Public stuff
|
||||||
if (MastodonLoadedFeed[CurrentThing + counter + 1] == undefined) {
|
if (MastodonLoadedFeed[CurrentThing + counter + 1] == undefined) {
|
||||||
let TempFeed;
|
let TempFeed;
|
||||||
if (Discover == true) {
|
if (Discover == true) {
|
||||||
|
@ -230,15 +229,17 @@ async function PosterContainerUpdate(Direction) {
|
||||||
MastodonLoadedFeed = await MastodonLoadedFeed.concat(TempFeed);
|
MastodonLoadedFeed = await MastodonLoadedFeed.concat(TempFeed);
|
||||||
}
|
}
|
||||||
// put the reblog into the regular post; Make changes as necessary.
|
// put the reblog into the regular post; Make changes as necessary.
|
||||||
if (MastodonLoadedFeed[CurrentThing + counter].reblog != null) {
|
if (MastodonLoadedFeed[CurrentThing + counter].reblog != null && typeof MastodonLoadedFeed[CurrentThing + counter].reblog != "string") {
|
||||||
i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].reblog.account.username + " ( R: " + MastodonLoadedFeed[CurrentThing + counter].account.username + " )";
|
|
||||||
// Fix a reblog issue.
|
// 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] = MastodonLoadedFeed[CurrentThing + counter].reblog;
|
||||||
MastodonLoadedFeed[CurrentThing + counter].reblog = ReblogFix;
|
MastodonLoadedFeed[CurrentThing + counter].reblog = ReblogFix;
|
||||||
} else {
|
i.getElementsByClassName("Username")[0].innerHTML = " ( R: " + MastodonLoadedFeed[CurrentThing + counter].reblog + " )";
|
||||||
i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].account.username
|
} 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.
|
// Check for images.
|
||||||
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
|
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) {
|
||||||
if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "image") {
|
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/>";
|
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has an image!<br/>";
|
||||||
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.video") {
|
} else if (BlueskyLoadedFeed[CurrentThing + counter].post.record.embed.$type == "app.bsky.embed.video") {
|
||||||
i.getElementsByClassName("PostContent")[0].innerHTML += "This post has a video!<br/>";
|
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.
|
// Check for a thread.
|
||||||
|
|
|
@ -307,5 +307,7 @@
|
||||||
<p class="Posting">Posting</p>
|
<p class="Posting">Posting</p>
|
||||||
</footer>
|
</footer>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<audio controls src="Audio/soft-piano-music-312509.mp3" loop=true preload=auto>Lmao you can't hear music XD</audio>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue