support multiple buttons for the same menu

pull/6499/head
PhilW 6 years ago
parent 30fb7fc552
commit 99fc4cd387

@ -125,21 +125,24 @@ function rcube_webmail()
// register a button with popup menu, to set its state according to the state of all commands in the menu
this.register_menu_button = function(button, menu_id)
{
var commands = [];
if (!this.menu_buttons[menu_id]) {
this.menu_buttons[menu_id] = [[], []];
var commands = [];
$('#' + menu_id).find('a').each(function() {
var command, link = $(this), onclick = link.attr('onclick');
$('#' + menu_id).find('a').each(function() {
var command, link = $(this), onclick = link.attr('onclick');
if (onclick && String(onclick).match(/rcmail\.command\(\'([^']+)/))
command = RegExp.$1;
else
command = function() { return link.is('.active'); };
if (onclick && String(onclick).match(/rcmail\.command\(\'([^']+)/))
command = RegExp.$1;
else
command = function() { return link.is('.active'); };
commands.push(command);
});
ref.menu_buttons[menu_id][1].push(command);
});
}
if (commands.length)
this.menu_buttons[menu_id] = [button, commands];
if (ref.menu_buttons[menu_id][1].length)
this.menu_buttons[menu_id][0].push(button);
this.set_menu_buttons();
};

Loading…
Cancel
Save