Guest User

Untitled

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