Replace Images with Animated Smiley

Replaces all images (including JPG, PNG, GIF, etc.) on the page with an animated smiley.

  1. // ==UserScript==
  2. // @name Replace Images with Animated Smiley
  3. // @namespace your-namespace
  4. // @version 1.0
  5. // @description Replaces all images (including JPG, PNG, GIF, etc.) on the page with an animated smiley.
  6. // @author Your Name
  7. // @match https://zelenka.guru/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var smileyImageUrl = 'https://lztcdn.com/files/310336b3-c10e-4ad1-8fdf-0bbe73835ca1.webp';
  15.  
  16. function replaceImagesWithSmiley() {
  17. var images = document.querySelectorAll('img, span.img.m, span.img.s');
  18.  
  19. for (var i = 0; i < images.length; i++) {
  20. if (images[i].tagName === 'IMG') {
  21. images[i].src = smileyImageUrl;
  22. } else if (images[i].style.backgroundImage) {
  23. images[i].style.backgroundImage = 'url(' + smileyImageUrl + ')';
  24. }
  25. }
  26.  
  27. // Set the avatar as the background of the body
  28. document.body.style.backgroundImage = 'url(' + smileyImageUrl + ')';
  29. document.body.style.backgroundSize = 'cover';
  30. document.body.style.backgroundPosition = 'center center';
  31. document.body.style.backgroundAttachment = 'fixed';
  32. document.body.style.backgroundRepeat = 'no-repeat';
  33. }
  34.  
  35. replaceImagesWithSmiley(); // Replace images initially
  36.  
  37. // Set an interval to check and replace images every second
  38. setInterval(replaceImagesWithSmiley, 1000);
  39. })();