First trim content, then truncate

Otherwise, we'd only get 150chars if the first 50 were whitespace.
Additionally switch trim -> $.trim to support non-es5 browsers.

Change-Id: I5cf62ac67dc5660af6ea6267704e2abe2c8dca98