mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 17:02:41 +01:00
52 lines
1 KiB
JavaScript
52 lines
1 KiB
JavaScript
|
/**
|
||
|
* @provides javelin-behavior-aphlict-dropdown
|
||
|
* @requires javelin-behavior
|
||
|
* javelin-aphlict
|
||
|
* javelin-util
|
||
|
* javelin-request
|
||
|
* javelin-stratcom
|
||
|
*/
|
||
|
|
||
|
JX.behavior('aphlict-dropdown', function(config) {
|
||
|
var dropdown = JX.$('phabricator-notification-dropdown');
|
||
|
var indicator = JX.$('phabricator-notification-indicator');
|
||
|
var visible = false;
|
||
|
|
||
|
//populate panel
|
||
|
(new JX.Request('/notification/panel/',
|
||
|
function(response) {
|
||
|
JX.DOM.setContent(dropdown, JX.$H(response.content));
|
||
|
})).send();
|
||
|
|
||
|
|
||
|
JX.Stratcom.listen(
|
||
|
'click',
|
||
|
null,
|
||
|
function(e) {
|
||
|
if(e.getNode('aphlict-dropdown') ||
|
||
|
e.getNode('aphlict-indicator')) {
|
||
|
// Click is inside the dropdown, or on indicator
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
JX.DOM.hide(dropdown);
|
||
|
visible = false;
|
||
|
});
|
||
|
|
||
|
|
||
|
JX.DOM.listen(
|
||
|
indicator,
|
||
|
'click',
|
||
|
null,
|
||
|
function(e) {
|
||
|
if(visible) {
|
||
|
JX.DOM.hide(dropdown);
|
||
|
} else {
|
||
|
JX.DOM.show(dropdown);
|
||
|
}
|
||
|
visible = !visible;
|
||
|
}
|
||
|
)
|
||
|
|
||
|
});
|