Suppress Facebook posts

Suppress Facebook posts with short or no post message

目前為 2020-02-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Suppress Facebook posts
// @namespace    https://gf.qytechs.cn/en/users/445779-haanjj
// @version      0.1
// @description  Suppress Facebook posts with short or no post message
// @author       Jeff Haan
// @match        https://www.facebook.com/*
// @require      http://code.jquery.com/jquery-1.11.1.min.js
// @require https://gf.qytechs.cn/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// @require      https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

var debug = false;
debug && console.log("Facebook thoughtless post removal");


// Facebook posts with no post message or a post message shorter than lengthLimit, are removed form the page
var lengthLimit =100;


waitForKeyElements (
    "[data-testid~='fbfeed_story']",
    function (jNode) {
        'use strict';

        if ($(jNode).find("div[data-testid='post_message'][class*='userContent'][style!='display: none;']").find("p").length > 0) {
            var post_message = $(jNode).find("div[data-testid='post_message'][class*='userContent'][style!='display: none;']").find("p")[0].innerText;
            var post_message_length = post_message.length;
            if ( debug ) console.log("POST MESSAGE " + post_message );
            if ( debug ) console.log("POST MESSAGE length"  + post_message_length );
            if ( post_message_length < lengthLimit ) $(jNode).remove();
        }else{
            if ( debug ) console.log("       No post message!");
            $(jNode).remove();
        }
    }

);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址