Tampermonkey Script to Ignore Users and Auto-add Youtube Viewer Links

null

...
Joined
Nov 12, 2014
Messages
35,285
Reputation
6,820
Daps
53,820
Reppin
UK, DE, GY, DMV
now excludes all notifications ...

just replace "Doobie Doo" with "Doobie Doo Doo"

(or don't)

:hubie::mjlol:

Code:
// ==UserScript==
// @name         Hide Posts - TheColi
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Hide posts by user and quotes of on ...
// @match        https://www.thecoli.com/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    const HIDDEN_USERS = ['Doobie Doo', 'Doobie Doo Doo'];
    function hideAll(root) {
        root = root || document;
        HIDDEN_USERS.forEach(user => {
            root.querySelectorAll(`article.message[data-author="${user}"]`).forEach(el => {
                el.style.display = 'none';
            });
            root.querySelectorAll(`blockquote[data-quote="${user}"]`).forEach(el => {
                el.style.display = 'none';
            });
            root.querySelectorAll('li.alert .username').forEach(el => {
                if (el.textContent.trim() === user) {
                    const li = el.closest('li.alert');
                    if (li) li.style.display = 'none';
                }
            });
            root.querySelectorAll('.reactionsBar-link bdi').forEach(el => {
                if (el.textContent.trim() === user) {
                    el.style.display = 'none';
                    const prev = el.previousSibling;
                    if (prev && prev.nodeType === Node.TEXT_NODE) {
                        prev.textContent = prev.textContent.replace(/,\s*$/, '');
                    }
                    const link = el.closest('.reactionsBar-link');
                    if (link) {
                        const remaining = Array.from(link.querySelectorAll('bdi'))
                            .filter(b => b.style.display !== 'none');
                        if (remaining.length === 0) {
                            const bar = link.closest('.reactionsBar') || link.parentElement;
                            if (bar) bar.style.display = 'none';
                            else link.style.display = 'none';
                        }
                    }
                }
            });
        });
    }
    hideAll();
    new MutationObserver(muts => {
        for (const m of muts) {
            for (const n of m.addedNodes) {
                if (n.nodeType === 1) hideAll(n);
            }
        }
    }).observe(document.body, { childList: true, subtree: true });
})();
 

Doobie Doo

Veteran
Joined
May 2, 2012
Messages
64,236
Reputation
25,580
Daps
412,168
Reppin
Raleigh, NC
now excludes all notifications ...

just replace "Doobie Doo" with "Doobie Doo Doo"

(or don't)

:hubie::mjlol:

Code:
// ==UserScript==
// @name         Hide Posts - TheColi
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Hide posts by user and quotes of on ...
// @match        https://www.thecoli.com/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    const HIDDEN_USERS = ['Doobie Doo', 'Doobie Doo Doo'];
    function hideAll(root) {
        root = root || document;
        HIDDEN_USERS.forEach(user => {
            root.querySelectorAll(`article.message[data-author="${user}"]`).forEach(el => {
                el.style.display = 'none';
            });
            root.querySelectorAll(`blockquote[data-quote="${user}"]`).forEach(el => {
                el.style.display = 'none';
            });
            root.querySelectorAll('li.alert .username').forEach(el => {
                if (el.textContent.trim() === user) {
                    const li = el.closest('li.alert');
                    if (li) li.style.display = 'none';
                }
            });
            root.querySelectorAll('.reactionsBar-link bdi').forEach(el => {
                if (el.textContent.trim() === user) {
                    el.style.display = 'none';
                    const prev = el.previousSibling;
                    if (prev && prev.nodeType === Node.TEXT_NODE) {
                        prev.textContent = prev.textContent.replace(/,\s*$/, '');
                    }
                    const link = el.closest('.reactionsBar-link');
                    if (link) {
                        const remaining = Array.from(link.querySelectorAll('bdi'))
                            .filter(b => b.style.display !== 'none');
                        if (remaining.length === 0) {
                            const bar = link.closest('.reactionsBar') || link.parentElement;
                            if (bar) bar.style.display = 'none';
                            else link.style.display = 'none';
                        }
                    }
                }
            });
        });
    }
    hideAll();
    new MutationObserver(muts => {
        for (const m of muts) {
            for (const n of m.addedNodes) {
                if (n.nodeType === 1) hideAll(n);
            }
        }
    }).observe(document.body, { childList: true, subtree: true });
})();
Nobody cares about you on this message board dawg. I'm sorry you have to keep trolling and spaming your threads for attention.
 

