☰

f only

Hide posts containing (m) tag in its title

スクリプトをインストールするには、Tampermonkey, Greasemonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、 Tampermonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、Tampermonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、Tampermonkey や Userscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら、通報はこちらへお寄せください
// ==UserScript==
// @name         f only
// @namespace    reddit-f-only
// @version      1.0
// @description  Hide posts containing (m) tag in its title
// @match        https://www.reddit.com/r/gonewild/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function filterPosts() {

        const posts = document.querySelectorAll('shreddit-post');

        const regexM = /(\(|\[)(?:\d+)?m(?:\d+?)?(\)|\])/i;

        posts.forEach(post => {

            const titleElement = post.querySelector('a[slot="title"]');

            if (!titleElement) return;

            const title = titleElement.innerText.toLowerCase();

            const ismatch = regexM.test(title);

            if (ismatch) {
                post.style.display = "none";
            }

        });
    }

    filterPosts();

    const observer = new MutationObserver(() => {
        filterPosts();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();