Port from apache/couchdb: COUCHDB-2158 Fauxton: Implement a filter for changes 

This is a port from https://github.com/apache/couchdb/pull/227 - full previous discussion there.

There are already changes from the previous review included, and after the review I will rebase/squash them.