First attempt at a userscript, and despite finding numerous examples on the internet of how to remove elements from a page, none of them work (and this looks like one of the most basic applications of a userscript, too).
Using violentmonkey-2.12.8 on this page:
I want to remove the "exitModalOverlay" div (disabling it in the developer tools does exactly what I want), which blacks out the page (preventing me from reading it).
I will insert one of the more common techniques I have found (which doesn't work). I would appreciate any method which does. Thanks.
// ==UserScript==
// @namespace confused
// @name zehohedge_remove_subscription_popup
// @version 1
// @description removes the overlay div that asks to subscribe
// @match https://www.zerohedge.com/*
// @grant none
// @noframes
// ==/UserScript==
var todelete = document.getElementById('exitModalOverlay');
if (todelete) { todelete.parentNode.removeChild(todelete); }
Maybe so...
window.onload = function() {
var todelete = document.querySelector('#exitModalOverlay');
todelete.outerHTML = '';
}
or
window.onload = function() {
var todelete = document.querySelector('#exitModalOverlay');
todelete.remove();
}