From aa97f229d6a6a1e5bc2bd133d0d39eefff888566 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 14 Apr 2015 10:44:57 +0200 Subject: submit on keypress --- index.php | 12 +++++++++++- lfpe.css | 14 ++++++++++++++ lfpe.js | 16 ++++++++++++++-- model/grammar.gz | Bin 121 -> 153 bytes model/run | 9 ++++++++- model/src.gz | Bin 70 -> 128 bytes server.rb | 4 ++-- 7 files changed, 49 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index ef1574e..7439c91 100644 --- a/index.php +++ b/index.php @@ -8,22 +8,32 @@ +
+
- +

+
+

translating

+

+Press the 'Next' to submit your post-edit and request the next segment to translate +(or just press enter when the textarea is in focus). +

+ + diff --git a/lfpe.css b/lfpe.css index b7959fa..91b8c3a 100644 --- a/lfpe.css +++ b/lfpe.css @@ -4,6 +4,8 @@ textarea { p#translating_status { display: none; + margin-left: 4.2em; + margin-top: -5.5em } button { @@ -17,3 +19,15 @@ p#fi { display: none; } +div#wrapper { + margin: 4em; + padding: 1em; + border: 1px dashed #000 +} + +p#desc { + font-size:0.8em; + color: #ccc; + position: fixed +} + diff --git a/lfpe.js b/lfpe.js index 4bbbcee..bf7aa0e 100644 --- a/lfpe.js +++ b/lfpe.js @@ -14,9 +14,18 @@ function CreateCORSRequest(method, url) { return xhr; } -function Next(url) +function submit(e) { + if (e.keyCode == 13) { + e.preventDefault(); + Next(); + } + + return false; +} + +function Next() { - url = "http://localhost:31337/next"; + url = "http://coltrane.cl.uni-heidelberg.de:60666/next"; var pe = document.getElementById("trgt").value; if (pe != "") { var src = document.getElementById("src").value; @@ -43,6 +52,9 @@ function Next(url) document.getElementById("trgt").value = x[1]; document.getElementById("trgt").cols = x[1].length; document.getElementById("translating_status").style.display = "none"; + document.getElementById("trgt").focus(); + document.getElementById("trgt").selectionStart = 0; + document.getElementById("trgt").selectionEnd = 0; } }; diff --git a/model/grammar.gz b/model/grammar.gz index 84eb73c..8c5f570 100644 Binary files a/model/grammar.gz and b/model/grammar.gz differ diff --git a/model/run b/model/run index 43f20b0..2ab2498 100755 --- a/model/run +++ b/model/run @@ -1,4 +1,11 @@ #!/bin/bash -x -~/src/cdec_net/training/dtrain/dtrain_net_interface -c dtrain.ini -a ipc:///tmp/dtrain.ipc +export LD_LIBRARY_PATH=/fast_scratch/simianer/lfpe/nanomsg-0.5-beta/lib + +while true; do +/fast_scratch/simianer/lfpe/cdec_net/training/dtrain/dtrain_net_interface -c dtrain.ini -a ipc:///tmp/dtrain.ipc &>dtrain.out & +PID=$! +sleep 600 +kill $PID +done diff --git a/model/src.gz b/model/src.gz index 9aa247f..3f8f895 100644 Binary files a/model/src.gz and b/model/src.gz differ diff --git a/server.rb b/server.rb index fac51d1..def401e 100644 --- a/server.rb +++ b/server.rb @@ -5,8 +5,8 @@ require 'sinatra/cross_origin' require 'nanomsg' require 'zipf' -set :bind, '0.0.0.0' -set :port, 31337 +set :bind, '147.142.207.52' +set :port, 60666 set :allow_origin, :any set :allow_methods, [:get, :post, :options] -- cgit v1.2.3