aboutsummaryrefslogtreecommitdiff
path: root/static/commits.js
blob: 6a919ca5d4b0922879704c41dc7fcd7f0489914b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
  });