From a287dcf7866958078057688bb2b10a812234c160 Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Mon, 30 Nov 2020 18:35:13 -0800 Subject: [PATCH] Support text/menu/xtrn*_tail even when xtrn<secnum|name> menu exists. Previously, the xtrn*_tail menu was only displayed in the programmatic menu mode. Also, using the P_NOERROR mode flag for bbs.menu() to simplify all the if/else logic. And use require() instead of load(). --- exec/xtrn_sec.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/exec/xtrn_sec.js b/exec/xtrn_sec.js index df76534865..e1f846b335 100644 --- a/exec/xtrn_sec.js +++ b/exec/xtrn_sec.js @@ -9,10 +9,10 @@ "use strict"; -load("sbbsdefs.js"); +require("sbbsdefs.js", "P_NOERROR"); /* text.dat entries */ -load("text.js"); +require("text.js", "XtrnProgLstFmt"); /* See if an xtrn section code was passed as an argument */ /* must parse argv before calling load() */ @@ -123,17 +123,11 @@ function external_program_menu(xsec) var secnum = xtrn_area.sec_list[xsec].number+1; var seccode = xtrn_area.sec_list[xsec].code; - if(bbs.menu_exists("xtrn" + secnum + "_head")) { - bbs.menu("xtrn" + secnum + "_head"); - } - else if(bbs.menu_exists("xtrn" + seccode + "_head")) { - bbs.menu("xtrn" + seccode + "_head"); - } - if(bbs.menu_exists("xtrn" + secnum)) { - bbs.menu("xtrn" + secnum); - } - else if(bbs.menu_exists("xtrn" + seccode)) { - bbs.menu("xtrn" + seccode); + if(!bbs.menu("xtrn" + secnum + "_head", P_NOERROR)) + bbs.menu("xtrn" + seccode + "_head", P_NOERROR); + if(bbs.menu("xtrn" + secnum, P_NOERROR) || bbs.menu("xtrn" + seccode, P_NOERROR)) { + if(!bbs.menu("xtrn" + secnum + "_tail", P_NOERROR)) + bbs.menu("xtrn" + seccode + "_tail", P_NOERROR); } else { var multicolumn = options.multicolumn && prog_list.length > options.singlecolumn_height; @@ -182,12 +176,8 @@ function external_program_menu(xsec) } console.crlf(); } - if(bbs.menu_exists("xtrn" + secnum + "_tail")) { - bbs.menu("xtrn" + secnum + "_tail"); - } - else if(bbs.menu_exists("xtrn" + seccode + "_tail")) { - bbs.menu("xtrn" + seccode + "_tail"); - } + if(!bbs.menu("xtrn" + secnum + "_tail", P_NOERROR)) + bbs.menu("xtrn" + seccode + "_tail", P_NOERROR); bbs.node_sync(); console.mnemonics(options.which); } -- GitLab