diff options
author | Patrick Simianer <p@simianer.de> | 2016-01-27 17:42:33 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-01-27 17:42:33 +0100 |
commit | 1b83206627566d55d5fb83c2044091cef02ad48e (patch) | |
tree | 93243a0dcb0a3861f682495800fc775d9e10a693 | |
parent | 4b201cb661909a2663b8f94fe9f7b27dca33c287 (diff) |
bugfix
-rw-r--r-- | js/lfpe.js | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -171,7 +171,12 @@ function Next() // extract data from interfaces if (ui_type == 'g') { - send_data = JSON.parse(DE_extract_data()); + data_s = DE_extract_data(); + if (!data_s) { + not_working(); + return; + } + send_data = JSON.parse(data_s); post_edit = trim(send_data["target"].join(" ")); if (DE_target_done.length != DE_target_shapes.length) post_edit = ""; @@ -209,7 +214,7 @@ function Next() tgt.push(encodeURIComponent(trim(document.getElementById("oov_tgt"+i).value))); if (tgt[tgt.length-1] == "") { // empty correction alert("Please provide translations for all words."); - //not_working(); + not_working(); return; } @@ -245,6 +250,8 @@ function Next() // 'next' request's callbacks xhr.onload = function() { + if (xhr.readyState != 4 || xhr.status!=200) { alert("XHR ERROR 2"); return; } + document.getElementById("init").value = 1; // for pause() // translation system is currently handling a request // FIXME maybe poll server for result? @@ -370,8 +377,6 @@ function Next() } }; - xhr.onerror = function() {}; // FIXME do something reasonable - xhr.send(JSON.stringify(send_data)); // send 'next' request return; |