Facebook Recommands Removal

Remove Facebook recommands

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Facebook Recommands Removal
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  Remove Facebook recommands
// @author       PoH98
// @match        https://www.facebook.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=facebook.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let css = '[data-pagelet] { visibility: hidden; animation: .1s fadeIn .2s linear forwards; } @keyframes fadeIn { 99% { visibility: hidden; } 100% { visibility: visible; }}',
        head = document.head || document.getElementsByTagName('head')[0],
        style = document.createElement('style');

    head.appendChild(style);

    style.type = 'text/css';
    if (style.styleSheet){
        // This is required for IE8 and below.
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }
    setInterval(() => {
        const els = document.querySelectorAll(".x193iq5w.xeuugli.x13faqbe.x1vvkbs.x1xmvt09.x6prxxf.xvq8zen.x1s688f.x1fey0fg");
        els.forEach((el) => {
            const parent = el.closest("[data-pagelet]");
            parent?.remove();
        });
        const recommands = document.querySelectorAll("[aria-label='Reels']");
        recommands.forEach((el) => {
            const parent = el.closest("[data-pagelet]");
            parent?.remove();
        });
    }, 100);
})();