Creating an add-in to hide the <div> block in an HTML page
There is a webpage with something annoying that I would like to hide every time I visit it. I thought a good way to do this is to make an add-on for Firefox.
I had never done this before and came across a Firefox web browser. I'm not too sure where to go from here. I know this should be fairly easy to do. I believe that all I need to do is check if a block with a specific identifier is used on the website, and if so, remove / hide it from my view.
Is this the best way to do this? If not, what do you suggest? If so, can you give me any tips to help me accomplish this?
That's right, I realized:
Using only the standalone Firefox add-on, use the following code:
exports.main = function() {
var pageMod = require("page-mod");
pageMod.PageMod({
include: "*.ca",
contentScriptWhen: 'end',
contentScript: 'document.getElementById("DIVID").style.visibility="hidden";'
});
};
Just replace DIVIDwith what you want.
Similarly, in Greasemonkey just add this to the script:
document.getElementById('DIVID').style.visibility='hidden';
The only reason I didn’t want to use Greasemonkey is that sharing it is not so easy. But its convenience cannot be beaten!
Won't Adblock Plus do the trick here? You can give him a rule to hide an element (based on a class attribute or identifier) on any site, if I remember correctly.