Last change
on this file since 51 was 48, checked in by yakumo.izuru, 20 months ago |
Reorganized the codebase, add support for flag modus operandi
Signed-off-by: Izuru Yakumo <yakumo.izuru@…>
|
File size:
974 bytes
|
Rev | Line | |
---|
[48] | 1 | // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
---|
| 2 | // this code submits the translation form when pressing Ctrl/Meta+Enter while focussed on the input text field
|
---|
| 3 | document.getElementById("input").addEventListener("keydown", function (event) {
|
---|
| 4 | if (event.keyCode === 13 && (event.metaKey || event.ctrlKey)) {
|
---|
| 5 | document.getElementById("translation-form").submit();
|
---|
| 6 | }
|
---|
| 7 | });
|
---|
| 8 | // @license-end
|
---|
| 9 |
|
---|
| 10 | // Auto resize textarea to fit words inside it without need to scroll -- Thanks to: https://stackoverflow.com/a/25621277
|
---|
| 11 | var input = document.getElementById("input");
|
---|
| 12 | var output = document.getElementById("output");
|
---|
| 13 | input.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;");
|
---|
| 14 | output.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;");
|
---|
| 15 | input.addEventListener("input", function (e) {
|
---|
| 16 | this.style.height = 150 + "px";
|
---|
| 17 | this.style.height = this.scrollHeight + "px";
|
---|
| 18 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.