New example, and attempt to formatting main plugin code

Made a better example.html page for testing purposes. I also wanted to
format the JS so it's more readable. I don't think this uses some best
practices but I don't have the skill/time to do it better at the
moment, but I'll come back to this.