const slideElements = document.getElementsByClassName('slide')
for (let i = 0; i < slideElements.length; i++) {
slideElements[i].removeAttribute('style')
}
function downloadImages() {
const images = document.getElementsByTagName('img')
let index = 0
function downloadNextImage() {
if (index >= images.length) {
console.log('All images downloaded.')
return
}
console.log(`Downloading image ${index + 1} of ${images.length}`)
const link = document.createElement('a')
link.href = images[index].src
const fileExtension = images[index].src.split('.').pop()
link.download = `image${index}.${fileExtension}`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
index++
setTimeout(downloadNextImage, 500)
}
downloadNextImage()
}
downloadImages()