Tweaks for mobile.
This commit is contained in:
1
Makefile
1
Makefile
@ -544,6 +544,7 @@ $(DEPLOY):
|
|||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
REPLACE = tools/replace.js \
|
REPLACE = tools/replace.js \
|
||||||
|
HEAD=@site/head.html \
|
||||||
COMMON=@site/common.html \
|
COMMON=@site/common.html \
|
||||||
POSIX_COMMON=@site/posix_common.html \
|
POSIX_COMMON=@site/posix_common.html \
|
||||||
DESKTOP_COMMON=@site/desktop_common.html \
|
DESKTOP_COMMON=@site/desktop_common.html \
|
||||||
|
|||||||
@ -16,9 +16,8 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>ESP32forth</title>
|
<title>ESP32forth</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -15,9 +15,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>Classic EForth</title>
|
<title>Classic EForth</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
20
site/head.html
Normal file
20
site/head.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<!--
|
||||||
|
Copyright 2021 Bradley D. Nelson
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
|
||||||
|
<link rel="stylesheet" href="static/eforth.css">
|
||||||
@ -16,9 +16,8 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>EForth</title>
|
<title>EForth</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -16,9 +16,8 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>µEforth Internals</title>
|
<title>µEforth Internals</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -16,9 +16,8 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>µEforth for Linux</title>
|
<title>µEforth for Linux</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -21,6 +21,9 @@ body {
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
padding: 0px 10px;
|
padding: 0px 10px;
|
||||||
}
|
}
|
||||||
|
.web_wrapper {
|
||||||
|
padding: 0px 10px;
|
||||||
|
}
|
||||||
h1 {
|
h1 {
|
||||||
border-top: 3px solid #777;
|
border-top: 3px solid #777;
|
||||||
background-color: #111;
|
background-color: #111;
|
||||||
@ -47,6 +50,10 @@ h5 {
|
|||||||
margin: 2px;
|
margin: 2px;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
}
|
}
|
||||||
|
pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
a:link {
|
a:link {
|
||||||
color: #00c;
|
color: #00c;
|
||||||
}
|
}
|
||||||
@ -67,6 +74,7 @@ a:hover {
|
|||||||
.menu span {
|
.menu span {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
line-height: 32px;
|
||||||
}
|
}
|
||||||
.menu a:link {
|
.menu a:link {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|||||||
@ -16,15 +16,14 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>µEforth for Web</title>
|
<title>µEforth for Web</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>µEforth for Web</h1>
|
<h1>µEforth for Web</h1>
|
||||||
{{MENU}}
|
{{MENU}}
|
||||||
<div class="wrapper">
|
|
||||||
|
|
||||||
|
<div class="web_wrapper">
|
||||||
<div id="ueforth"></div>
|
<div id="ueforth"></div>
|
||||||
<script src="ueforth.js"></script>
|
<script src="ueforth.js"></script>
|
||||||
|
|||||||
@ -16,9 +16,8 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
{{HEAD}}
|
||||||
<title>µEforth for Windows</title>
|
<title>µEforth for Windows</title>
|
||||||
<link rel="stylesheet" href="static/eforth.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ function DropCopyright(source) {
|
|||||||
while (lines[i] != '-->') {
|
while (lines[i] != '-->') {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
i += 2;
|
++i;
|
||||||
}
|
}
|
||||||
if (lines[i].search('Copyright') >= 0) {
|
if (lines[i].search('Copyright') >= 0) {
|
||||||
while (lines[i] != '') {
|
while (lines[i] != '') {
|
||||||
@ -33,7 +33,7 @@ function DropCopyright(source) {
|
|||||||
cleaned.push(lines[i]);
|
cleaned.push(lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cleaned.join('\n');
|
return cleaned.join('\n').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
var source = fs.readFileSync(process.stdin.fd).toString();
|
var source = fs.readFileSync(process.stdin.fd).toString();
|
||||||
|
|||||||
@ -31,9 +31,22 @@ r|
|
|||||||
context.inbuffer = [];
|
context.inbuffer = [];
|
||||||
context.outbuffer = '';
|
context.outbuffer = '';
|
||||||
if (!globalObj.write) {
|
if (!globalObj.write) {
|
||||||
|
function AddMeta(name, content) {
|
||||||
|
var meta = document.createElement('meta');
|
||||||
|
meta.name = name;
|
||||||
|
meta.content = content;
|
||||||
|
document.head.appendChild(meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddMeta('apple-mobile-web-app-capable', 'yes');
|
||||||
|
AddMeta('apple-mobile-web-app-status-bar-style', 'black-translucent');
|
||||||
|
AddMeta('viewport', 'width=device-width, initial-scale=1.0, ' +
|
||||||
|
'maximum-scale=1.0, user-scalable=no, minimal-ui');
|
||||||
|
|
||||||
context.screen = document.getElementById('ueforth');
|
context.screen = document.getElementById('ueforth');
|
||||||
if (context.screen === null) {
|
if (context.screen === null) {
|
||||||
context.screen = document.createElement('div');
|
context.screen = document.createElement('div');
|
||||||
|
context.screen.style.width = '100%';
|
||||||
document.body.appendChild(context.screen);
|
document.body.appendChild(context.screen);
|
||||||
}
|
}
|
||||||
context.filler = document.createElement('div');
|
context.filler = document.createElement('div');
|
||||||
@ -50,6 +63,8 @@ if (!globalObj.write) {
|
|||||||
context.screen.appendChild(context.canvas);
|
context.screen.appendChild(context.canvas);
|
||||||
context.ctx = context.canvas.getContext('2d');
|
context.ctx = context.canvas.getContext('2d');
|
||||||
context.terminal = document.createElement('pre');
|
context.terminal = document.createElement('pre');
|
||||||
|
context.terminal.style.width = '100%';
|
||||||
|
context.terminal.style.whiteSpace = 'pre-wrap';
|
||||||
context.screen.appendChild(context.terminal);
|
context.screen.appendChild(context.terminal);
|
||||||
context.text_fraction = 1667;
|
context.text_fraction = 1667;
|
||||||
context.min_text_portion = 120;
|
context.min_text_portion = 120;
|
||||||
@ -100,13 +115,23 @@ if (!globalObj.write) {
|
|||||||
window.onresize = function(e) {
|
window.onresize = function(e) {
|
||||||
Resize();
|
Resize();
|
||||||
};
|
};
|
||||||
window.onkeypress = function(e) {
|
function KeyPress(e) {
|
||||||
context.inbuffer.push(e.keyCode);
|
context.inbuffer.push(e.keyCode);
|
||||||
};
|
e.preventDefault();
|
||||||
window.onkeydown = function(e) {
|
return false;
|
||||||
|
}
|
||||||
|
window.onkeypress = KeyPress;
|
||||||
|
function KeyDown(e) {
|
||||||
if (e.keyCode == 8) {
|
if (e.keyCode == 8) {
|
||||||
context.inbuffer.push(e.keyCode);
|
context.inbuffer.push(e.keyCode);
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
window.onkeydown = KeyDown;
|
||||||
|
context.Update = function(active) {
|
||||||
|
var cursor = String.fromCharCode(0x2592);
|
||||||
|
context.terminal.innerText = context.outbuffer + cursor;
|
||||||
};
|
};
|
||||||
setMode(0);
|
setMode(0);
|
||||||
context.Clear();
|
context.Clear();
|
||||||
@ -132,7 +157,7 @@ r|
|
|||||||
context.outbuffer += String.fromCharCode(ch);
|
context.outbuffer += String.fromCharCode(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.terminal.innerText = context.outbuffer + String.fromCharCode(0x2592);
|
context.Update();
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
|
|||||||
Reference in New Issue
Block a user