aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2024-02-22 16:02:47 +0100
committerCem Keylan <cem@ckyln.com>2024-02-22 16:02:47 +0100
commite1137646a1b13b0d96ff8524f8f6f2702daf389c (patch)
treefe237e7f61b4f9990398232baabe97f9e29e6ad0 /static
parentb0eac72afeae3b0ef3cb4b3b765f8e55a737e729 (diff)
downloadwebsite-e1137646a1b13b0d96ff8524f8f6f2702daf389c.tar.gz
home: use inline js for reading latest package info
Diffstat (limited to 'static')
-rw-r--r--static/commits.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/static/commits.js b/static/commits.js
new file mode 100644
index 0000000..6a919ca
--- /dev/null
+++ b/static/commits.js
@@ -0,0 +1,21 @@
+function createListItem(commit) {
+ const li = document.createElement('li');
+ const a = document.createElement('a');
+ a.setAttribute('href', `https://git.carbslinux.org/repository/commit/?id=${commit.id}`);
+ a.textContent = `${commit.log}`
+ li.appendChild(a);
+ return li;
+}
+
+fetch('https://git.carbslinux.org/exports/repository.json')
+ .then(response => response.json())
+ .then(data => {
+ const commits = data["latest-commits"];
+ const list = document.createElement('ul');
+ for (let i = 0; i < commits.length; i++) {
+ const commit = commits[i];
+ const item = createListItem(commit);
+ list.appendChild(item);
+ }
+ document.getElementById("commits").appendChild(list);
+ });