Hacker News new | ask | show | jobs
by runjake 733 days ago
I'm probably much older than you and I don't mind, and in fact, I regularly watch vertical videos. They don't bother me.

But here is some sloppy code you could create a basic browser extension and shove in content.js:

  function hideVerticalVideos() {
    const videos = document.querySelectorAll('video');
    videos.forEach(video => {
      if (video.videoHeight > video.videoWidth) {
        video.style.display = 'none';
      }
    });
  }

  // Run hideVerticalVideos() when the page loads
  window.addEventListener('load', hideVerticalVideos);

  // Run when the DOM updates
  const observer = new MutationObserver(hideVerticalVideos);
  observer.observe(document.body, { childList: true, subtree: true });