Advertisement
Guest User

HabrJS Source

a guest
Jul 14th, 2011
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Source for http://pastebin.com/qVqNYPzr
  2.  
  3. // Collect posts and its marks
  4. var comments=$$('li.comment_holder'), marks=[];
  5. comments.each(function(item) {
  6.   item.div=item.getChildren('.entry-content')[0].getChildren('.entry-content-only')[0];
  7.   item.mark=parseInt(item.getChildren('.msg-meta')[0].getElements('li.mark span')[0].innerHTML.replace('–', '-'));
  8.   marks.push(item.mark);
  9. });
  10.  
  11. // Get threshold
  12. marks=marks.sort(function(a, b) {return a - b});
  13. var l=parseInt(marks.length * 0.05);
  14. var max=marks[marks.length - l];
  15.  
  16. // Hide unwanted
  17. comments.each(function(item) {
  18.   if (item.mark < max)
  19.     item.div.addClass('bad5');
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement