mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-05 10:17:46 +00:00
Create github.js
This commit is contained in:
parent
364c304d4a
commit
127a5077c9
1 changed files with 26 additions and 0 deletions
26
web/assets/js/github.js
Normal file
26
web/assets/js/github.js
Normal file
|
@ -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();
|
||||
};
|
Loading…
Add table
Reference in a new issue