Comment

Comment by joshwa

  // ==UserScript==
  // @name				 news.yc open in new tab
  // @namespace		 http://joshwand.com/
  // @description	 opens links on news.yc's list pages in new tabs/windows
  // @include			 http://news.ycombinator.com/
  // @include			 http://news.ycombinator.com/news
  // @include			 http://news.ycombinator.com/newest
  // @include			 http://news.ycombinator.com/x?*

  // ==/UserScript==

  var a, links, thisdomain;
  thisdomain = window.location.host;

  links = document.getElementsByTagName('a');
  for (var i = 0; i < links.length; i++) {
      a = links[i];
      if (a.host && (a.host != thisdomain || String(a).match(/item\?id=/))) {
          a.target = "_blank";
      }
  }
parent joshwa 18 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton