Merge branch 'canvas-babel' into canvas

cpsdqs/unified-input
Ondřej Hruška 7 years ago
commit c07a6162f2
  1. 18
      .babelrc
  2. 28
      build.sh
  3. 4
      jssrc/appcommon.js
  4. 3
      jssrc/lib/keymaster.js
  5. 14
      jssrc/term_screen.js
  6. 2
      jssrc/utils.js
  7. 2
      jssrc/wifi.js
  8. 5
      package.json
  9. 2
      pages/_head.php
  10. 884
      yarn.lock

@ -0,0 +1,18 @@
{
"presets": [
["env", {
"targets": {
"browsers": [
"last 2 versions",
"> 4%",
"ie 11",
"safari 8",
"android 4.4"
]
}
}],
["minify", {
"mergeVars": false
}]
]
}

@ -1,21 +1,19 @@
#!/bin/bash
echo 'Packing JS...'
echo ';' > ';'
cat jssrc/lib/chibi.js ';' \
jssrc/lib/keymaster.js ';' \
jssrc/lib/polyfills.js ';' \
jssrc/utils.js ';' \
jssrc/modal.js ';' \
jssrc/notif.js ';' \
jssrc/appcommon.js ';' \
jssrc/lang.js ';' \
jssrc/wifi.js ';' \
jssrc/term_* ';' \
jssrc/term.js ';' \
jssrc/soft_keyboard.js | npm run --silent minify > js/app.js
rm ';'
npm run babel -- -o js/app.js --source-maps jssrc/lib \
jssrc/lib/chibi.js \
jssrc/lib/keymaster.js \
jssrc/lib/polyfills.js \
jssrc/utils.js \
jssrc/modal.js \
jssrc/notif.js \
jssrc/appcommon.js \
jssrc/lang.js \
jssrc/wifi.js \
jssrc/term_* \
jssrc/term.js \
jssrc/soft_keyboard.js
echo 'Building CSS...'

@ -58,8 +58,8 @@ $.ready(function () {
val -= step
}
if (typeof min != 'undefined') val = Math.max(val, +min)
if (typeof max != 'undefined') val = Math.min(val, +max)
if (undef(min)) val = Math.max(val, +min)
if (undef(max)) val = Math.min(val, +max)
$this.val(val)
if ('createEvent' in document) {

@ -307,4 +307,5 @@
if(typeof module !== 'undefined') module.exports = assignKey;
})(this);
})(window);

@ -69,7 +69,7 @@ for (let gray = 0; gray < 24; gray++) {
class TermScreen {
constructor () {
this.canvas = document.createElement('canvas')
this.canvas = mk('canvas')
this.ctx = this.canvas.getContext('2d')
if ('AudioContext' in window || 'webkitAudioContext' in window) {
@ -587,7 +587,7 @@ class TermScreen {
let selectedText = this.getSelectedText()
// don't copy anything if nothing is selected
if (!selectedText) return
let textarea = document.createElement('textarea')
let textarea = mk('textarea')
document.body.appendChild(textarea)
textarea.value = selectedText
textarea.select()
@ -717,10 +717,10 @@ class TermScreen {
const FONT_MASK = 0b101
// Map of (attrs & FONT_MASK) -> Array of cell indices
const fontGroups = new Map()
let fontGroups = new Map()
// Map of (cell index) -> boolean, whether or not a cell has updated
const updateMap = new Map()
let updateMap = new Map()
for (let cell = 0; cell < screenLength; cell++) {
let x = cell % width
@ -994,9 +994,7 @@ class TermScreen {
this.screenAttrs = new Array(screenLength).fill(' ')
}
let strArray = typeof Array.from !== 'undefined'
? Array.from(str)
: str.split('')
let strArray = !undef(Array.from) ? Array.from(str) : str.split('')
const MASK_LINE_ATTR = 0xC8
const MASK_BLINK = 1 << 4
@ -1084,7 +1082,7 @@ class TermScreen {
let label = pieces[i + 1].trim()
// if empty string, use the "dim" effect and put nbsp instead to
// stretch the button vertically
button.innerHTML = label ? e(label) : '&nbsp;'
button.innerHTML = label ? esc(label) : '&nbsp;'
button.style.opacity = label ? 1 : 0.2
})
}

@ -73,7 +73,7 @@ Math.log10 = Math.log10 || function (x) {
}
/** HTML escape */
function e (str) {
function esc (str) {
return $.htmlEscape(str)
}

@ -15,7 +15,7 @@
$('#sta-nw').toggleClass('hidden', name.length === 0)
$('#sta-nw-nil').toggleClass('hidden', name.length > 0)
$('#sta-nw .essid').html(e(name))
$('#sta-nw .essid').html(esc(name))
const nopw = undef(password) || password.length === 0
$('#sta-nw .passwd').toggleClass('hidden', nopw)
$('#sta-nw .nopasswd').toggleClass('hidden', !nopw)

@ -4,11 +4,14 @@
"description": "ESPTerm web interface",
"license": "MPL-2.0",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-minify": "^0.2.0",
"babel-preset-env": "^1.6.0",
"node-sass": "^4.5.3",
"standard": "^10.0.3"
"standard": "^10.0.3"
},
"scripts": {
"babel": "babel $@",
"minify": "babel-minify $@",
"sass": "node-sass $@"
}

@ -11,7 +11,7 @@
var _root = <?= JS_WEB_ROOT ?>;
var _demo = <?= (int)ESP_DEMO ?>;
<?php if($_GET['page']=='term'): ?>var _demo_screen = <?= ESP_DEMO ? DEMO_SCREEN : 0 ?>;<?php endif; ?>
<?php if($_GET['page']=='cfg_wifi'): ?>var _demo_aps = <?= ESP_DEMO ? json_encode(DEMO_APS) : '' ?>;<?php endif; ?>
<?php if($_GET['page']=='cfg_wifi'): ?>var _demo_aps = <?= ESP_DEMO ? json_encode(DEMO_APS) : '""' ?>;<?php endif; ?>
</script>
</head>
<body class="<?= $_GET['BODYCLASS'] ?>">

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save