Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var UsetToHide = [//По имени фильтруем,
  3.     'Фёдор Хан',
  4.     'Барак' // или всех по имени Барак....
  5. ];
  6.  
  7. var UserIDToHide = [ // По ID фильтруем, чтоб наверняка
  8.     '66666',//Иван Иванов
  9. ];
  10.  
  11. var ratingToMegaHide = -10; // после какого рейтинга сносим комментарий
  12. var ratingToHide = -1; // после какого рейтинга делаем комментарий прозрачным
  13.  
  14. $("div.comment").each(function( index ) {
  15.     var comment = $( this );
  16.     var username = comment.find("a.b-comment__user").find("span").text();
  17.     var user_id = comment.find("a.b-comment__user").attr("href");
  18.     comment.find("div.rating").each(function( index ) {
  19.         count = parseInt($( this ).find("div.rating-count").text().trim().replace("–","-"));
  20.         if(count < ratingToMegaHide){
  21.             $(comment).css("opacity","0.1").css("background-color",'pink').mouseover(function(){
  22.                 $(this).css("opacity","1");
  23.             }).mouseout(function(){
  24.                 $(this).css("opacity","0.1");
  25.             });
  26.         }else if(count < ratingToHide){
  27.             $(comment).css("opacity","0.5").mouseover(function(){
  28.                 $(this).css("opacity","1");
  29.             }).mouseout(function(){
  30.                 $(this).css("opacity","0.5");
  31.             });
  32.         }
  33.     });
  34.     for(var i=0;i<UserIDToHide.length;i++){
  35.         var patt = new RegExp('/'+UserIDToHide[i],"i");
  36.         if(patt.test(user_id)){
  37.             $(comment).css("opacity","0.1").css("background-color",'red').mouseover(function(){
  38.                 $(this).css("opacity","1");
  39.             }).mouseout(function(){
  40.                 $(this).css("opacity","0.1");
  41.             });
  42.         }
  43.     }
  44.     for(i=0;i<UsetToHide.length;i++){
  45.         patt = new RegExp(UsetToHide[i],"i");
  46.         if(patt.test(username)){
  47.             $(comment).css("opacity","0.1").css("background-color",'red').mouseover(function(){
  48.                 $(this).css("opacity","1");
  49.             }).mouseout(function(){
  50.                 $(this).css("opacity","0.1");
  51.             });
  52.         }
  53.     }
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement