Advertisement
Guest User

Untitled

a guest
May 31st, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function add_comment_scores(){
  2.     if($(this).data("score") > 0)
  3.         $(this).find(".author p").append("<br><span style='color:green;'>(+"+$(this).data("score")+")</span>");
  4.     if($(this).data("score") < 0)
  5.         $(this).find(".author p").append("<br><span style='color:red;'>("+$(this).data("score")+")</span>")
  6. };
  7.  
  8. //Supposed to happen on DOMReady, but actually waits until the page with all content is fully loaded.
  9. $(function(){
  10. //Add scores to existing comments
  11. $(".comment").each(add_comment_scores);
  12. //Bind scoring to show-all-comments in comment listing (scores vanish otherwise)
  13. $("span[id^=threshold-comments-notice-for-] a").bind('ajax:success', function(){
  14.     $(this).parents(".comments-for-post").find(".comment").each(add_comment_scores);
  15.   })
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement