') {
path = '';
}
if (destination && !omitDestination) {
path = path + '?destination=' + destination;
}
return Drupal.settings.basePath + path;
};
plugin['handlers'].push({
'id': 'menu_goto',
'name': Drupal.t('Go to and return'),
'data_class': 'url_data',
'handler': function(text, item) {
window.location.href = uri_from_item(item);
}
});
plugin['handlers'].push({
'id': 'menu_goto_stay',
'name': Drupal.t('Go to'),
'data_class': 'url_data',
'handler': function(text, item) {
window.location.href = uri_from_item(item, true);
}
});
plugin['handlers'].push({
'id': 'menu_open_in_new_window',
'name': Drupal.t('Open in new window'),
'data_class': 'url_data',
'handler': function(text, item) {
var form = document.createElement("form");
$(form).attr({
'method': 'GET',
'action': uri_from_item(item),
'target': '_blank'
}).appendTo('body');
try {
form.submit();
}
catch(e) {
var message = $('');
message.append('' + Drupal.t('Could not open window') + '
');
message.append('' + Drupal.t('You might be using a popup blocker, which stopped Cobalt from opening a new window.') + '
');
cobalt.showHtml(message);
}
$(form).remove();
}
});
cobalt.registerPlugin('cobalt_menu', plugin);
});
})(jQuery);