Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var UsetToHide = [//По имени фильтруем,
- 'Фёдор Хан',
- 'Барак' // или всех по имени Барак....
- ];
- var UserIDToHide = [ // По ID фильтруем, чтоб наверняка
- '66666',//Иван Иванов
- ];
- var ratingToMegaHide = -10; // после какого рейтинга сносим комментарий
- var ratingToHide = -1; // после какого рейтинга делаем комментарий прозрачным
- $("div.comment").each(function( index ) {
- var comment = $( this );
- var username = comment.find("a.b-comment__user").find("span").text();
- var user_id = comment.find("a.b-comment__user").attr("href");
- comment.find("div.rating").each(function( index ) {
- count = parseInt($( this ).find("div.rating-count").text().trim().replace("–","-"));
- if(count < ratingToMegaHide){
- $(comment).css("opacity","0.1").css("background-color",'pink').mouseover(function(){
- $(this).css("opacity","1");
- }).mouseout(function(){
- $(this).css("opacity","0.1");
- });
- }else if(count < ratingToHide){
- $(comment).css("opacity","0.5").mouseover(function(){
- $(this).css("opacity","1");
- }).mouseout(function(){
- $(this).css("opacity","0.5");
- });
- }
- });
- for(var i=0;i<UserIDToHide.length;i++){
- var patt = new RegExp('/'+UserIDToHide[i],"i");
- if(patt.test(user_id)){
- $(comment).css("opacity","0.1").css("background-color",'red').mouseover(function(){
- $(this).css("opacity","1");
- }).mouseout(function(){
- $(this).css("opacity","0.1");
- });
- }
- }
- for(i=0;i<UsetToHide.length;i++){
- patt = new RegExp(UsetToHide[i],"i");
- if(patt.test(username)){
- $(comment).css("opacity","0.1").css("background-color",'red').mouseover(function(){
- $(this).css("opacity","1");
- }).mouseout(function(){
- $(this).css("opacity","0.1");
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement