Skip to content

Instantly share code, notes, and snippets.

@konecnyna
Last active September 17, 2021 17:40
Show Gist options
  • Save konecnyna/9141b38578d5f1faadc69a8c6bcc04f0 to your computer and use it in GitHub Desktop.
Save konecnyna/9141b38578d5f1faadc69a8c6bcc04f0 to your computer and use it in GitHub Desktop.
const fun = `
(async () => {
const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
const btns = [...document.getElementsByClassName("btn")].filter( it => it.title === "Add to Card");
for (let i = 0; i < btns.length; i++) {
btns[i].click();
await sleep(1000);
}
})()
`;
console.log(`javascript: {${fun.replace(/\n+/g, '')}}; void (0);`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment