10

When you go to profile -> favorites for the first time (or on a full page reload), the de/re-select works as expected. However, after clicking to change the sort or if you go to another page of Favorites it no longer appears to register the click.

I've checked in Fx 3.5.x and Chrome 3.0.x(beta)

3
  • 2
    Broken on my machine too.
    – jjnguy
    Aug 19, 2009 at 18:44
  • Confirmed for me too with IE 8 and FF 3.5.x. It's making favorites management quite a chore. Oct 17, 2009 at 19:28
  • Still broken in the year 2010.
    – Zombies
    May 24, 2010 at 20:07

2 Answers 2

3

Using some suggestions from Nick Craver, this has been fixed.

0
4

Here's the script I use to fix the in-page version SO currently outputs, replacing the SO version with this would resolve the favorites issue, (it can be optimized much further, trying to change as little as possible for the purposes of a fix patch):

$(function() {
    $(".star-off")
        .css("cursor", "pointer")
        .attr("title", "This is a favorite question (click again to undo)");
    $(".star-off:not(.disabled)").live('click', function() {
        voteFavorite($(this));
    });
});

function getPostId(jClicked) {
    return jClicked.prev("input").val();
}

function voteFavorite(jClicked) {
    var jFavoriteCount = jClicked.parent().find("b");
    var count = parseInt("0" + jFavoriteCount.text().replace(/^\s+|\s+$/g, ""), 10);

    if (jClicked.hasClass('star-on')) {
        jFavoriteCount.css("color", "#808185").text((count-- <= 0) ? "" : count);
    } else {
        jFavoriteCount.css("color", "#D4A849").text(++count);   
    }

    jClicked.addClass('disabled').toggleClass('star-on');

    submit(jClicked, getPostId(jClicked), 5, function() {
        jClicked.removeClass('disabled');
    });     
}

function submit(jClicked, postId, voteTypeId, callback) {
    var formData = { "fkey": "FORMDATAKEYHERE" };

    $.post("/posts/" + postId + "/vote/" + voteTypeId, formData, function(data) { callback(jClicked, postId, data); }, "json");
};
1
  • nice and neat. very cool.
    – Rob Allen
    Jun 10, 2010 at 2:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .