Disable Instagram Reels and Explore Button

Disable Instagram reels and the explore button from the webpage, avoid distraction and see people only you follow. (https://github.com/akm2006/Disable-insta-reels)

当前为 2024-12-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Disable Instagram Reels and Explore Button
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Disable Instagram reels and the explore button from the webpage, avoid distraction and see people only you follow. (https://github.com/akm2006/Disable-insta-reels)
// @author       AKM777
// @match        https://www.instagram.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    // Function to hide reels and explore button
    function hideElements() {
        // Hide reels in feed
        const reelPosts = document.querySelectorAll('article div div div div video'); // Video reels in feed
        reelPosts.forEach(el => {
            const parent = el.closest('article');
            if (parent) parent.style.display = 'none';
        });

        // Hide the "Reels" button
        const reelsButtons = document.querySelectorAll('a[href*="/reels/"], div[role="button"][aria-label*="Reels"]');
        reelsButtons.forEach(el => {
            el.style.display = 'none';
        });

        // Hide the "Explore" button
        const exploreButton = document.querySelector('a[href="/explore/"]'); // Explore button in navigation
        if (exploreButton) {
            exploreButton.style.display = 'none';
        }
    }

    // Observe the page for dynamic changes
    const observer = new MutationObserver(hideElements);
    observer.observe(document.body, { childList: true, subtree: true });

    // Initial execution
    hideElements();
})();