import * as MastodonAPI from "/JS/MastodonAPI.js";
import * as BlueskyAPI from "/JS/BlueskyAPI.js";
import * as TumblrAPI from "/JS/TumblrAPI.js";
import * as Variables from "/JS/Variables.js";

// Below is the thing it populates if you login.
async function PopulateMastodonNotifications() {
	let Notifications = await MastodonAPI.GetNotifications();
	
	let NotificationsArea = document.getElementsByClassName("Notifications")[0];
	// Populate the Conversations area.
	for (let i in Notifications) {
		NotificationsArea.innerHTML += "<article style='top:" + getRandomArbitrary(0, 84) + "%; left: " + getRandomArbitrary(0, 84) + "%;' class='Notification'></article>";
		NotificationsArea.getElementsByClassName("Notification")[i].innerHTML = Notifications[i].status.content;
	}
}

// Populate the areas.
PopulateMastodonNotifications();

// 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;
}
