// Favs function buildFav(f) { var h = '
' + '' + '' + f.from + '' + ' just faved you!' + '
'; return $(h); } function removeFavAndHideBox() { $(this).remove(); if ($('#favbox').children().length == 0) $('#favbox').hide(); } function showFav(f) { $('#favbox').show(); buildFav(f).appendTo('#favbox').animate( {"opacity": 0}, {"duration": 9000, "complete": removeFavAndHideBox }); } function updateFavs(fs) { if (fs.length == 0) return; console.log("new faves"); $('#favbox').show(); $(fs).each(function(i, f) { showFav(f) }); }