Redirect Slashdot entries to source

Automatically redirects to the source of a Slashdot article

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name     Redirect Slashdot entries to source
// @description   Automatically redirects to the source of a Slashdot article
// @version  4
// @grant    none
// @noframes
// @include  /https?://(\w*\.)?slashdot.org/story/.+$/
// @namespace https://greasyfork.org/users/4654
// ==/UserScript==

const sources = document.getElementsByClassName('story-sourcelnk');
const timeout = 2000;

if (sources.length > 0) {
  console.log('Found this source for the article, redirecting to', sources[0].href, 'in', timeout, 'ms');
  window.setTimeout(() => window.location = sources[0].href, timeout);
}