dotPageMod: a firefox extension
A long while ago I was using Greasemonkey, but
just hiding a few elements with it felt very daunting with all this metadata
and editing in a browser window. I regressed to using Adblock
Plus and later uBlock
Origin for cosmetic filtering and more and
more to block the execution of JavaScript by default. Eventually I introduced
uMatrix with a rigid block-policy to the
mix which ended up leaving uBlock mostly jobless beside a bunch of cosmetic
filters. Management of these isn't perfect through and sometimes you want more
than just display: none
– especially now that I had all of JavaScript blocked
by default and some websites downright refuse to be usable without it (e.g.
default collapsed infoboxes). So I moved my filters to ~/.css
and started
fixing up websites in ~/.js
with dotjs.
Quickly I ended up hitting issue #27: console.log doesn't work from
dotjs which I researched and
after commenting researched even more. Set out to write a patch to have this
option set automatically I ended up changing other things as well until I
realized that the architecture as-is wasn't to my liking (using a single global
PageMod reading files dynamically and sending the content to be processed by
eval (JS) and by DOM insertion (CSS) – the later failing in the event of a
content policy forbidding inline CSS) – and I always wanted to look into
developing Firefox extensions…
So, with a "how hard can it be?" I moved on to write my own extension to resolve my real as well as my imaginary problems by introducing new problems – not for me (hopefully), but potentially for anyone (else) wanting to use it…
The result is dotPageMod which exports the strength of the SDKs PageMods to be configured easily at runtime.
This isn't a WebExtension and I have my doubts that it ever will be possible to do it as a WebExtension as it contradicts the requirement of extension signing & review somewhat, but I will worry about that at a later time. It is at least only using low- and high-level SDK functions and most could be done in terms of a WebExtension, you would "just" loose all of the easy configuration part – which is the whole point of the exercise…