☰

Hide Reddit app banner

aaaaaaa

Αυτός ο κώδικας δεν πρέπει να εγκατασταθεί άμεσα. Είναι μια βιβλιοθήκη για άλλους κώδικες που περιλαμβάνεται μέσω της οδηγίας meta // @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 για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
})();