diff --git a/load/ansiframe.js b/load/ansiframe.js index c0f488c..9632973 100644 --- a/load/ansiframe.js +++ b/load/ansiframe.js @@ -1,5 +1,11 @@ var FRAME_ANSI=(1<<1); +var ANSI_FRAME_LENGTH =22; /* Length of a frame */ +var ANSI_FRAME_WIDTH =80; /* Width of a frame */ +var ANSI_FRAME_HEADER =56; /* Size of page owner (length) */ +var ANSI_FRAME_PAGENUM =12; /* Size of page number (length with a-z) */ +var ANSI_FRAME_COST = 9; /* Size of cost (length without unit) */ + // Our frame object function ANSIFrame() { this.version=1; // The version of this frame - in case we update functionality and we need to be @@ -42,9 +48,9 @@ function ANSIFrame() { cost = (this.isAccessible ? this.cost+FRAME_COSTUNIT : ' -') - header = '\1n'+this.pageownerlogo+' '.repeat(FRAME_HEADER-console.strlen(this.pageownerlogo))+'\1n '+ - (this.isAccessible ? '\1W' : '\1R')+'\1H'+this.page+' '.repeat(FRAME_PAGENUM-this.page.length)+' '+ - '\1G\1H'+' '.repeat(FRAME_COST-cost.toString().length+1)+cost+'\1n'+ + header = '\1n'+this.pageownerlogo+' '.repeat(ANSI_FRAME_HEADER-console.strlen(this.pageownerlogo))+'\1n '+ + (this.isAccessible ? '\1W' : '\1R')+'\1H'+this.page+' '.repeat(ANSI_FRAME_PAGENUM-this.page.length)+' '+ + '\1G\1H'+' '.repeat(ANSI_FRAME_COST-cost.toString().length+1)+cost+'\1n'+ (console.screen_columns > 80 ? '\n\r' : ''); } @@ -118,7 +124,7 @@ function ANSIFrame() { for(p=0;pFRAME_WIDTH) { + if (c>ANSI_FRAME_WIDTH) { c = 1; r++; } /* - // @todo - If we are longer than FRAME_LENGTH, move the output into the next frame. - if (r>FRAME_LENGTH) { + // @todo - If we are longer than ANSI_FRAME_LENGTH, move the output into the next frame. + if (r>ANSI_FRAME_LENGTH) { break; } */ diff --git a/load/defs.js b/load/defs.js index 2a22d5d..2a7fbda 100644 --- a/load/defs.js +++ b/load/defs.js @@ -19,11 +19,6 @@ var MODE_RFNOTSENT =4; /* Response frame not sent */ var MODE_RFSENT =5; /* Response frame sent */ var MODE_RFERROR =6; /* Response frame error */ -var FRAME_LENGTH =22; /* Length of a frame */ -var FRAME_WIDTH =80; /* Width of a frame */ -var FRAME_HEADER =56; /* Size of page owner (length) */ -var FRAME_PAGENUM =12; /* Size of page number (length with a-z) */ -var FRAME_COST = 9; /* Size of cost (length without unit) */ var FRAME_COSTUNIT ='c'; /* Unit of cost */ var FRAME_TYPE_INFO ='i'; // Information Frame, requires no response after viewed diff --git a/load/edit.js b/load/edit.js index c56a68d..cfa1eb3 100644 --- a/load/edit.js +++ b/load/edit.js @@ -30,8 +30,8 @@ function edit(fo) { const frame = new Frame(1,1,console.screen_columns,console.screen_rows,BG_BLACK|LIGHTGRAY); frame.gotoxy(1,1); - header = '\1n'+fo.pageownerlogo+' '.repeat(FRAME_HEADER-console.strlen(fo.pageownerlogo))+'\1n '+ - '\1W\1H'+fo.page+' '.repeat(FRAME_PAGENUM-fo.page.length)+' '+ + header = '\1n'+fo.pageownerlogo+' '.repeat(ANSI_FRAME_HEADER-console.strlen(fo.pageownerlogo))+'\1n '+ + '\1W\1H'+fo.page+' '.repeat(ANSI_FRAME_PAGENUM-fo.page.length)+' '+ '\1G\1H'+' Edit'; frame.putmsg(header); frame.open();