fabien-d/alertify.js — pull request #173 by fabien-d (2013-10-06 05:05:18+00:00)
Title: WIP - Version 0.5.0

The todo list will be growing...

## Todo
- [ ] Handle attempt to open multiple dialogs at one time. Queue? Simply don't open?
- [ ] Keyboard shortcut - ESC = cancel, Space = OK, Enter = submits prompt
- [ ] Keep focus inside dialog
- [ ] Reset the focus to the last focused element before the dialog was open
- [ ] Add growl notifications? Or open separate repo...
- [ ] Show cover when dialog opens
- [ ] Set ARIA attributes based on state

---

**This PR will most likely be long running and changing over time.**

---

## New API & Usage
Only supports dialog at the moment. I am thinking of moving the growl notification into its own project.

### Alert
```js
// basic
alertify.alert( 'Title' ).show();

// advanced
var alert = alertify.alert( 'Title' );
alert.accept = function () {
// OK
};
alert.show();
```

### Confirm
```js
// basic
alertify.confirm( 'Title' ).show();

// advanced
var confirm = alertify.confirm( 'Title' );
confirm.accept = function () {
// OK
};
confirm.deny = function () {
// Cancel
};
confirm.show();
```

### Prompt
```js
// basic
alertify.prompt( 'Title' ).show();

// advanced
var prompt = alertify.prompt( 'Title' );
prompt.accept = function ( val ) {
// OK
// val => Value of input field
};
prompt.deny = function () {
// Cancel
};
prompt.show();
```

### Extra methods
A few extra methods are available on each dialog.
```js
var alert = alertify.alert( 'Title' );
alert.onshow = function () {
// called on dialog show
};
alert.onclose = function () {
// called on dialog closed
};
alert.onfocus = function () {
// called after focus to element has been set
};

alert.show(); // shows the dialog

// close() is available if a dialog must be closed programmatically,
// it's automatically call on click of a button
alert.close(); // closes the dialog
```