Show the input messages and set focus correct on input required.
This commit is contained in:
@ -1160,7 +1160,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
switch(msg.cmd) {
|
switch(msg.cmd) {
|
||||||
case 'input':
|
case 'input':
|
||||||
showPrompt();
|
showPrompt(msg);
|
||||||
break;
|
break;
|
||||||
case 'write':
|
case 'write':
|
||||||
printWebsocketOutput(msg);
|
printWebsocketOutput(msg);
|
||||||
@ -1249,11 +1249,13 @@ $(function() {
|
|||||||
executeWebsocketCommand(msg);
|
executeWebsocketCommand(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
var showPrompt = function() {
|
var showPrompt = function(msg) {
|
||||||
|
var label = $('#prompt .input-group-addon');
|
||||||
|
label.text(msg.data || label.data('prompt'));
|
||||||
if (prompt.isPresent() && prompt.hasClass('hidden')) {
|
if (prompt.isPresent() && prompt.hasClass('hidden')) {
|
||||||
prompt.removeClass('hidden');
|
prompt.removeClass('hidden');
|
||||||
}
|
}
|
||||||
prompt.focus();
|
$('#prompt input').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
var hidePrompt = function() {
|
var hidePrompt = function() {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#output-col1
|
#output-col1
|
||||||
// todo set to full width if turtle isnt used
|
// todo set to full width if turtle isnt used
|
||||||
#prompt.input-group.hidden
|
#prompt.input-group.hidden
|
||||||
span.input-group-addon = t('exercises.editor.input')
|
span.input-group-addon data-prompt=t('exercises.editor.input') = t('exercises.editor.input')
|
||||||
input#prompt-input.form-control type='text'
|
input#prompt-input.form-control type='text'
|
||||||
span.input-group-btn
|
span.input-group-btn
|
||||||
button#prompt-submit.btn.btn-primary type="button" = t('exercises.editor.send')
|
button#prompt-submit.btn.btn-primary type="button" = t('exercises.editor.send')
|
||||||
|
Reference in New Issue
Block a user