B
B
BUSHA2010-11-04 17:03:24
JavaScript
BUSHA, 2010-11-04 17:03:24

How to automatically pull and modify the link to the image from the source code of the page?

Can you please tell me how to extract and modify the link to the image from the source code of the page? Preferably through userscript for opera.
Target: photo of goods, for example - direct.asda.com/george/shoes/ladies-shoes/boots/fa...
In the code you can find a direct link to the image - http://asda.scene7.com/is/image/ Asda/5052341219998...
If you change the parameter ?hei=400 to ?hei=2000, then the image is displayed in the maximum size, for example - http://asda.scene7.com/is/image/Asda/5052341219998...
Attention, connoisseurs , question :)
How to automate this business through userjs for opera, so that, for example, a link appears next to the product photo, which would lead to a picture of the maximum size, so that it would be convenient to save it?
Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Psych0, 2010-11-18
@Psych0

And yet this is not JAVA ... The tag should be removed. This is how JS is required. But in essence: there is Jquery.
We hang the script on the page and in it something like this script:
we get the path of the default image for the product $("#backImageSjElement4_img").attr('src') in this element the first image loaded is stored. Now we need to take the ID of the picture from our src, we can leave all other attributes as they are ... they are the same for all pictures. In your example, asda.scene7.com/is/image/Asda/5052341219998?hei=2000&wid=370&resmode=sharp&op_usm=1.1,0.5,0,0, the ID is 5052341219998. We got our attribute by regularity. Now we take and insert it into a new path that is the same for everyone, only the ID changes -
“asda.scene7.com/is/image/Asda/” + our ID received earlier+"?hei=2000&wid=370&resmode=sharp&op_usm=1.1,0.5,0,0". We create our tag and throw it in href our path just created. we throw a tag for example in a div with a picture where $("#SjElement3 div") is our dear div :) $("#SjElement3 div").add(ourNewElement);
Well, in short, I sort of described it :) In essence, JS is simple, so if you don’t want to use JQUEry, then write the same thing in native :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question