Skip to content

Instantly share code, notes, and snippets.

@mnutt
Created July 20, 2009 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnutt/150387 to your computer and use it in GitHub Desktop.
Save mnutt/150387 to your computer and use it in GitHub Desktop.
$.each(results, function(index, result) {
if($('#'+result.sha1).length == 0) {
var treeItem = $(document.createElement('treeitem')).addClass('result').attr('id', result.sha1);
var treeRow = $(document.createElement('treerow'));
treeRow.append($(document.createElement('treecell')).addClass('space').attr('label', ' '));
treeRow.append($(document.createElement('treecell')).addClass('from').attr('label', result.sources));
if(result.properties.TITLE && result.properties.AUTHOR) {
treeRow.append($(document.createElement('treecell')).addClass('name').attr('label', result.properties.TITLE + " - " + result.properties.AUTHOR));
} else {
treeRow.append($(document.createElement('treecell')).addClass('name').attr('label', result.properties.NAME));
}
treeRow.append($(document.createElement('treecell')).addClass('extension').attr('label', result.filename.split('.').reverse()[0]));
treeRow.append($(document.createElement('treecell')).addClass('type').attr('label', result.category));
treeRow.append($(document.createElement('treecell')).addClass('size').attr('label', size_format(result.properties.FILE_SIZE)));
treeItem.append(treeRow);
$('#results treechildren').append(treeItem);
//if(index == 0) { $("#results li:first").addClass("selected"); }
//$('#results li:last').click(startDownload);
}
if($('#results treechildren').length > 50) {
controller.stop();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment