cleanup
This commit is contained in:
parent
6988fbcb5b
commit
f41955432b
2 changed files with 15 additions and 11 deletions
|
@ -1,4 +1,3 @@
|
|||
// STRINGS TODO: make sure to seperate stuff that a user will want to input: BlueskyPDSName.
|
||||
// Mastodon
|
||||
export const MastodonWebsite = "mastodon_website";
|
||||
export const MastodonClientID = "mastodon_client_id";
|
||||
|
|
25
JS/index.js
25
JS/index.js
|
@ -105,20 +105,13 @@ ArrowsButton[0].onclick = (event) => {
|
|||
// Call this to update the things :)
|
||||
async function PosterContainerUpdate() {
|
||||
let Lim = 6;
|
||||
// Variables for the public timelines
|
||||
// Variables for the public timelines. Only for mastodon
|
||||
let LocalVar = localStorage.getItem("Local");
|
||||
var LocalTrue = (LocalVar === "true");
|
||||
let RemoteVar = localStorage.getItem("Remote");
|
||||
var RemoteTrue = (RemoteVar === "true");
|
||||
let Website = localStorage.getItem(Variables.MastodonWebsite);
|
||||
// Get the websites backwards. To see if I need more posts from Mastodon
|
||||
let BlueskyTimeline;
|
||||
if (localStorage.getItem(Variables.BlueskyPDS) == null) {
|
||||
console.log("No Bluesky instance. multiplying mastodon posts by 2...");
|
||||
Lim = Lim * 2;
|
||||
} else {
|
||||
BlueskyTimeline = await BlueskyAPI.GetTimeline();
|
||||
}
|
||||
// Mastodon gaining of timeline
|
||||
let MastodonTimeline;
|
||||
if (localStorage.getItem(Variables.MastodonWebsite) == null) {
|
||||
// The default website is Wetdry :3
|
||||
|
@ -126,15 +119,27 @@ async function PosterContainerUpdate() {
|
|||
} else {
|
||||
MastodonTimeline = await MastodonAPI.GetTimeline();
|
||||
}
|
||||
// Bluesky gaining of timeline
|
||||
let BlueskyTimeline;
|
||||
if (localStorage.getItem(Variables.BlueskyPDS) == null) {
|
||||
console.log("No Bluesky instance. multiplying mastodon posts by 2...");
|
||||
Lim = Lim * 2;
|
||||
} else {
|
||||
BlueskyTimeline = await BlueskyAPI.GetTimeline();
|
||||
}
|
||||
// Counters. The first counter counts the posts in the gained timelines...
|
||||
// The second increments to another timeline once posts hit the "limit".
|
||||
let counter = 0;
|
||||
let countergroup = 0;
|
||||
let CenterContainer = document.getElementsByClassName("PostContainer")[2].children;
|
||||
for (let i in CenterContainer) {
|
||||
switch(countergroup) {
|
||||
// Bsky
|
||||
case 0:
|
||||
CenterContainer[i].getElementsByClassName("PostContent")[0].innerHTML = BlueskyTimeline.feed[counter].post.record.text;
|
||||
CenterContainer[i].getElementsByClassName("Username")[0].innerHTML = MastodonTimeline[counter].account.username;
|
||||
CenterContainer[i].getElementsByClassName("Username")[0].innerHTML = BlueskyTimeline.feed[counter].post.author.handle;
|
||||
break;
|
||||
// Mastodon
|
||||
case 1:
|
||||
CenterContainer[i].getElementsByClassName("PostContent")[0].innerHTML = MastodonTimeline[counter].content;
|
||||
CenterContainer[i].getElementsByClassName("Username")[0].innerHTML = MastodonTimeline[counter].account.username;
|
||||
|
|
Loading…
Add table
Reference in a new issue