-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·90 lines (77 loc) · 2.74 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
89
90
<!doctype html>
<html>
<head>
<title>Active Pull Requests</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="style.css"/>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>
</head>
<body>
<div id="controls">Pull Requests // <a href="#open" class="control-link active">open</a> | <a href="#closed" class="control-link">closed</a></div>
<div id="content">
<img src="ajax.gif" id="ajax"/>
</div>
<script type="text/javascript">
var token = ""; //Create a Personal Access Token in github to use here
var user = "Sitesquad";
var repos = [];
var pState = window.location.hash.replace('#','');
if(pState == '') pState = 'open';
$(function(){
$('.control-link').on('click',function(){
pState = this.href.replace('#','');
renderList();
});
});
renderList();
function renderList()
{
$.ajax({
//url: "https://api.github.com/repos/"+user+"/"+item+"/pulls",
url: "https://api.github.com/orgs/"+user+"/repos",
data: {
access_token: token,
per_page: 100
},
dataType: "json",
success: function (d)
{
$('#content').empty();
repos = [];
if(d.length < 1) return true;
$(d).each(function(i,repo){
repos.push(repo.name);
});
$(repos).each(function(index,item){
$.ajax({
url: "https://api.github.com/repos/"+user+"/"+item+"/pulls",
data: {
access_token: token,
state: pState
},
dataType: "json",
success: function (d)
{
if(d.length < 1) return true;
$("<h2>",{class:"repo",id:"repo-"+item}).html(item + ' ('+d.length+')').appendTo("#content").on('click',function(){ $(this).next().toggle() });
var list = $("<ul>",{class:"pull-list",id:"pulls-"+item}).appendTo("#content");
if(pState == 'closed')
list.hide();
$(d).each(function(i,pull){
var container = $("<li>",{class:"pull"});
$("<a>",{href:pull.html_url,class:"pull-link"}).html("#"+pull.number+" "+pull.title).appendTo(container);
var date = new Date(pull.created_at);
$("<div>",{class:"pull-created"}).html('<span class="user">'+pull.user.login+"</span> on "+date.getFullYear()+"/"+date.getMonth()+"/"+date.getDate()).appendTo(container);
$("<div>",{class:"pull-data"}).html('<span class="highlight">'+pull.base.label+'</span> ... <span class="highlight">'+pull.head.label+'</span>').appendTo(container);
$("<div>",{class:"pull-comment"}).html(pull.body).appendTo(container);
container.appendTo(list);
});
}
});
});
}
});
}
</script>
</body>
</html>