2012-01-05 01:52:13 +01:00
|
|
|
/**
|
|
|
|
* @provides javelin-behavior-differential-dropdown-menus
|
|
|
|
* @requires javelin-behavior
|
|
|
|
* javelin-dom
|
2012-01-05 23:41:11 +01:00
|
|
|
* javelin-util
|
2012-01-05 01:52:13 +01:00
|
|
|
* javelin-stratcom
|
|
|
|
* phabricator-dropdown-menu
|
|
|
|
* phabricator-menu-item
|
|
|
|
*/
|
|
|
|
|
|
|
|
JX.behavior('differential-dropdown-menus', function(config) {
|
|
|
|
|
2012-01-05 23:41:11 +01:00
|
|
|
var buttons = JX.DOM.scry(window.document, 'a', 'differential-view-options');
|
2012-01-05 01:52:13 +01:00
|
|
|
|
2012-01-05 23:41:11 +01:00
|
|
|
for (var ii = 0; ii < buttons.length; ii++) {
|
|
|
|
var data = JX.Stratcom.getData(buttons[ii]);
|
|
|
|
|
|
|
|
var diffusion_item = new JX.PhabricatorMenuItem(
|
|
|
|
'Browse in Diffusion',
|
|
|
|
JX.bind(null, window.open, data.diffusionURI))
|
2012-01-05 01:52:13 +01:00
|
|
|
|
2012-01-05 23:41:11 +01:00
|
|
|
if (!data.diffusionURI) {
|
|
|
|
diffusion_item.setDisabled(true);
|
2012-01-05 01:52:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
new JX.PhabricatorDropdownMenu(buttons[ii])
|
2012-01-05 23:41:11 +01:00
|
|
|
.addItem(diffusion_item)
|
2012-01-05 01:52:13 +01:00
|
|
|
.addItem(
|
|
|
|
new JX.PhabricatorMenuItem(
|
|
|
|
'View Standalone',
|
2012-01-05 23:41:11 +01:00
|
|
|
JX.bind(null, window.open, data.detailURI)))
|
2012-01-05 01:52:13 +01:00
|
|
|
.addItem(
|
|
|
|
new JX.PhabricatorMenuItem(
|
|
|
|
'Show Raw File (Left)',
|
2012-01-05 23:41:11 +01:00
|
|
|
JX.bind(null, window.open, data.leftURI)))
|
2012-01-05 01:52:13 +01:00
|
|
|
.addItem(
|
|
|
|
new JX.PhabricatorMenuItem(
|
|
|
|
'Show Raw File (Right)',
|
2012-01-05 23:41:11 +01:00
|
|
|
JX.bind(null, window.open, data.rightURI)));
|
2012-01-05 01:52:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|