Skip to content

Commit

Permalink
Color IDs on new posts received via AJAX
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlcctrlv authored and czaks committed Oct 5, 2014
1 parent 035f843 commit f8178dc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/id_colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (active_page == 'thread' || active_page == 'index') {
return rgb;
}

$(".poster_id").each(function(){
function colorPostId(el) {
var rgb = stringToRGB($(this).text());

$(this).css({
Expand All @@ -32,6 +32,16 @@ if (active_page == 'thread' || active_page == 'index') {
"border-radius": "8px",
"color": "white"
});
}

$(".poster_id").each(function(k, v){
colorPostId(v);
});

$(document).on('new_post', function(e, post) {
$(post).find('.poster_id').each(function(k, v) {
colorPostId(v);
});
});
});
}

0 comments on commit f8178dc

Please sign in to comment.