Skip to content

Instantly share code, notes, and snippets.

@breakerh
Last active January 12, 2022 12:55
Show Gist options
  • Save breakerh/65effed319eec7f3dd8e1d72983dc573 to your computer and use it in GitHub Desktop.
Save breakerh/65effed319eec7f3dd8e1d72983dc573 to your computer and use it in GitHub Desktop.
If cloudflare adds ALOT of records, use this script to remove them
const findButtonByText = text => [...document.querySelectorAll('button')]
.find(btn => btn.textContent.includes(text));
const func = () => {
document.querySelector("button[data-testid='dns-table-row-edit-link']").click();
window.setTimeout(function() {
findButtonByText('Delete').click();
window.setTimeout(function() {
let b = document.querySelectorAll("button");
b[b.length - 1].click();
}, 500);
}, 500);
};
const floop = () => {
// add better check to see if there's no record or another page.
window.setTimeout(function() {
func();
if (document.querySelector("button[data-testid='dns-table-row-edit-link']")) {
console.log('new find');
floop();
} else
console.log('Done');
}, 7000);
}
floop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment