Message Library

This is a library which provides analogs to standard methods alert, confirm and prompt.

Installation

bower install message-library

Usage

Alert

Alert
Message.alert({
  title: 'Picture',
  content: '<img src="lenna.png">',
  size: 'large',
  callback: function (response) {
    alert(response);
  }
});

Confirm

Confirm
Message.confirm({
  title: 'Licence',
  content: '<p>Do you confirm we can do everything we want with your personal data?</p>',
  size: 'large',
  callback: function (response) {
    alert(response);
  }
});

Prompt

Prompt
Message.prompt({
  title: 'Name',
  content: "<p>What's your name?</p>",
  callback: function (response) {
    alert(response);
  },
  value: 'John?'
});

Translations

You may declare your translations for buttons 'Cancel' and 'Ok'.

Permanently:

Message.translate({
  cancel: 'New cancel',
  ok: 'New ok'
});

Only once:

Message.alert({
  title: 'Picture',
  content: '<img src="lenna.png">',
  size: 'large',
  callback: function (response) {
    alert(response);
  },
  translations: {
    cancel: 'New cancel',
    ok: 'New ok'
  }
});

Notices

Author (Speransky Danil): Personal Page | LinkedIn | GitHub | StackOverflow