sbbs/tools/frame_import.js

36 lines
718 B
JavaScript

/**
* Load a frame, and store it in the message base
*/
load('ansitex/load/page.js');
load('ansitex/load/funcs.js');
load('lz-string.js');
/* parse command arguments */
if (argv.length !== 1) {
writeln('ERROR: Need a frame ID');
exit(1);
} else {
writeln('Importing frame:'+argv[0]);
}
var po = new PageObject(argv[0]);
// Load ANSItex frame
var SESSION_EXT = 'tex';
require('ansitex/load/session/ansitex.js','SESSION_ANSITEX');
var p = new Page();
p.get(po);
// Load Viewdata frame
var SESSION_EXT = 'vtx';
require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA');
var vtx = p.file_content(FRAMES_HOME+SESSION_EXT+'/'+po.toString()+'.'+CONTENT_EXT);
if (vtx !== undefined)
p.raw = vtx;
p.save();