mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-08 11:05:54 +00:00
142 lines
4.2 KiB
Text
142 lines
4.2 KiB
Text
<link rel="stylesheet" href="/css/style.css">
|
|
<link rel="stylesheet" href="/css/projects.css">
|
|
<!--[if IE 6]>
|
|
<link rel="stylesheet" href="/css/ie6.css">
|
|
<![endif]-->
|
|
<!--[if lt IE 8]>
|
|
<link rel="stylesheet" href="/css/ie7.css">
|
|
<script src="http://d1eqzjbvoh1rux.cloudfront.net/json2.min.js"></script>
|
|
<script src="/js/storage-polyfill.js"></script>
|
|
<![endif]-->
|
|
<style>
|
|
#gh { text-align: center }
|
|
#gh img { border: none }
|
|
span { padding: 5px }
|
|
#forkme { display: none }
|
|
#projects li p { margin: 0 }
|
|
#projects li p.description
|
|
{ font-size: 0.6em
|
|
; line-height: 1em
|
|
; color: #444
|
|
; margin-bottom: 0.5em
|
|
}
|
|
#stats a { text-decoration: none }
|
|
</style>
|
|
|
|
<a href="https://github.com/samsonjs"><img id="forkme" src="/images/forkme@2x.png" width="140" height="140" alt="Fork me on GitHub"></a>
|
|
|
|
<nav class="navbar" id="title">projects</nav>
|
|
|
|
<p id="gh">
|
|
<a class="img" href="https://github.com/samsonjs"><img src="/images/dr-octocat-448x448.png" width="224" height="224" alt="GitHub"></a>
|
|
</p>
|
|
<table align="center" id="stats">
|
|
<tr>
|
|
<td align="right">
|
|
<a href="https://github.com/samsonjs">
|
|
<span id="npublicRepos"></span> projects
|
|
</a>
|
|
</td>
|
|
<td>—</td>
|
|
<td align="left">
|
|
<a href="https://github.com/samsonjs/followers">
|
|
<span id="nfollowers"></span> followers
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">
|
|
<a href="https://gist.github.com/samsonjs">
|
|
<span id="npublicGists"></span> gists
|
|
</a>
|
|
</td>
|
|
<td>—</td>
|
|
<td align="left">
|
|
<a href="https://github.com/samsonjs/following">
|
|
following <span id="nfollowing"></span>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<nav>
|
|
<ul class="nav" id="projects">
|
|
<% for (var name in public.projects._data) { %>
|
|
<% var proj = public.projects._data[name]; %>
|
|
<li>
|
|
<p class="title"><a href="<%= name %>"><%= name %></a></p>
|
|
<p class="description"><%= proj.description %></p>
|
|
</li>
|
|
<% } %>
|
|
</ul>
|
|
</nav>
|
|
|
|
<script src="/js/gitter.js"></script>
|
|
<script src="/js/store.js"></script>
|
|
<script>
|
|
if (typeof console === 'undefined') {
|
|
console = { log: function() {} }
|
|
}
|
|
|
|
;(function() {
|
|
if (document.addEventListener) {
|
|
document.addEventListener('DOMContentLoaded', ready, false)
|
|
} else if (window.attachEvent) {
|
|
window.attachEvent('onload', ready)
|
|
}
|
|
|
|
function ready() {
|
|
function addClass(el, name) {
|
|
var c = el.className || name
|
|
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
|
}
|
|
|
|
var body = document.getElementsByTagName('body')[0]
|
|
, text
|
|
if ('innerText' in body) {
|
|
text = function(id, text) {
|
|
document.getElementById(id).innerText = text
|
|
}
|
|
} else {
|
|
text = function(id, text) {
|
|
document.getElementById(id).textContent = text
|
|
}
|
|
}
|
|
|
|
function highlight(id) {
|
|
document.getElementById(id).style.className = ' highlight'
|
|
}
|
|
function textHighlight(id, t) {
|
|
text(id, t)
|
|
document.getElementById(id).className = ' highlight'
|
|
}
|
|
function updateN(name, things) {
|
|
textHighlight('n' + name, things)
|
|
}
|
|
|
|
var data = createObjectStore('proj')
|
|
, t = data.get('t-proj')
|
|
, user = GITR.user('samsonjs')
|
|
, names = ['followers', 'following', 'publicRepos', 'publicGists']
|
|
if (!t || +new Date() - t > 3600 * 1000) {
|
|
console.log('stale ' + String(t))
|
|
data.set('t-proj', +new Date())
|
|
user.fetch(function(err, user) {
|
|
if (user) {
|
|
data.set('user', user)
|
|
}
|
|
names.forEach(function(name) {
|
|
if (err) {
|
|
updateN(name, '?')
|
|
}
|
|
else {
|
|
updateN(name, user[name])
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
console.log('hit ' + t + ' (' + (+new Date() - t) + ')')
|
|
names.forEach(function(name) { updateN(name, data.get('user')[name]) })
|
|
}
|
|
}
|
|
}())
|
|
</script>
|