Chris's Wiki :: blog/programming/FirefoxNewWebExtsAPI Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/FirefoxNewWebExtsAPI?atomcommentsDWiki2018-01-29T18:00:58ZRecent comments in Chris's Wiki :: blog/programming/FirefoxNewWebExtsAPI.By Brendan Long on /blog/programming/FirefoxNewWebExtsAPItag:CSpace:blog/programming/FirefoxNewWebExtsAPI:ae15232a7cf72de487c00a4c8e5226473d8c9f9bBrendan Longhttps://www.brendanlong.com<div class="wikitext"><p>I suspect learning JavaScript is going to be a lot less work long-term than maintaining a patch against Firefox :\</p>
<p>Since you're using an extension that can execute JavaScript, I think all you need is code like this:</p>
<pre>
var styles = document.querySelectorAll("style, link[rel=stylesheet]");
for (var i = 0; i < styles.length; ++i) {
var style = styles[i];
style.parentNode.removeChild(style);
}
</pre>
<p>It gets trickier if you want to be able to put the styles back, but just turning them off should be easy.</p>
</div>2018-01-29T18:00:58ZBy db48x on /blog/programming/FirefoxNewWebExtsAPItag:CSpace:blog/programming/FirefoxNewWebExtsAPI:7cbe9ae4d1ed591cb4f92c62606f87c9da27ca2fdb48xhttp://db48x.net/<div class="wikitext"><p>Sweet. Will you be submitting this patch for inclusion in Firefox 60?</p>
</div>2018-01-29T16:49:56ZBy Chris Siebenmann on /blog/programming/FirefoxNewWebExtsAPItag:CSpace:blog/programming/FirefoxNewWebExtsAPI:4d42a098c77c2f808f4b336e0085a6afc599a854Chris Siebenmann<div class="wikitext"><p>The pragmatic answer is that I know almost nothing about writing Firefox
extensions and DOM-manipulating JavaScript in general, while I do know
something about hacking small modifications into Firefox (and I already
build my own version).</p>
<p>(<a href="https://github.com/marklieberman/foxygestures/issues/212">My Foxy Gestures feature request</a>
also got me a link to <a href="https://superuser.com/questions/447269/is-there-any-way-to-view-a-webpage-without-styles-in-chrome">this discussion of stripping CSS in Chrome</a>,
which would probably have convinced me that it was more complicated than I
wanted to tackle if I'd had any thoughts of doing it in the first place.)</p>
</div>2018-01-29T13:46:00ZBy Brendan Long on /blog/programming/FirefoxNewWebExtsAPItag:CSpace:blog/programming/FirefoxNewWebExtsAPI:b3daca2c871b77fcb10e575342cfdc639c80c6c3Brendan Longhttps://www.brendanlong.com<div class="wikitext"><p>Wouldn't it be easier to make a web extension that loops through a page and removes all style elements? Or does something to temporarily disable them if you want to be able to switch this on and off? I think this method would also leave other addons alone, since their CSS isn't part of the page.</p>
</div>2018-01-29T13:29:38Z