diff --git a/load/msgbases.js b/load/msgbases.js index 0649692..969568b 100644 --- a/load/msgbases.js +++ b/load/msgbases.js @@ -47,13 +47,9 @@ function MsgAreas() { writeln('Areas that we ARE managing mail:'+this.areas.length); for(var x in this.areas_excluded) { - /* - writeln(this.areas_excluded[x].area_name = undefined - ? JSON.stringify(this.areas_excluded[x]) - : this.areas_excluded[x].area_name); - */ - writeln(JSON.stringify(this.areas_excluded[x])); - exit(); + writeln(x+':'+((this.areas_excluded[x].area_name === undefined) + ? this.areas_excluded[x] + : JSON.stringify(this.areas_excluded[x]))); } } }); diff --git a/load/page.js b/load/page.js index 06f3b5d..9a030b3 100644 --- a/load/page.js +++ b/load/page.js @@ -443,8 +443,7 @@ function Page(debug) { /** * Build in any input_fields with values */ - this.build_input_fields = function() - { + this.build_input_fields = function() { var that = this; var f = this.input_fields.filter(function(item) { return item.value.length; }); @@ -836,7 +835,7 @@ function Page(debug) { throw new Error('page must be a PageObject'); // Load a page from disk first if it exists - if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+SESSION_EXT+'/'+page.toString())) + if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+SESSION_EXT+'/'+page.toString(),SESSION_EXT)) return true; // Fall back to loading from msgbase @@ -868,7 +867,7 @@ function Page(debug) { * @returns {boolean} * @todo Dont allow load() to load a Viewdata frame for an ANSItex session and visa-versa. */ - this.import = function(filename,width,height) { + this.import = function(filename,ext,width,height) { log(LOG_DEBUG,'|- Importing frame: ['+filename+']'); var f = new File(filename); @@ -881,7 +880,6 @@ function Page(debug) { f.close(); var valid_sauce = false; - var ext = SESSION_EXT; if (contents.substr(-128, 7) === 'SAUCE00') { ext = file_getext(filename).substr(1).toLowerCase(); diff --git a/load/session/ansitex.js b/load/session/ansitex.js index 428a117..0b22e4e 100644 --- a/load/session/ansitex.js +++ b/load/session/ansitex.js @@ -43,10 +43,12 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) { // @todo temp hack, rework ansi variable - perhaps have a function that converts an attribute back into an ANSI sequence var ansi = { i: 0, f: 37, b: 40 }; + var line; + var x; while (lines.length > 0) { - var x = 0; - var line = lines.shift(); + x = 0; + line = lines.shift(); if ((debug !== undefined) && (y > debug)) { exit(1); diff --git a/tools/frame_load.js b/tools/frame_load.js index a49098c..4a7a688 100644 --- a/tools/frame_load.js +++ b/tools/frame_load.js @@ -1,12 +1,19 @@ +/** + * Load a frame, optionally with a new ANSI/BIN and load it into the msgbase. + */ + load('ansitex/load/funcs.js'); +// Our page handler load('ansitex/load/page.js'); /* parse command arguments */ -if (argv.length !== 1) { - writeln('! ERROR: Need 1 arguments only'); +if (argv.length !== 3) { + writeln('! ERROR: Need 3 arguments only'); exit(1); } +var frame = argv.shift(); +var index = argv.shift(); var file = argv.shift(); var ext = file_getext(file).substr(1).toLowerCase(); @@ -14,16 +21,17 @@ var ext = file_getext(file).substr(1).toLowerCase(); // Type of frame to load switch (ext) { case 'tex': + case 'ans': require('ansitex/load/session/ansitex.js','SESSION_ANSITEX'); break; case 'vtx': + case 'bin': require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA'); break; } -var page = new Page(false); -page.import(file); -//page.build(); -//page.get(new PageObject(980,'a')); +var page = new Page(); +page.get(new PageObject(frame,index)); +page.import(file,ext); page.save(); diff --git a/tools/frames_check.js b/tools/frames_check.js index 370d923..8aa7817 100644 --- a/tools/frames_check.js +++ b/tools/frames_check.js @@ -102,8 +102,8 @@ if (! tex.import(FRAMES_HOME+SESSION_EXT+'/'+page)) { // Checking keys if (vtx.raw && tex.raw) { - writeln('- Checking Page: '); + if (vtx.name.toString() !== tex.name.toString()) { writeln(' - ! VTX: '+vtx.name.toString()); writeln(' - ! TEX: '+tex.name.toString()); diff --git a/tools/msgbases_list.js b/tools/msgbases_list.js index 90e3296..d02145d 100644 --- a/tools/msgbases_list.js +++ b/tools/msgbases_list.js @@ -1,4 +1,4 @@ load('ansitex/load/msgbases.js'); var ma = new MsgAreas(); -writeln(JSON.stringify(ma.list)); +ma.list;