-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlistrepo.js
46 lines (39 loc) · 1.37 KB
/
listrepo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const w3c_report = 'https://w3c.github.io/validate-repos/report.json';
var w3c_data;
var w3c_group;
function LoadData() {
fetch(w3c_report, { mode: 'cors'})
.then(function(response) {
if (response.ok) {return response.json(); }
throw Error("Returned response for data: " + response.status);
}).then(function(data) {
w3c_data = data.repos;
w3c_group = data.groups;
});
document.getElementById('group_submit').addEventListener('click', ListRepositories);
}
window.addEventListener('load', LoadData);
function ListRepositories() {
var gid = document.getElementById('group_id').value;
var out = '';
var ginfo = '';
if (w3c_group[gid]) {
ginfo = w3c_group[gid]['name'] + ' / ' + w3c_group[gid]['type'];
}
document.getElementById('group_info').innerText = ginfo;
var cstr;
w3c_data.forEach(elem => {
if (elem.w3c && (elem.w3c.group == gid)) {
out += '<tr>';
cstr = elem.owner.login + '/' + elem.name;
out += '<td><a href="https://github.com/' + cstr + '">' + cstr + '</td>';
out += '<td>' + elem.createdAt + '</td>';
out += '<td>' + elem.homepageUrl + '</td>';
out += '<td>' + elem.isPrivate + '</td>';
out += '<td>' + elem.defaultBranch.name + '</td>';
out += '<td>' + elem.w3c['repo-type'][0] + '</td>';
out += '</tr>';
}
});
document.getElementById('repos_list').innerHTML = out;
}