Merge pull request #98 from idotj/main

Features + fix bugs (frontend)
This commit is contained in:
Piero Toffanin 2021-06-12 10:52:23 -04:00 committed by GitHub
commit 5ffe73cd15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 31 deletions

View file

@ -57,7 +57,7 @@ h3.header {
background: none;
padding: 0;
cursor: pointer;
color: #888;
color: #777;
}
.btn-delete-text:focus,
@ -69,17 +69,17 @@ h3.header {
position: absolute;
right: 2rem;
bottom: 1rem;
color: #888;
color: #777;
pointer-events: none;
}
.btn-copy-translated {
position: absolute;
right: 2rem;
right: 2.75rem;
bottom: 1rem;
display: flex;
align-items: center;
color: #888;
color: #777;
font-size: 0.85rem;
background: none;
border: none;
@ -96,7 +96,7 @@ h3.header {
}
.progress {
background-color: #efefef;
background-color: #f3f3f3;
}
.progress.translate {
@ -111,16 +111,26 @@ h3.header {
font-size: 1.25rem;
resize: none;
border: 1px solid #ccc;
background: #efefef;
background: #f3f3f3;
padding: 1rem 2rem 1rem 1.5rem;
overflow-y: hidden;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
.code {
font-size: 90%;
border-radius: 4px;
padding: 1rem 1.5rem;
border: 1px solid #9e9e9e;
border: 1px solid #ccc;
background: #fbfbfb;
overflow: auto;
font-family: monospace;

View file

@ -1 +1 @@
h3.header{margin-bottom:2.5rem}.mb-0{margin-bottom:0!important}.mt-0{margin-top:0!important}.position-relative{position:relative}.language-select{display:inline-flex;align-items:center;justify-content:flex-start}.language-select select{border:none;width:auto;cursor:pointer;font-weight:600;text-decoration:underline;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-indent:1px;text-overflow:"";padding:0;height:2rem}.btn-switch-language{color:#000;margin-left:-1.5rem;margin-right:1rem}.textarea-container{margin-top:0;position:relative}.btn-delete-text{position:absolute;right:1.5rem;top:.75rem;border:0;background:0 0;padding:0;cursor:pointer;color:#888}.btn-copy-translated:focus,.btn-delete-text:focus{background:0 0!important}.characters-limit-container{position:absolute;right:2rem;bottom:1rem;color:#888;pointer-events:none}.btn-copy-translated{position:absolute;right:2rem;bottom:1rem;display:flex;align-items:center;color:#888;font-size:.85rem;background:0 0;border:none;cursor:pointer;margin-right:-1.5rem}.btn-copy-translated span{padding-right:.5rem}.btn-copy-translated .material-icons{font-size:1.35rem}.progress{background-color:#efefef}.progress.translate{position:absolute}.progress .indeterminate{background-color:#4682b4}.textarea-container textarea{font-size:1.25rem;resize:none;border:1px solid #ccc;background:#efefef;padding:1rem 2rem 1rem 1.5rem;overflow-y:hidden}.code{font-size:90%;border-radius:4px;padding:1rem 1.5rem;border:1px solid #9e9e9e;background:#fbfbfb;overflow:auto;font-family:monospace;min-height:280px;width:100%;overflow:auto}.page-footer .footer-copyright{justify-content:center}@media (max-width:760px){.language-select select{text-align:center;margin:auto}.language-select span{display:none}}
h3.header{margin-bottom:2.5rem}.mb-0{margin-bottom:0!important}.mt-0{margin-top:0!important}.position-relative{position:relative}.language-select{display:inline-flex;align-items:center;justify-content:flex-start}.language-select select{border:none;width:auto;cursor:pointer;font-weight:600;text-decoration:underline;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-indent:1px;text-overflow:"";padding:0;height:2rem}.btn-switch-language{color:#000;margin-left:-1.5rem;margin-right:1rem}.textarea-container{margin-top:0;position:relative}.btn-delete-text{position:absolute;right:1.5rem;top:.75rem;border:0;background:0 0;padding:0;cursor:pointer;color:#777}.btn-copy-translated:focus,.btn-delete-text:focus{background:0 0!important}.characters-limit-container{position:absolute;right:2rem;bottom:1rem;color:#777;pointer-events:none}.btn-copy-translated{position:absolute;right:2.75rem;bottom:1rem;display:flex;align-items:center;color:#777;font-size:.85rem;background:0 0;border:none;cursor:pointer;margin-right:-1.5rem}.btn-copy-translated span{padding-right:.5rem}.btn-copy-translated .material-icons{font-size:1.35rem}.progress{background-color:#f3f3f3}.progress.translate{position:absolute}.progress .indeterminate{background-color:#4682b4}.textarea-container textarea{font-size:1.25rem;resize:none;border:1px solid #ccc;background:#f3f3f3;padding:1rem 2rem 1rem 1.5rem;overflow-y:hidden}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.code{font-size:90%;padding:1rem 1.5rem;border:1px solid #ccc;background:#fbfbfb;overflow:auto;font-family:monospace;min-height:280px;width:100%;overflow:auto}.page-footer .footer-copyright{justify-content:center}@media (max-width:760px){.language-select select{text-align:center;margin:auto}.language-select span{display:none}}

View file

@ -42,7 +42,7 @@
</a>
<ul class="right hide-on-med-and-down">
<li><a href="/docs">API Docs</a></li>
<li><a href="https://github.com/uav4geo/LibreTranslate">GitHub</a></li>
<li><a href="https://github.com/uav4geo/LibreTranslate" rel="noopener noreferrer">GitHub</a></li>
{% if api_keys %}
<li><a href="javascript:setApiKey()" title="Set API Key"><i class="material-icons">vpn_key</i></a></li>
{% endif %}
@ -50,7 +50,7 @@
<ul id="nav-mobile" class="sidenav">
<li><a href="/docs">API Docs</a></li>
<li><a href="https://github.com/uav4geo/LibreTranslate">GitHub</a></li>
<li><a href="https://github.com/uav4geo/LibreTranslate" rel="noopener noreferrer">GitHub</a></li>
{% if api_keys %}
<li><a href="javascript:setApiKey()" title="Set API Key"><i class="material-icons">vpn_key</i></a></li>
{% endif %}
@ -132,6 +132,9 @@
<div class="row">
<div class="input-field textarea-container col s6">
<label for="textarea1" class="sr-only">
Text to translate
</label>
<textarea id="textarea1" v-model="inputText" @input="handleInput" ref="inputTextarea"></textarea>
<button class="btn-delete-text" title="Delete text" @click="deleteText">
<i class="material-icons">close</i>
@ -142,16 +145,17 @@
</div>
<div class="input-field textarea-container col s6">
<div class="position-relative">
<textarea id="textarea2" v-model="translatedText" ref="translatedTextarea"></textarea>
<button class="btn-copy-translated" @click="copyText">
<span>[[ copyTextLabel ]]</span> <i class="material-icons">content_copy</i>
</button>
<label for="textarea2">
<div class="progress translate" v-if="loadingTranslation">
<div class="indeterminate"></div>
</div>
</label>
<label for="textarea2" class="sr-only">
Translated text
</label>
<textarea id="textarea2" v-model="translatedText" ref="translatedTextarea" readonly></textarea>
<button class="btn-copy-translated" @click="copyText">
<span>[[ copyTextLabel ]]</span> <i class="material-icons">content_copy</i>
</button>
<div class="position-relative">
<div class="progress translate" v-if="loadingTranslation">
<div class="indeterminate"></div>
</div>
</div>
</div>
</div>
@ -161,7 +165,7 @@
</div>
</div>
<div class="section no-pad-bot" id="index-banner">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<div class="col s12 m12">
@ -184,13 +188,13 @@
</div>
</div>
{% if web_version %}
<div class="section no-pad-bot" id="index-banner">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<div class="col s12 m12">
<h3 class="header">Open Source Machine Translation</h3>
<h4 class="header">100% Self-Hosted. No Limits. No Ties to Proprietary Services.</h4>
<br/><a class="waves-effect waves-light btn btn-large" href="https://github.com/uav4geo/LibreTranslate"><i class="material-icons left">cloud_download</i> Download</a>
<br/><a class="waves-effect waves-light btn btn-large" href="https://github.com/uav4geo/LibreTranslate" rel="noopener noreferrer"><i class="material-icons left">cloud_download</i> Download</a>
<br/><br/><br/>
</div>
</div>
@ -206,11 +210,11 @@
<div class="col l12 s12">
<h5 class="white-text">LibreTranslate</h5>
<p class="grey-text text-lighten-4">Free and Open Source Machine Translation API</p>
<p><a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html">License: AGPLv3</a></p>
<p><a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html" rel="noopener noreferrer">License: AGPLv3</a></p>
<p><a class="grey-text text-lighten-4" href="/javascript-licenses" rel="jslicense">JavaScript license information</a></p>
{% if web_version %}
<p>
The public API on libretranslate.com should be used for testing, personal or infrequent use. If you're going to run an application in production, please <a href="https://github.com/uav4geo/LibreTranslate" class="grey-text text-lighten-4" style="text-decoration: underline;">host your own server</a> or <a class="grey-text text-lighten-4" href="https://uav4geo.com/contact" style="text-decoration: underline;">get in touch</a> to obtain an API key.
The public API on libretranslate.com should be used for testing, personal or infrequent use. If you're going to run an application in production, please <a href="https://github.com/uav4geo/LibreTranslate" class="grey-text text-lighten-4" style="text-decoration: underline;" rel="noopener noreferrer">host your own server</a> or <a class="grey-text text-lighten-4" href="https://uav4geo.com/contact" style="text-decoration: underline;" rel="noopener noreferrer">get in touch</a> to obtain an API key.
</p>
{% endif %}
</div>
@ -218,7 +222,7 @@
</div>
<div class="footer-copyright center">
<p>
Made with ❤ by <a class="grey-text text-lighten-3" href="https://uav4geo.com">UAV4GEO</a> and powered by <a class="grey-text text-lighten-3" href="https://github.com/argosopentech/argos-translate/">Argos Translate</a>
Made with ❤ by <a class="grey-text text-lighten-3" href="https://uav4geo.com" rel="noopener noreferrer">UAV4GEO</a> and powered by <a class="grey-text text-lighten-3" href="https://github.com/argosopentech/argos-translate/" rel="noopener noreferrer">Argos Translate</a>
</p>
</div>
</footer>
@ -426,9 +430,8 @@
};
request.send(data);
}, {{ frontendTimeout }});
}, '{{ frontendTimeout }}');
},
copyText: function(e){
e.preventDefault();
this.$refs.translatedTextarea.select();
@ -443,10 +446,9 @@
}, 1500);
}
},
deleteText: function(e){
e.preventDefault();
this.inputText = this.translatedText = "";
this.inputText = this.translatedText = this.output = "";
}
}
});