Save toner and paper with a couple lines of javascript

By Dario Iacampo

I just stumbled upon an interesting, pretty long, article I wanted to read but not immediately. I thought it could be a good idea to print it out and store it for later.
First problem arises: how to avoid to print unnecessary layout stuff that are always present on websites?
A quick search suggested that pocket  is a good choice, it has a convenient chrome extension that let's you add the cleaned and simply formatted article to a reading list.

Second problem arises: some images on the page take too much space and costs me a waste of toner and paper... how to quickly reduce their size?

In chrome it is easy, I press F12 and I'm in the interactive console; jquery is already part of the libraries for this application so, select all images and reduce their size:

$('img').each(function(i, img) {img.width = 100;});

But that was not exactly what I wanted because some images contains relevant data and I would like to keep those untouched, furthermore I would like to quickly select the best size for each image. Here it is what I came out with:

$("img").click(function(evt) {
  var img =;
  img.width = (img.width / 2); = "auto";

Again I select all images and attach an eventHandler for the click event that reduces by half the size of the image for each click.
Now I can print this paper and enjoy it.