☰

Hide Reddit app banner

aaaaaaa

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.sleazyfork.org/scripts/606603/2005932/Hide%20Reddit%20app%20banner.js

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

You will need to install an extension such as Tampermonkey or Violentmonkey 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         Hide Reddit app banner
// @match        https://*.reddit.com/*
// @run-at       document-idle
// @grant        none
// ==/UserScript==
(function () {
  const TEXT = 'Get the Reddit app';
  function fixedAncestor(el) {
    let n = el, found = null;
    while (n && n !== document.documentElement) {
      const p = getComputedStyle(n).position;
      if (p === 'fixed' || p === 'sticky') found = n;
      const root = n.getRootNode();
      n = n.parentElement || (root instanceof ShadowRoot ? root.host : null);
    }
    return found;
  }
  function sweep(root) {
    root.querySelectorAll('*').forEach(el => {
      if (el.shadowRoot) sweep(el.shadowRoot);
      const t = el.textContent || '';
      if (t.includes(TEXT) && t.length < 200) {
        const a = fixedAncestor(el);
        if (a && a.getBoundingClientRect().height < 200)
          a.style.setProperty('display', 'none', 'important');
      }
    });
  }
  let timer;
  const run = () => { clearTimeout(timer); timer = setTimeout(() => sweep(document), 300); };
  new MutationObserver(run).observe(document.documentElement, { childList: true, subtree: true });
  sweep(document);
})();