Notifier.js
Javascript library for Gnome / Growl type non-blocking notifications. Jquery required.
Usage Guide
Install Via Bower
// Will include jquery dependency
bower install notifier.js
Trigger Notifications
// Success notifs
Notifier.success('User registration successful')
Notifier.success('It\'s a boy!', 'Congrats!')
// Info notifs
Notifier.info('You have been informed!')
Notifier.info('Tomorrow is another day', 'Words of wisdom')
// Warning notifs
Notifier.warning('I warn you Ceasar!')
Notifier.warning('I warn you Ceasar!', 'Assassination Warning')
// Error notifs
Notifier.error('Something may be wrong..')
Notifier.error('Something may be wrong..', 'Ummm..')
// Notif with custom icon and timeout
Notifier.notify('Babe I\'m gonna leave you', 'Led Zeppelin', './icons/Music.png', 2000)
// HTMLs are escaped, XSS attempts are blunted
Notifier.error('<script>alert(\'xss attempt blunted\')</script>')
Sticky Notifications
Using a sticky notification will create a notification which does not timeout, but will be dismissed be a user clicking on it,
or by another notification being triggered.
// Success sticky notifs
Notifier.stickySuccess('User registration successful')
// Info sticky notifs
Notifier.stickyInfo('You have been informed!')
// Warning sticky notifs
Notifier.stickyWarning('I warn you Ceasar!')
// Error sticky notifs
Notifier.stickyError('Something may be wrong..')
// Note that Notifier.stickyNotification will hold the existing object and calling .click() on this object in code will dismiss it.
// when dismissed, this object will be null.
Super Sticky Notifications
Using a "super-sticky" notification will create a notification which does not timeout and cannot be dismissed unless .rubbingAlcohol is
called on the object.
Notifier.superStickyNotification will hold this object and calling .rubbingAlcohol() on the object will dismiss it and make the object null.
// Success super sticky notifs
Notifier.superStickySuccess('User registration successful')
// Info super sticky notifs
Notifier.superStickyInfo('You have been informed!')
// Warning super sticky notifs
Notifier.superStickyWarning('I warn you Ceasar!')
// Error super sticky notifs
Notifier.superStickyError('Something may be wrong..')
Configure
Default behavior of NotifierJS can be modified without having to muddle through the code.
Here's an example of reducing the default timeout and changing the position of the notifications:
<script>
NotifierjsConfig.defaultTimeOut = 250;
NotifierjsConfig.position = ["bottom", "right"];
</script>