mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
use a template for projects
This commit is contained in:
parent
37136eae8a
commit
513e18fe43
10 changed files with 1052 additions and 117 deletions
2
TODO
2
TODO
|
|
@ -1,7 +1,7 @@
|
||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
* use a template for project pages, generate static html
|
* promote JS links on project pages (the only ones that mention javascript so far!)
|
||||||
|
|
||||||
* integrate github finder into project pages
|
* integrate github finder into project pages
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,13 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
<meta name=viewport content=width=device-width>
|
<meta name=viewport content=width=device-width>
|
||||||
<title>batteries for node</title>
|
<title>batteries</title>
|
||||||
<link rel=stylesheet href=../../style.css>
|
<link rel=stylesheet href=../../style.css>
|
||||||
<style>
|
<style>
|
||||||
#forkme { position: absolute
|
#forkme { position: absolute
|
||||||
; top: 0
|
; top: 0
|
||||||
; right: 0
|
; right: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#info { text-align: center
|
#info { text-align: center
|
||||||
; margin: 0 auto
|
; margin: 0 auto
|
||||||
; padding: 1em
|
; padding: 1em
|
||||||
|
|
@ -21,9 +20,7 @@
|
||||||
; -webkit-border-radius: 20px
|
; -webkit-border-radius: 20px
|
||||||
; -moz-border-radius: 20px
|
; -moz-border-radius: 20px
|
||||||
}
|
}
|
||||||
|
|
||||||
h4 { margin: 0.5em 0 0.7em }
|
h4 { margin: 0.5em 0 0.7em }
|
||||||
|
|
||||||
#info > div { text-align: center
|
#info > div { text-align: center
|
||||||
; font-size: 1.3em
|
; font-size: 1.3em
|
||||||
; width: 32%
|
; width: 32%
|
||||||
|
|
@ -32,7 +29,6 @@
|
||||||
; padding: 0.5em 0.2em
|
; padding: 0.5em 0.2em
|
||||||
; border-left: dashed 1px #aaa
|
; border-left: dashed 1px #aaa
|
||||||
}
|
}
|
||||||
|
|
||||||
#info > div:first-child { border-left: none }
|
#info > div:first-child { border-left: none }
|
||||||
|
|
||||||
#info div:last-child { clear: both
|
#info div:last-child { clear: both
|
||||||
|
|
@ -48,7 +44,6 @@
|
||||||
_gaq.push( ['_setAccount', 'UA-214054-5']
|
_gaq.push( ['_setAccount', 'UA-214054-5']
|
||||||
, ['_trackPageview']
|
, ['_trackPageview']
|
||||||
);
|
);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
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';
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
|
@ -80,51 +75,43 @@
|
||||||
function hide(id) {
|
function hide(id) {
|
||||||
document.getElementById(id).style.display = 'none'
|
document.getElementById(id).style.display = 'none'
|
||||||
}
|
}
|
||||||
|
|
||||||
function branchLink(b) {
|
function branchLink(b) {
|
||||||
return '<a href=https://github.com/samsonjs/batteries/tree/' + b + '>' + b + '</a>'
|
return '<a href=https://github.com/samsonjs/batteries/tree/' + b + '>' + b + '</a>'
|
||||||
}
|
}
|
||||||
|
|
||||||
function userLink(u) {
|
function userLink(u) {
|
||||||
return '<a href=https://github.com/' + u.login + '>' + u.name + '</a>'
|
return '<a href=https://github.com/' + u.login + '>' + u.name + '</a>'
|
||||||
}
|
}
|
||||||
|
|
||||||
function langsByUsage(langs) {
|
function langsByUsage(langs) {
|
||||||
return Object.keys(langs).sort(function(a, b) {
|
return Object.keys(langs).sort(function(a, b) {
|
||||||
return langs[a] < langs[b] ? -1 : 1
|
return langs[a] < langs[b] ? -1 : 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateBranches(branches) {
|
function updateBranches(branches) {
|
||||||
html('branches', Object.keys(branches).map(branchLink).join('<br>'))
|
html('branches', Object.keys(branches).map(branchLink).join('<br>'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateContributors(contributors) {
|
function updateContributors(contributors) {
|
||||||
html('contributors', contributors.map(userLink).join('<br>'))
|
html('contributors', contributors.map(userLink).join('<br>'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLangs(langs) {
|
function updateLangs(langs) {
|
||||||
html('langs', langsByUsage(langs).join('<br>'))
|
html('langs', langsByUsage(langs).join('<br>'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateN(name, things) {
|
function updateN(name, things) {
|
||||||
textHighlight('n' + name, things.length)
|
textHighlight('n' + name, things.length)
|
||||||
if (things.length === 1) hide(name.charAt(0) + 'plural')
|
if (things.length === 1) hide(name.charAt(0) + 'plural')
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', ready, false)
|
document.addEventListener('DOMContentLoaded', ready, false)
|
||||||
|
var data = createObjectStore('batteries')
|
||||||
function ready() {
|
function ready() {
|
||||||
var t = ObjectStore.get('t-batteries')
|
var t = data.get('t-batteries')
|
||||||
if (!t || +new Date() - t > 86400000) {
|
if (!t || +new Date() - t > 86400000) {
|
||||||
console.log('stale ' + String(t))
|
console.log('stale ' + String(t))
|
||||||
ObjectStore.set('t-batteries', +new Date())
|
data.set('t-batteries', +new Date())
|
||||||
GITR.repo('samsonjs/batteries')
|
GITR.repo('samsonjs/batteries')
|
||||||
.getBranches(function(err, branches) {
|
.getBranches(function(err, branches) {
|
||||||
if (err) {
|
if (err) {
|
||||||
text('branches', '(oops)')
|
text('branches', '(oops)')
|
||||||
} else {
|
} else {
|
||||||
ObjectStore.set('branches', branches)
|
data.set('branches', branches)
|
||||||
updateBranches(branches)
|
updateBranches(branches)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -133,14 +120,14 @@
|
||||||
text('langs', '(oops)')
|
text('langs', '(oops)')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ObjectStore.set('langs', langs)
|
data.set('langs', langs)
|
||||||
updateLangs(langs)
|
updateLangs(langs)
|
||||||
})
|
})
|
||||||
.getContributors(function(err, users) {
|
.getContributors(function(err, users) {
|
||||||
if (err) {
|
if (err) {
|
||||||
text('contributors', '(oops)')
|
text('contributors', '(oops)')
|
||||||
} else {
|
} else {
|
||||||
ObjectStore.set('contributors', users)
|
data.set('contributors', users)
|
||||||
updateContributors(users)
|
updateContributors(users)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -148,7 +135,7 @@
|
||||||
if (err) {
|
if (err) {
|
||||||
text('nwatchers', '?')
|
text('nwatchers', '?')
|
||||||
} else {
|
} else {
|
||||||
ObjectStore.set('watchers', users)
|
data.set('watchers', users)
|
||||||
updateN('watchers', users)
|
updateN('watchers', users)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -156,17 +143,17 @@
|
||||||
if (err) {
|
if (err) {
|
||||||
text('nforks', '?')
|
text('nforks', '?')
|
||||||
} else {
|
} else {
|
||||||
ObjectStore.set('forks', repos)
|
data.set('forks', repos)
|
||||||
updateN('forks', repos)
|
updateN('forks', repos)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('hit ' + t + ' (' + (+new Date() - t) + ')')
|
console.log('hit ' + t + ' (' + (+new Date() - t) + ')')
|
||||||
updateBranches(ObjectStore.get('branches'))
|
updateBranches(data.get('branches'))
|
||||||
updateLangs(ObjectStore.get('langs'))
|
updateLangs(data.get('langs'))
|
||||||
updateContributors(ObjectStore.get('contributors'))
|
updateContributors(data.get('contributors'))
|
||||||
updateN('watchers', ObjectStore.get('watchers'))
|
updateN('watchers', data.get('watchers'))
|
||||||
updateN('forks', ObjectStore.get('forks'))
|
updateN('forks', data.get('forks'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}())
|
}())
|
||||||
|
|
@ -176,7 +163,7 @@
|
||||||
<p><a class=up href=../>← projects</a></p>
|
<p><a class=up href=../>← projects</a></p>
|
||||||
<a href=https://github.com/samsonjs/batteries><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
<a href=https://github.com/samsonjs/batteries><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
||||||
<h1>batteries</h1>
|
<h1>batteries</h1>
|
||||||
<h2>useful stuff for node</h2>
|
<h2>a general purpose node library</h2>
|
||||||
<table align=center>
|
<table align=center>
|
||||||
<tr>
|
<tr>
|
||||||
<td align=right><span id=nwatchers><img src=../spinner.gif></span> watcher<span id=wplural>s</span></td>
|
<td align=right><span id=nwatchers><img src=../spinner.gif></span> watcher<span id=wplural>s</span></td>
|
||||||
|
|
|
||||||
52
proj/build.js
Executable file
52
proj/build.js
Executable file
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var constants
|
||||||
|
, fs = require('fs')
|
||||||
|
, path = require('path')
|
||||||
|
, mustache = require('mustache')
|
||||||
|
, EEXIST
|
||||||
|
, ENOENT
|
||||||
|
, _template
|
||||||
|
, _n = 0
|
||||||
|
|
||||||
|
try {
|
||||||
|
constants = require('constants')
|
||||||
|
} catch (e) {
|
||||||
|
constants = process
|
||||||
|
}
|
||||||
|
EEXIST = constants.EEXIST
|
||||||
|
ENOENT = constants.ENOENT
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
fs.readFile(path.join(__dirname, 'template', 'index.html'), function(err, html) {
|
||||||
|
if (err) throw err
|
||||||
|
_template = html.toString()
|
||||||
|
fs.readFile(path.join(__dirname, 'projects.json'), function(err, json) {
|
||||||
|
if (err) throw err
|
||||||
|
var projects = JSON.parse(json)
|
||||||
|
Object.keys(projects).forEach(function(name) {
|
||||||
|
_n += 1
|
||||||
|
buildProject(name, projects[name])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildProject(name, project) {
|
||||||
|
var dir = path.join(__dirname, name)
|
||||||
|
, index = path.join(dir, 'index.html')
|
||||||
|
fs.mkdir(dir, 0775, function(err) {
|
||||||
|
if (err && err.errno !== EEXIST) throw err
|
||||||
|
fs.unlink(index, function(err) {
|
||||||
|
if (err && err.errno !== ENOENT) throw err
|
||||||
|
project.name = name
|
||||||
|
fs.writeFile(index, mustache.to_html(_template, project), function(err) {
|
||||||
|
_n -= 1
|
||||||
|
console.log('* ' + name)
|
||||||
|
if (_n === 0) console.log('done')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module == require.main) main()
|
||||||
|
|
@ -1,19 +1,188 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset=utf-8>
|
<head>
|
||||||
<title>printf for JavaScript</title>
|
<meta charset=utf-8>
|
||||||
<script>
|
<meta name=viewport content=width=device-width>
|
||||||
var _gaq = _gaq || [];
|
<title>format</title>
|
||||||
_gaq.push( ['_setAccount', 'UA-214054-5']
|
<link rel=stylesheet href=../../style.css>
|
||||||
, ['_trackPageview']
|
<style>
|
||||||
);
|
#forkme { position: absolute
|
||||||
|
; top: 0
|
||||||
(function() {
|
; right: 0
|
||||||
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';
|
#info { text-align: center
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
; margin: 0 auto
|
||||||
})();
|
; padding: 1em
|
||||||
</script>
|
; border: solid 1px #ccc
|
||||||
<p align=center>
|
; width: 90%
|
||||||
printf for JavaScript<br>
|
; max-width: 950px
|
||||||
<a href="http://github.com/samsonjs/strftime">github project</a>
|
; background-color: #fff
|
||||||
</p>
|
; 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/format/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('format')
|
||||||
|
function ready() {
|
||||||
|
var t = data.get('t-format')
|
||||||
|
if (!t || +new Date() - t > 86400000) {
|
||||||
|
console.log('stale ' + String(t))
|
||||||
|
data.set('t-format', +new Date())
|
||||||
|
GITR.repo('samsonjs/format')
|
||||||
|
.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/format><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
||||||
|
<h1>format</h1>
|
||||||
|
<h2>printf for JavaScript</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>
|
||||||
|
|
@ -1,19 +1,188 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset=utf-8>
|
<head>
|
||||||
<title>gitter for node</title>
|
<meta charset=utf-8>
|
||||||
<script>
|
<meta name=viewport content=width=device-width>
|
||||||
var _gaq = _gaq || [];
|
<title>gitter</title>
|
||||||
_gaq.push( ['_setAccount', 'UA-214054-5']
|
<link rel=stylesheet href=../../style.css>
|
||||||
, ['_trackPageview']
|
<style>
|
||||||
);
|
#forkme { position: absolute
|
||||||
|
; top: 0
|
||||||
(function() {
|
; right: 0
|
||||||
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';
|
#info { text-align: center
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
; margin: 0 auto
|
||||||
})();
|
; padding: 1em
|
||||||
</script>
|
; border: solid 1px #ccc
|
||||||
<p align=center>
|
; width: 90%
|
||||||
GitHub client for Node, v2 API<br>
|
; max-width: 950px
|
||||||
<a href="http://github.com/samsonjs/gitter">github project</a>
|
; background-color: #fff
|
||||||
</p>
|
; 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>
|
||||||
6
proj/projects.json
Normal file
6
proj/projects.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ "batteries" : { "description" : "a general purpose node library" }
|
||||||
|
, "format" : { "description" : "printf for JavaScript" }
|
||||||
|
, "gitter" : { "description" : "a GitHub client for Node (v2 API)" }
|
||||||
|
, "repl-edit" : { "description" : "edit Node repl commands with your text editor" }
|
||||||
|
, "strftime" : { "description" : "strftime for JavaScript" }
|
||||||
|
}
|
||||||
|
|
@ -1,19 +1,188 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset=utf-8>
|
<head>
|
||||||
<title>repl-edit for node</title>
|
<meta charset=utf-8>
|
||||||
<script>
|
<meta name=viewport content=width=device-width>
|
||||||
var _gaq = _gaq || [];
|
<title>repl-edit</title>
|
||||||
_gaq.push( ['_setAccount', 'UA-214054-5']
|
<link rel=stylesheet href=../../style.css>
|
||||||
, ['_trackPageview']
|
<style>
|
||||||
);
|
#forkme { position: absolute
|
||||||
|
; top: 0
|
||||||
(function() {
|
; right: 0
|
||||||
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';
|
#info { text-align: center
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
; margin: 0 auto
|
||||||
})();
|
; padding: 1em
|
||||||
</script>
|
; border: solid 1px #ccc
|
||||||
<p align=center>
|
; width: 90%
|
||||||
Use your text editor to edit commands in Node's repl.<br>
|
; max-width: 950px
|
||||||
<a href="http://github.com/samsonjs/repl-edit">github project</a>
|
; background-color: #fff
|
||||||
</p>
|
; 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/repl-edit/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('repl-edit')
|
||||||
|
function ready() {
|
||||||
|
var t = data.get('t-repl-edit')
|
||||||
|
if (!t || +new Date() - t > 86400000) {
|
||||||
|
console.log('stale ' + String(t))
|
||||||
|
data.set('t-repl-edit', +new Date())
|
||||||
|
GITR.repo('samsonjs/repl-edit')
|
||||||
|
.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/repl-edit><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
||||||
|
<h1>repl-edit</h1>
|
||||||
|
<h2>edit Node repl commands with your text editor</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>
|
||||||
|
|
@ -1,22 +1,33 @@
|
||||||
(function() {
|
(function() {
|
||||||
if (typeof localStorage === 'undefined') return
|
if (typeof localStorage === 'undefined') return
|
||||||
var global = this
|
var global = this
|
||||||
global.ObjectStore = {
|
global.createObjectStore = function(namespace) {
|
||||||
clear: function() {
|
function makeKey(k) {
|
||||||
localStorage.clear()
|
return '--' + namespace + '-' + (k || '')
|
||||||
},
|
}
|
||||||
get: function(key) {
|
return {
|
||||||
var val = localStorage.getItem(key)
|
clear: function() {
|
||||||
return typeof val === 'string' ? JSON.parse(val) : val
|
var i = localStorage.length
|
||||||
},
|
, k
|
||||||
key: function(n) {
|
, prefix = new RegExp('^' + makeKey())
|
||||||
return localStorage.key(n)
|
while (--i) {
|
||||||
},
|
k = localStorage.key(i)
|
||||||
set: function(key, val) {
|
if (k.match(prefix)) {
|
||||||
localStorage.setItem(key, JSON.stringify(val))
|
localStorage.remove(k)
|
||||||
},
|
}
|
||||||
remove: function(key) {
|
}
|
||||||
localStorage.remove(key)
|
},
|
||||||
|
get: function(key) {
|
||||||
|
var val = localStorage.getItem(makeKey(key))
|
||||||
|
return typeof val === 'string' ? JSON.parse(val) : val
|
||||||
|
},
|
||||||
|
set: function(key, val) {
|
||||||
|
localStorage.setItem(makeKey(key), JSON.stringify(val))
|
||||||
|
},
|
||||||
|
remove: function(key) {
|
||||||
|
localStorage.removeItem(makeKey(key))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
global.ObjectStore = global.createObjectStore('default')
|
||||||
}())
|
}())
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,188 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset=utf-8>
|
<head>
|
||||||
<title>strftime for JavaScript</title>
|
<meta charset=utf-8>
|
||||||
<script>
|
<meta name=viewport content=width=device-width>
|
||||||
var _gaq = _gaq || [];
|
<title>strftime</title>
|
||||||
_gaq.push( ['_setAccount', 'UA-214054-5']
|
<link rel=stylesheet href=../../style.css>
|
||||||
, ['_trackPageview']
|
<style>
|
||||||
);
|
#forkme { position: absolute
|
||||||
|
; top: 0
|
||||||
(function() {
|
; right: 0
|
||||||
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';
|
#info { text-align: center
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
; margin: 0 auto
|
||||||
})();
|
; padding: 1em
|
||||||
</script>
|
; border: solid 1px #ccc
|
||||||
<p align=center>
|
; width: 90%
|
||||||
strftime for JavaScript<br>
|
; max-width: 950px
|
||||||
<a href="http://github.com/samsonjs/strftime">github project</a>
|
; background-color: #fff
|
||||||
</p>
|
; 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/strftime/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('strftime')
|
||||||
|
function ready() {
|
||||||
|
var t = data.get('t-strftime')
|
||||||
|
if (!t || +new Date() - t > 86400000) {
|
||||||
|
console.log('stale ' + String(t))
|
||||||
|
data.set('t-strftime', +new Date())
|
||||||
|
GITR.repo('samsonjs/strftime')
|
||||||
|
.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/strftime><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
||||||
|
<h1>strftime</h1>
|
||||||
|
<h2>strftime for JavaScript</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>
|
||||||
203
proj/template/index.html
Normal file
203
proj/template/index.html
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<meta name=viewport content=width=device-width>
|
||||||
|
<title>{{name}}</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/{{name}}/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('{{name}}')
|
||||||
|
|
||||||
|
function ready() {
|
||||||
|
var t = data.get('t-{{name}}')
|
||||||
|
if (!t || +new Date() - t > 86400000) {
|
||||||
|
console.log('stale ' + String(t))
|
||||||
|
data.set('t-{{name}}', +new Date())
|
||||||
|
GITR.repo('samsonjs/{{name}}')
|
||||||
|
.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/{{name}}><img id=forkme src=../forkme.png alt="Fork me on GitHub"></a>
|
||||||
|
<h1>{{name}}</h1>
|
||||||
|
<h2>{{description}}</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>
|
||||||
Loading…
Reference in a new issue