From e1137646a1b13b0d96ff8524f8f6f2702daf389c Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Thu, 22 Feb 2024 16:02:47 +0100 Subject: home: use inline js for reading latest package info --- static/commits.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 static/commits.js (limited to 'static') 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); + }); -- cgit v1.2.3