Little Userscript for jpg4 and jpg6 Images

Home Page Forums General Chat Little Userscript for jpg4 and jpg6 Images

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2064556
    Lewd18Ratio
    Participant
    Rank: Rank 3

    Hey everyone,

    I created a simple userscript to address an issue I encounter here. It's annoying when images hosted on simp4.jpg.church and simp6.jpg.church don't load properly due to outdated URLs.

    This script automatically replaces these old URLs with the correct ones (simp4.host.church and simp6.host.church) so you can view the images hassle-free.

    You can download the userscript here.

    You can use any Userscipt extension you want. (Tampermonkey, Greazyfork, Violentmonkey, ...)

    Here also the code if you want to paste it directly

    
    // ==UserScript==
    // @name         Replace Image Host URL from JPG4 and JPG6
    // @version      0.1
    // @description  Replace image host URLs from simp4.jpg.church and simp6.jpg.church to their corresponding host URLs
    // @author       L18R
    // @match        https://zonegfx.com/*
    // @grant        none
    // ==/UserScript==
    
    (function() {
        'use strict';
        function replaceImageHostURL() {
            const images = document.querySelectorAll('img[src*="https://simp4.jpg.church/"], img[src*="https://simp6.jpg.church/"]');
            images.forEach(img => {
                try {
                    img.src = img.src.replace('https://simp4.jpg.church/', 'https://simp4.host.church/')
                                     .replace('https://simp6.jpg.church/', 'https://simp6.host.church/');
                } catch (error) {
                    console.error('Error replacing image host URL:', error);
                }
            });
        }
        setTimeout(replaceImageHostURL, 250);
        const observer = new MutationObserver(mutationsList => {
            mutationsList.forEach(mutation => {
                if (mutation.type === 'childList') {
                    replaceImageHostURL();
                }
            });
        });
        observer.observe(document.body, { subtree: true, childList: true });
    })();
    
    #2064562
    TheDamnThing
    Participant
    Rank: Rank 5

    This works great! Thank you so much for sharing this gem 🙂

    #2064564
    Lewd18Ratio
    Participant
    Rank: Rank 3

    I'm glad it helps you 😀

    #2064683
    Phegor
    Participant
    Rank: Rank-1

    This is amazing, thank you very much.

    #2064747
    Lewd18Ratio
    Participant
    Rank: Rank 3

    I am happy to hear it 😀

    Edit: read* ;D

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

 

Post You Might Like