mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Wide Coverage Demo App updates
+ Add Clear button. + Use localstorage to remember entered text between visits. + Add a link to it on the GF cloud service start page.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
<li><a href="gfse/">GF online editor for simple multilingual grammars</a>
|
||||
<li><a href="translator/">Simple Translation Tool</a>
|
||||
(bilingual document editor)
|
||||
<li><a href="wc.html">Wide Coverage Translation Demo</a>
|
||||
</ul>
|
||||
|
||||
<h2>Documentation</h2>
|
||||
|
||||
@@ -6,6 +6,7 @@ wc.e=element("extra")
|
||||
wc.p=element("pick")
|
||||
wc.serial=0
|
||||
wc.os=[]
|
||||
wc.local=appLocalStorage("gf.wc.")
|
||||
|
||||
wc.delayed_translate=function() {
|
||||
function restart(){ if(wc.f.input.value!=wc.translating) wc.translate() }
|
||||
@@ -16,6 +17,28 @@ wc.delayed_translate=function() {
|
||||
if(wc.f.input.clientHeight<h) wc.f.input.style.height=h+15+"px"
|
||||
}
|
||||
|
||||
wc.clear=function() {
|
||||
wc.f.input.value=""
|
||||
wc.f.input.style.height=""
|
||||
clear(wc.o)
|
||||
wc.delayed_translate()
|
||||
}
|
||||
|
||||
wc.save=function() {
|
||||
var f=wc.f
|
||||
wc.local.put("from",f.from.value)
|
||||
wc.local.put("to",f.to.value)
|
||||
wc.local.put("input",f.input.value)
|
||||
}
|
||||
|
||||
wc.load=function() {
|
||||
var f=wc.f
|
||||
f.input.value=wc.local.get("input",f.input.value)
|
||||
f.from.value=wc.local.get("from",f.from.value)
|
||||
f.to.value=wc.local.get("to",f.to.value)
|
||||
wc.delayed_translate()
|
||||
}
|
||||
|
||||
wc.translate=function() {
|
||||
var current= ++wc.serial
|
||||
var f=wc.f, e=wc.e, p=wc.p
|
||||
@@ -178,6 +201,7 @@ wc.translate=function() {
|
||||
translate_segment(i)
|
||||
}
|
||||
}
|
||||
wc.save()
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -246,4 +270,5 @@ if(wc.cnl) {
|
||||
wc.pgf_online=pgf_online({});
|
||||
wc.pgf_online.switch_grammar(wc.cnl+".pgf")
|
||||
}
|
||||
wc.load()
|
||||
wc.f.input.focus()
|
||||
|
||||
@@ -43,6 +43,7 @@ small { color: #666; }
|
||||
<option value=Hin>Hindi</option>
|
||||
<option value=Swe>Swedish</option>
|
||||
</select>
|
||||
<input type=button value="Clear" onclick="wc.clear()">
|
||||
<td style="text-align: right">
|
||||
<input type=button name=swap onclick="wc.swap()" value="⇆">
|
||||
<td>
|
||||
@@ -77,7 +78,7 @@ small { color: #666; }
|
||||
</div>
|
||||
<p>
|
||||
<div class=modtime><small>
|
||||
<!-- hhmts start -->Last modified: Tue Apr 8 13:22:42 CEST 2014 <!-- hhmts end -->
|
||||
<!-- hhmts start -->Last modified: Wed Apr 9 15:43:04 CEST 2014 <!-- hhmts end -->
|
||||
</small></div>
|
||||
<script src="js/support.js"></script>
|
||||
<script src="js/gftranslate.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user