import $ from 'jquery';
import { Types } from '../types';
import * as Models from '../ivprog_elements';
import { LocalizedStrings } from '../../services/localizedStringsService';
import * as GlobalsManagement from '../globals';
import * as VariablesManagement from '../variables';
import * as VariableValueMenu from './variable_value_menu';
import * as CommandsManagement from '../commands';
export function createFloatingCommand () {
return $('
'+LocalizedStrings.getUI('text_command_read')+' var
');
}
export function renderCommand (command, function_obj) {
var el = ' '+LocalizedStrings.getUI('text_command_read')+' ( )
';
el = $(el);
el.data('command', command);
VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
addHandlers(command, function_obj, el);
return el;
}
function addHandlers (command, function_obj, reader_dom) {
reader_dom.find('.button_remove_command').on('click', function() {
if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
reader_dom.fadeOut(400, function() {
reader_dom.remove();
});
}
});
}