diff options
Diffstat (limited to 'static/js/src/favs.js')
| -rw-r--r-- | static/js/src/favs.js | 34 |
1 files changed, 34 insertions, 0 deletions
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 = '<div class="fav-note">' + + '<img src="' + RootDomain + 'static/img/thumbs/chatheartover.gif">' + + '<a href="' + RootDomain + f.from + '">' + f.from + '</a>' + + ' <span>just faved you!</span>' + + '</div>'; + 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) }); +} |
