From 0094395c61e36f3455eff643465201b32d084dad Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 10 Oct 2013 13:13:49 -0600 Subject: [PATCH] clean --- .../meta/pkg-index/official/static/index.js | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/pkgs/plt-services/meta/pkg-index/official/static/index.js b/pkgs/plt-services/meta/pkg-index/official/static/index.js index 83dec3ec9a..e3916f56dd 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -252,34 +252,33 @@ $( document ).ready(function() { curate_link ( curate_span, false, value ), " "); } + var now = new Date().getTime() / 1000; + function add_package_to_list ( value ) { + var curate_span = $('', { class: "curate_link" } ).hide(); + update_curate_span (curate_span, value); + + $('', + { class: ((now - (60*60*24*2)) < value['last-updated'] ? "recent" : "old") }) + .data( "obj", value) + .append( + $('').html("") + .append( curate_span, + jslink( value['name'], function () { open_info ( value ); }) ), + $('').append( $.map( value['authors'], function ( author, i ) { + return addfilterlink ( author, "author:" + author, "possible" ); } ) ), + $('').text( value['description'] ), + $('').append( $.map( value['tags'], function ( tag, i ) { + return addfilterlink ( tag, tag, "possible" ); } ) )) + .appendTo('#packages_table'); } + $.getJSON( "/pkgs-all.json", function( resp ) { var names = object_keys(resp); var snames = names.sort(function(a,b) { return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }) - var now = new Date().getTime() / 1000; - - $.each( snames, - function (name_i) { - var name = snames[name_i]; - var value = resp[name]; - - var curate_span = $('', { class: "curate_link" } ).hide(); - update_curate_span (curate_span, value); - - $('', - { class: ((now - (60*60*24*2)) < value['last-updated'] ? "recent" : "old") }) - .data( "obj", value) - .append( - $('').html("") - .append( curate_span, - jslink( value['name'], function () { open_info ( value ); }) ), - $('').append( $.map( value['authors'], function ( author, i ) { - return addfilterlink ( author, "author:" + author, "possible" ); } ) ), - $('').text( value['description'] ), - $('').append( $.map( value['tags'], function ( tag, i ) { - return addfilterlink ( tag, tag, "possible" ); } ) )) - .appendTo('#packages_table'); }); + $.each( snames, function (name_i) { + var name = snames[name_i]; + add_package_to_list ( resp[name] ); }); evaluate_search();