From 127a5077c997119d7198058c818ad26dfb2975ba Mon Sep 17 00:00:00 2001 From: Leo Carvalho <38107116+Sveimoldr@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:23:36 -0300 Subject: [PATCH] Create github.js --- web/assets/js/github.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 web/assets/js/github.js diff --git a/web/assets/js/github.js b/web/assets/js/github.js new file mode 100644 index 00000000..0fdb887d --- /dev/null +++ b/web/assets/js/github.js @@ -0,0 +1,26 @@ +unction fetchRecentActivity() { + var url = "https://api.github.com/repos/SapphireMordred/Sapphire/events"; + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + + xhr.onreadystatechange = function() { + if (xhr.readyState == 4 && xhr.status == 200) { + var response = JSON.parse(xhr.responseText); + var commitLog = document.getElementById("commit-log"); + + for (var i = 0; i < response.length; i++) { + var commit = response[i]; + var commitItem = document.createElement("li"); + commitItem.innerHTML = commit.type + " - " + commit.actor.login; + commitLog.appendChild(commitItem); + } + } + } + + xhr.send(); +} + +// Call the fetchRecentActivity function when the page loads +window.onload = function() { + fetchRecentActivity(); +};