Skip to content

Instantly share code, notes, and snippets.

@roeeyn
Forked from rafmagana/unwatch-repos.js
Created March 18, 2021 19:13
Show Gist options
  • Save roeeyn/f768f678ec2ae30e629e1f6ccd1ae254 to your computer and use it in GitHub Desktop.
Save roeeyn/f768f678ec2ae30e629e1f6ccd1ae254 to your computer and use it in GitHub Desktop.
Unwatch multiple repositories at once in GiHub
/* 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