From f8178dcbe4c23c930b865c993c8f5ab8c831e59c Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 27 Sep 2014 20:17:31 +0000 Subject: [PATCH] Color IDs on new posts received via AJAX --- js/id_colors.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/id_colors.js b/js/id_colors.js index 7d531fde..e0795b75 100644 --- a/js/id_colors.js +++ b/js/id_colors.js @@ -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({ @@ -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); + }); }); }); }