Created
January 31, 2019 16:23
-
-
Save jacobkahn/3d84b19a89db513857571404f1292cc3 to your computer and use it in GitHub Desktop.
Unsubscribe from Repositories in an Org
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
function unwatchOrgRepos(orgName, repoNameFirstFourChars) { | |
var repoItems = document.querySelectorAll(".repo-list > li") | |
repoItems.forEach(function (item) { | |
var repoOrgElement = item.querySelector(".repo-name").previousElementSibling; | |
var repoElement = item.querySelector(".repo-name"); | |
var repoOrgName = repoOrgElement.innerText; | |
if (repoOrgName === orgName && repoElement.innerHTML.substring(0, 4) == repoNameFirstFourChars) { | |
var unwatchButton = item.querySelector(".js-unsubscribe-form > button"); | |
unwatchButton.click(); | |
var itemName = repoOrgElement.parentElement.innerText; | |
console.log("Unwatched " + itemName); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment