working unicode!!! WTF!! and ajax initial load to avoid having to escape shit
This commit is contained in:
+16
-11
@@ -1091,7 +1091,6 @@ function tr(key) { return _tr[key] || '?'+key+'?'; }
|
||||
ap.enc = parseInt(ap.enc);
|
||||
|
||||
if (ap.enc > 4) return; // hide unsupported auths
|
||||
WiFi.scan_url = '/cfg/wifi/scan';
|
||||
|
||||
var item = mk('div');
|
||||
|
||||
@@ -1145,7 +1144,7 @@ function tr(key) { return _tr[key] || '?'+key+'?'; }
|
||||
|
||||
/** Ask the CGI what APs are visible (async) */
|
||||
function scanAPs() {
|
||||
$.get('http://'+_root+w.scan_url, onScan);
|
||||
$.get('http://'+_root+'/cfg/wifi/scan', onScan);
|
||||
}
|
||||
|
||||
function rescan(time) {
|
||||
@@ -1183,7 +1182,7 @@ function tr(key) { return _tr[key] || '?'+key+'?'; }
|
||||
w.startScanning = startScanning;
|
||||
})(window.WiFi = {});
|
||||
var Screen = (function () {
|
||||
var W, H; // dimensions
|
||||
var W = 0, H = 0; // dimensions
|
||||
var inited = false;
|
||||
|
||||
var cursor = {
|
||||
@@ -1338,21 +1337,21 @@ var Screen = (function () {
|
||||
if (!inited) _init();
|
||||
|
||||
// Set size
|
||||
num = parse2B(str, i); i += 2;
|
||||
num2 = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // height
|
||||
num2 = parse2B(str, i); i += 2; // width
|
||||
if (num != H || num2 != W) {
|
||||
_rebuild(num, num2);
|
||||
}
|
||||
console.log("Size ",num, num2);
|
||||
|
||||
// Cursor position
|
||||
num = parse2B(str, i); i += 2;
|
||||
num2 = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // row
|
||||
num2 = parse2B(str, i); i += 2; // col
|
||||
cursorSet(num, num2);
|
||||
console.log("Cursor at ",num, num2);
|
||||
|
||||
// Attributes
|
||||
num = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // fg bg bold hidden
|
||||
cursor.fg = num & 0x0F;
|
||||
cursor.bg = (num & 0xF0) >> 4;
|
||||
cursor.bold = !!(num & 0x100);
|
||||
@@ -1444,12 +1443,19 @@ var Conn = (function() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
ws = new WebSocket("ws://"+_root+"/ws/update.cgi");
|
||||
ws = new WebSocket("ws://"+_root+"/term/update.ws");
|
||||
ws.onopen = onOpen;
|
||||
ws.onclose = onClose;
|
||||
ws.onmessage = onMessage;
|
||||
|
||||
console.log("Opening socket.");
|
||||
|
||||
// Ask for initial data
|
||||
$.get('http://'+_root+'/term/init', function(resp, status) {
|
||||
if (status !== 200) location.reload(true);
|
||||
console.log("Data received!");
|
||||
Screen.load(resp);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -1511,8 +1517,7 @@ var Input = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
window.termInit = function (str) {
|
||||
Screen.load(str);
|
||||
window.termInit = function () {
|
||||
Conn.init();
|
||||
Input.init();
|
||||
};
|
||||
|
||||
+15
-9
@@ -1,5 +1,5 @@
|
||||
var Screen = (function () {
|
||||
var W, H; // dimensions
|
||||
var W = 0, H = 0; // dimensions
|
||||
var inited = false;
|
||||
|
||||
var cursor = {
|
||||
@@ -154,21 +154,21 @@ var Screen = (function () {
|
||||
if (!inited) _init();
|
||||
|
||||
// Set size
|
||||
num = parse2B(str, i); i += 2;
|
||||
num2 = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // height
|
||||
num2 = parse2B(str, i); i += 2; // width
|
||||
if (num != H || num2 != W) {
|
||||
_rebuild(num, num2);
|
||||
}
|
||||
console.log("Size ",num, num2);
|
||||
|
||||
// Cursor position
|
||||
num = parse2B(str, i); i += 2;
|
||||
num2 = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // row
|
||||
num2 = parse2B(str, i); i += 2; // col
|
||||
cursorSet(num, num2);
|
||||
console.log("Cursor at ",num, num2);
|
||||
|
||||
// Attributes
|
||||
num = parse2B(str, i); i += 2;
|
||||
num = parse2B(str, i); i += 2; // fg bg bold hidden
|
||||
cursor.fg = num & 0x0F;
|
||||
cursor.bg = (num & 0xF0) >> 4;
|
||||
cursor.bold = !!(num & 0x100);
|
||||
@@ -260,12 +260,19 @@ var Conn = (function() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
ws = new WebSocket("ws://"+_root+"/ws/update.cgi");
|
||||
ws = new WebSocket("ws://"+_root+"/term/update.ws");
|
||||
ws.onopen = onOpen;
|
||||
ws.onclose = onClose;
|
||||
ws.onmessage = onMessage;
|
||||
|
||||
console.log("Opening socket.");
|
||||
|
||||
// Ask for initial data
|
||||
$.get('http://'+_root+'/term/init', function(resp, status) {
|
||||
if (status !== 200) location.reload(true);
|
||||
console.log("Data received!");
|
||||
Screen.load(resp);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -327,8 +334,7 @@ var Input = (function() {
|
||||
};
|
||||
})();
|
||||
|
||||
window.termInit = function (str) {
|
||||
Screen.load(str);
|
||||
window.termInit = function () {
|
||||
Conn.init();
|
||||
Input.init();
|
||||
};
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
ap.enc = parseInt(ap.enc);
|
||||
|
||||
if (ap.enc > 4) return; // hide unsupported auths
|
||||
WiFi.scan_url = '/cfg/wifi/scan';
|
||||
|
||||
var item = mk('div');
|
||||
|
||||
@@ -122,7 +121,7 @@
|
||||
|
||||
/** Ask the CGI what APs are visible (async) */
|
||||
function scanAPs() {
|
||||
$.get('http://'+_root+w.scan_url, onScan);
|
||||
$.get('http://'+_root+'/cfg/wifi/scan', onScan);
|
||||
}
|
||||
|
||||
function rescan(time) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input id="softkb-input" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
|
||||
<textarea id="softkb-input" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||
|
||||
<nav id="botnav">
|
||||
<a href="#" onclick="toggleSoftKb(true); return false" class="icn-keyboard mq-tablet-max"></a><!--
|
||||
@@ -34,7 +34,7 @@
|
||||
<script>
|
||||
// TODO cleanup
|
||||
try {
|
||||
termInit("%screenData%");
|
||||
termInit();
|
||||
|
||||
// auto-clear the input box
|
||||
$('#softkb-input').on('input', function(e) {
|
||||
@@ -47,7 +47,8 @@
|
||||
}
|
||||
|
||||
function toggleSoftKb(yes) {
|
||||
qs('#softkb-input')[yes ? 'focus' : 'blur']();
|
||||
qs('.icn-keyboard').blur();
|
||||
var i = qs('#softkb-input');
|
||||
if (yes) i.focus();
|
||||
else i.blur();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user