编程作业新建和编辑的时候,测试输出集很长的显示不友好,调整

This commit is contained in:
cxt 2016-12-05 17:18:56 +08:00
parent f9767abd3b
commit 88c8c4144b
3 changed files with 15 additions and 14 deletions

View File

@ -48,8 +48,8 @@
}
if (inputs.length == outputs.length) {
for (var i=0; i<inputs.length; i++) {
autoTextarea2(inputs[i], outputs[i]);
autoTextarea2(outputs[i], inputs[i]);
autoTextarea2(inputs[i], outputs[i], 0, 140);
autoTextarea2(outputs[i], inputs[i], 0, 140);
}
}
$(inputs[inputs.length - 1]).focus();
@ -61,7 +61,16 @@
<% if !edit_mode %>
var text = document.getElementById("textarea_input_test");
var text2 = document.getElementById("textarea_output_test");
autoTextarea2(text,text2);
autoTextarea2(text2,text);
autoTextarea2(text,text2, 0, 140);
autoTextarea2(text2,text, 0, 140);
<% else %>
var inputs = document.getElementsByName("program[input][]");
var outputs = document.getElementsByName("program[output][]");
if (inputs.length == outputs.length) {
for (var i=0; i<inputs.length; i++) {
autoTextarea2(inputs[i], outputs[i], 0, 140);
autoTextarea2(outputs[i], inputs[i], 0, 140);
}
}
<% end %>
</script>

View File

@ -1446,7 +1446,7 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
} : function (name) {
return getComputedStyle(elem, null)[name];
},
minHeight = parseFloat(getFirstStyle('height'))
minHeight = parseFloat(getFirstStyle('height'));
elem.style.resize = 'none';
elem2.style.resize = 'none';
@ -1474,8 +1474,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
style2.overflowY = 'auto';
} else {
height = elem.scrollHeight - padding;
style.overflowY = 'hidden';
style2.overflowY = 'hidden';
};
style.height = height + extra + 'px';
style2.height = height + extra + 'px';
@ -1491,8 +1489,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
style2.overflowY = 'auto';
} else {
height = elem2.scrollHeight - padding;
style.overflowY = 'hidden';
style2.overflowY = 'hidden';
};
style.height = height + extra + 'px';
style2.height = height + extra + 'px';

View File

@ -632,7 +632,7 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
} : function (name) {
return getComputedStyle(elem, null)[name];
},
minHeight = parseFloat(getFirstStyle('height'))
minHeight = parseFloat(getFirstStyle('height'));
elem.style.resize = 'none';
elem2.style.resize = 'none';
@ -660,8 +660,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
style2.overflowY = 'auto';
} else {
height = elem.scrollHeight - padding;
style.overflowY = 'hidden';
style2.overflowY = 'hidden';
};
style.height = height + extra + 'px';
style2.height = height + extra + 'px';
@ -677,8 +675,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
style2.overflowY = 'auto';
} else {
height = elem2.scrollHeight - padding;
style.overflowY = 'hidden';
style2.overflowY = 'hidden';
};
style.height = height + extra + 'px';
style2.height = height + extra + 'px';