mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-22 07:30:19 +00:00
Support source queryparam. Fix space.
This commit is contained in:
parent
9504df54ca
commit
7f1e5e57ef
16
index.js
16
index.js
@ -233,6 +233,15 @@ window.onload = function () {
|
||||
}
|
||||
}
|
||||
|
||||
function parseQueryParams() {
|
||||
var params = {};
|
||||
var query = document.location.search.substring(1);
|
||||
query.split(/&/g).forEach(function(pair) {
|
||||
pair = pair.replace(/\+/g, " ").split(/=/).map(decodeURIComponent);
|
||||
params[pair[0]] = pair.length === 1 ? pair[0] : pair[1];
|
||||
});
|
||||
return params;
|
||||
}
|
||||
|
||||
function loadFile(filename, callback) {
|
||||
var req = new XMLHttpRequest();
|
||||
@ -250,7 +259,12 @@ window.onload = function () {
|
||||
}
|
||||
|
||||
// load default
|
||||
loadFile('samples/sample.default.txt', setSource);
|
||||
var params = parseQueryParams();
|
||||
if ('source' in params) {
|
||||
setSource(params.source);
|
||||
} else {
|
||||
loadFile('samples/sample.default.txt', setSource);
|
||||
}
|
||||
|
||||
// Show change history
|
||||
atomToHtml('feed.xml?' + Math.random(), $('#feed'));
|
||||
|
5
tty.js
5
tty.js
@ -738,7 +738,7 @@ function TTY(screenElement, keyboardElement, bell) {
|
||||
}
|
||||
|
||||
// Symbol and Punctuation
|
||||
case 'Spacebar': return ord(' ');
|
||||
case 'Space': return ord(' ');
|
||||
case 'Semicolon': return e.shiftKey ? ord(':') : ord(';');
|
||||
case 'Equal': return e.shiftKey ? ord('+') : ord('=');
|
||||
case 'Comma': return e.shiftKey ? ord('<') : ord(',');
|
||||
@ -751,7 +751,8 @@ function TTY(screenElement, keyboardElement, bell) {
|
||||
case 'BracketRight': return e.ctrlKey ? 29 : e.shiftKey ? ord('}') : ord(']');
|
||||
case 'Quote': return e.shiftKey ? ord('"') : ord('\'');
|
||||
|
||||
// not present on Apple II keyboard
|
||||
// Apple IIgs Keyboard
|
||||
case 'NumpadClear': return 24;
|
||||
case 'NumpadAdd': return ord('+');
|
||||
case 'NumpadSubtract': return ord('-');
|
||||
case 'NumpadMultiply': return ord('*');
|
||||
|
Loading…
Reference in New Issue
Block a user