Created
May 24, 2010 17:54
-
-
Save mape/412196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package.js sprint help | |
// Example output (for a single entry): | |
/* | |
{ | |
"name":"Wrench-JS" | |
,"description":"Useful Node.js operations (recursive directory operations, etc)" | |
,"url":"http://github.com/ryanmcgrath/wrench-js/" | |
,"issues":"http://github.com/ryanmcgrath/wrench-js/issues/" | |
,"mail":"ryan@venodesigns.net" | |
,"handle":"ryanmcgrath" | |
,"author":"Ryan McGrath" | |
} | |
*/ | |
// USAGE | |
// 1. Go to: http://wiki.github.com/ry/node/modules | |
// 2. Run this code in Firebug console (if error, refresh with console actived) | |
var modules = {}; | |
function getInfo(that) | |
{ | |
var $this = $(that); | |
var url = $this.find('a').attr('href').replace(/[^\/]*\/?$/,''); | |
if (url.indexOf('http://github.com') !== -1) | |
{ | |
var module = $this.text().split(/ *— */); | |
var moduleName = module[0]; | |
var moduleDescription = module[1]; | |
modules[moduleName] = { | |
'name': moduleName, | |
'description': moduleDescription || null, | |
'url': $this.find('a').attr('href')+'/'.replace('//','/') || null, | |
'issues': $this.find('a').attr('href')+'/issues/'.replace('//','/') || null | |
}; | |
$.ajax({ | |
dataType: 'html', | |
dataType: 'jsonp', | |
url: 'http://github.com/api/v2/json/user/show/'+url.match(/([^/]+)\/$/)[1]+'/?callback=?', | |
success: function(json) | |
{ | |
modules[moduleName].mail = json.user.email || null; | |
modules[moduleName].handle = json.user.login || null; | |
modules[moduleName].author = json.user.name || null; | |
$ul.append('<li style="border-bottom: 1px solid #888; padding: 10px;">'+JSON.stringify(modules[moduleName])+'</li>'); | |
} | |
}) | |
} | |
} | |
$('.wikistyle').detach().find('li').each(function(index) | |
{ | |
var self = this; | |
setTimeout(function() | |
{ | |
getInfo(self); | |
}, 1010*index); // Fetch once a second, otherwise github whines on API rate. | |
}); | |
var $ul = $('<ul>'); | |
$('body').html($ul) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment