sbbs/tools/frame_import.js

38 lines
811 B
JavaScript
Raw Normal View History

/**
* 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();
if (! p.get(po))
throw new Error('Page doesnt exist:'+po.toString());
if (! p.isSystemConfig) {
// 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();