Guest User

hide_posts

a guest
Oct 31st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         name
  3. // @namespace    namespace
  4. // @version      0.1
  5. // @match        https://tjournal.ru/*
  6. // @description  description
  7. // @author       author
  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.     var words = ['мегафон', 'republic', 'apple'];
  16.  
  17.     $(document).ready(function() {
  18.         remove_posts();
  19.         $(document).on( "click", function() {
  20.             setTimeout(function () {
  21.                 remove_posts();
  22.             },1500);
  23.         });
  24.     });
  25.  
  26.     function remove_posts()
  27.     {
  28.         $('.b-article h2 span').each(function( index ) {
  29.             var title = $( this ).text();
  30.             var title_low = title.toLowerCase();
  31.             $.each(words, function( index, word ) {
  32.                 var word_low = word.toLowerCase();
  33.                 var includes = title_low.includes(word_low);
  34.  
  35.                 if (includes == true) {
  36.                     var post = ".b-article h2 span:contains('" + title +"')";
  37.                     $(".feed__container").find(post).closest(".feed__item").hide();
  38.                 }
  39.             });
  40.         });
  41.     }
  42. })();
Advertisement
Add Comment
Please, Sign In to add comment