mirror of
https://codeberg.org/aryak/mozhi
synced 2024-12-22 00:19:45 +05:30
ctrl+return to send, english default source
This commit is contained in:
parent
a2ae02f6d7
commit
197296e91f
@ -62,5 +62,6 @@ func HandleIndex(c *fiber.Ctx) error {
|
||||
"To": to,
|
||||
"TtsFrom": ttsFrom,
|
||||
"TtsTo": ttsTo,
|
||||
"defaultLang": "en",
|
||||
})
|
||||
}
|
||||
|
@ -5,7 +5,9 @@
|
||||
Translate with: <a href="#" class="selected-option">{{.Engine}}</a>
|
||||
<ul class="options">
|
||||
{{range .enginesNames}}
|
||||
<a href="/?engine={{.}}"><li>{{.}}</li></a>
|
||||
<a href="/?engine={{.}}">
|
||||
<li>{{.}}</li>
|
||||
</a>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
@ -18,11 +20,15 @@
|
||||
<div class="wrap languages">
|
||||
<div class="language">
|
||||
<select name="from" aria-label="Source language">
|
||||
{{range $key, $value := .SourceLanguages}}
|
||||
{{range $key, $value := .SourceLanguages}} {{if $.From}}
|
||||
<option value="{{ .Id }}" {{if eq $.From .Id}}selected{{end}}>
|
||||
{{ .Name }}
|
||||
</option>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<option value="{{ .Id }}" {{if eq .Id $.defaultLang}}selected{{end}}>
|
||||
{{ .Name }}
|
||||
</option>
|
||||
{{end}} {{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -91,5 +97,16 @@
|
||||
<button type="submit">Translate with {{ .Engine }}!</button>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
||||
// this code submits the translation form when pressing Ctrl/Meta+Enter while focussed on the input text field
|
||||
document
|
||||
.getElementById("input")
|
||||
.addEventListener("keydown", function (event) {
|
||||
if (event.keyCode === 13 && (event.metaKey || event.ctrlKey)) {
|
||||
document.getElementById("translation-form").submit();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</main>
|
||||
{{ template "footer" .}}
|
||||
|
Loading…
Reference in New Issue
Block a user