null

...
Joined
Nov 12, 2014
Messages
35,285
Reputation
6,820
Daps
53,820
Reppin
UK, DE, GY, DMV
updated to add invidious etc youtube viewer:

adjust HIDDEN_USERS list

const HIDDEN_USERS = ['Dookie Doo', 'user2', 'user3', ... , 'userN'];

view:

Screenshot-2026-04-28-at-14-38-49.png



Code:
// ==UserScript==
// @name         Hide Posts - TheColi
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Hide user + add youtube viewers ...
// @match        https://www.thecoli.com/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  const HIDDEN_USERS = ['Dookie Doo'];
  const REPLACEMENT = 'Ignored Member';
  const INV_HOSTS = [
      { host: 'inv.nadeko.net', label: 'inv.nadeko.net (Alternative Youtube Viewer)' },
      { host: 'invidious.nerdvpn.de', label: 'invidious.nerdvpn.de' }
  ];

  function extractYouTubeId(url) {
      if (!url) return null;
      const m = url.match(/(?:youtube(?:-nocookie)?\.com\/(?:embed\/|shorts\/|watch\?(?:[^#]*&)?v=)|youtu\.be\/)([A-Za-z0-9_-]{11})/);
      return m ? m[1] : null;
  }

  function buildInvidiousBlock(id) {
      const wrap = document.createElement('div');
      wrap.className = 'custom-youtube-links';
      wrap.style.cssText = 'margin-top: 8px; text-align: left; font-family: monospace; font-size: 90%;';
      INV_HOSTS.forEach((entry, i) => {
          if (i > 0) wrap.appendChild(document.createTextNode(' | '));
          const a = document.createElement('a');
          a.href = `https://${entry.host}/watch?v=${id}&hl=en-US`;
          a.target = '_blank';
          a.rel = 'noopener noreferrer';
          a.style.cssText = 'text-decoration: underline; color: #0066cc;';
          a.textContent = entry.label;
          wrap.appendChild(a);
      });
      return wrap;
  }

  function findEmbedId(embed) {
      // 1. Already-rendered iframe (s9e replaced the inner span)
      const iframe = embed.querySelector('iframe[src*="/embed/"]');
      if (iframe) {
          const id = extractYouTubeId(iframe.src);
          if (id) return id;
      }
      // 2. c2l oembed id
      const c2l = embed.querySelector('[data-s9e-mediaembed-c2l-oembed-id]');
      if (c2l) {
          const id = c2l.getAttribute('data-s9e-mediaembed-c2l-oembed-id');
          if (id) return id;
      }
      // 3. Pre-render iframe data attribute
      const iframeHost = embed.querySelector('[data-s9e-mediaembed-iframe]');
      if (iframeHost) {
          try {
              const p = JSON.parse(iframeHost.getAttribute('data-s9e-mediaembed-iframe'));
              const i = p.indexOf('src');
              if (i >= 0) {
                  const id = extractYouTubeId(p[i + 1]);
                  if (id) return id;
              }
          } catch (e) {}
      }
      // 4. Thumbnail background URL
      const styleEls = embed.querySelectorAll('[style*="ytimg.com"]');
      for (const el of styleEls) {
          const bg = el.getAttribute('style') || '';
          const m = bg.match(/\/vi\/([A-Za-z0-9_-]{11})\//);
          if (m) return m[1];
      }
      return null;
  }

  function addInvidiousLinks(root) {
      root.querySelectorAll('span[data-s9e-mediaembed="youtube"]').forEach(embed => {
          if (embed.dataset.invAdded) return;
          const id = findEmbedId(embed);
          if (!id) return;
          embed.parentNode.insertBefore(buildInvidiousBlock(id), embed.nextSibling);
          embed.dataset.invAdded = '1';
      });

      root.querySelectorAll('.bbWrapper a[href*="youtube.com"], .bbWrapper a[href*="youtu.be"]').forEach(a => {
          if (a.dataset.invAdded) return;
          const id = extractYouTubeId(a.href);
          if (!id) return;
          a.insertAdjacentElement('afterend', buildInvidiousBlock(id));
          a.dataset.invAdded = '1';
      });
  }

  function hideAll(root) {
      root = root || document;

      HIDDEN_USERS.forEach(user => {
          root.querySelectorAll(`article.message[data-author="${user}"]`).forEach(el => {
              el.style.display = 'none';
          });
          root.querySelectorAll(`blockquote[data-quote="${user}"]`).forEach(el => {
              el.style.display = 'none';
          });
          root.querySelectorAll('li.alert .username').forEach(el => {
              if (el.textContent.trim() === user) {
                  const li = el.closest('li.alert');
                  if (li) li.style.display = 'none';
              }
          });
          root.querySelectorAll('.reactionsBar-link bdi').forEach(el => {
              if (el.textContent.trim() === user) {
                  el.style.display = 'none';
                  const prev = el.previousSibling;
                  if (prev && prev.nodeType === Node.TEXT_NODE) {
                      prev.textContent = prev.textContent.replace(/,\s*$/, '');
                  }
                  const link = el.closest('.reactionsBar-link');
                  if (link) {
                      const remaining = Array.from(link.querySelectorAll('bdi'))
                          .filter(b => b.style.display !== 'none');
                      if (remaining.length === 0) {
                          const bar = link.closest('.reactionsBar') || link.parentElement;
                          if (bar) bar.style.display = 'none';
                          else link.style.display = 'none';
                      }
                  }
              }
          });

          root.querySelectorAll(`.structItem--thread[data-author="${user}"]`).forEach(item => {
              item.querySelectorAll('.structItem-parts .username').forEach(el => {
                  el.replaceWith(document.createTextNode(REPLACEMENT));
              });
          });
      });

      root.querySelectorAll('.structItem-cell--latest .username').forEach(el => {
          if (HIDDEN_USERS.includes(el.textContent.trim())) {
              el.replaceWith(document.createTextNode(REPLACEMENT));
          }
      });

      root.querySelectorAll('.node-extra-row .username').forEach(el => {
          if (HIDDEN_USERS.includes(el.textContent.trim())) {
              el.replaceWith(document.createTextNode(REPLACEMENT));
          }
      });

      addInvidiousLinks(root);
  }

  hideAll();

  new MutationObserver(muts => {
      for (const m of muts) {
          for (const n of m.addedNodes) {
              if (n.nodeType !== 1) continue;
              // If an iframe was just inserted, find its s9e wrapper and process it
              if (n.tagName === 'IFRAME' && /youtube.*\/embed\//.test(n.src || '')) {
                  const wrapper = n.closest('span[data-s9e-mediaembed="youtube"]');
                  if (wrapper && !wrapper.dataset.invAdded) {
                      const id = extractYouTubeId(n.src);
                      if (id) {
                          wrapper.parentNode.insertBefore(buildInvidiousBlock(id), wrapper.nextSibling);
                          wrapper.dataset.invAdded = '1';
                      }
                  }
                  continue;
              }
              hideAll(n);
          }
      }
  }).observe(document.body, { childList: true, subtree: true });
})();
 
Top