Added *# and *95#

This commit is contained in:
Deon George
2019-10-18 00:27:51 +11:00
parent c0b6af5363
commit e6e9396c8d
7 changed files with 51 additions and 10 deletions

View File

@@ -12,10 +12,11 @@ load('texfuncs.js');
while(bbs.online) {
var mode = false; // Initial mode
var next_page = { frame: 98,index: 'b'}; // Start Frame
var next_page = { frame: 98,index: 'b' }; // Start Frame
var action = ACTION_GOTO; // Initial action
var inkey_timeout = 0; // Timeout waiting for input @todo required? check if idle timetout occurs
var fo = null; // Current Frame
var history = []; // Page history
ansiterm.send('ext_mode','clear','cursor');
while (action != ACTION_TERMINATE) {
@@ -145,7 +146,10 @@ while(bbs.online) {
// Nothing typed between * and #
// *# means go back
if (cmd == '') {
sendBaseline(ERR_NOT_IMPLEMENTED,false);
mode = false;
cursorOff();
sendBaseline('',false);
action = ACTION_BACKUP;
} else if (cmd == '0') {
next_page = { frame: 1 }; // @todo specificy home page in config
@@ -193,6 +197,24 @@ while(bbs.online) {
break;
// GO Backwards
case ACTION_BACKUP:
// Do we have anywhere to go, drop the current page from the history.
if (history.length > 1)
history.pop();
// @todo If in control...
next_page = (history.length > 0) ? history[history.length-1] : null;
log(LOG_DEBUG,'- ACTION_BACKUP: Backing up to ['+(next_page ? pageStr(next_page) : '')+'] current ['+fo.page+']');
// If there is no next page, we'll ignore the request.
if (! next_page || (pageStr(next_page) == fo.page)) {
action = false;
break;
}
// Goto specific page
case ACTION_GOTO:
log(LOG_DEBUG,'- ACTION_GOTO: ['+(next_page ? pageStr(next_page) : '')+']');
@@ -234,10 +256,15 @@ while(bbs.online) {
}
}
// @todo if page is a new location, and we are not going backwards
// if (($history->last() != $next_page) AND ($action == ACTION_GOTO || $action == ACTION_NEXT))
if (false) {
//$history->push($next_page);
log(LOG_DEBUG,'- ACTION_GOTO: next_page ['+JSON.stringify(next_page)+'] last history ['+JSON.stringify(history[history.length-1])+']');
// Record our history
if (next_page && (! history.length || (pageStr(history[history.length-1]) != pageStr(next_page)))) {
// Ignore the login frames
if (LOGIN_FRAMES.indexOf(pageStr(next_page)) == -1) {
history.push(next_page);
log(LOG_DEBUG,'- ACTION_GOTO: Added to history ['+(next_page ? pageStr(next_page) : '')+'] now ['+history.length+']');
}
}
next_page = null;

View File

@@ -25,6 +25,8 @@ var FRAME_TYPE_TERMINATE ='t';
var ERR_NOT_IMPLEMENTED = '\1RNOT IMPLEMENTED YET?';
var ERR_ROUTE = '\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
var LOGIN_FRAMES = ['98b'];
// Our frame object
function Frame(frame,index) {
if (frame === undefined) {
@@ -55,4 +57,4 @@ function Frame(frame,index) {
Object.defineProperty(this,'page', {
get: function() {return pageStr({frame: this.frame, index: this.index }); }
});
}
}