mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
188 lines
No EOL
5.9 KiB
HTML
188 lines
No EOL
5.9 KiB
HTML
<!doctype html>
|
|
<head>
|
|
<meta charset=utf-8>
|
|
<meta name=viewport content=width=device-width>
|
|
<title>gitter</title>
|
|
<link rel=stylesheet href=../../style.css>
|
|
<style>
|
|
#forkme { position: absolute
|
|
; top: 0
|
|
; right: 0
|
|
}
|
|
#info { text-align: center
|
|
; margin: 0 auto
|
|
; padding: 1em
|
|
; border: solid 1px #ccc
|
|
; width: 90%
|
|
; max-width: 950px
|
|
; background-color: #fff
|
|
; border-radius: 20px
|
|
; -webkit-border-radius: 20px
|
|
; -moz-border-radius: 20px
|
|
}
|
|
h4 { margin: 0.5em 0 0.7em }
|
|
#info > div { text-align: center
|
|
; font-size: 1.3em
|
|
; width: 32%
|
|
; max-width: 400px
|
|
; float: left
|
|
; padding: 0.5em 0.2em
|
|
; border-left: dashed 1px #aaa
|
|
}
|
|
#info > div:first-child { border-left: none }
|
|
|
|
#info div:last-child { clear: both
|
|
; float: none
|
|
; border: none
|
|
; height: 0
|
|
; width: 0
|
|
; padding: 0
|
|
}
|
|
</style>
|
|
<script>
|
|
var _gaq = _gaq || [];
|
|
_gaq.push( ['_setAccount', 'UA-214054-5']
|
|
, ['_trackPageview']
|
|
);
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
</script>
|
|
<script src=../gitter.js></script>
|
|
<script src=../store.js></script>
|
|
<script>
|
|
(function() {
|
|
function addClass(el, name) {
|
|
var c = el.className || name
|
|
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
|
}
|
|
function html(id, h) {
|
|
document.getElementById(id).innerHTML = h
|
|
}
|
|
function text(id, text) {
|
|
document.getElementById(id).innerText = text
|
|
}
|
|
function highlight(id) {
|
|
document.getElementById(id).style.className = ' highlight'
|
|
}
|
|
function textHighlight(id, text) {
|
|
var el = document.getElementById(id)
|
|
el.innerText = text
|
|
el.className = ' highlight'
|
|
}
|
|
function hide(id) {
|
|
document.getElementById(id).style.display = 'none'
|
|
}
|
|
function branchLink(b) {
|
|
return '<a href=https://github.com/samsonjs/gitter/tree/' + b + '>' + b + '</a>'
|
|
}
|
|
function userLink(u) {
|
|
return '<a href=https://github.com/' + u.login + '>' + u.name + '</a>'
|
|
}
|
|
function langsByUsage(langs) {
|
|
return Object.keys(langs).sort(function(a, b) {
|
|
return langs[a] < langs[b] ? -1 : 1
|
|
})
|
|
}
|
|
function updateBranches(branches) {
|
|
html('branches', Object.keys(branches).map(branchLink).join('<br>'))
|
|
}
|
|
function updateContributors(contributors) {
|
|
html('contributors', contributors.map(userLink).join('<br>'))
|
|
}
|
|
function updateLangs(langs) {
|
|
html('langs', langsByUsage(langs).join('<br>'))
|
|
}
|
|
function updateN(name, things) {
|
|
textHighlight('n' + name, things.length)
|
|
if (things.length === 1) hide(name.charAt(0) + 'plural')
|
|
}
|
|
document.addEventListener('DOMContentLoaded', ready, false)
|
|
var data = createObjectStore('gitter')
|
|
function ready() {
|
|
var t = data.get('t-gitter')
|
|
if (!t || +new Date() - t > 86400000) {
|
|
console.log('stale ' + String(t))
|
|
data.set('t-gitter', +new Date())
|
|
GITR.repo('samsonjs/gitter')
|
|
.getBranches(function(err, branches) {
|
|
if (err) {
|
|
text('branches', '(oops)')
|
|
} else {
|
|
data.set('branches', branches)
|
|
updateBranches(branches)
|
|
}
|
|
})
|
|
.getLanguages(function(err, langs) {
|
|
if (err) {
|
|
text('langs', '(oops)')
|
|
return
|
|
}
|
|
data.set('langs', langs)
|
|
updateLangs(langs)
|
|
})
|
|
.getContributors(function(err, users) {
|
|
if (err) {
|
|
text('contributors', '(oops)')
|
|
} else {
|
|
data.set('contributors', users)
|
|
updateContributors(users)
|
|
}
|
|
})
|
|
.getWatchers(function(err, users) {
|
|
if (err) {
|
|
text('nwatchers', '?')
|
|
} else {
|
|
data.set('watchers', users)
|
|
updateN('watchers', users)
|
|
}
|
|
})
|
|
.getNetwork(function(err, repos) {
|
|
if (err) {
|
|
text('nforks', '?')
|
|
} else {
|
|
data.set('forks', repos)
|
|
updateN('forks', repos)
|
|
}
|
|
})
|
|
} else {
|
|
console.log('hit ' + t + ' (' + (+new Date() - t) + ')')
|
|
updateBranches(data.get('branches'))
|
|
updateLangs(data.get('langs'))
|
|
updateContributors(data.get('contributors'))
|
|
updateN('watchers', data.get('watchers'))
|
|
updateN('forks', data.get('forks'))
|
|
}
|
|
}
|
|
}())
|
|
</script>
|
|
</head>
|
|
<a class=up href=../../>← samhuri.net</a>
|
|
<p><a class=up href=../>← projects</a></p>
|
|
<a href=https://github.com/samsonjs/gitter><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
|
<h1>gitter</h1>
|
|
<h2>a GitHub client for Node (v2 API)</h2>
|
|
<table align=center>
|
|
<tr>
|
|
<td align=right><span id=nwatchers><img src=../spinner.gif></span> watcher<span id=wplural>s</span></td>
|
|
<td>—</td>
|
|
<td align=left><span id=nforks><img src=../spinner.gif></span> fork<span id=fplural>s</span></td>
|
|
</tr>
|
|
</table>
|
|
<div id=info>
|
|
<div>
|
|
<h4>branches</h4>
|
|
<span id=branches><img src=../spinner.gif></span>
|
|
</div>
|
|
<div>
|
|
<h4>languages</h4>
|
|
<span id=langs><img src=../spinner.gif></span>
|
|
</div>
|
|
<div>
|
|
<h4>contributors</h4>
|
|
<span id=contributors><img src=../spinner.gif></span>
|
|
</div>
|
|
<div></div>
|
|
</div> |