Advertisement
Guest User

UwU FB filter

a guest
Apr 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Ewadication
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  
  6. // @author       The Ewadicatow
  7. // @match        https://www.facebook.com/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. const THRESHOLD = 5
  12.  
  13.  
  14. function myFunction() {
  15.     'use strict';
  16.     let feed = document.querySelectorAll("._4-u2");
  17.  
  18.     feed.forEach( post => {
  19.         let userContent = post.querySelector(".userContent:not([style='display:none'])")
  20.         if (userContent) {
  21.             let offenders = userContent.textContent.match(/(uwu|owo)/gi);
  22.             if (offenders) {
  23.                 console.log(offenders.length)
  24.             }
  25.             if ( offenders && offenders.length > THRESHOLD ) {
  26.                 post.style.display = "none"
  27.                 console.log("post hidden\n")
  28.                 console.log(userContent)
  29.             }
  30.         }
  31.     })
  32. }
  33.  
  34.  
  35. myFunction()
  36. setTimeout(myFunction, 1000);
  37. (function () {
  38.   window.addEventListener('scroll', () => {
  39.     myFunction()
  40.     setTimeout(myFunction, 1000);
  41.   });
  42. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement