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

Merge branch 'dd_file_lister_view_file_pause' into 'master'

Added an option to pause after viewing a file (defaults to true)

See merge request !138
parents cf3ecb0a e5891c57
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!138Added an option to pause after viewing a file (defaults to true)
...@@ -8,5 +8,8 @@ ...@@ -8,5 +8,8 @@
; DATE_D: Import date/time descending sort order ; DATE_D: Import date/time descending sort order
sortOrder=NATURAL sortOrder=NATURAL
; Whether or not to pause after viewing a file
pauseAfterViewingFile=true
; The name of the color theme configuration file ; The name of the color theme configuration file
themeFilename=defaultTheme.cfg themeFilename=defaultTheme.cfg
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* 2022-02-07 Eric Oulashin Version 2.01 * 2022-02-07 Eric Oulashin Version 2.01
* Fixed file description being undefined when viewing * Fixed file description being undefined when viewing
* file info. Fixed command bar refreshing when pressing * file info. Fixed command bar refreshing when pressing
* the hotkeys. * the hotkeys. Added an option to pause after viewing a
* file (defaults to true).
*/ */
if (typeof(require) === "function") if (typeof(require) === "function")
...@@ -170,6 +171,8 @@ var gErrorMsgBoxULY = 4; ...@@ -170,6 +171,8 @@ var gErrorMsgBoxULY = 4;
var gErrorMsgBoxWidth = console.screen_columns - 2; var gErrorMsgBoxWidth = console.screen_columns - 2;
var gErrorMsgBoxHeight = 3; var gErrorMsgBoxHeight = 3;
// Whether or not to pause after viewing a file
var gPauseAfterViewingFile = true;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Script execution code // Script execution code
...@@ -188,6 +191,7 @@ if (!gFilebase.open()) ...@@ -188,6 +191,7 @@ if (!gFilebase.open())
// If there are no files in the filebase, then say so and exit now. // If there are no files in the filebase, then say so and exit now.
if (gFilebase.files == 0) if (gFilebase.files == 0)
{ {
gFilebase.close();
var libIdx = file_area.dir[bbs.curdir_code].lib_index; var libIdx = file_area.dir[bbs.curdir_code].lib_index;
console.crlf(); console.crlf();
console.print("\1n\1cThere are no files in \1h" + file_area.lib_list[libIdx].description + "\1n\1c - \1h" + console.print("\1n\1cThere are no files in \1h" + file_area.lib_list[libIdx].description + "\1n\1c - \1h" +
...@@ -502,7 +506,8 @@ function viewFile(pFilebase, pFileList, pFileListMenu) ...@@ -502,7 +506,8 @@ function viewFile(pFilebase, pFileList, pFileListMenu)
console.print("\1n"); console.print("\1n");
console.crlf(); console.crlf();
var successfullyViewed = bbs.view_file(fullyPathedFilename); var successfullyViewed = bbs.view_file(fullyPathedFilename);
if (!successfullyViewed) console.print("\1n");
if (gPauseAfterViewingFile || !successfullyViewed)
console.pause(); console.pause();
retObj.reDrawListerHeader = true; retObj.reDrawListerHeader = true;
...@@ -2311,7 +2316,6 @@ function readConfigFile() ...@@ -2311,7 +2316,6 @@ function readConfigFile()
var setting = null; // A setting name (string) var setting = null; // A setting name (string)
var settingUpper = null; // Upper-case setting name var settingUpper = null; // Upper-case setting name
var value = null; // To store a value for a setting (string) var value = null; // To store a value for a setting (string)
var valueUpper = null; // Upper-cased value for a setting (string)
while (!cfgFile.eof) while (!cfgFile.eof)
{ {
// Read the next line from the config file. // Read the next line from the config file.
...@@ -2343,7 +2347,7 @@ function readConfigFile() ...@@ -2343,7 +2347,7 @@ function readConfigFile()
setting = trimSpaces(fileLine.substr(0, equalsPos), true, false, true); setting = trimSpaces(fileLine.substr(0, equalsPos), true, false, true);
settingUpper = setting.toUpperCase(); settingUpper = setting.toUpperCase();
value = trimSpaces(fileLine.substr(equalsPos+1), true, false, true); value = trimSpaces(fileLine.substr(equalsPos+1), true, false, true);
valueUpper = value.toUpperCase(); var valueUpper = value.toUpperCase();
// Set the appropriate valueUpper in the settings object. // Set the appropriate valueUpper in the settings object.
if (settingUpper == "SORTORDER") if (settingUpper == "SORTORDER")
...@@ -2374,6 +2378,8 @@ function readConfigFile() ...@@ -2374,6 +2378,8 @@ function readConfigFile()
else // Default else // Default
gFileSortOrder = FileBase.SORT.NATURAL; gFileSortOrder = FileBase.SORT.NATURAL;
} }
else if (settingUpper == "PAUSEAFTERVIEWINGFILE")
gPauseAfterViewingFile = (value.toUpperCase() == "TRUE");
else if (settingUpper == "THEMEFILENAME") else if (settingUpper == "THEMEFILENAME")
{ {
// First look for the theme config file in the sbbs/mods // First look for the theme config file in the sbbs/mods
......
...@@ -165,6 +165,10 @@ sortOrder String: The file sort order to use. ...@@ -165,6 +165,10 @@ sortOrder String: The file sort order to use.
DATE_A: Import date/time ascending sort order DATE_A: Import date/time ascending sort order
DATE_D: Import date/time descending sort order DATE_D: Import date/time descending sort order
pauseAfterViewingFile Whether or not to pause after viewing a
file
themeFilename The name of the configuration file to themeFilename The name of the configuration file to
use for colors & string settings use for colors & string settings
......
...@@ -7,5 +7,6 @@ Version Date Description ...@@ -7,5 +7,6 @@ Version Date Description
------- ---- ----------- ------- ---- -----------
2.01 2022-02-07 Fixed file description being undefined when viewing file 2.01 2022-02-07 Fixed file description being undefined when viewing file
info. Fixed command bar refreshing when pressing the info. Fixed command bar refreshing when pressing the
hotkeys. hotkeys. Added an option to pause after viewing a file
(defaults to true).
2.00 2022-02-06 Initial version. 2.00 2022-02-06 Initial version.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment