summaryrefslogtreecommitdiff
path: root/static/js/src/favs.js
blob: ad9ee3b3f989024d1f0cf80916a2e9ea564dcf93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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>'
        + '&nbsp;<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) });
}