Merge branch 'upload-tool-improve' into work

box-drawing
Ondřej Hruška 7 years ago
commit 6ee7754a6a
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 15
      js/term/upload.js
  2. 8
      pages/term.php
  3. 2
      sass/form/_form_elements.scss
  4. 2
      sass/pages/_term.scss

@ -44,7 +44,7 @@ module.exports = function (conn, input, screen) {
lines = v.split('\n') lines = v.split('\n')
line_i = 0 line_i = 0
inline_pos = 0 // offset in line inline_pos = 0 // offset in line
send_delay_ms = qs('#fu_delay').value send_delay_ms = +qs('#fu_delay').value
// sanitize - 0 causes overflows // sanitize - 0 causes overflows
if (send_delay_ms < 0) { 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 let chunk
if ((curLine.length - inline_pos) <= MAX_LINE_LEN) { if ((curLine.length - inline_pos) <= maxChunk) {
chunk = curLine.substr(inline_pos, MAX_LINE_LEN) chunk = curLine.substr(inline_pos, maxChunk)
inline_pos = 0 inline_pos = 0
} else { } else {
chunk = curLine.substr(inline_pos, MAX_LINE_LEN) chunk = curLine.substr(inline_pos, maxChunk)
inline_pos += MAX_LINE_LEN inline_pos += maxChunk
} }
if (!input.sendString(chunk)) { if (!input.sendString(chunk)) {

@ -20,7 +20,7 @@
<textarea id="fu_text"></textarea> <textarea id="fu_text"></textarea>
</p> </p>
<p> <p>
<label for="fu_crlf">Line Endings:</label> <label for="fu_crlf">Line endings:</label>
<select id="fu_crlf"> <select id="fu_crlf">
<option value="CR">CR (Enter key)</option> <option value="CR">CR (Enter key)</option>
<option value="CRLF">CR LF (Windows)</option> <option value="CRLF">CR LF (Windows)</option>
@ -28,9 +28,13 @@
</select> </select>
</p> </p>
<p> <p>
<label for="fu_delay">Line Delay (ms):</label> <label for="fu_delay">Chunk delay (ms):</label>
<input id="fu_delay" type="number" value=1 min=0> <input id="fu_delay" type="number" value=1 min=0>
</p> </p>
<p>
<label for="fu_chunk">Chunk size (0=line):</label>
<input id="fu_chunk" type="number" value=0 min=0 max=100>
</p>
</div> </div>
<div class="fu-buttons"> <div class="fu-buttons">
<button id="term-fu-start" class="icn-ok x-fu-go">Start</button>&nbsp; <button id="term-fu-start" class="icn-ok x-fu-go">Start</button>&nbsp;

@ -17,7 +17,7 @@ input.tiny, select.tiny {
border-bottom: 2px solid $c-form-highlight; border-bottom: 2px solid $c-form-highlight;
background-color: $c-form-field-bg; background-color: $c-form-field-bg;
color: $c-form-field-fg; color: $c-form-field-fg;
padding: 6px; padding: 4px 6px;
line-height: 1em; line-height: 1em;
//outline: 0 none !important; //outline: 0 none !important;
//-moz-outline: 0 none !important; //-moz-outline: 0 none !important;

@ -205,7 +205,7 @@ body.term {
z-index: 1000; z-index: 1000;
label { label {
width: 8em; width: 10em;
display: inline-block; display: inline-block;
} }

Loading…
Cancel
Save