Redirect Slashdot entries to source

Automatically redirects to the source of a Slashdot article

当前为 2018-11-07 提交的版本,查看 最新版本

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