7$6#&256$6-+22+

Hapus NSFW modal, & unblur

// ==UserScript==
// @name         7$6#&256$6-+22+
// @namespace    Violentmonkey Scripts
// @match        https://www.reddit.com/*
// @match        https://sh.reddit.com/*
// @grant        none
// @version      1.4
// @author       Jembuds
// @description  Hapus NSFW modal, & unblur
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  function fixScrollAndClick() {
    const html = document.documentElement;
    const body = document.body;

    [html, body].forEach(el => {
      el.style.overflow = 'auto';
      el.style.position = 'static';
      el.style.height = 'auto';
      el.style.pointerEvents = 'auto';
    });

    const mainApp = document.querySelector("shreddit-app");
    if (mainApp) {
      mainApp.style.pointerEvents = 'auto';
    }
  }

  function removeAnnoyances() {
    // Modal NSFW dan app prompt
    document.querySelector("#xpromo-bottom-sheet")?.remove();
    document.querySelector("#blocking-modal")?.remove();

    // Blur overlay
    document.querySelectorAll("div[style*='backdrop-filter']").forEach(el => {
      if (getComputedStyle(el).position === 'fixed') el.remove();
    });

    // NSFW Prompt di shadow DOM
    const prompts = document.getElementsByTagName("xpromo-nsfw-blocking-container");
    if (prompts.length > 0) {
      try {
        prompts[0].shadowRoot?.querySelector(".prompt")?.remove();
      } catch (e) {}
    }

    // Hapus semua overlay tinggi lainnya
    document.querySelectorAll('div, faceplate-modal, shreddit-async-loader')
      .forEach(el => {
        const style = getComputedStyle(el);
        if (
          style.position === 'fixed' &&
          parseInt(style.zIndex) >= 100 &&
          style.width === '100%' &&
          style.height === '100%'
        ) {
          el.remove();
        }
      });

    // Perbaiki interaksi dan scroll
    fixScrollAndClick();
  }

  // Jalankan saat halaman siap
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', removeAnnoyances);
  } else {
    removeAnnoyances();
  }

  // Pantau perubahan dinamis
  const observer = new MutationObserver(removeAnnoyances);
  observer.observe(document, {
    childList: true,
    subtree: true,
    attributes: true,
  });

  // Hentikan observer kalau Reddit bukan shreddit
  const interval = setInterval(() => {
    if (!document.querySelector("shreddit-app")) {
      observer.disconnect();
      clearInterval(interval);
    }
  }, 8000);
})();