Skip to content

Instantly share code, notes, and snippets.

@r-sal
Created August 14, 2013 01:55
Show Gist options
  • Select an option

  • Save r-sal/6227393 to your computer and use it in GitHub Desktop.

Select an option

Save r-sal/6227393 to your computer and use it in GitHub Desktop.
cdnjs.com Extract, save as window.cdnjs and output as JSON string.
/**
* http://cdnjs.com/
* Extract, save as window.cdnjs and output as JSON string.
*/
window.cdnjs = {};
$('#example').find('tr').each(function(){
var name = $(this).attr('data-library-name'),
url = $(this).find('p[itemprop="downloadUrl"]').text(),
description = $(this).find('[itemprop="description"]').text(),
libUrl = $(this).find('[itemprop="url"]').attr('content'),
ver = $(this).find('[itemprop="version"]').attr('content');
cdnjs[name] = { 'name' : name, 'url' : url, 'description' : description, 'version' : ver, 'project' : libUrl };
});
console.log(window.cdnjs);
//console.log(JSON.stringify(cdn));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment