Agency Based Discussion > Bigstock.com

Request for Sean L.

<< < (2/4) > >>

Semmick Photo:

--- Quote from: Sean Locke Photography on February 28, 2015, 10:56 ---I don't have an account there, so it would be really hard.  The script isn't too insane though.  With a little time, you could probably tweak it.  It helps to have firebug so you can find the objects on the page the various things are in.

--- End quote ---
I have never coded before, but I will look at it to see if I can find anything that makes sense to me and change it. LOL

thanks,

Sean Locke Photography:
Ok, so under the function showThumbs, the first section grabs all the links on the page with the document.links function.  It then steps through them to find all the ones that match "media", since each file in the list on the page is linked to like this:
href="/media/MABDFyKV0GQ"

And it puts a reference to each of the link objects into an array - linkObjs.  So, you need to change that to pick out the image details page links.  The next bit from table through label.setAttribute just makes a new header column for the table, so you need to figure out how to find that area of the document.  I know the table has the className of "list" and is the only one with that class, so it's easy to find.

Then the
ajaxStream[0].makeRequest(myDataUrl, linkObjs[j], addThumbnailImage);
kicks off the call to each image details page, with the url to the page, a reference to the link object on the sales page, and the function to do when the call is finished.

Once the ajax finishes its magic, it runs the addThumbnailImage function, giving it all the source from the called page, and the "elementToChange" which is the reference to the link object.  It then grabs all the images on the called page with div.getElementsByTagName('img'); and steps through them one by one to see if their .id attribute is "mainImage" .  The rest just takes the linkObject reference from before, steps up into the table cell it is in, then up into the table row, and adds a new cell at the end.  Into that goes a created image pointing to the thumbnail.  The big image on the image details page is like:
https://d117r1wt3t6ahr.cloudfront.net/MABDFyKV0GQ/1/screen.jpg
And I found that the thumbnail is:
https://d117r1wt3t6ahr.cloudfront.net/MABDFyKV0GQ/1/thumbnail.jpg
So, I search and replace on the img.src string to switch to the thumb.

So, all those bits need to change based on the BS pages.  It shouldn't be hard if you go step by step.

Semmick Photo:
Cheers Sean, appreciated. If I have a result I will post here, if not, as well. Haha.

Semmick Photo:
Sean, been looking at this, but I think there is a challenge. You are referring to this


--- Quote --- under the function showThumbs, the first section grabs all the links on the page with the document.links function.  It then steps through them to find all the ones that match "media", since each file in the list on the page is linked to like this:
href="/media/MABDFyKV0GQ"
--- End quote ---

So when I check the details for the BS image it seems that they generate a unique link for every image. Not sure how to pull this into the script.

Image-xxxxxxxxx

Sean Locke Photography:
You should be able to match on that.  Just change:
         if (str.match(/media/g))
to
         if (str.match(/image-/g))

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version