2014-05-05 19:57:23 +02:00
|
|
|
/**
|
2015-05-19 21:14:44 +02:00
|
|
|
* @provides javelin-behavior-phui-dropdown-menu
|
2014-05-05 19:57:23 +02:00
|
|
|
* @requires javelin-behavior
|
|
|
|
* javelin-stratcom
|
|
|
|
* javelin-dom
|
|
|
|
* phuix-dropdown-menu
|
|
|
|
*/
|
|
|
|
|
2015-05-19 21:14:44 +02:00
|
|
|
JX.behavior('phui-dropdown-menu', function() {
|
2014-05-05 19:57:23 +02:00
|
|
|
|
2015-05-19 21:14:44 +02:00
|
|
|
JX.Stratcom.listen('click', 'phui-dropdown-menu', function(e) {
|
|
|
|
var data = e.getNodeData('phui-dropdown-menu');
|
2014-05-05 19:57:23 +02:00
|
|
|
if (data.menu) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
e.kill();
|
|
|
|
|
|
|
|
var list = JX.$H(data.items).getFragment().firstChild;
|
|
|
|
|
2015-05-19 21:14:44 +02:00
|
|
|
var icon = e.getNode('phui-dropdown-menu');
|
2014-05-05 19:57:23 +02:00
|
|
|
data.menu = new JX.PHUIXDropdownMenu(icon);
|
|
|
|
data.menu.setContent(list);
|
|
|
|
data.menu.open();
|
|
|
|
|
|
|
|
JX.DOM.listen(list, 'click', 'tag:a', function(e) {
|
|
|
|
if (!e.isNormalClick()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
data.menu.close();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|