sbbs/tools/frame_load.js

43 lines
852 B
JavaScript
Raw Normal View History

/**
* 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 !== 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();
// 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();
if (page.get(new PageObject(frame,index))) {
page.import(file,ext);
page.save();
} else if (['vtx','tex'].indexOf(ext) !== -1) {
page.import(file,ext);
page.save();
}