Created
October 3, 2015 12:23
-
-
Save rkachowski/b0140a2e5585caeb4b66 to your computer and use it in GitHub Desktop.
jquery script to grab all the large preview photos from http://marathonfoto.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var images = $('img[src$=".jpg"]'); | |
| var frame_ids = $.map(images, function(el, index){ return $(el).attr("frameid")}); | |
| var urls = $.map(frame_ids, function(el, index){ return "/Ajax/Zoom/?frameid=" + el}); | |
| var responses = []; | |
| $.each(urls, function(index, el){ resp = $.get(el, null, function(data){responses.push(data)}) }); | |
| function getImagesUrlsFromServerResponses(responses) | |
| { | |
| var regex = /.*Vertical.*'(.*)'/; | |
| var encoded = $.map(responses, function(element,index){ | |
| var match = regex.exec(element); | |
| if(match != null){return match[1]} | |
| }); | |
| var decoded = $.map(encoded, function(element, index){ | |
| return $("<div/>").html(element).text(); | |
| }); | |
| return decoded; | |
| } | |
| function downloadURI(uri, name) | |
| { | |
| var link = document.createElement("a"); | |
| link.download = name; | |
| link.href = uri; | |
| link.click(); | |
| } | |
| function downloadAll() | |
| { | |
| image_urls = getImagesUrlsFromServerResponses(responses); | |
| $.each(image_urls, function(index, el){ | |
| downloadURI(el, "photo"+index); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, nice job!
how should I run the script? how can I pass the args? I'm not very good with js and html.
Regards.