Imgur Mirror By El9in

Imgur Mirror

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Imgur Mirror By El9in
// @namespace    Imgur Mirror By El9in
// @include http://*/*
// @include https://*/*
// @version      0.1
// @description  Imgur Mirror
// @author       You
// @match        *
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zelenka.guru
// @license      el9in
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function init() {
        const images = document.getElementsByTagName('img');
        for (var i = 0; i < images.length; i++) {
            const img = images[i];
            const src = img.getAttribute('src');
            if (src && src.includes('i.imgur.com')) {
                const newSrc = src.replace('i.imgur.com', 'i.imgurp.com');
                img.setAttribute('src', newSrc);
            }
        }
    }
    const observer = new MutationObserver((mutationsList, observer) => {
    	for (const mutation of mutationsList) {
    		if (mutation.type === 'childList') {
    			setTimeout(function() {
    				init();
    			},1000);
    		}
    	}
    });
    const config = { childList: true, subtree: true };
    observer.observe(document.body, config);
    init();
})();