mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 20:52:43 +01:00
1053a50f67
Summary: - Allow more than one notification to be shown. - Allow notifications to be customized with extra classes. Test Plan: {F12776} Reviewers: allenjohnashton, ddfisher, keebuhm, jungejason Reviewed By: jungejason CC: aran Maniphest Tasks: T944 Differential Revision: https://secure.phabricator.com/D2758
42 lines
1,015 B
JavaScript
42 lines
1,015 B
JavaScript
/**
|
|
* @requires phabricator-notification
|
|
* javelin-stratcom
|
|
* javelin-behavior
|
|
* javelin-uri
|
|
* @provides javelin-behavior-phabricator-notification-example
|
|
*/
|
|
|
|
JX.behavior('phabricator-notification-example', function(config) {
|
|
JX.Stratcom.listen(
|
|
'click',
|
|
'notification-example',
|
|
function(e) {
|
|
e.kill();
|
|
|
|
var notification = new JX.Notification();
|
|
if (Math.random() > 0.1) {
|
|
notification.setContent('It is ' + new Date().toString());
|
|
|
|
notification.listen(
|
|
'activate',
|
|
function(e) {
|
|
if (!confirm("Close notification?")) {
|
|
e.kill();
|
|
}
|
|
});
|
|
} else {
|
|
notification
|
|
.setContent('Alert! Click to reload!')
|
|
.setDuration(0)
|
|
.setClassName('jx-notification-alert');
|
|
|
|
notification.listen(
|
|
'activate',
|
|
function(e) {
|
|
new JX.$U().go();
|
|
});
|
|
}
|
|
notification.show()
|
|
});
|
|
|
|
});
|