Skip to content

Instantly share code, notes, and snippets.

@hawkapparel
Last active August 20, 2016 07:43
Show Gist options
  • Save hawkapparel/94e513ab63a336c43374dca2c4f42372 to your computer and use it in GitHub Desktop.
Save hawkapparel/94e513ab63a336c43374dca2c4f42372 to your computer and use it in GitHub Desktop.
var a = [];
for (var i = 0; i < 152; i++) {
if (i <= 9){
console.log("menor o igual a 9");
a[i] = $("<a class='wawa'>").attr("href","http://www.serebii.net/pokemongo/pokemon/00" + i + ".png").attr("download","img.png").appendTo("body");
//saveFile("http://www.serebii.net/pokemongo/pokemon/00" + i + ".png");
}
if (i > 9 && i <= 99){
console.log("decenas");
a[i] = $("<a class='wawa'>").attr("href","http://www.serebii.net/pokemongo/pokemon/0" + i + ".png").attr("download","img.png").appendTo("body");
//saveFile("http://www.serebii.net/pokemongo/pokemon/0" + i + ".png");
}
if (i > 99){
console.log("centenas");
a[i] = $("<a class='wawa'>").attr("href","http://www.serebii.net/pokemongo/pokemon/" + i + ".png").attr("download","img.png").appendTo("body");
//saveFile("http://www.serebii.net/pokemongo/pokemon/" + i + ".png");
};
a[i].click();
};
//trigger
for (var i = 0; i < wawa.length; i++) {
wawa[i].click();
};
source: http://stackoverflow.com/questions/17311645/download-image-with-javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment