Skip to content

Instantly share code, notes, and snippets.

@naxoc
Last active December 3, 2025 08:44
Show Gist options
  • Select an option

  • Save naxoc/43661de644da64eb8e8dffbf8f09ac27 to your computer and use it in GitHub Desktop.

Select an option

Save naxoc/43661de644da64eb8e8dffbf8f09ac27 to your computer and use it in GitHub Desktop.
GitHub notifications helper userscript. Will check merged and closed notification checkboxes in one go. Use with Tapermonkey or whatever userscript thing works for you.
// ==UserScript==
// @name Github Notifications Helper
// @namespace https://naxoc.net/
// @version 0.1.0
// @description Clicks things for you it just takes too long to click.
// @author naxoc
// @include https://github.com/notifications*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
(function () {
'use strict';
function checkClosed() {
const closed = document.querySelectorAll('div.flex-row:has(svg.color-fg-done, svg.color-fg-closed)');
// Check if we found any.
if (closed.length > 0) {
closed.forEach((div) => {
// Find the checkbox inside this div
const checkbox = div.querySelector('input.js-notification-bulk-action-check-item');
// Check the checkbox if found
if (checkbox) {
checkbox.checked = true;
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
}
});
}
}
function createButton() {
const button = document.createElement('button');
button.textContent = 'Check closed';
button.style.position = 'fixed';
button.style.bottom = '10px';
button.style.left = '10px';
button.style.zIndex = '9999';
button.style.border = 'none';
button.style.padding = '10px';
button.style.color = 'white';
button.style.backgroundColor = "#824FE0";
button.addEventListener('click', checkClosed);
document.body.appendChild(button);
return button;
}
let theButton = null;
const originalPushState = history.pushState;
const originalReplaceState = history.replaceState;
// Override pushState
history.pushState = function() {
originalPushState.apply(this, arguments);
checkUrl();
};
// Override replaceState
history.replaceState = function() {
originalReplaceState.apply(this, arguments);
checkUrl();
};
// Listen for popstate (back/forward buttons)
window.addEventListener('popstate', checkUrl);
function checkUrl() {
// Check if current URL matches your pattern
if (window.location.pathname === '/notifications') {
if (!theButton) {
theButton = createButton();
}
} else {
if (theButton && theButton.parentNode) {
theButton.parentNode.removeChild(theButton);
theButton = null;
}
}
}
checkUrl();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment