Skip to content
Snippets Groups Projects
Commit 06884399 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Refactor, make bullseye menu file (e.g. bullseye.asc) optional

Use console.uselect() to list the bulletin files, if the menu file
(e.g. bullseye.asc) doesn't exist. For Amessyroom.

Don't replace the Pause (hit a key) prompt, since that messes up
localizaton support (reverts to the text.dat Pause prompt, instead of the
text.*.ini translated Pause prompt). The replace/revert text buffers should
really be a stack for a full fix for this.

Missing bulletin files are automatically excluded from the bulletin list.

The rest is just clean-up from the conversion from Baja.

This is still a very old/basic script, but at least it's not quite as hideous
and outdated as before.

Increment the version to 3.00.
parent 5d708cdb
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
......@@ -2,22 +2,19 @@
// Bulletins written in Baja by Rob Swindell
// Translated to JS by Stehen Hurd
// Refactored by Rob Swindell
// @format.tab-size 4, @format.use-tabs true
load("sbbsdefs.js");
"use strict";
// Load the configuration file
var i=0;
var b=0;
var filepos=0;
var total=0;
var mode=0;
var fname="";
var str="";
var html=user.settings&USER_HTML;
var file;
if(html) {
if(!file_exists(system.text_dir+"bullseye.html"))
......@@ -26,57 +23,53 @@ if(html) {
if(!html) {
writeln("");
writeln("Synchronet BullsEye! Version 2.00 by Rob Swindell");
writeln("Synchronet BullsEye! Version 3.00 by Rob Swindell");
}
console.line_counter=0;
file=new File(system.text_dir+"bullseye.cfg");
var file=new File(system.text_dir+"bullseye.cfg");
if(!file.open("r", true)) {
writeln("");
writeln("!ERROR "+file.error+" opening "+system.text_dir+"bullseye.cfg");
writeln("!ERROR "+file.error+" opening "+ file.name);
exit(1);
}
mode=file.readln();
filepos=file.position;
file.readln(); // First line is not used (mode?)
bull = file.readAll();
file.close();
bull = bull.filter(function(str) { return truncsp(str) && file_getcase(str); });
total=0;
// write(total+": "+mode);
while((str=file.readln())!=null) {
// write(total+": "+str);
total++;
if(bull.length < 1) {
alert("No bulletins listed in " + file.name);
exit(0);
}
// Display menu, list bulletins, display prompt, etc.
menu:
while(1) {
bbs.menu("../bullseye");
console.mnemonics("\r\nEnter number of bulletin or [~Quit]: ");
b=console.getnum(total);
if(b<1)
exit(0);
file.position=filepos;
i=0;
while((str=file.readln())!=null) {
i++;
if(i==b) {
console.clear(7);
str=truncsp(str);
fname=str;
bbs.replace_text(563,"\001n\001h\001b{\001wContinue? Yes/No\001b} ");
var ext = file_getext(fname);
if(ext == ".*")
bbs.menu(fname.slice(0, -2));
else if(str.search(/\.htm/)!=-1)
load(new Object, "typehtml.js", "-color", str);
else
load(new Object, "typeasc.js", str, "BullsEye Bulletin #"+b);
log("Node "+bbs.node_num+" "+user.alias+" viewed bulletin #"+i+": "+fname);
bbs.revert_text(563);
console.aborted=false;
continue menu;
}
while(bbs.online && !js.terminated) {
if(bbs.menu("../bullseye")) {
console.mnemonics("\r\nEnter number of bulletin or [~Quit]: ");
b = console.getnum(bull.length);
} else {
for(i = 0; i < bull.length; ++i)
console.uselect(i + 1, "Bulletin", file_getname(bull[i]));
b = console.uselect();
}
if(b < 1)
break;
if(b > bull.length) {
alert("Invalid bulletin number: "+b);
} else {
console.clear(7);
var fname = truncsp(bull[b - 1]);
var ext = file_getext(fname);
if(ext == ".*")
bbs.menu(fname.slice(0, -2));
else if(fname.search(/\.htm/)!=-1)
load(new Object, "typehtml.js", "-color", fname);
else
load(new Object, "typeasc.js", fname, "BullsEye Bulletin #"+b);
log("Node "+bbs.node_num+" "+user.alias+" viewed bulletin #"+i+": "+fname);
console.aborted=false;
}
writeln();
write("Invalid bulletin number: "+b);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment