mirror of
https://codeberg.org/aryak/mozhi
synced 2024-11-26 18:11:57 +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,
|
"To": to,
|
||||||
"TtsFrom": ttsFrom,
|
"TtsFrom": ttsFrom,
|
||||||
"TtsTo": ttsTo,
|
"TtsTo": ttsTo,
|
||||||
|
"defaultLang": "en",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
Translate with: <a href="#" class="selected-option">{{.Engine}}</a>
|
Translate with: <a href="#" class="selected-option">{{.Engine}}</a>
|
||||||
<ul class="options">
|
<ul class="options">
|
||||||
{{range .enginesNames}}
|
{{range .enginesNames}}
|
||||||
<a href="/?engine={{.}}"><li>{{.}}</li></a>
|
<a href="/?engine={{.}}">
|
||||||
|
<li>{{.}}</li>
|
||||||
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -18,11 +20,15 @@
|
|||||||
<div class="wrap languages">
|
<div class="wrap languages">
|
||||||
<div class="language">
|
<div class="language">
|
||||||
<select name="from" aria-label="Source 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}}>
|
<option value="{{ .Id }}" {{if eq $.From .Id}}selected{{end}}>
|
||||||
{{ .Name }}
|
{{ .Name }}
|
||||||
</option>
|
</option>
|
||||||
{{end}}
|
{{else}}
|
||||||
|
<option value="{{ .Id }}" {{if eq .Id $.defaultLang}}selected{{end}}>
|
||||||
|
{{ .Name }}
|
||||||
|
</option>
|
||||||
|
{{end}} {{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -91,5 +97,16 @@
|
|||||||
<button type="submit">Translate with {{ .Engine }}!</button>
|
<button type="submit">Translate with {{ .Engine }}!</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</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>
|
</main>
|
||||||
{{ template "footer" .}}
|
{{ template "footer" .}}
|
||||||
|
Loading…
Reference in New Issue
Block a user