mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
Wide Coverage Translation Demo: better resizing behavior on startup and when pasting text
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
/* --- Wide Coverage Translation Demo web app ------------------------------- */
|
||||||
|
|
||||||
var wc={}
|
var wc={}
|
||||||
//wc.cnl="Phrasebook" // try this controlled natural language first
|
//wc.cnl="Phrasebook" // try this controlled natural language first
|
||||||
wc.f=document.forms[0]
|
wc.f=document.forms[0]
|
||||||
@@ -11,13 +14,15 @@ wc.local=appLocalStorage("gf.wc.")
|
|||||||
wc.translating=""
|
wc.translating=""
|
||||||
|
|
||||||
wc.delayed_translate=function() {
|
wc.delayed_translate=function() {
|
||||||
function restart(){ if(wc.f.input.value!=wc.translating) wc.translate() }
|
function restart(){
|
||||||
if(wc.timer) clearTimeout(wc.timer);
|
if(wc.f.input.value!=wc.translating) wc.translate()
|
||||||
wc.timer=setTimeout(restart,500)
|
|
||||||
var h=wc.f.input.scrollHeight,bh=document.body.clientHeight
|
var h=wc.f.input.scrollHeight,bh=document.body.clientHeight
|
||||||
if(h>bh) h=bh
|
if(h>bh) h=bh
|
||||||
if(wc.f.input.clientHeight<h) wc.f.input.style.height=h+15+"px"
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
wc.clear=function() {
|
wc.clear=function() {
|
||||||
wc.f.input.value=""
|
wc.f.input.value=""
|
||||||
|
|||||||
Reference in New Issue
Block a user