forked from ghtorrent/ghtorrent.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lean.html
98 lines (79 loc) · 2.36 KB
/
lean.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
89
90
91
92
93
94
95
96
97
98
---
layout: page
title: Lean GHTorrent
header: Lean GHTorrent
group: navigation
---
Lean GHTorrent allows researchers to get a slice of the full GHTorrent
dataset
<script>
function checkRepos(repos) {
var repoArr = repos.split(/\r?\n/).map(function(x){return x.trim();});
return repoArr.reduce(function(acc, project) {
var owner = project.split("/")[0];
var repo = project.split("/")[1];
// Missing / in repo name
if (owner == project) {
return acc.concat([project]);
}
// Missing repo name
if (repo === undefined) {
return acc.concat([project]);
}
if (!/^[0-9a-zA-Z\-_.]+$/.test(repo) ||
!/^[0-9a-zA-Z\-_.]+$/.test(owner)) {
return acc.concat([project]);
}
return acc;
}, []);
}
$(document).ready(function() {
function resetErrors() {
$("#errors").hide();
$("#missname").hide();
$("#missemail").hide();
$("#missrepo").hide();
}
function displayErrors(errors) {
resetErrors();
$("#leansubmit").hide();
if (errors.length > 0) {
errors.forEach(function(x) {
$("#errorrepos").append(x + "<br/>");
});
$("#errors").show("fast");
} else {
$("#leansubmit").show("fast");
}
}
function checkForm() {
//if ()
}
$("#leanform").load("http://ghtorrent.org/lean/", function() {
$("#leansubmit").click(function() {
displayErrors(checkRepos($("#repos").val()));
});
$("#leancheck").click(function() {
displayErrors(checkRepos($("#repos").val()));
});
});
});
</script>
<div id="leanform"></div>
<div id="missname" style="display:none; color: rgb(173, 63, 63);">Missing name</div>
<div id="missemail" style="display:none; color: rgb(173, 63, 63);">Missing email</div>
<div id="missrepo" style="display:none; color: rgb(173, 63, 63);">No repositories were specified</div>
<div id="errors" style="display:none">
The following are not valid repository names:
<div id="errorrepos" style="margin: 20px; color: rgb(173, 63, 63);"></div>
Valid repository names
contain small and capital letters or one of the following characters: _-.
<br/>
Examples of valid repository names are the following:
<ul>
<li>mojombo/jekyll</li>
<li>gousiosg/github-mirror</li>
<li>foo/BAR.org</li>
</ul>
Please fix the repository list as necessary.
</div>