Skip to content

Instantly share code, notes, and snippets.

@balaclark
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balaclark/03a375c4398bae5eb58c to your computer and use it in GitHub Desktop.
Save balaclark/03a375c4398bae5eb58c to your computer and use it in GitHub Desktop.
Hacky way to download all items from within a smugmug gallery
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