Unfortunate-Maps RES Preview Image Proxy

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

当前为 2020-12-05 提交的版本,查看 最新版本

  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. (function() {
  12. 'use strict';
  13. $(function(){
  14. console.log("loaded");
  15. setTimeout(() => {
  16. $(".nestedlisting .expando-button").click(updateUMImages);
  17. }, 1000);
  18. });
  19.  
  20. setInterval(() => {
  21. $(".nestedlisting .res-image-media").each(function(){
  22. let imageSRC = $(this).attr("src");
  23. if(!imageSRC.includes("unfortunate")) return;
  24. if(imageSRC.includes("parretlabs.xyz:8006")) return;
  25.  
  26. $(this).attr("src", `https://parretlabs.xyz:8006/proxy?link=${imageSRC}&isBlob=1&type=image/png`);
  27. });
  28. }, 1000);
  29.  
  30. function updateUMImages() {
  31. setTimeout(() => {
  32. let imageSRC = $(this).parent().parent().find(".res-image-media").attr("src");
  33. if(!imageSRC.includes("unfortunate")) return;
  34. if(imageSRC.includes("parretlabs.xyz:8006")) return;
  35. $(this).parent().parent().find(".res-image-media").attr("src", `https://parretlabs.xyz:8006/proxy?link=${imageSRC}&isBlob=1&type=image/png`);
  36. }, 200);
  37. }
  38. // Your code here...
  39. })();