Rewrite and improve trimOpenChats. updates #61
Stub trimChat for PhantomJS and move tests_main.js to tests/main.js