Use MutationObserver to detect page changes

We can detect page changes in a more efficient way with MutationObserver
instead of using setInterval to detect DOM length.

https://hacks.mozilla.org/2012/05/dom-mutationobserver-reacting-to-dom-changes-without-killing-browser-performance/