Redirect Slashdot entries to source

Automatically redirects to the source of a Slashdot article

  1. // ==UserScript==
  2. // @name Redirect Slashdot entries to source
  3. // @description Automatically redirects to the source of a Slashdot article
  4. // @version 4
  5. // @grant none
  6. // @noframes
  7. // @include /https?://(\w*\.)?slashdot.org/story/.+$/
  8. // @namespace https://greasyfork.org/users/4654
  9. // ==/UserScript==
  10.  
  11. const sources = document.getElementsByClassName('story-sourcelnk');
  12. const timeout = 2000;
  13.  
  14. if (sources.length > 0) {
  15. console.log('Found this source for the article, redirecting to', sources[0].href, 'in', timeout, 'ms');
  16. window.setTimeout(() => window.location = sources[0].href, timeout);
  17. }