From c4338d2ae878a167c409e91dea6d1783fc7e30ba Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 18 Jul 2012 00:02:21 -0400 Subject: put away back --- static/js/src/favs.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 static/js/src/favs.js (limited to 'static/js/src/favs.js') diff --git a/static/js/src/favs.js b/static/js/src/favs.js new file mode 100644 index 0000000..ad9ee3b --- /dev/null +++ b/static/js/src/favs.js @@ -0,0 +1,34 @@ +// 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) }); +} -- cgit v1.2.3-70-g09d2