waltzio/waltz — pull request #338 by landakram (2014-06-18 02:04:08+00:00)
Title: Make Waltz work universally

This PR makes Waltz work on sites without site configs. This means:
* Waltz detects login forms and displays the button when something looks like a login form
* For "anonymous" sites, or sites without site configs, *all* cookies are deleted from the base domain on logout
* Logins are acknowledged as successful when visiting a page that doesn't have a login form

In addition, instead of using timers, this PR changes waltz.js to use [DOM Mutation Observers](https://code.google.com/p/mutation-summary/) to detect login fields and the logged-in check. This means Waltz can be loaded before `$(document).ready` and the button displayed as soon as possible. It also means Waltz works on ajax-y pages that dynamically load login form elements after the page is loaded.

There are a few issues that should be addressed, however:
* Waltz button will show even when login forms are hidden (i.e. on a wordpress login page with Clef enabled)
* This is because `findLoginForm` finds even hidden login forms. Do we want it to only find login forms that are shown?
* Waltz overlay flashes when logging into some sites (for an example, see [npr.org](http://npr.org))
* This is because `kickedOff` is unset before a login. I did this so that ajax errors are correctly detected (for examples, try logging in to [crashlytics.com](http://crashlytics.com) or [pandora.com](http://pandora.com) with bad credentials). However, it might be worthwhile to remove this or implement it differently, since I'm not sure how many sites are affected by Waltz flashing vs. how many use ajax logins.