Guest User

Untitled

a guest
Oct 31st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Нужно указать имя пользователя и его id на TJ.
  2. var users = {
  3.     "arayam": 126048
  4. };
  5.  
  6. // Слова для блокировки постов
  7. var words = ['рэп', 'Оксимирон', 'медуза'];
  8.  
  9. // Елемент замещения блокированных комментов
  10. var element = '<div class="comments__item"><p class="comments__item__user__removed_title">Комментарии скрыт</p> </div>';
  11.  
  12. setInterval(remove, 3000);
  13.  
  14. $(document).ready(function() {
  15.     setTimeout(function () {
  16.         remove_posts();
  17.         remove_user_posts();
  18.     },1500);
  19.  
  20.     remove_posts();
  21.     $(document).on( "click", function() {
  22.         setTimeout(function () {
  23.             remove_posts();
  24.             remove_user_posts();
  25.         },1500);
  26.     });
  27. });
  28.  
  29. function remove() {
  30.     remove_comments();
  31.     remove_comments_from_wall();
  32.     remove_notifications_from_wall();
  33.     remove_notifications_from_bar();
  34. }
  35.  
  36.  
  37. function remove_comments() {
  38.     $.each(users, function( name, id ) {
  39.         var comment = ".comments__item__user[href='https://tjournal.ru/users/" + id + "']";
  40.         $(".comments__body").find(comment).closest(".comments__item").replaceWith(element);
  41.     });
  42. }
  43.  
  44. function remove_comments_from_wall() {
  45.     $.each(users, function( name, id ) {
  46.         var wall_comment = ".live__item__user[href='/users/"+ id +"']";
  47.         $(".live__content").find(wall_comment).closest(".live__item").hide();
  48.     });
  49. }
  50.  
  51. function remove_notifications_from_wall()
  52. {
  53.     $.each(users, function( name, id ) {
  54.         var notification = ".live__item__name span:contains('" + name +"')";
  55.         $(".live__content").find(notification).parent().parent().hide();
  56.     });
  57. }
  58.  
  59. function remove_notifications_from_bar()
  60. {
  61.     $.each(users, function( name, id ) {
  62.         var notification = ".notification__text span[name=js-notification-user]:contains('" + name +"')";
  63.         $(".head-notifies__panel").find(notification).parent().parent().hide();
  64.     });
  65. }
  66.  
  67. function remove_user_posts()
  68. {
  69.     $.each(users, function( name, id ) {
  70.         var post = ".entry_header__author[href='https://tjournal.ru/users/" + id + "']";
  71.         $(".feed__container").find(post).closest(".feed__item").hide();
  72.     });
  73. }
  74.  
  75. function remove_posts()
  76. {
  77.     $('.b-article h2 span').each(function( index ) {
  78.         var title = $( this ).text();
  79.         var title_low = title.toLowerCase();
  80.         $.each(words, function( index, word ) {
  81.             var word_low = word.toLowerCase();
  82.             var includes = title_low.includes(word_low);
  83.  
  84.             if (includes === true) {
  85.                 var post = ".b-article h2 span:contains('" + title +"')";
  86.                 $(".feed__container").find(post).closest(".feed__item").hide();
  87.             }
  88.         });
  89.     });
  90. }
Advertisement
Add Comment
Please, Sign In to add comment