Skip to content

Instantly share code, notes, and snippets.

@sudodoki
Last active August 29, 2015 14:22
Show Gist options
  • Save sudodoki/c3026dac949d99c44bb2 to your computer and use it in GitHub Desktop.
Save sudodoki/c3026dac949d99c44bb2 to your computer and use it in GitHub Desktop.
rubyc_photos
var urls = []
function repeat(operationWithCb, num) {
if (num <= 0) return
operationWithCb(function () {
return repeat(operationWithCb, --num)
})
}
function clickAndWait(cb) {
urls.push(document.querySelectorAll('.spotlight')[0].src)
document.querySelectorAll('.snowliftPager.next')[0].click()
setTimeout(cb, 1000);
}
repeat(clickAndWait, 30);
// --- after finished clicking
var resultMarkdown = urls.reduce(function (stringedUrls, url) {
stringedUrls += '![photo](' + url + ')\n'
return stringedUrls
}, '')
console.log(resultMarkdown);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment