编程作业新建和编辑的时候,测试输出集很长的显示不友好,调整
This commit is contained in:
parent
f9767abd3b
commit
88c8c4144b
|
@ -48,8 +48,8 @@
|
||||||
}
|
}
|
||||||
if (inputs.length == outputs.length) {
|
if (inputs.length == outputs.length) {
|
||||||
for (var i=0; i<inputs.length; i++) {
|
for (var i=0; i<inputs.length; i++) {
|
||||||
autoTextarea2(inputs[i], outputs[i]);
|
autoTextarea2(inputs[i], outputs[i], 0, 140);
|
||||||
autoTextarea2(outputs[i], inputs[i]);
|
autoTextarea2(outputs[i], inputs[i], 0, 140);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(inputs[inputs.length - 1]).focus();
|
$(inputs[inputs.length - 1]).focus();
|
||||||
|
@ -61,7 +61,16 @@
|
||||||
<% if !edit_mode %>
|
<% if !edit_mode %>
|
||||||
var text = document.getElementById("textarea_input_test");
|
var text = document.getElementById("textarea_input_test");
|
||||||
var text2 = document.getElementById("textarea_output_test");
|
var text2 = document.getElementById("textarea_output_test");
|
||||||
autoTextarea2(text,text2);
|
autoTextarea2(text,text2, 0, 140);
|
||||||
autoTextarea2(text2,text);
|
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 %>
|
<% end %>
|
||||||
</script>
|
</script>
|
|
@ -1446,7 +1446,7 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
} : function (name) {
|
} : function (name) {
|
||||||
return getComputedStyle(elem, null)[name];
|
return getComputedStyle(elem, null)[name];
|
||||||
},
|
},
|
||||||
minHeight = parseFloat(getFirstStyle('height'))
|
minHeight = parseFloat(getFirstStyle('height'));
|
||||||
|
|
||||||
elem.style.resize = 'none';
|
elem.style.resize = 'none';
|
||||||
elem2.style.resize = 'none';
|
elem2.style.resize = 'none';
|
||||||
|
@ -1474,8 +1474,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
style2.overflowY = 'auto';
|
style2.overflowY = 'auto';
|
||||||
} else {
|
} else {
|
||||||
height = elem.scrollHeight - padding;
|
height = elem.scrollHeight - padding;
|
||||||
style.overflowY = 'hidden';
|
|
||||||
style2.overflowY = 'hidden';
|
|
||||||
};
|
};
|
||||||
style.height = height + extra + 'px';
|
style.height = height + extra + 'px';
|
||||||
style2.height = height + extra + 'px';
|
style2.height = height + extra + 'px';
|
||||||
|
@ -1491,8 +1489,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
style2.overflowY = 'auto';
|
style2.overflowY = 'auto';
|
||||||
} else {
|
} else {
|
||||||
height = elem2.scrollHeight - padding;
|
height = elem2.scrollHeight - padding;
|
||||||
style.overflowY = 'hidden';
|
|
||||||
style2.overflowY = 'hidden';
|
|
||||||
};
|
};
|
||||||
style.height = height + extra + 'px';
|
style.height = height + extra + 'px';
|
||||||
style2.height = height + extra + 'px';
|
style2.height = height + extra + 'px';
|
||||||
|
|
|
@ -632,7 +632,7 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
} : function (name) {
|
} : function (name) {
|
||||||
return getComputedStyle(elem, null)[name];
|
return getComputedStyle(elem, null)[name];
|
||||||
},
|
},
|
||||||
minHeight = parseFloat(getFirstStyle('height'))
|
minHeight = parseFloat(getFirstStyle('height'));
|
||||||
|
|
||||||
elem.style.resize = 'none';
|
elem.style.resize = 'none';
|
||||||
elem2.style.resize = 'none';
|
elem2.style.resize = 'none';
|
||||||
|
@ -660,8 +660,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
style2.overflowY = 'auto';
|
style2.overflowY = 'auto';
|
||||||
} else {
|
} else {
|
||||||
height = elem.scrollHeight - padding;
|
height = elem.scrollHeight - padding;
|
||||||
style.overflowY = 'hidden';
|
|
||||||
style2.overflowY = 'hidden';
|
|
||||||
};
|
};
|
||||||
style.height = height + extra + 'px';
|
style.height = height + extra + 'px';
|
||||||
style2.height = height + extra + 'px';
|
style2.height = height + extra + 'px';
|
||||||
|
@ -677,8 +675,6 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
||||||
style2.overflowY = 'auto';
|
style2.overflowY = 'auto';
|
||||||
} else {
|
} else {
|
||||||
height = elem2.scrollHeight - padding;
|
height = elem2.scrollHeight - padding;
|
||||||
style.overflowY = 'hidden';
|
|
||||||
style2.overflowY = 'hidden';
|
|
||||||
};
|
};
|
||||||
style.height = height + extra + 'px';
|
style.height = height + extra + 'px';
|
||||||
style2.height = height + extra + 'px';
|
style2.height = height + extra + 'px';
|
||||||
|
|
Loading…
Reference in New Issue