The Github notifications hub integrates pretty nicely into my daily work workflow, but something has always irked me: if I have a bunch of notifications for issues that have been closed, I have no way to filter them out, or to clear them at once.
I made this small TamperMonkey snippet to do this precise job, and will add more scripts as time goes (and will edit this article accordingly).
// @grant unsafeWindow
// @grant GM_registerMenuCommand
// @grant GM_log
// @run-at document-start
GM_registerMenuCommand('Select expired notifications', function(_) {
const notifs = Array.from(unsafeWindow.document.querySelectorAll('li.notifications-list-item.notification-unread'));
notifs.forEach((notif) => {
const is_open = !!notif.querySelector('svg.octicon-git-pull-request');
const checkbox = notif.querySelector('input.js-notification-bulk-action-check-item');
if (!is_open) checkbox.checked = true;
});
});