Suppress Facebook posts

Suppress Facebook posts with short or no post message

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Suppress Facebook posts
// @namespace    https://greasyfork.org/en/users/445779-haanjj
// @version      0.3
// @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://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// ==/UserScript==

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

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;
            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();
        }
    }
);