Facebook Debloater

Debloat Facebook

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Facebook Debloater
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Debloat Facebook
// @author       mut-ex
// @match        https://www.facebook.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    function hideCrap() {

        // Select all divs with the classes "m" and "displayed"

        const divs = document.querySelectorAll('div.m.displayed');
        divs.forEach(div => {

            // Hide stories
            const storiesDiv = div.querySelector('div.m.hscroller');
            if (storiesDiv) {
                div.style.display = 'none';
            }

            // Hide sponsored
            const sponsoredSpans = div.querySelectorAll('span.f5');
            sponsoredSpans.forEach(span => {
                if (span.textContent.startsWith("Sponsored")) {
                    div.style.display = 'none';
                }
            });

            // Hide 'Follow suggestions'
            const followSpans = div.querySelectorAll('span.f2');
            followSpans.forEach(span => {
                if (span.innerText === "Follow") {
                    div.style.display = 'none';
                }
            });

        });
    }
    setInterval(hideCrap, 1000);
})();