This repository has been archived by the owner on May 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
linecount.html
73 lines (64 loc) · 2.7 KB
/
linecount.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/bootstrap/docs/assets/css/bootstrap.css" type="text/css" />
<script src="/jquery/jquery.min.js" type="text/javascript"></script>
<script src="/bootstrap/docs/assets/js/bootstrap.min.js" type="text/javascript"></script>
<script>
$(function() {
'use strict';
var re = new RegExp("^.*/([^/]+)/([^/]+)/?$");
var match = re.exec(document.URL);
var user = match[1], repo = match[2];
var $githubUrl = $('#github-url');
var $consoleOutput = $('#console-output');
var $results = $('#results');
var githubUrl = 'https://github.com/'+user+'/'+repo;
$githubUrl.append($('<a href="'+githubUrl+'" target="_blank">'+githubUrl+'</a>'));
var eventSourceUrl = '/' + user + '/' + repo + '/' + Math.floor(Math.random() * 10000000);
var source = new EventSource(eventSourceUrl);
source.addEventListener('console-output', function(e) {
var data = JSON.parse(e.data)
$consoleOutput.append(document.createTextNode(data)).append('<br/>');
$consoleOutput.stop().animate({
scrollTop: $consoleOutput[0].scrollHeight
}, 400);
}, false);
source.addEventListener('results', function(e) {
var data = JSON.parse(e.data)
$.each(data, function(key, value) {
$results.append(
$('<tr><td>'+key+'</td><td>'+value.files+'</td><td>'+value.codeLines+'</td><td>'+value.lines+'</td></tr>')
);
});
$('#results-container').show();
}, false);
});
</script>
</head>
<body>
<a href="https://github.com/cb372/line-count"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<div class="container">
<div class="row">
<div class="span8 offset2">
<h1 id="title">Line count for <span id="github-url"></span></h1>
<div style="padding-top: 20px;">
<h2>Progress</h2>
<div id="console-output" class="well" style="height: 150px; overflow: scroll; font-size: 0.85em; font-family: 'Lucida Console', Monaco, monospace; "></div>
</div>
<div id="results-container" style="display: none; padding-top: 20px;">
<h2>Results</h2>
<table id="results" class="table table-striped">
<tr>
<th>File Type</th>
<th>Files</th>
<th>Lines of Code</th>
<th>Total lines</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>