From: Luigi Pinca Date: Sun, 7 Apr 2013 14:43:46 +0000 (+0200) Subject: changed the JSON structure returned by requests sent to /artworks X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=6cd16f6c3f0c779241aaa1725facc0d287cb0a25;p=binbsis50.git changed the JSON structure returned by requests sent to /artworks --- diff --git a/public/js/home.js b/public/js/home.js index 98c56ee..238bdb5 100644 --- a/public/js/home.js +++ b/public/js/home.js @@ -6,11 +6,10 @@ } }); $.get('/artworks', function(data) { - $('.thumbnail').each(function(index) { - var i = index * 6; - var j = i + 6; - for(i; i < j; i++) { - $('').appendTo($(this)); + $('.thumbnail').each(function() { + var urls = data[$(this).attr('href')]; + for (var i = 0; i < urls.length; i++) { + $('').appendTo($(this)); } }); }); diff --git a/routes/site.js b/routes/site.js index 42d4177..a6c77db 100644 --- a/routes/site.js +++ b/routes/site.js @@ -12,10 +12,10 @@ var async = require('async') , trackscount = utils.trackscount; /** - * Generate a task. + * Generate a sub-task. */ -var task = function(genre) { +var subTask = function(genre) { return function(callback) { var index = randInt(trackscount[genre]); db.zrange(genre, index, index, function(err, res) { @@ -29,18 +29,18 @@ var task = function(genre) { */ exports.artworks = function(req, res) { - var tasks = []; - for (var i=0; i