Skip to content

Instantly share code, notes, and snippets.

@nicksahler
Last active May 28, 2021 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicksahler/0ed50d03d20919bf7effd9b8d4156ed4 to your computer and use it in GitHub Desktop.
Save nicksahler/0ed50d03d20919bf7effd9b8d4156ed4 to your computer and use it in GitHub Desktop.
Bookmarklet: Toggle-Select Merged PRs in Github Notifications Page

This code simply checks or unchecks (clicks) the checkbox next to merged PRs at https://github.com/notifications. It's frustrating that Github doesn't let you filter on these by default.

Original Source:

[...document.querySelectorAll('.notifications-list-item')].forEach( item => {
  if(item.querySelector('.octicon-git-merge, .octicon-git-pull-request-closed')) {
    item.querySelector('input[type=checkbox]').click()
  }
})

Converted to a Bookmarklet using Bookmarklet Maker. Github hides executable javascript: type anchors for security reasons, so to add this Bookmarklet you can create a new browser bookmark in your bookmarks bar and make the content the following:

javascript:(function()%7B%5B...document.querySelectorAll('.notifications-list-item')%5D.forEach(%20item%20%3D%3E%20%7B%0A%20%20if(item.querySelector('.octicon-git-merge%2C%20.octicon-git-pull-request-closed'))%20%7B%0A%20%20%20%20item.querySelector('input%5Btype%3Dcheckbox%5D').click()%0A%20%20%7D%0A%7D)%7D)()%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment