From 18a9a9db415d34f51001c9e26f7cbaa59e709f46 Mon Sep 17 00:00:00 2001 From: Eric Oulashin <nightfox@synchro.net> Date: Sat, 28 Oct 2023 06:21:44 +0000 Subject: [PATCH] DD Message area chooser: Lightbar mode name collapsing: Ensure the intermediate subgroup is selected --- xtrn/DDAreaChoosers/DDMsgAreaChooser.js | 26 +++++++++++++++++++++++-- xtrn/DDAreaChoosers/readme.txt | 4 ++-- xtrn/DDAreaChoosers/version_history.txt | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/xtrn/DDAreaChoosers/DDMsgAreaChooser.js b/xtrn/DDAreaChoosers/DDMsgAreaChooser.js index 80779270d4..da309044c5 100644 --- a/xtrn/DDAreaChoosers/DDMsgAreaChooser.js +++ b/xtrn/DDAreaChoosers/DDMsgAreaChooser.js @@ -71,6 +71,9 @@ * Sub-board name collapsing: Fix for incorrect sub-subboard assignment. * Also, won't collapse if the name before the separator is the same as * the message group description. + * 2023-10-27 Eric Oulashin Version 1.41 + * Lightbar mode: When using name collapisng, ensure the menu item for + * the appropriate subgroup is selected. */ // TODO: In the area list, the 10,000ths digit (for # posts) is in a different color) @@ -114,8 +117,8 @@ if (system.version_num < 31400) } // Version & date variables -var DD_MSG_AREA_CHOOSER_VERSION = "1.40"; -var DD_MSG_AREA_CHOOSER_VER_DATE = "2023-10-24"; +var DD_MSG_AREA_CHOOSER_VERSION = "1.41"; +var DD_MSG_AREA_CHOOSER_VER_DATE = "2023-10-27"; // Keyboard input key codes var CTRL_H = "\x08"; @@ -1177,19 +1180,38 @@ function DDMsgAreaChooser_CreateLightbarSubBoardMenu(pLevel, pGrpIdx, pSubIdx) // Set the currently selected item. If the current sub-board is in this list, // then set the selected item to that; otherwise, the selected item should be // the first sub-board. + var selectedItemIdxWasSet = false; if (msg_area.sub[bbs.cursub_code].grp_index == pGrpIdx) { + //if (user.is_sysop) console.print("\x01n\r\nHere 1\r\n\x01p"); // Temporary if ((pSubIdx >= 0) && (pSubIdx < this.group_list[pGrpIdx].sub_list.length)) { var subSubsValid = Array.isArray(this.group_list[pGrpIdx].sub_list[pSubIdx].sub_subboard_list) && this.group_list[pGrpIdx].sub_list[pSubIdx].sub_subboard_list.length > 0; if (!subSubsValid && bbs.cursub_code == this.group_list[pGrpIdx].sub_list[pSubIdx].code) { + //if (user.is_sysop) console.print("\x01n\r\nHere 3\r\n\x01p"); // Temporary subBoardMenu.selectedItemIdx = pSubIdx; if (subBoardMenu.selectedItemIdx >= subBoardMenu.topItemIdx+subBoardMenu.GetNumItemsPerPage()) subBoardMenu.topItemIdx = subBoardMenu.selectedItemIdx - subBoardMenu.GetNumItemsPerPage() + 1; } } } + // If the selected item wasn't set, then check whether the current sub-board + // is within any of the sub-subboards for the subgroups in the group, and set + // it if so. + if (!selectedItemIdxWasSet) + { + for (var subIdx = 0; subIdx < this.group_list[pGrpIdx].sub_list.length; ++subIdx) + { + if (this.CurrentSubBoardIsInSubSubsForSub(pGrpIdx, subIdx)) + { + subBoardMenu.selectedItemIdx = subIdx; + if (subBoardMenu.selectedItemIdx >= subBoardMenu.topItemIdx+subBoardMenu.GetNumItemsPerPage()) + subBoardMenu.topItemIdx = subBoardMenu.selectedItemIdx - subBoardMenu.GetNumItemsPerPage() + 1; + break; + } + } + } } else if (pLevel == 3) { diff --git a/xtrn/DDAreaChoosers/readme.txt b/xtrn/DDAreaChoosers/readme.txt index 866e372947..6e1deb3ba7 100644 --- a/xtrn/DDAreaChoosers/readme.txt +++ b/xtrn/DDAreaChoosers/readme.txt @@ -1,6 +1,6 @@ Digital Distortion Area Choosers - Version 1.40 - Release date: 2023-10-24 + Version 1.41/1.40 + Release date: 2023-10-27 by diff --git a/xtrn/DDAreaChoosers/version_history.txt b/xtrn/DDAreaChoosers/version_history.txt index e262f717cf..c1d8de7ea4 100644 --- a/xtrn/DDAreaChoosers/version_history.txt +++ b/xtrn/DDAreaChoosers/version_history.txt @@ -5,6 +5,10 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +1.41 2023-1027 Message area chooser only: In lightbar mode, when using + name collapisng, ensure the menu item for the appropriate + subgroup is selected. + The file area chooser was already doing this. 1.40 2023-10-24 Name collapsing: Fix for incorrect subboard/directory assignment. Also, won't collapse if the name before the separator is the same as the message group description. -- GitLab