Kelsondre69

needed

May 19th, 2025
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Replace and Enlarge Image
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Replace specific image and enlarge it
  6. // @match *://*/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. const originalSrc = "https://d35aaqx5ub95lt.cloudfront.net/vendor/70a4be81077a8037698067f583816ff9.svg";
  14. const newSrc = "https://files.catbox.moe/57xv08.jpg";
  15. const newWidth = "200px"; // You can change this to whatever size you want
  16. const newHeight = "auto"; // Keeps aspect ratio, or specify e.g. "150px"
  17.  
  18. function replaceAndResizeImage() {
  19. const images = document.querySelectorAll('img.sOuBs');
  20. images.forEach(img => {
  21. if (img.src === originalSrc) {
  22. img.src = newSrc;
  23. img.style.width = newWidth;
  24. img.style.height = newHeight;
  25. }
  26. });
  27. }
  28.  
  29. // Run on initial load
  30. replaceAndResizeImage();
  31.  
  32. // Observe DOM changes in case the image is loaded dynamically
  33. const observer = new MutationObserver(replaceAndResizeImage);
  34. observer.observe(document.body, {
  35. childList: true,
  36. subtree: true
  37. });
  38. })();
  39.  
Add Comment
Please, Sign In to add comment