Discussions » Creation Requests

Tampermonkey Script

§
Posted: 2017-02-11

Tampermonkey Script

Hallo.
Sry my English is not good.
I need help for to write a script.
I will replace a img on a website and I have no Idee was i do.

The site is
http://stuniverse.de/

And I will replace this img. Zb

http://stuniverse.de/gfx//rassen/1.png

To this

http://stuniverse.de/gfx//rassen/2.png

Can say what have I done.
Or please a send me a script. White the replace from 1 img. For more img can I copy the code and replace the links.

Thanks for help.

§
Posted: 2017-03-02
Edited: 2017-03-02

How about

// ==UserScript==
// @name         Stuniverse image swapper
// @namespace    Danielv123
// @version      0.1
// @description  Swaps images
// @author       Danielv123
// @match        http://stuniverse.de/*
// @grant        none
// ==/UserScript==
images = document.querySelectorAll("img");
for(i=0;i<images.length;i++){
    if(images[i].src == "http://stuniverse.de/gfx//rassen/1.png"){
        images[i].src = "http://stuniverse.de/gfx//rassen/2.png";
    }
}

Tell me if there are any problems with this snippet, possibly give link to where on the page this image appears as I couldn't find it.

Post reply

Sign in to post a reply.