Dark Light

GreaseMonkey is a Firefox Extension that allows you to run arbitrary Javascript files on pages from your client. This is cool, because you can do stuff to pages after they’re downloaded to make them work, or cooler, or both.

There are a large number of greasemonkey scripts already written and various people are rewriting more. (Actually, once my NDA runs out – and if my ex-CEO has given up on the idea – I may rewrite the fabled BrowserAngel project in GM)

So, with all that in mind, I’ve fixed something that really annoys me in a few sites I use, and have solved this problem with GreaseMonkey.

One of the problems with most aggregators which display more posts on one page is one of styling. If a single one of the feeds you can see puts in an oversized image, either the entire page/frame – and all the posts on it – is extended somewhere into the far reaches of horizontal-scrollbar-land, or just that post is, with the effect that you see the scrollbars for the rest of the page too. Also, you are probably going to have to scroll around looking for content. And it’s fugly.

One solution to this is the max-width CSS element. If you drop something like max-width: "100%"; into your CSS Style or userContent.css, it’ll force all images to have a maximum width of the area available. The down sides are that either everyone in the world needs to put it in their CSS files – which is unlikely – or you put it into your browser defaults. The latter causes it also to affect unwanted things, like if you view an image on its own there is no way to force it to display at actual size.

Max Width, btw, doesn’t work in IE 1 though 6. Don’t know about 7 yet.

My first solution to this was a bookmarklet which iterated though all the images on the page and made them all max-width: 100%, which works perfectly.

Here it is: <a href="javascript:function mis(){imgs = document.getElementsByTagName("img");for(i=0;iMaxWidthifier

The downside is that Bloglines, which is one of the two places I have this problem has a frames interface, the Bookmarklet doesn’t work, because it only applies to the top level frame, not the containing frames. (The site with the problem is LiveJournal. Actually, most of the feeds with this brokenness on my Bloglines feed are syndications of LiveJournals & LJ Communities, but I digress).

So I’ve packaged the whole thing up into a GreaseMonkey user script, which does apply to the framesets, and defaulted it to apply to Livejournal and Bloglines.

Here is the Greasemonkey Script

Related Posts