From 85a007b32bb5db6c9fa4519cbe2fafb6b0ef9af2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?=
Date: Sat, 30 Sep 2017 18:57:34 +0200
Subject: [PATCH] upload chunk size configurable
---
js/term/upload.js | 15 ++++++++++-----
pages/term.php | 8 ++++++--
sass/form/_form_elements.scss | 2 +-
sass/pages/_term.scss | 2 +-
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/js/term/upload.js b/js/term/upload.js
index 6632755..68ea32c 100644
--- a/js/term/upload.js
+++ b/js/term/upload.js
@@ -44,7 +44,7 @@ module.exports = function (conn, input, screen) {
lines = v.split('\n')
line_i = 0
inline_pos = 0 // offset in line
- send_delay_ms = qs('#fu_delay').value
+ send_delay_ms = +qs('#fu_delay').value
// sanitize - 0 causes overflows
if (send_delay_ms < 0) {
@@ -92,13 +92,18 @@ module.exports = function (conn, input, screen) {
}
}
+ let maxChunk = +qs('#fu_chunk').value
+ if (maxChunk === 0 || maxChunk > MAX_LINE_LEN) {
+ maxChunk = MAX_LINE_LEN
+ }
+
let chunk
- if ((curLine.length - inline_pos) <= MAX_LINE_LEN) {
- chunk = curLine.substr(inline_pos, MAX_LINE_LEN)
+ if ((curLine.length - inline_pos) <= maxChunk) {
+ chunk = curLine.substr(inline_pos, maxChunk)
inline_pos = 0
} else {
- chunk = curLine.substr(inline_pos, MAX_LINE_LEN)
- inline_pos += MAX_LINE_LEN
+ chunk = curLine.substr(inline_pos, maxChunk)
+ inline_pos += maxChunk
}
if (!input.sendString(chunk)) {
diff --git a/pages/term.php b/pages/term.php
index feb3c92..3684863 100644
--- a/pages/term.php
+++ b/pages/term.php
@@ -20,7 +20,7 @@
-
+
-
+
+
+
+
+
diff --git a/sass/form/_form_elements.scss b/sass/form/_form_elements.scss
index 9186edd..d46a61a 100644
--- a/sass/form/_form_elements.scss
+++ b/sass/form/_form_elements.scss
@@ -17,7 +17,7 @@ input.tiny, select.tiny {
border-bottom: 2px solid $c-form-highlight;
background-color: $c-form-field-bg;
color: $c-form-field-fg;
- padding: 6px;
+ padding: 4px 6px;
line-height: 1em;
//outline: 0 none !important;
//-moz-outline: 0 none !important;
diff --git a/sass/pages/_term.scss b/sass/pages/_term.scss
index 56f2de6..d69f1df 100644
--- a/sass/pages/_term.scss
+++ b/sass/pages/_term.scss
@@ -201,7 +201,7 @@ body.term {
z-index: 1000;
label {
- width: 8em;
+ width: 10em;
display: inline-block;
}