Last active
August 29, 2015 14:25
-
-
Save balaclark/03a375c4398bae5eb58c to your computer and use it in GitHub Desktop.
Hacky way to download all items from within a smugmug gallery
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
downloadImages() | |
function downloadImages () { | |
var nextBtn = document.querySelector('.sm-gallery-image-pagination [data-value="right"]') | |
var current = -1 | |
var total = 0 | |
download(function () { | |
var index = document.querySelector('.sm-gallery-image-totals').textContent.split('/') | |
current = parseInt(index[0], 10) | |
total = parseInt(index[1], 10) | |
if (current < total) { | |
nextBtn.click() | |
setTimeout(downloadImages, (current % 10 === 0) ? 7000 : 2000) | |
} | |
}) | |
} | |
function download (cb) { | |
document.querySelector('.sm-button-image-download').click() | |
setTimeout(cb, 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment