Old Reddit Image Loader

add images in comments

  1. // ==UserScript==
  2. // @name Old Reddit Image Loader
  3. // @namespace https://rant.li/boson
  4. // @match *://*.reddit.com/*
  5. // @grant none
  6. // @version 1.1
  7. // @author Boson
  8. // @description add images in comments
  9. // @license GNU AGPLv3
  10. // ==/UserScript==
  11. [...document.querySelectorAll('a')].forEach((element) => {
  12. if(element.innerHTML == '<image>'){
  13. const my_img = document.createElement('img');
  14. my_img.src = element.href;
  15. my_img.style = 'max-width:240px;width:100%';
  16. element.replaceWith(my_img);
  17. }
  18. });