forked from TheBusyBiscuit/builds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (71 loc) · 4.2 KB
/
index.html
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE HTML>
<html>
<head>
<title>TheBusyBiscuit's builds page</title>
<link id="favicon" rel="shortcut icon" type="image/png" href="resources/favicon.png">
<link rel="stylesheet" href="resources/style.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans:400,700" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$.getJSON("https://thebusybiscuit.github.io/builds/resources/repos.json", function(repos) {
$("#repos").html("");
var profiles = [];
for (var repo in repos) {
if (!profiles.includes(repo.split("/")[0])) {
console.log("Found Author \"" + repo.split("/")[0] + "\"");
profiles.push(repo.split("/")[0]);
addProfile(repo.split("/")[0], repos);
}
}
console.log(profiles);
});
});
function addProfile(user, repos) {
$("#repos").append('<div class="box" style="width: 65%; margin: 2vh auto;"><a style="padding-top: 1vh;" class="link_build link_repo" href="https://github.com/' + user + '"><img alt="profil" src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/person.svg" class="profile_icon">' + '<span>' + user + '<span></a><table id="projects_' + user + '" class="info_table"></table></div>');
var table = $("#projects_" + user);
for (var repo in repos) {
if (repo.split("/")[0] !== user) continue;
console.log("Found Project \"" + repo + "\"");
var repository = repo.split('/')[1].split(":")[0];
var branch = repo.split('/')[1].split(":")[1];
var directory = user + '/' + repository + '/' + branch;
if (repos[repo].options && repos[repo].options.custom_directory) {
directory = repos[repo].options.custom_directory;
}
addRepository(table, directory, user, repository, branch);
}
// Alphabetical sorting
var items = table.children("tr");
items.sort((a, b) => {
var repo1 = $(a).attr("project").toUpperCase();
var repo2 = $(b).attr("project").toUpperCase();
return (repo1 > repo2) ? 1 : -1;
});
$(table).append(items);
}
function addRepository(table, directory, owner, repo, branch) {
let html = "";
html += "<tr project=\"" + repo + ":" + branch + "\"><td class=\"icon\"><img class=\"icon\" alt=\"project page\" src=\"https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/beaker.svg\"></td>";
html += '<td class="table_label" style="width: auto;"><a class="link_info" href="' + directory + '">' + (repo + " (" + branch + ")") + "</a></td><td>";
html += '<img style="float: right;" alt=\"project badge\" src="https://thebusybiscuit.github.io/builds/' + directory + '/badge.svg"/></td></tr>';
table.append(html);
}
</script>
</head>
<body>
<div class="header">
<a class="link_main" href="https://github.com/TheBusyBiscuit/builds">
<img alt="beaker" src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/beaker.svg" style="filter: invert(1);height: 50%; vertical-align: middle; padding-bottom: 6px;">
<span>TheBusyBiscuit's builds page</span>
</a>
</div>
<div id="repos" class="page">
<div class="box repo">
<div style="width: 100%; text-align: center;">
<img style="width: 30%;" class="loading" alt="loading" src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/sync.svg"/>
</div>
</div>
</div>
</body>
</html>