Comment

Comment by smnrg

Userscript/Violentmonkey version

  // ==UserScript==
  // @name         Hide Specific HN Entries
  // @namespace    Violentmonkey Scripts
  // @version      0.1
  // @description  Hide HN entries from specific websites
  // @author       h_o_o_t, smnrg
  // @match        https://news.ycombinator.com/*
  // @grant        none
  // ==/UserScript==

  (function() {
      'use strict';

      const blockedSites = [
          'businessinsider.com',
          'dailymail.co.uk',
          'foxnews.com',
          'theverge.com',
          'cnn.com',
          'reuters.com',
          'zerohedge.com',
          'insider.com',
          'bloomberg.com',
          'euronews.com',
          'theguardian.com',
          'wsj.com',
          'ft.com',
          'theconversation.com',
          'thetimes.co.uk',
          'bbc.co.uk',
          'nytimes.com',
          'newyorker.com',
          'theatlantic.com',
          'bbycroft.net'
      ];

      const entries = document.querySelectorAll('table:not(.fatitem) tr > td.title');

      entries.forEach(entry => {
          const link = entry.querySelector('a');
          if (link && blockedSites.some(site => link.href.includes(site))) {
              const row = entry.parentElement;
              row.style.display = 'none';
              if (row.nextElementSibling) row.nextElementSibling.style.display = 'none';
              if (row.nextElementSibling && row.nextElementSibling.nextElementSibling) row.nextElementSibling.nextElementSibling.style.display = 'none';
          }
      });
  })();
parent smnrg 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton