gaveitatry gaveitatry - 5 months ago 19
HTML Question

Greasemonkey - Add overflow:hidden to <main class="bucket_main">

I don't know anything about scripting and this will be the first time that I ever tried to create a Greasemonkey script. I couldn't find an existing Mozilla Firefox add-on or user script, so that is why I had to resort to such measures.

So anyway, there is a website that I visit on a regular basis. Let's call it http://www.DARNSITE.com. It has been adding an additional, unnecessary, and non-functional vertical scrollbar next to the browser's vertical scrollbar.

I want to create a user script that changes this line:

<main class="bucket__main">


to

<main class="bucket__main" style="overflow:hidden;">


Since I am a complete newbie and this will probably take a very small amount of code, could someone please give me a full answer (full code) that I can just copy and paste into my new script? I am worried that I will get some incomplete code that won't do anything because something is missing.

Thank you.

Answer

This should do the trick if there is only one occurence of the class bucket__main:

document.querySelector(".bucket__main").style.overflow='hidden';