mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Wide Coverage Demo App: new buttons: to switch colors on/off & to try Google Translate
This commit is contained in:
@@ -29,6 +29,7 @@ wc.save=function() {
|
|||||||
wc.local.put("from",f.from.value)
|
wc.local.put("from",f.from.value)
|
||||||
wc.local.put("to",f.to.value)
|
wc.local.put("to",f.to.value)
|
||||||
wc.local.put("input",f.input.value)
|
wc.local.put("input",f.input.value)
|
||||||
|
wc.local.put("colors",f.colors.checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
wc.load=function() {
|
wc.load=function() {
|
||||||
@@ -36,6 +37,8 @@ wc.load=function() {
|
|||||||
f.input.value=wc.local.get("input",f.input.value)
|
f.input.value=wc.local.get("input",f.input.value)
|
||||||
f.from.value=wc.local.get("from",f.from.value)
|
f.from.value=wc.local.get("from",f.from.value)
|
||||||
f.to.value=wc.local.get("to",f.to.value)
|
f.to.value=wc.local.get("to",f.to.value)
|
||||||
|
f.colors.checked=wc.local.get("colors",f.colors.checked)
|
||||||
|
wc.colors()
|
||||||
wc.delayed_translate()
|
wc.delayed_translate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +215,11 @@ wc.speak=function(text,lang) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wc.colors=function() {
|
||||||
|
wc.o.className=wc.f.colors.checked ? "colors" : ""
|
||||||
|
wc.local.put("colors",wc.f.colors.checked)
|
||||||
|
}
|
||||||
|
|
||||||
wc.swap=function() {
|
wc.swap=function() {
|
||||||
var f=wc.f
|
var f=wc.f
|
||||||
function txt(r) { return r.text }
|
function txt(r) { return r.text }
|
||||||
@@ -228,13 +236,13 @@ wc.google_translate_url=function() {
|
|||||||
+"/"+alangcode(wc.f.to.value)
|
+"/"+alangcode(wc.f.to.value)
|
||||||
+"/"+encodeURIComponent(wc.f.input.value)
|
+"/"+encodeURIComponent(wc.f.input.value)
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
wc.try_google=function() {
|
wc.try_google=function() {
|
||||||
var w=window.open(wc.google_translate_url(),
|
var w=window.open(wc.google_translate_url(),
|
||||||
"google_translate")
|
"google_translate")
|
||||||
w.focus()
|
w.focus()
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Update language selection menus with the languages supported by the grammar
|
// Update language selection menus with the languages supported by the grammar
|
||||||
function init_languages() {
|
function init_languages() {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ body:target h1, body:target div.modtime { display: none; }
|
|||||||
small { color: #666; }
|
small { color: #666; }
|
||||||
#pick>* { padding: 0 0.5ex; }
|
#pick>* { padding: 0 0.5ex; }
|
||||||
#speak { display: none; }
|
#speak { display: none; }
|
||||||
.default_quality { background-color: #ffc; }
|
.colors .default_quality { background-color: #ffc; }
|
||||||
.high_quality { background-color: #cfc; }
|
.colors .high_quality { background-color: #cfc; }
|
||||||
.low_quality { background-color: #fcc; }
|
.colors .low_quality { background-color: #fcc; }
|
||||||
.placeholder { color: #999; }
|
.placeholder { color: #999; }
|
||||||
.error { color: #c00; }
|
.error { color: #c00; }
|
||||||
</style>
|
</style>
|
||||||
@@ -57,7 +57,8 @@ small { color: #666; }
|
|||||||
<option value=Hin>Hindi</option>
|
<option value=Hin>Hindi</option>
|
||||||
<option value=Swe selected>Swedish</option>
|
<option value=Swe selected>Swedish</option>
|
||||||
</select>
|
</select>
|
||||||
<td><button name=translate type=submit><strong><big>Translate</big></strong></button>
|
<input name=colors type=checkbox checked onchange="wc.colors()"> Colors
|
||||||
|
<td><button name=translate type=submit><strong>Translate</strong></button>
|
||||||
<tr><td class=input colspan=2>
|
<tr><td class=input colspan=2>
|
||||||
<textarea name=input rows=5 style="width: 100%" onkeyup="wc.delayed_translate()"></textarea>
|
<textarea name=input rows=5 style="width: 100%" onkeyup="wc.delayed_translate()"></textarea>
|
||||||
<small>Enter text to translate above.</small>
|
<small>Enter text to translate above.</small>
|
||||||
@@ -72,13 +73,13 @@ small { color: #666; }
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class=center>
|
<div class=center>
|
||||||
<!--input type=button onclick="wc.try_google()" value="Google Translate"-->
|
<input type=button onclick="wc.try_google()" value="Try Google Translate">
|
||||||
<div id=pick></div>
|
<div id=pick></div>
|
||||||
<small id=extra></small>
|
<small id=extra></small>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<div class=modtime><small>
|
<div class=modtime><small>
|
||||||
<!-- hhmts start -->Last modified: Wed Apr 9 20:57:07 CEST 2014 <!-- hhmts end -->
|
<!-- hhmts start -->Last modified: Wed Apr 9 22:35:17 CEST 2014 <!-- hhmts end -->
|
||||||
</small></div>
|
</small></div>
|
||||||
<script src="js/support.js"></script>
|
<script src="js/support.js"></script>
|
||||||
<script src="js/gftranslate.js"></script>
|
<script src="js/gftranslate.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user