const create_dom_time = 50;
const download_time = 500;
const imgs = document.images;
const delay = imgs.length * create_dom_time;
const img_id_prep = "img_"
const create_a_dom = function (obj) {
let a = document.createElement("a");
a.id = obj.id;
a.target = "_blank";
a.href = obj.url;
a.download = obj.id;
document.body.appendChild(a);
}
for (let i = 0; i < imgs.length;i++){
create_a_dom({
id: img_id_prep + i,
url: imgs[i].src
});
}
setTimeout(function(){
for (let i = 0; i < imgs.length; i++) {
setTimeout( function timer() {
if (document.getElementById(img_id_prep + i)) {
document.getElementById(img_id_prep + i).click();
}
}, i*download_time );
}
}, delay)