undo one es6 fix that wasn't really all that great + some comments cleaning and removed one forgotten console.log

cpsdqs/unified-input
Ondřej Hruška 7 years ago
parent 54d314517f
commit 83f24cbe34
  1. 2
      _debug_replacements.php
  2. 22
      base.php
  3. 2
      js/appcommon.js
  4. 14
      js/term_input.js
  5. 8
      js/term_upload.js
  6. 2
      js/wifi.js

@ -83,7 +83,7 @@ return [
'term_height' => '25', 'term_height' => '25',
'default_bg' => '0', 'default_bg' => '0',
'default_fg' => '7', 'default_fg' => '7',
'show_buttons' => '0', 'show_buttons' => '1',
'show_config_links' => '1', 'show_config_links' => '1',
'uart_baud' => 115200, 'uart_baud' => 115200,

@ -12,19 +12,27 @@ if (!empty($argv[1])) {
parse_str($argv[1], $_GET); parse_str($argv[1], $_GET);
} }
if (!file_exists(__DIR__ . '/_env.php')) {
die("Copy <b>_env.php.example</b> to <b>_env.php</b> and check the settings inside!");
}
define('GIT_HASH', trim(shell_exec('git rev-parse --short HEAD'))); define('GIT_HASH', trim(shell_exec('git rev-parse --short HEAD')));
require_once __DIR__ . '/_env.php';
$prod = defined('STDIN'); $prod = defined('STDIN');
define('DEBUG', !$prod); define('DEBUG', !$prod);
$root = DEBUG ? json_encode(ESP_IP) : 'location.host';
// Resolve hostname for ajax etc
$root = 'location.host';
if (!file_exists(__DIR__ . '/_env.php')) {
if (DEBUG) {
die("No _env.php found! Copy _env.php.example</b> to <b>_env.php</b> and check the settings inside!");
}
} else {
if (DEBUG) {
require_once __DIR__ . '/_env.php';
$root = json_encode(ESP_IP);
}
}
define('JS_WEB_ROOT', $root); define('JS_WEB_ROOT', $root);
define('ESP_DEMO', (bool)getenv('ESP_DEMO')); define('ESP_DEMO', (bool)getenv('ESP_DEMO'));
if (ESP_DEMO) { if (ESP_DEMO) {
define('DEMO_APS', <<<APS define('DEMO_APS', <<<APS

@ -97,7 +97,7 @@ $.ready(function () {
Modal.init() Modal.init()
Notify.init() Notify.init()
// remove tabindixes from h2 if wide // remove tabindices from h2 if wide
if (window.innerWidth > 550) { if (window.innerWidth > 550) {
$('.Box h2').forEach(function (x) { $('.Box h2').forEach(function (x) {
x.removeAttribute('tabindex') x.removeAttribute('tabindex')

@ -106,7 +106,9 @@ window.Input = function (conn) {
'np_sub': na('\x1bOS', '-'), 'np_sub': na('\x1bOS', '-'),
'np_point': na('\x1bOn', '.'), 'np_point': na('\x1bOn', '.'),
'np_div': na('\x1bOQ', '/') 'np_div': na('\x1bOQ', '/')
// we don't implement numlock key (should change in numpad_alt mode, but it's even more useless than the rest) // we don't implement numlock key (should change in numpad_alt mode,
// but it's even more useless than the rest and also has the side
// effect of changing the user's numlock state)
} }
const blacklist = [ const blacklist = [
@ -204,7 +206,7 @@ window.Input = function (conn) {
// Button presses // Button presses
$('#action-buttons button').forEach(s => { $('#action-buttons button').forEach(s => {
s.addEventListener('click', () => { s.addEventListener('click', function (evt) {
sendBtnMsg(+this.dataset['n']) sendBtnMsg(+this.dataset['n'])
}) })
}) })
@ -290,10 +292,10 @@ window.Input = function (conn) {
// console.log("B ",b," M ",m); // console.log("B ",b," M ",m);
}, },
mouseTracksClicks () { /**
return cfg.mt_click * Prevent capturing keys. This is used for text input
}, * modals on the terminal screen
*/
blockKeys (yes) { blockKeys (yes) {
cfg.no_keys = yes cfg.no_keys = yes
} }

@ -97,7 +97,6 @@ window.TermUpl = function (conn, input, screen) {
inline_pos += MAX_LINE_LEN inline_pos += MAX_LINE_LEN
} }
console.log(chunk)
if (!input.sendString(chunk)) { if (!input.sendString(chunk)) {
updateStatus('FAILED!') updateStatus('FAILED!')
return return
@ -134,10 +133,11 @@ window.TermUpl = function (conn, input, screen) {
qs('#fu_file').addEventListener('change', function (evt) { qs('#fu_file').addEventListener('change', function (evt) {
let reader = new FileReader() let reader = new FileReader()
let file = evt.target.files[0] let file = evt.target.files[0]
console.log('Selected file type: ' + file.type) let ftype = file.type || 'application/octet-stream'
if (!file.type.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*)/)) { console.log('Selected file type: ' + ftype)
if (!ftype.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*|x-php)/)) {
// Deny load of blobs like img - can crash browser and will get corrupted anyway // Deny load of blobs like img - can crash browser and will get corrupted anyway
if (!confirm('This does not look like a text file: ' + file.type + '\nReally load?')) { if (!confirm(`This does not look like a text file: ${ftype}\nReally load?`)) {
qs('#fu_file').value = '' qs('#fu_file').value = ''
return return
} }

@ -149,7 +149,7 @@
}) })
// Forget STA credentials // Forget STA credentials
$('#forget-sta').on('click', function () { $('#forget-sta').on('click', () => {
selectSta('', '', '') selectSta('', '', '')
return false return false
}) })

Loading…
Cancel
Save