Created
March 21, 2017 23:12
-
-
Save cxmcc/839d5eba7b24af04282b5dd9fb7d103b to your computer and use it in GitHub Desktop.
Nuke all Closed and Merged branches on a github web page.
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
// Paste into console | |
// Need to disable Content Security Policy in your browser | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var branch_actions = $('.branch-actions'); | |
$.each(branch_actions, function() { | |
var first_child = this.children[0]; | |
if (first_child != undefined && $(first_child).attr('class') == 'pr-details') { | |
var state = $(first_child.children[1]); | |
var klass = state.attr('class'); | |
if (klass == "state state-closed" || klass == "state state-merged") { | |
console.log($(first_child.children[1]).attr('title')) | |
var form = this.children[1]; | |
var button = form.children[1]; | |
$(button).click(); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment