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
(async () => { | |
const link = document.createElement('a'); | |
document.body.appendChild(link); | |
// loop through matching images | |
for (const image of document.querySelectorAll('.pv-inner img:first-child')) { | |
const path = image.style.backgroundImage.split('"')[1].replace(/-\d.jpg/, '-5.jpg'); | |
// filename of the image | |
link.download = new URL(path).pathname.replace(/^.*\//, ''); | |
// fetch the image, convert it to a data URL, set as the href of the link element |