mirror of
https://codeberg.org/aryak/mozhi
synced 2025-01-07 09:23:46 +05:30
move translate buttons up for better mobile usability (closes #16)
This commit is contained in:
parent
2f63e58e4d
commit
0f72048b11
@ -97,9 +97,11 @@ func HandleIndex(c *fiber.Ctx) error {
|
|||||||
if engine != "" && originalText != "" && from != "" && to != "" {
|
if engine != "" && originalText != "" && from != "" && to != "" {
|
||||||
if engine == "all" {
|
if engine == "all" {
|
||||||
transmany = libmozhi.TranslateAll(to, from, originalText)
|
transmany = libmozhi.TranslateAll(to, from, originalText)
|
||||||
|
translationExists = true
|
||||||
} else if engine == "some" {
|
} else if engine == "some" {
|
||||||
// The error doesn't really matter since it just checks if the engines are valid, which is already checked in the code at the beginning of the func
|
// The error doesn't really matter since it just checks if the engines are valid, which is already checked in the code at the beginning of the func
|
||||||
transmany, _ = libmozhi.TranslateSome(enginesSome.Engines, to, from, originalText)
|
transmany, _ = libmozhi.TranslateSome(enginesSome.Engines, to, from, originalText)
|
||||||
|
translationExists = true
|
||||||
} else {
|
} else {
|
||||||
translation, tlerr = libmozhi.Translate(engine, to, from, originalText)
|
translation, tlerr = libmozhi.Translate(engine, to, from, originalText)
|
||||||
if tlerr != nil {
|
if tlerr != nil {
|
||||||
|
@ -73,6 +73,22 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if .TranslationExists }}
|
||||||
|
<div style="display:flex;
|
||||||
|
justify-content:space-around;
|
||||||
|
align-items:center">
|
||||||
|
<button class="wrap" type="button" onclick="copyToClipboard()">Copy the translation</button>
|
||||||
|
{{ if and .Engine .From .To .OriginalText }}
|
||||||
|
<p>
|
||||||
|
<a id="url"
|
||||||
|
class="button"
|
||||||
|
onclick="copyLinkToClipboard(event)"
|
||||||
|
href="/?engine={{.Engine}}&from={{.From}}&to={{.To}}&text={{.OriginalText}}">Copy translation link</a>
|
||||||
|
</p>
|
||||||
|
{{ end }}
|
||||||
|
<button class="wrap" type="submit">Translate!</button>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
<div class="center-area2 item-wrapper">
|
<div class="center-area2 item-wrapper">
|
||||||
Source Text:
|
Source Text:
|
||||||
<textarea autofocus class="item" id="input" name="text" dir="auto" placeholder="Enter Text Here">
|
<textarea autofocus class="item" id="input" name="text" dir="auto" placeholder="Enter Text Here">
|
||||||
@ -128,31 +144,15 @@
|
|||||||
<br>
|
<br>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div style="display:flex;
|
{{ if not .TranslationExists }}
|
||||||
justify-content:space-around;
|
<button class="wrap"
|
||||||
align-items:center">
|
style="margin-left:auto;
|
||||||
{{ if .TranslationExists }}
|
position:relative;
|
||||||
<button class="wrap" type="button" onclick="copyToClipboard()">Copy the translation</button>
|
left:-10%;
|
||||||
{{ end }}
|
margin-top: 1%"
|
||||||
{{ if and .Engine .From .To .OriginalText }}
|
type="submit">Translate!</button>
|
||||||
<p>
|
{{ end }}
|
||||||
<a id="url"
|
|
||||||
class="button"
|
|
||||||
onclick="copyLinkToClipboard(event)"
|
|
||||||
href="/?engine={{.Engine}}&from={{.From}}&to={{.To}}&text={{.OriginalText}}">Copy translation link</a>
|
|
||||||
</p>
|
|
||||||
{{ end }}
|
|
||||||
{{ if .TranslationExists }}
|
|
||||||
<button class="wrap" type="submit">Translate!</button>
|
|
||||||
{{ else }}
|
|
||||||
<button class="wrap"
|
|
||||||
style="margin-left:auto;
|
|
||||||
position:relative;
|
|
||||||
left:-10%;
|
|
||||||
margin-top: 1%"
|
|
||||||
type="submit">Translate!</button>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{{ if eq .Engine "yandex" }}
|
{{ if eq .Engine "yandex" }}
|
||||||
{{ template "yandex_extras" . }}
|
{{ template "yandex_extras" . }}
|
||||||
|
Loading…
Reference in New Issue
Block a user