fix some bugs

pull/111/merge
Ondřej Hruška 7 years ago
parent 0b3cfe0e74
commit 0a731bd35e
  1. 13
      html_orig/js/app.js
  2. 13
      html_orig/jssrc/term.js
  3. 5
      html_orig/pages/term.php

@ -1350,13 +1350,13 @@ var Screen = (function () {
if (num != H || num2 != W) { if (num != H || num2 != W) {
_rebuild(num, num2); _rebuild(num, num2);
} }
console.log("Size ",num, num2); // console.log("Size ",num, num2);
// Cursor position // Cursor position
num = parse2B(str, i); i += 2; // row num = parse2B(str, i); i += 2; // row
num2 = parse2B(str, i); i += 2; // col num2 = parse2B(str, i); i += 2; // col
cursorSet(num, num2); cursorSet(num, num2);
console.log("Cursor at ",num, num2); // console.log("Cursor at ",num, num2);
// Attributes // Attributes
num = parse2B(str, i); i += 2; // fg bg bold hidden num = parse2B(str, i); i += 2; // fg bg bold hidden
@ -1364,7 +1364,7 @@ var Screen = (function () {
cursor.bg = (num & 0xF0) >> 4; cursor.bg = (num & 0xF0) >> 4;
cursor.bold = !!(num & 0x100); cursor.bold = !!(num & 0x100);
cursor.hidden = !(num & 0x200); cursor.hidden = !(num & 0x200);
console.log("FG ",cursor.fg, ", BG ", cursor.bg,", BOLD ", cursor.bold, ", HIDE ", cursor.hidden); // console.log("FG ",cursor.fg, ", BG ", cursor.bg,", BOLD ", cursor.bold, ", HIDE ", cursor.hidden);
fg = cursor.fg; fg = cursor.fg;
bg = cursor.bg; bg = cursor.bg;
@ -1380,11 +1380,11 @@ var Screen = (function () {
fg = num & 0x0F; fg = num & 0x0F;
bg = (num & 0xF0) >> 4; bg = (num & 0xF0) >> 4;
bold = !!(num & 0x100); bold = !!(num & 0x100);
console.log("Switch to ",fg,bg,bold); // console.log("Switch to ",fg,bg,bold);
} }
else if (jc == SEQ_REPEAT) { else if (jc == SEQ_REPEAT) {
num = parse2B(str, i); i += 2; num = parse2B(str, i); i += 2;
console.log("Repeat x ",num); // console.log("Repeat x ",num);
for (; num>0 && ci<W*H; num--) { for (; num>0 && ci<W*H; num--) {
cell = screen[ci++]; cell = screen[ci++];
cell.fg = fg; cell.fg = fg;
@ -1400,7 +1400,7 @@ var Screen = (function () {
cell.fg = fg; cell.fg = fg;
cell.bg = bg; cell.bg = bg;
cell.bold = bold; cell.bold = bold;
console.log("Symbol ", j); // console.log("Symbol ", j);
} }
} }
@ -1412,6 +1412,7 @@ var Screen = (function () {
qs('h1').textContent = pieces[0]; qs('h1').textContent = pieces[0];
qsa('#buttons button').forEach(function(x, i) { qsa('#buttons button').forEach(function(x, i) {
var s = pieces[i+1].trim(); var s = pieces[i+1].trim();
// if empty string, use the "dim" effect and put nbsp instead to stretch the btn vertically
x.innerHTML = s.length >0 ? e(s) : "&nbsp;"; x.innerHTML = s.length >0 ? e(s) : "&nbsp;";
x.style.opacity = s.length > 0 ? 1 : 0.2; x.style.opacity = s.length > 0 ? 1 : 0.2;
}); });

@ -158,13 +158,13 @@ var Screen = (function () {
if (num != H || num2 != W) { if (num != H || num2 != W) {
_rebuild(num, num2); _rebuild(num, num2);
} }
console.log("Size ",num, num2); // console.log("Size ",num, num2);
// Cursor position // Cursor position
num = parse2B(str, i); i += 2; // row num = parse2B(str, i); i += 2; // row
num2 = parse2B(str, i); i += 2; // col num2 = parse2B(str, i); i += 2; // col
cursorSet(num, num2); cursorSet(num, num2);
console.log("Cursor at ",num, num2); // console.log("Cursor at ",num, num2);
// Attributes // Attributes
num = parse2B(str, i); i += 2; // fg bg bold hidden num = parse2B(str, i); i += 2; // fg bg bold hidden
@ -172,7 +172,7 @@ var Screen = (function () {
cursor.bg = (num & 0xF0) >> 4; cursor.bg = (num & 0xF0) >> 4;
cursor.bold = !!(num & 0x100); cursor.bold = !!(num & 0x100);
cursor.hidden = !(num & 0x200); cursor.hidden = !(num & 0x200);
console.log("FG ",cursor.fg, ", BG ", cursor.bg,", BOLD ", cursor.bold, ", HIDE ", cursor.hidden); // console.log("FG ",cursor.fg, ", BG ", cursor.bg,", BOLD ", cursor.bold, ", HIDE ", cursor.hidden);
fg = cursor.fg; fg = cursor.fg;
bg = cursor.bg; bg = cursor.bg;
@ -188,11 +188,11 @@ var Screen = (function () {
fg = num & 0x0F; fg = num & 0x0F;
bg = (num & 0xF0) >> 4; bg = (num & 0xF0) >> 4;
bold = !!(num & 0x100); bold = !!(num & 0x100);
console.log("Switch to ",fg,bg,bold); // console.log("Switch to ",fg,bg,bold);
} }
else if (jc == SEQ_REPEAT) { else if (jc == SEQ_REPEAT) {
num = parse2B(str, i); i += 2; num = parse2B(str, i); i += 2;
console.log("Repeat x ",num); // console.log("Repeat x ",num);
for (; num>0 && ci<W*H; num--) { for (; num>0 && ci<W*H; num--) {
cell = screen[ci++]; cell = screen[ci++];
cell.fg = fg; cell.fg = fg;
@ -208,7 +208,7 @@ var Screen = (function () {
cell.fg = fg; cell.fg = fg;
cell.bg = bg; cell.bg = bg;
cell.bold = bold; cell.bold = bold;
console.log("Symbol ", j); // console.log("Symbol ", j);
} }
} }
@ -220,6 +220,7 @@ var Screen = (function () {
qs('h1').textContent = pieces[0]; qs('h1').textContent = pieces[0];
qsa('#buttons button').forEach(function(x, i) { qsa('#buttons button').forEach(function(x, i) {
var s = pieces[i+1].trim(); var s = pieces[i+1].trim();
// if empty string, use the "dim" effect and put nbsp instead to stretch the btn vertically
x.innerHTML = s.length >0 ? e(s) : "&nbsp;"; x.innerHTML = s.length >0 ? e(s) : "&nbsp;";
x.style.opacity = s.length > 0 ? 1 : 0.2; x.style.opacity = s.length > 0 ? 1 : 0.2;
}); });

@ -31,14 +31,11 @@
--><a href="<?= url('about') ?>">About</a> --><a href="<?= url('about') ?>">About</a>
</nav> </nav>
<!-- this avoids having to escape quotes for JSON -->
<span class="hidden" id="initial_data">%labels_seq%</span>
<script> <script>
try { try {
window.noAutoShow = true; window.noAutoShow = true;
termInit(); // the screen will be loaded via ajax termInit(); // the screen will be loaded via ajax
Screen.load(qs('#initial_data').textContent); Screen.load('%labels_seq%');
// auto-clear the input box // auto-clear the input box
$('#softkb-input').on('input', function(e) { $('#softkb-input').on('input', function(e) {

Loading…
Cancel
Save