Replace GIFs on globalpixel.xyz

Replace GIFs with the names ua.gif, ru.gif, and by.gif on globalpixel.xyz

目前為 2023-12-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Replace GIFs on globalpixel.xyz
// @namespace    http://tampermonkey.net/
// @version      0.6
// @license      MIT
// @description  Replace GIFs with the names ua.gif, ru.gif, and by.gif on globalpixel.xyz
// @author       th3b3lg
// @match        https://globalpixel.xyz/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to replace GIFs
    function replaceGIFs() {
        // Get all images on the page
        var images = document.getElementsByTagName('img');

        // Loop through each image
        for (var i = 0; i < images.length; i++) {
            // Check if the image source contains 'ua.gif', 'ru.gif', or 'by.gif' (case-insensitive)
            if (images[i].src.toLowerCase().includes('ua.gif')) {
                // Replace the image source for ua.gif
                images[i].src = 'https://coffeesource.thetemmie.repl.co/ua.gif';
            } else if (images[i].src.toLowerCase().includes('ru.gif')) {
                // Replace the image source for ru.gif
                images[i].src = 'https://coffeesource.thetemmie.repl.co/ru.gif';
            } else if (images[i].src.toLowerCase().includes('by.gif')) {
                // Replace the image source for by.gif
                images[i].src = 'https://coffeesource.thetemmie.repl.co/by.gif';
            }
        }
    }

    // Create a MutationObserver to detect changes in the DOM
    var observer = new MutationObserver(replaceGIFs);

    // Options for the observer (in this case, we're observing changes to the subtree)
    var observerConfig = { subtree: true, childList: true };

    // Start observing the target node for configured mutations
    observer.observe(document.body, observerConfig);

    // Replace GIFs on page load
    replaceGIFs();
})();