auth0/auth0.js — pull request #5 by cristiandouce (2014-02-01 21:41:58+00:00)
Title: Feature popup

Updates:

* Add `popup` feature support at `auth0.login()` with 3rd party connection networks, like google, etc...
* Login API now allows following new options:
- **popup**: Boolean with default `false` value. If `true`, triggers `loginWithPopup` method.
- **popupOptions**: Object with default `{width: 500, height: 600 }`. Sets popup window settings used at `window.open(url, title, *settings*)`

Usage example looks like this:
```js
var auth0 = new Auth0(); // of course with required options

auth0.login({ popup: true, popupOptions: opts, connection: 'google_oauth2'});
```

Basically, the code opens a new `popup` window and sets and interval to check it's url changes.

When `protocol`s, `domain`s, and `port`s match (because of browsers security policies), it looks for an `#access_token` or `?error` url match.

If found, it closes the `popup` and triggers an `onready` function which reloads original login page with the obtained `hash` (from popup) so `auth0.parseHash` executes.

If for some reason the `popup` is closed... then it cuts off the interval check.