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