Unfortunate-Maps RES Preview Image Proxy

Fixes u-m preview images not loading in RES expandos.

  1. // ==UserScript==
  2. // @name Unfortunate-Maps RES Preview Image Proxy
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description Fixes u-m preview images not loading in RES expandos.
  6. // @author Electro
  7. // @match https://*.reddit.com/r/TagPro/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. (function() {
  13. 'use strict';
  14. $(function(){
  15. console.log("loaded");
  16. setTimeout(() => {
  17. $(".expando-button").click(updateUMImages);
  18. }, 1000);
  19. });
  20.  
  21. setInterval(() => {
  22. $(".res-expando-link .res-image-media").each(function(){
  23. let imageSRC = $(this).attr("src");
  24. if(!imageSRC.includes("unfortunate")) return;
  25. if(imageSRC.includes("parretlabs.xyz:8006")) return;
  26.  
  27. $(this).attr("src", `https://parretlabs.xyz:8006/proxy?link=${imageSRC}&isBlob=1&type=image/png`);
  28. });
  29. }, 1000);
  30.  
  31. function updateUMImages() {
  32. setTimeout(() => {
  33. let imageSRC = $(this).parent().parent().find(".res-image-media").attr("src");
  34. if(!imageSRC.includes("unfortunate")) return;
  35. if(imageSRC.includes("parretlabs.xyz:8006")) return;
  36. $(this).parent().parent().find(".res-image-media").attr("src", `https://parretlabs.xyz:8006/proxy?link=${imageSRC}&isBlob=1&type=image/png`);
  37. }, 200);
  38. }
  39. // Your code here...
  40. })();