Last active
August 29, 2015 14:22
-
-
Save sudodoki/c3026dac949d99c44bb2 to your computer and use it in GitHub Desktop.
rubyc_photos
This file contains 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 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