Reorganized the codebase, add support for flag modus operandi
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/mai/trunk@48 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
This commit is contained in:
18
static/script.js
Normal file
18
static/script.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// @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();
|
||||
}
|
||||
});
|
||||
// @license-end
|
||||
|
||||
// Auto resize textarea to fit words inside it without need to scroll -- Thanks to: https://stackoverflow.com/a/25621277
|
||||
var input = document.getElementById("input");
|
||||
var output = document.getElementById("output");
|
||||
input.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;");
|
||||
output.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;");
|
||||
input.addEventListener("input", function (e) {
|
||||
this.style.height = 150 + "px";
|
||||
this.style.height = this.scrollHeight + "px";
|
||||
});
|
||||
Reference in New Issue
Block a user