Skip to content

Instantly share code, notes, and snippets.

@chamakits
Created November 7, 2017 06:25
Show Gist options
  • Save chamakits/a0980ea8ce4d085426525df14275b042 to your computer and use it in GitHub Desktop.
Save chamakits/a0980ea8ce4d085426525df14275b042 to your computer and use it in GitHub Desktop.
javascript: function runDownloadThing(howManyToDownload) {
if (!howManyToDownload) {
howManyToDownload = 3;
}
if (window['downloadSome']) {
window.downloadSome();
return;
}
var iter = $('div.download a.a:not([download])').toArray();
iter = iter.concat($('div.row a[download]').toArray());
window['downloadSome'] = (function() {
console.log("Downloads left: ", iter.length);
var someToDownload = iter.slice(0, howManyToDownload);
someToDownload.forEach(function(curr) {
curr.click();
});
iter = iter.slice(howManyToDownload);
});
window.downloadSome();
}
runDownloadThing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment