2020年12月31日星期四

removing an element with a userscript

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:

https://www.zerohedge.com/economics/2020-greatest-hits-most-popular-articles-past-year-and-look-ahead

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); }
https://stackoverflow.com/questions/65526839/removing-an-element-with-a-userscript January 01, 2021 at 10:06AM

没有评论:

发表评论