Skip to content

Commit

Permalink
Merge pull request mrishab#55 from gradrix/making-checkbox-checker-wait
Browse files Browse the repository at this point in the history
  • Loading branch information
mrishab authored Feb 4, 2024
2 parents 1c7a6af + bb967c1 commit 650a079
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions delete_photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const TIME_CONFIG = {
press_button_delay: 2000
};

const MAX_RETRIES = 10;
const MAX_RETRIES = 1000;

let imageCount = 0;

Expand All @@ -27,12 +27,12 @@ let buttons = {
confirmationButton: null
}

let deleteTask = setInterval(() => {
let deleteTask = setInterval(async () => {
let attemptCount = 1;

do {
checkboxes = document.querySelectorAll(ELEMENT_SELECTORS['checkboxClass']);

await new Promise(r => setTimeout(r, 1000));
} while (checkboxes.length <= 0 && attemptCount++ < MAX_RETRIES);


Expand All @@ -43,6 +43,7 @@ let deleteTask = setInterval(() => {
return;
}

attemptCount = 1;
imageCount += checkboxes.length;

checkboxes.forEach((checkbox) => { checkbox.click() });
Expand Down

0 comments on commit 650a079

Please sign in to comment.