From e6f4c0414669505436ae9476aca9b5664cb5b36a Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Mon, 20 Jun 2016 11:09:14 +0200 Subject: js/interface.js: fix --- js/interface.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/js/interface.js b/js/interface.js index 089f417..58c89d8 100644 --- a/js/interface.js +++ b/js/interface.js @@ -225,6 +225,11 @@ var wait_for_processed_postedit = function (url_prefix, seg_id) }, 3000); } +var safe_str = function (s) +{ + return encodeURIComponent(JSON.stringify(s)).replace(/^%22/,"").replace(/%22$/,""); +} + /* * next button * @@ -274,25 +279,25 @@ var next = function () post_edit = $.trim(send_data["target"].join(" ")); if (DE_target_done.length != DE_target_shapes.length) post_edit = ""; - send_data["post_edit"] = encodeURIComponent(post_edit); + send_data["post_edit"] = safe_str(post_edit); send_data['type'] = 'g'; send_data["original_svg"] = document.getElementById("original_svg").value; } else { post_edit = $.trim(target_textarea.value); - send_data["post_edit"] = encodeURIComponent(post_edit); + send_data["post_edit"] = safe_str(post_edit); send_data['type'] = 't'; send_data["count_click"] = TEXT_count_click; send_data["count_kbd"] = TEXT_count_kbd; } send_data["key"] = key; - send_data["name"] = encodeURIComponent($("#name").val().replace(/"/g, ' ').trim()); + send_data["name"] = safe_str($.trim($("#name").val())); // send data if (oov_correct.value=="false" && post_edit != "") { send_data["EDIT"] = true; send_data["duration"] = Timer.get(); - send_data["source_value"] = encodeURIComponent(source.value); + send_data["source_value"] = safe_str(source.value); // compose request // no change? if (post_edit == last_post_edit.value) { @@ -307,8 +312,8 @@ var next = function () var src = []; var tgt = []; for (var i=0; i Date: Mon, 20 Jun 2016 11:15:46 +0200 Subject: util/run_all: fix --- util/run_all | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/run_all b/util/run_all index ef3386a..6b4b382 100755 --- a/util/run_all +++ b/util/run_all @@ -4,6 +4,6 @@ for i in `cat ../sessions/sessions | cut -f 1`; do echo $i ./util/run_server $i & - sleep 15 + sleep 60 done -- cgit v1.2.3