summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-06-20 13:26:24 +0200
committerPatrick Simianer <p@simianer.de>2016-06-20 13:26:24 +0200
commit758e8671e0148d2abb0895a26593c33601aa44cc (patch)
tree8f6a0b70c480d50f308854f6b910872030671eca
parent550748d07cb660c28d28e41eee256b3371d4ce62 (diff)
parentaf01bff529f5b70e2e552ddd98b980e8222a1876 (diff)
Merge branch 'master' of github.com:pks/lfpe
-rw-r--r--js/interface.js17
-rwxr-xr-xutil/run_all2
2 files changed, 12 insertions, 7 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<l; i++) {
- src.push(encodeURIComponent($.trim(document.getElementById("oov_src"+i).value)));
- tgt.push(encodeURIComponent($.trim(document.getElementById("oov_tgt"+i).value)));
+ src.push(safe_str($.trim(document.getElementById("oov_src"+i).value)));
+ tgt.push(safe_str($.trim(document.getElementById("oov_tgt"+i).value)));
if (tgt[tgt.length-1] == "") { // empty correction
alert("Please provide translations for all words.");
not_working();
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