Skip to content

Instantly share code, notes, and snippets.

@sbolel
Created October 24, 2020 02:40
Show Gist options
  • Save sbolel/7244b0c8f823d747f6d8add70cc77745 to your computer and use it in GitHub Desktop.
Save sbolel/7244b0c8f823d747f6d8add70cc77745 to your computer and use it in GitHub Desktop.
Google Voice Deletion Script
/**
* Script that deletes all Google Voice items visible in the current list.
* @param {number} timeout - milliseconds to wait between each dialog opening.
* @usage copy and paste into JS console.
*/
(function(timeout){
const getConfirm = () => document.querySelector('[gv-test-id="dialog-confirm-button"]')
const getDelete = () => document.querySelector('[icon-name="delete"]')
const getFirst = () => document.querySelector('[gv-test-id="conversation-avatar-or-checkmark"]')
const getRest = () => document.querySelectorAll('div[md-virtual-repeat]').splice(0, 1)
const getFifthChild(node) => node.children[0].children[0].children[0].children[0].children[0]
setInterval(() => {
getFirst().click()
setTimeout(() => getRest().forEach((value) => getFifthChild(value).click(), timeout)
setTimeout(() => getDelete().click(), timeout)
setTimeout(() => getConfirm().click(), timeout)
}, 2000)
})(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment