idolpx / Reddit Hide NSFW

// ==UserScript==
// @namespace    https://gist.github.com/idolpx
// @name         Reddit Hide NSFW
// @version      1.0.0
// @description  Removes NSFW content from the main feed
// @downloadURL  https://openuserjs.org/install/idolpx/Reddit_Hide_NSFW.user.js
// @updateURL    https://openuserjs.org/meta/idolpx/Reddit_Hide_NSFW.meta.js
// @author       Jaime Idolpx
// @copyright    2020, idolpx (https://openuserjs.org/users/idolpx)
// @license      MIT
// @match        https://www.reddit.com/
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant        none
// ==/UserScript==

function hide_element() {
    $.each( $('span:contains("nsfw")'), function( key, value ) {
        text = $(this).text();
        //console.log( key + ': ' + text );
        if ( text.indexOf('nsfw') > -1 )
        {
            console.log( key + ': ' + text );
            //$(this).parent().eq(7).remove();
            $(this).parent().parent().parent().parent().parent().parent().parent().remove();
        }
    });
}

(function() {
    'use strict';

    hide_element();
    $('body').on("click",function(){
        console.log('body click');
        hide_element();
    });

    $(window).scroll(function() {
        clearTimeout($.data(this, 'scrollTimer'));
        $.data(this, 'scrollTimer', setTimeout(function() {
            hide_element();
        }, 350));
    });
})();