diff --git a/public/assets/js/toot.js b/public/assets/js/toot.js new file mode 100644 index 0000000..f9e6873 --- /dev/null +++ b/public/assets/js/toot.js @@ -0,0 +1,28 @@ +const log = document.getElementById('log'); +log.innerHTML = ""; + +async function fetchData() { + + var serverAddress = "techhub.social"; + + const response = await fetch(`https://${serverAddress}/api/v1/accounts/111518136987654656/statuses`); + + const data = await response.json(); + + data.forEach(obj => { + Object.entries(obj).forEach(([key, value]) => { + + if (key == "id") { + log.innerHTML = log.innerHTML + `` + '
'; + } + + }); + log.innerHTML = log.innerHTML + '
'; + }); +} + +function openInNewTab(url) { + window.open(url, '_blank').focus(); +} + +document.addEventListener("DOMContentLoaded", fetchData); diff --git a/public/index.html b/public/index.html index 2d1ac9e..f920843 100644 --- a/public/index.html +++ b/public/index.html @@ -275,7 +275,9 @@ - + + + +