Subj : Java script
To : Theviper
From : Digital Man
Date : Wed Feb 05 2025 10:10 pm
Re: Java script
By: Theviper to All on Tue Feb 04 2025 02:31 pm
> // Filename: sysop_chat_with_splitscreen_and_colors.js
>
> load('sbbsdefs.js'); // Load the standard definitions
> load('userdefs.js'); // Load user definitions if needed
Use require() instead of load() to prevent redundant/unnecessary reloads of the script.
> // Helper function to add ANSI color codes
> function color(text, foreColor, backColor = null) {
> var ansiCode = '\x1b[';
> if (foreColor) ansiCode += foreColor + 'm';
> if (backColor) ansiCode += backColor + 'm';
> return ansiCode + text + '\x1b[0m'; // Reset color after text
> }
>
> // ANSI color codes for foreground
> const RED = '31';
> const GREEN = '32';
> const YELLOW = '33';
> const BLUE = '34';
> const MAGENTA = '35';
> const CYAN = '36';
> const WHITE = '37';
You seem to be reinventing the wheel here:
1. This code only works with ANSI terminals and will not produce anything useful for other terminals.
2. We already have console.attributes and a ton of other ways (in Synchronet-JS) to set the attributes in a terminal-neutral manner that will "just work" with other non-ANSI terminals.
https://www.synchro.net/docs/jsobjs.html#console_object_properties
> This is the new Chat system screen for the BBS Java script a new sysop page!
Cool! Keep it up. And it's "JavaScript". :-)
--
digital man (rob)
This Is Spinal Tap quote #20:
Well, I'm sure I'd feel much worse if I weren't under such heavy sedation.
Norco, CA WX: 55.7�F, 90.0% humidity, 0 mph W wind, 0.01 inches rain/24hrs
---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net