Ive been thinking about making a Mozilla/Firefox extension for a long while now. The project that I have in mind is a solution for the problem that I have when printing an SDN forum thread in Firefox. Printed threads arent WYSIWYG at all. Everything is cluttered and things arent shown as they should be, or are incomplete.
Unlike Internet Explorer, Firefox doesnt have any context print functionality. The possibility does exist though. You only need to install the Print extension from e.g. http://extensionroom.mozdev.org/more-info/print and you get a print functionality when you click the right mouse button. So whats the problem? Without under appreciating this extension, it does the same as File/Print a.k.a. Ctrl+P, so we still have the same problem here since it (tries to) print(s) the whole page. Im only interested in the forum thread itself as such. The menus are rather useless on paper anyway. I saw the other day in a forum post that I wasnt the only one having problems with printing forum threads. So it was time to find a solution to the problem.
The solution is rather simple. Since the content of a forum thread is shown in an iframe, one only has to print that one. So I decided to have a go and create a Mozilla/Extension. There is a good guide available at http://extensions.roachfiend.com/howto_bug.html. As you can see, this isnt something that you can create in a few moments or as we say in Flemish: between the soup and the potatoes. It isnt that it is difficult as such, but theres a whole procedure to follow. It is positively overkill for what I wanted to achieve. Youll see why in a moment.
So weve now reached the point where some work needs to be done. Start Firefox you probably did that already to read this Web log and start the Bookmark Manager (second item under the Bookmark menu). Create a new bookmark (first icon on the toolbar) and youll see this popup.
Fill in an appropriate name and put the following code in the Location:
getElementById was introduced in DOM (Document Object Model, see also http://www.w3.org/DOM/) Level 2 and returns the element whose ID is specified. The ID we specify (iframecontent) is the iframe containing the forum thread. The contentWindow property returns the window object for the frame
Click on OK to save. Congratulations, youve made a bookmarklet. It couldnt be simpler, could it? My dream of making a Mozilla/Firefox is put on ice until I find a more complicated problem to solve.
Update: Check the Super (re)size it. web log if you want to print web logs.