Last active
May 19, 2021 23:05
-
-
Save rafmagana/c6859e21951c9642af1d0d548d6cc0f6 to your computer and use it in GitHub Desktop.
Unwatch multiple repositories at once in GiHub
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
/* USAGE | |
Go to https://github.com/watching | |
Paste this function in the console | |
e.g. unwatchRepos("rails|node|go") | |
That unwatches repos containing rails, node or go in the repo link. | |
*/ | |
var unwatchRepos = (pattern) => { | |
var list = document.getElementsByClassName('repo-list')[0] | |
var rows = list.getElementsByClassName('js-subscription-row') | |
for(var i = 0; i < rows.length; i++) { | |
var row = rows[i] | |
var link = row.getElementsByTagName('a')[0] | |
if(RegExp(pattern).test(link.href)) { | |
row.getElementsByClassName('btn-sm')[0].click() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found this Gist following the github onboarding guide while going through new hire onboarding. Github must have changed some of ids on their watching page since this was written so the script no longer works for me.
I took the liberty of modifying it for my usecase and am sharing the modified version here:
An important note, I have changed the pattern that unwatchRepos takes in from a language based pattern to a repo named pattern so unwatchReposExcept("android-instant") will unwatch everything except "android-instant".