Skip to content

Instantly share code, notes, and snippets.

@bleszerd
Last active May 6, 2024 20:34
Show Gist options
  • Save bleszerd/53936d9db7e0dc511782c1cb2aa521a7 to your computer and use it in GitHub Desktop.
Save bleszerd/53936d9db7e0dc511782c1cb2aa521a7 to your computer and use it in GitHub Desktop.
This script contain logic to remove all photos from google photos without any click
const MAIN_LOOP_INTERVAL = 1000
const REMOVE_REMINDER_BAR_TIMEOUT = 100
const SELECT_ALL_VISIBLE_CHECKBOX_TIMEOUT = 350
const CLICK_ON_DELETE_BUTTON_TIMEOUT = 600
const CLICK_ON_MOVE_TO_TRASH_BUTTON_TIMEOUT = 850
const removeReminderBar = () => {
setTimeout(() => {
document.querySelector('c-wiz > div > c-wiz > div > c-wiz > div')?.remove()
document.querySelector('div[style="position: absolute; width: 1038px; height: 248px; transform: translate3d(0px, 88px, 0px);"]')?.remove()
}, REMOVE_REMINDER_BAR_TIMEOUT);
}
const selectAllVisibleCheckbox = () => {
setTimeout(() => {
const dayCheckboxList = document.querySelectorAll('div.QcpS9c.ckGgle[role="checkbox"]')
dayCheckboxList.forEach((checkBox) => {
checkBox.click()
})
}, SELECT_ALL_VISIBLE_CHECKBOX_TIMEOUT);
}
const clickOnDeleteButton = () => {
setTimeout(() => {
const deleteButton = document.querySelector('div > c-wiz > div > div > div > div > div:nth-child(3) > span > button')
deleteButton?.click()
}, CLICK_ON_DELETE_BUTTON_TIMEOUT);
}
const clickOnMoveToTrashButton = () => {
setTimeout(() => {
const moveToTrashButton = document.querySelector('div > div > div > div > div > div > div > button.kDryjd')
moveToTrashButton?.click()
}, CLICK_ON_MOVE_TO_TRASH_BUTTON_TIMEOUT);
}
setInterval(() => {
removeReminderBar()
selectAllVisibleCheckbox()
clickOnDeleteButton()
clickOnMoveToTrashButton()
}, MAIN_LOOP_INTERVAL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment