summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-02-25 15:36:25 +0000
committerhallgren <hallgren@chalmers.se>2015-02-25 15:36:25 +0000
commit52212d5a7656a4af7460cca1ded367c3e0d62d2f (patch)
tree7678bcad44be50f1d38cfd733e1e8aadea8f1473 /src
parente68370e46308815b7c75d99bec9a27d44606584b (diff)
Wide Coverage Translation Demo: better resizing behavior on startup and when pasting text
Diffstat (limited to 'src')
-rw-r--r--src/www/js/wc.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/www/js/wc.js b/src/www/js/wc.js
index cbcb421d2..e0eeb4587 100644
--- a/src/www/js/wc.js
+++ b/src/www/js/wc.js
@@ -1,3 +1,6 @@
+
+/* --- Wide Coverage Translation Demo web app ------------------------------- */
+
var wc={}
//wc.cnl="Phrasebook" // try this controlled natural language first
wc.f=document.forms[0]
@@ -11,12 +14,14 @@ wc.local=appLocalStorage("gf.wc.")
wc.translating=""
wc.delayed_translate=function() {
- function restart(){ if(wc.f.input.value!=wc.translating) wc.translate() }
+ function restart(){
+ if(wc.f.input.value!=wc.translating) wc.translate()
+ var h=wc.f.input.scrollHeight,bh=document.body.clientHeight
+ if(h>bh) h=bh
+ if(wc.f.input.clientHeight<h) wc.f.input.style.height=h+15+"px"
+ }
if(wc.timer) clearTimeout(wc.timer);
wc.timer=setTimeout(restart,500)
- var h=wc.f.input.scrollHeight,bh=document.body.clientHeight
- if(h>bh) h=bh
- if(wc.f.input.clientHeight<h) wc.f.input.style.height=h+15+"px"
}
wc.clear=function() {