Facebook - Hides Suggested and Sponsored Posts

Hides Suggested For You, sponsored posts on the main feed & those silly sponsored ads in Marketplace

当前为 2021-09-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Facebook - Hides Suggested and Sponsored Posts
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Hides Suggested For You, sponsored posts on the main feed & those silly sponsored ads in Marketplace
// @author       ArthurG
// @match        https://www.facebook.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @grant        none
// ==/UserScript==

const pollTimeout = 3000;

function findAndHide() {

    // Suggested For You
    $( "span:contains('Suggested for you')" ).closest('[data-pagelet*="FeedUnit"]').hide();

    //Sponsored Ads in the Feed
    $('a[href*="/ads/"]').closest('[data-pagelet*="FeedUnit"]').hide();

    //Sponsored Ads in Marketplace
    $('a[href*="/ads/"]').closest('span > div > a > div > div > div').parent().parent().parent().parent().parent().parent().hide();

    //Repeat
    setTimeout(findAndHide, pollTimeout);
}

//Kick off
setTimeout(function(){
    findAndHide();
}, pollTimeout);