Implemented pausing on visibility change

That was surprisingly well supported. An event listener was added to
document's "visibilitychange" to handle it.

Fixes #158.