Fix redirect links in 5ch

Fix links in 5ch thread page so it will directly jump to the target page

  1. // ==UserScript==
  2. // @name Fix redirect links in 5ch
  3. // @namespace https://greasyfork.org/users/57176
  4. // @match https://*.5ch.net/*/read.cgi/**
  5. // @icon https://egg.5ch.net/favicon.ico
  6. // @grant none
  7. // @version 1.0.0
  8. // @author peng-devs
  9. // @description Fix links in 5ch thread page so it will directly jump to the target page
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'strict';
  15.  
  16. const NAME = 'fix-5ch-redirect-links';
  17.  
  18. function main() {
  19. console.log(`[${NAME}] initializing...`);
  20.  
  21. document.querySelectorAll('a[target="_blank"]').forEach(a => {
  22. const url = new URL(a.href);
  23. if (url.host !== 'jump.5ch.net') return;
  24.  
  25. a.href = a.href.split('?')[1];
  26. });
  27.  
  28. console.log(`[${NAME}] loaded`);
  29. }
  30.  
  31. main();
  32. }());