Skip to content

Instantly share code, notes, and snippets.

@ditsuke
Created July 28, 2026 18:58
Show Gist options
  • Select an option

  • Save ditsuke/509e4f6a0ab8a4521337e7b225d9cbd5 to your computer and use it in GitHub Desktop.

Select an option

Save ditsuke/509e4f6a0ab8a4521337e7b225d9cbd5 to your computer and use it in GitHub Desktop.
Remove reddit login force modal
// ==UserScript==
// @name Reddit Login Modal Remover
// @namespace https://reddit.com/
// @version 1.2
// @description Removes Reddit modals, overlays, and scroll lock.
// @match https://www.reddit.com/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function () {
'use strict';
function cleanup() {
const actions = [];
if (document.body?.classList.contains('rpl-scroll-lock')) {
document.body.classList.remove('rpl-scroll-lock');
actions.push('removed body.rpl-scroll-lock');
}
[
'rpl-modal-card',
'.dialog-overlay',
'#desktop-dynamic-upsell-dialog'
].forEach(selector => {
const els = document.querySelectorAll(selector);
if (els.length) {
els.forEach(el => el.remove());
actions.push(`removed ${els.length} ${selector}`);
}
});
if (actions.length) {
console.log(
`[Reddit Modal Remover] ${new Date().toLocaleTimeString()} - ${actions.join(', ')}`
);
}
}
// Initial cleanup.
cleanup();
// Poll periodically instead of observing the entire React app.
setInterval(cleanup, 250);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment