Skip to content

Instantly share code, notes, and snippets.

@bburhans
Last active June 3, 2020 06:37
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 bburhans/6f02e32a5df365f8b8d1ad45b9447833 to your computer and use it in GitHub Desktop.
Save bburhans/6f02e32a5df365f8b8d1ad45b9447833 to your computer and use it in GitHub Desktop.
Userscript to make new reddit slightly less terrible
// ==UserScript==
// @name Reddit
// @namespace bburhans
// @version 0.0.2
// @description Neuter lightbox click behavior on reddit
// @author Benjamin P. Burhans
// @match https://www.reddit.com/*
// @grant none
// ==/UserScript==
function f () {
'use strict';
const e = document.querySelector('div[style^="--fakelightbox-overlay-"]:not([cloned]), div#overlayScrollContainer:not([cloned])');
if (!e) {
return;
}
let clone = e.cloneNode(false);
clone.setAttribute('cloned', 'cloned');
e.replaceWith(clone);
clone.style.cursor = 'unset';
}
const observer = new MutationObserver(f);
observer.observe(document.querySelector('body'), {childList: true, subtree: true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment