Blogger and printing (and making it, you know, work)
2008-01-16 / 19:12 / dave
I was going to print David MacIver’s Why not Scala? article, but…
Well, Blogger, good job with the print style sheets. I guess that’s why we have Javascript and the lazy web. This stylesheet injection technique looks promising, and we can run the javascript via Greasemonkey or a bookmarklet. Dive Into Greasemonkey and the script loader that Western Civ used for MRI are all we need.
The files are all hosted on this site: http://svn.ndanger.org/blogger_print/:
- Makefile
- Automatically deploy live files (since can’t hotlink to SVN)
- blogger_print.css
- CSS stylesheet
- blogger_print.url
- Text file of URL for bookmarklet
- blogger_print.user.js
- Javascript for injecting CSS. Used by bookmarklet and Greasemonkey
- readme.txt
- Help file
I’ve been tweaking things when necessary, which is whenever I want to print from a Blogger site and think “god damn, why does the text flow off the right side of the page?”, but it’s still pretty rough: Greasemonkey only triggers on blogspot subdomians, some templates aren’t handled right, and the CSS contains some hacks to keep elements from overlapping too much (though no guarantees). If too many sites cause trouble I might go nuclear and remove all existing styles (right now it tries to preserve as much of the sites styling as possible) or maybe thermo-nuclear and strip out the sections I care about and rebuild the DOM.
Basically feel free to use it, but don’t expect it to work always, or even often. It works on stevey’s blog though, so feel free to join the comic fun.
Here’s the “after” print preview of David’s blog. Woo!
