added dom observer for new page notification

I ran a javascript formatter on this which is why there are so many changes.

The relevant code is at line 897, where I created a mutation observer to listen for changes to the nextpage anchor.