Expand collapse all: check for addListener support (fixes IE9)

PR fixes an IE9 javascript error by checking for addListener support:

```javascript
if (window.matchMedia && window.matchMedia.addListener) {
```

Other changes are all whitespace trimming.