Last active
January 11, 2024 08:12
-
-
Save ethaniel/71ff16b9b1d91ee706836ed8a57b2e77 to your computer and use it in GitHub Desktop.
Batch/bulk delete Cloudflare DNS records without API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy-paste this into your browser's console. | |
// WARNING: This will delete ALL DNS RECORDS that are visible on the current page one by one. | |
// It might take 5-10 seconds to delete one DNS record. | |
// Based on https://community.cloudflare.com/t/useful-script-to-bulk-delete-all-incorrectly-imported-dns-records/131144 | |
// Valid for 11 January 2024. Might need to be redone later. | |
(() => { | |
const deleteTopRecord = () => { | |
if (document.querySelector('[data-testid="dns-delete-modal-confirm-button"]')) { | |
setTimeout(deleteTopRecord, 500); | |
} else { | |
var elList = document.querySelectorAll("span"); | |
skip = false; | |
elList.forEach(function(el) { | |
if (skip) { | |
return; | |
} | |
if (el.innerHTML == "Edit") { | |
console.log(el); | |
skip = true; | |
el.parentElement.click(); | |
document.querySelector('[data-testid="dns-record-form-delete-button"]').click(); | |
document.querySelector('[data-testid="dns-delete-modal-confirm-button"]').click(); | |
setTimeout(deleteTopRecord, 500); | |
} | |
}); | |
} | |
}; | |
deleteTopRecord(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment