Auto loading 5ch images

Automatically showing images on the 5ch thread page

  1. // ==UserScript==
  2. // @name Auto loading 5ch images
  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.1
  8. // @author peng-devs
  9. // @description Automatically showing images on the 5ch thread page
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'strict';
  15.  
  16. const NAME = '5ch-image-autoloading';
  17.  
  18. function main() {
  19. console.log(`[${NAME}] initializing...`);
  20.  
  21. document.querySelectorAll('a.image').forEach(a => {
  22. const url = new URL(a.text);
  23. if (url.host !== 'i.imgur.com' && url.host !== 'pbs.twimg.com') return;
  24.  
  25. a.innerHTML = `
  26. <img src="${a.text}" style="max-width: 80%; max-height: 40rem;" />
  27. `;
  28. });
  29.  
  30. console.log(`[${NAME}] loaded`);
  31. }
  32.  
  33. main();
  34. }());