import * as MastodonAPI from "./MastodonAPI.js";
import * as BlueskyAPI from "./BlueskyAPI.js";
import * as TumblrAPI from "./TumblrAPI.js";
import * as Variables from "./Variables.js";
// Below is the thing it populates if you login.
async function PopulateFavorites() {
let Favorites = await MastodonAPI.GetFavorites();
let FavoritesArea = document.getElementsByClassName("Favorites")[0];
// Populate the favorites area.
for (let i in Favorites) {
FavoritesArea.innerHTML += "";
FavoritesArea.getElementsByClassName("Favorite")[i].innerHTML = Favorites[i].content;
}
}
async function PopulateBookmarks() {
let Bookmarks = await MastodonAPI.GetBookmarks();
let BookmarksArea = document.getElementsByClassName("Bookmarks")[0];
// Populate the Bookmarks area.
for (let i in Bookmarks) {
BookmarksArea.innerHTML += "";
BookmarksArea.getElementsByClassName("Bookmark")[i].innerHTML = Bookmarks[i].content;
}
}
async function PopulateNotifications() {
let Notifications = await MastodonAPI.GetNotifications();
let NotificationsArea = document.getElementsByClassName("Notifications")[0];
// Populate the Conversations area.
for (let i in Notifications) {
NotificationsArea.innerHTML += "";
NotificationsArea.getElementsByClassName("Notification")[i].innerHTML = Notifications[i].status.content;
}
}
// Populate the areas.
PopulateFavorites();
PopulateBookmarks();
PopulateNotifications();
// Functions stolen elsewhere
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}