Last active
February 10, 2020 15:06
-
-
Save leftdevel/c1b3508041226e27cda1084483536126 to your computer and use it in GitHub Desktop.
delete github branches on screen
This file contains 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
// Using this for branches displayed on the "stale branches" page, under https://github.com/yourOrg/yourProject/branches/stale | |
// Meant to be copy & paste into the browser console. | |
var i = 0; | |
function deleteOne() { | |
// Idempotent selector, should select only Delete buttons that are not already clicked. When clicked, the UI | |
// updates and replaces Details class with Details--on. | |
var deleteButton = document.querySelectorAll('li.Details form button.text-red.js-branch-delete-target')[i]; | |
if (typeof deleteButton === 'undefined') { | |
return false; | |
} | |
deleteButton.click(); | |
return true; | |
} | |
var id = setInterval(function() { | |
try { | |
if (!deleteOne()) { | |
clearInterval(id); | |
} | |
i += 1; | |
} catch (e) { | |
clearInterval(id); | |
throw e; | |
} | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment