Commit 752a4552 by Carlos Andrés Rocha Committed by Victor Shnayder

Fixed design-a-protein input type to save the value of output

parent bc3f373e
...@@ -9,13 +9,19 @@ ...@@ -9,13 +9,19 @@
function waitForApplet(applet) { function waitForApplet(applet) {
if (applet.isActive && applet.isActive()) { if (applet.isActive && applet.isActive()) {
console.log("Applet is ready."); console.log("Applet is ready.");
// FIXME: [rocha] This is a hack to capture the click on the check
// button and update the hidden field with the applet values
var input_field = $('.designprotein2dinput input');
var problem = $(applet).parents('.problem');
var check_button = problem.find('input.check');
check_button.on('click', function() {
var answerStr = applet.checkAnswer(); var answerStr = applet.checkAnswer();
console.log(answerStr); console.log(answerStr);
var input = $('.designprotein2dinput input'); input_field.val(answerStr);
console.log(input); });
input.val(answerStr);
} else if (timeout > 30 * 1000) {
console.error("Applet did not load on time.");
} else { } else {
console.log("Waiting for applet..."); console.log("Waiting for applet...");
setTimeout(function() { waitForApplet(applet); }, timeout); setTimeout(function() { waitForApplet(applet); }, timeout);
...@@ -24,4 +30,5 @@ ...@@ -24,4 +30,5 @@
var applets = $('.designprotein2dinput object'); var applets = $('.designprotein2dinput object');
applets.each(function(i, el) { initializeApplet(el); }); applets.each(function(i, el) { initializeApplet(el); });
}).call(this); }).call(this);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment