Newer
Older
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
// terminal supports both high-ASCII characters and ANSI codes.
function canDoHighASCIIAndANSI()
{
//return (console.term_supports(USER_ANSI) && (user.settings & USER_NO_EXASCII == 0));
return (console.term_supports(USER_ANSI));
}
// Searches a given range in an open message base and returns an object with arrays
// containing the message headers (0-based indexed and indexed by message number)
// with the message headers of any found messages.
//
// Parameters:
// pSubCode: The internal code of the message sub-board
// pSearchType: The type of search to do (one of the SEARCH_ values)
// pSearchString: The string to search for.
// pListingPersonalEmailFromUser: Optional boolean - Whether or not we're listing
// personal email sent by the user. This defaults
// to false.
// pStartIndex: The starting message index (0-based). Optional; defaults to 0.
// pEndIndex: One past the last message index. Optional; defaults to the total number
// of messages.
//
// Return value: An object with the following arrays:
// indexed: A 0-based indexed array of message headers
function searchMsgbase(pSubCode, pSearchType, pSearchString, pListingPersonalEmailFromUser, pStartIndex, pEndIndex)
{
var msgHeaders = new Object();
msgHeaders.indexed = new Array();
if ((pSubCode != "mail") && ((typeof(pSearchString) != "string") || !searchTypePopulatesSearchResults(pSearchType)))
return msgHeaders;
var msgbase = new MsgBase(pSubCode);
if (!msgbase.open())
return msgHeaders;
var startMsgIndex = 0;
var endMsgIndex = msgbase.total_msgs;
if (typeof(pStartIndex) == "number")
{
if ((pStartIndex >= 0) && (pStartIndex < msgbase.total_msgs))
startMsgIndex = pStartIndex;
}
if (typeof(pEndIndex) == "number")
{
if ((pEndIndex >= 0) && (pEndIndex > startMsgIndex) && (pEndIndex <= msgbase.total_msgs))
endMsgIndex = pEndIndex;
}
// Define a search function for the message field we're going to search
var readingPersonalEmailFromUser = (typeof(pListingPersonalEmailFromUser) == "boolean" ? pListingPersonalEmailFromUser : false);
var matchFn = null;
switch (pSearchType)
{
// It might seem odd to have SEARCH_NONE in here, but it's here because
// when reading personal email, we need to search for messages only to
// the current user.
case SEARCH_NONE:
if (pSubCode == "mail")
{
// Set up the match function slightly differently depending on whether
// we're looking for mail from the current user or to the current user.
if (readingPersonalEmailFromUser)
{
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
var msgText = strip_ctrl(pMsgBase.get_msg_body(false, pMsgHdr.number));
return gAllPersonalEmailOptSpecified || msgIsFromUser(pMsgHdr);
}
}
else
{
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
var msgText = strip_ctrl(pMsgBase.get_msg_body(false, pMsgHdr.number));
return gAllPersonalEmailOptSpecified || msgIsToUserByNum(pMsgHdr);
}
}
}
break;
case SEARCH_KEYWORD:
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
var msgText = strip_ctrl(pMsgBase.get_msg_body(false, pMsgHdr.number));
var keywordFound = ((pMsgHdr.subject.toUpperCase().indexOf(pSearchStr) > -1) || (msgText.toUpperCase().indexOf(pSearchStr) > -1));
if (pSubBoardCode == "mail")
return keywordFound && msgIsToUserByNum(pMsgHdr);
else
return keywordFound;
}
break;
case SEARCH_FROM_NAME:
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
var fromNameFound = (pMsgHdr.from.toUpperCase() == pSearchStr.toUpperCase());
if (pSubBoardCode == "mail")
return fromNameFound && (gAllPersonalEmailOptSpecified || msgIsToUserByNum(pMsgHdr));
else
return fromNameFound;
}
break;
case SEARCH_TO_NAME_CUR_MSG_AREA:
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
return (pMsgHdr.to.toUpperCase() == pSearchStr);
}
break;
case SEARCH_TO_USER_CUR_MSG_AREA:
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
case SEARCH_ALL_TO_USER_SCAN:
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
// See if the message is not marked as deleted and the 'To' name
// matches the user's handle, alias, and/or username.
return (((pMsgHdr.attr & MSG_DELETE) == 0) && userNameHandleAliasMatch(pMsgHdr.to));
}
break;
case SEARCH_TO_USER_NEW_SCAN:
case SEARCH_TO_USER_NEW_SCAN_CUR_SUB:
case SEARCH_TO_USER_NEW_SCAN_CUR_GRP:
case SEARCH_TO_USER_NEW_SCAN_ALL:
if (pSubCode != "mail")
{
// If pStartIndex or pEndIndex aren't specified, then set
// startMsgIndex to the scan pointer and endMsgIndex to one
// past the index of the last message in the sub-board
if (typeof(pStartIndex) != "number")
{
// First, write some messages to the log if verbose logging is enabled
if (gCmdLineArgVals.verboselogging)
{
writeToSysAndNodeLog("New-to-user scan for " +
subBoardGrpAndName(pSubCode) + " -- Scan pointer: " +
msg_area.sub[pSubCode].scan_ptr);
}
//startMsgIndex = absMsgNumToIdx(msgbase, msg_area.sub[pSubCode].last_read);
startMsgIndex = absMsgNumToIdx(msgbase, msg_area.sub[pSubCode].scan_ptr);
if (startMsgIndex == -1)
{
msg_area.sub[pSubCode].scan_ptr = 0;
startMsgIndex = 0;
}
else
{
// If this message has been read, then start at the next message.
var startMsgHeader = msgbase.get_msg_header(true, startMsgIndex, false);
if (startMsgHeader == null)
++startMsgIndex;
else
{
if ((startMsgHeader.attr & MSG_READ) == MSG_READ)
++startMsgIndex;
}
}
}
if (typeof(pEndIndex) != "number")
endMsgIndex = (msgbase.total_msgs > 0 ? msgbase.total_msgs : 0);
}
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
// Note: This assumes pSubBoardCode is not "mail" (personal mail).
// See if the message 'To' name matches the user's handle, alias,
// and/or username and is not marked as deleted and is unread.
return (((pMsgHdr.attr & MSG_DELETE) == 0) && ((pMsgHdr.attr & MSG_READ) == 0) && userNameHandleAliasMatch(pMsgHdr.to));
}
break;
case SEARCH_MSG_NEWSCAN:
case SEARCH_MSG_NEWSCAN_CUR_SUB:
case SEARCH_MSG_NEWSCAN_CUR_GRP:
case SEARCH_MSG_NEWSCAN_ALL:
matchFn = function(pSearchStr, pMsgHdr, pMsgBase, pSubBoardCode) {
// Note: This assumes pSubBoardCode is not "mail" (personal mail).
// Get the offset of the last read message and compare it with the
// offset of the given message header
var lastReadMsgHdr = pMsgBase.get_msg_header(false, msg_area.sub[pSubBoardCode].last_read, false);
//var lastReadMsgOffset = (lastReadMsgHdr != null ? lastReadMsgHdr.offset : 0);
var lastReadMsgOffset = (lastReadMsgHdr != null ? this.GetMsgIdx(lastReadMsgHdr.number) : 0);

nightfox
committed
if (lastReadMsgOffset < 0)
lastReadMsgOffset = 0;
//return (pMsgHdr.offset > lastReadMsgOffset);
return (this.GetMsgIdx(pMsgHdr.number) > lastReadMsgOffset);
}
break;
}
// Search the messages
if (matchFn != null)
{
// If get_all_msg_headers exists as a function, then use it. Otherwise,
// iterate through all message offsets and get the headers. We want to
// use get_all_msg_hdrs() if possible because that will include information
// about how many votes each message got (up/downvotes for regular
// messages or who voted for which options for poll messages).
if (useGetAllMsgHdrs && (typeof(msgbase.get_all_msg_headers) === "function"))
{
// Pass false to get_all_msg_headers() to tell it not to include vote messages
// (the parameter was introduced in Synchronet 3.17+)
var tmpHdrs = msgbase.get_all_msg_headers(false);
// Re-do startMsgIndex and endMsgIndex based on the message headers we got
startMsgIndex = 0;
endMsgIndex = msgbase.total_msgs;
if (typeof(pStartIndex) == "number")
{
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
if ((pStartIndex >= 0) && (pStartIndex < tmpHdrs.length))
startMsgIndex = pStartIndex;
}
if (typeof(pEndIndex) == "number")
{
if ((pEndIndex >= 0) && (pEndIndex > startMsgIndex) && (pEndIndex <= tmpHdrs.length))
endMsgIndex = pEndIndex;
}
// Search the message headers
var msgIdx = 0;
for (var prop in tmpHdrs)
{
// Only add the message header if the message is readable to the user
// and msgIdx is within bounds
if ((msgIdx >= startMsgIndex) && (msgIdx < endMsgIndex) && isReadableMsgHdr(tmpHdrs[prop], this.subBoardCode))
{
if (tmpHdrs[prop] != null)
{
if (matchFn(pSearchString, tmpHdrs[prop], msgbase, pSubCode))
msgHeaders.indexed.push(tmpHdrs[prop]);
}
}
++msgIdx;
}
}
else
{
for (var msgIdx = startMsgIndex; msgIdx < endMsgIndex; ++msgIdx)
{
var msgHeader = msgbase.get_msg_header(true, msgIdx, false);
// I've seen situations where the message header object is null for
// some reason, so check that before running the search function.
if (msgHeader != null)
{
if (matchFn(pSearchString, msgHeader, msgbase, pSubCode))
msgHeaders.indexed.push(msgHeader);
}
}
}
}
msgbase.close();
return msgHeaders;
}
// Returns whether or not a message is to the current user (either the current
// logged-in user or the user specified by the userNum command-line argument)
// and is not deleted.
//
// Parameters:
// pMsgHdr: A message header object
//
// Return value: Boolean - Whether or not the message is to the user and is not
// deleted.
function msgIsToUserByNum(pMsgHdr)
{
if (typeof(pMsgHdr) != "object")
return false;
// Return false if the message is marked as deleted
if ((pMsgHdr.attr & MSG_DELETE) == MSG_DELETE)
return false;
var msgIsToUser = false;
// If an alternate user number was specified on the command line, then use that
// user information. Otherwise, use the current logged-in user.
if (gCmdLineArgVals.hasOwnProperty("altUserNum"))
msgIsToUser = (pMsgHdr.to_ext == gCmdLineArgVals.altUserNum);
else
msgIsToUser = (pMsgHdr.to_ext == user.number);
return msgIsToUser;
}
// Returns whether or not a message is from the current user (either the current
// logged-in user or the user specified by the userNum command-line argument)
// and is not deleted.
//
// Parameters:
// pMsgHdr: A message header object
//
// Return value: Boolean - Whether or not the message is from the logged-in user
// and is not deleted.
function msgIsFromUser(pMsgHdr)
{
if (typeof(pMsgHdr) != "object")
return false;
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
// Return false if the message is marked as deleted
if ((pMsgHdr.attr & MSG_DELETE) == MSG_DELETE)
return false;
var isFromUser = false;
// If an alternate user number was specified on the command line, then use that
// user information. Otherwise, use the current logged-in user.
if (pMsgHdr.hasOwnProperty("from_ext"))
{
if (gCmdLineArgVals.hasOwnProperty("altUserNum"))
isFromUser = (pMsgHdr.from_ext == gCmdLineArgVals.altUserNum);
else
isFromUser = (pMsgHdr.from_ext == user.number);
}
else
{
var hdrFromUpper = pMsgHdr.from.toUpperCase();
if (gCmdLineArgVals.hasOwnProperty("altUserName") && gCmdLineArgVals.hasOwnProperty("altUserAlias"))
isFromUser = ((hdrFromUpper == gCmdLineArgVals.altUserAlias.toUpperCase()) || (hdrFromUpper == gCmdLineArgVals.altUserName.toUpperCase()));
else
isFromUser = ((hdrFromUpper == user.alias.toUpperCase()) || (hdrFromUpper == user.name.toUpperCase()));
}
return isFromUser;
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
}
/////////////////////////////////////////////////////////////////////////
// Functions for converting other BBS color codes to Synchronet attribute codes
// Converts WWIV attribute codes to Synchronet attribute codes.
//
// Parameters:
// pText: A string containing the text to convert
//
// Return value: The text with the color codes converted
function WWIVAttrsToSyncAttrs(pText)
{
// First, see if the text has any WWIV-style attribute codes at
// all. We'll be performing a bunch of search & replace commands,
// so we don't want to do all that work for nothing.. :)
if (/\x03[0-9]/.test(pText))
{

nightfox
committed
var text = pText.replace(/\x030/g, "\1n"); // Normal
text = text.replace(/\x031/g, "\1n\1c\1h"); // Bright cyan
text = text.replace(/\x032/g, "\1n\1y\1h"); // Bright yellow
text = text.replace(/\x033/g, "\1n\1m"); // Magenta
text = text.replace(/\x034/g, "\1n\1h\1w\1" + "4"); // Bright white on blue
text = text.replace(/\x035/g, "\1n\1g"); // Green
text = text.replace(/\x036/g, "\1h\1r\1i"); // Bright red, blinking
text = text.replace(/\x037/g, "\1n\1h\1b"); // Bright blue
text = text.replace(/\x038/g, "\1n\1b"); // Blue
text = text.replace(/\x039/g, "\1n\1c"); // Cyan
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
return text;
}
else
return pText; // No WWIV-style color attribute found, so just return the text.
}
// Converts PCBoard attribute codes to Synchronet attribute codes.
//
// Parameters:
// pText: A string containing the text to convert
//
// Return value: The text with the color codes converted
function PCBoardAttrsToSyncAttrs(pText)
{
// First, see if the text has any PCBoard-style attribute codes at
// all. We'll be performing a bunch of search & replace commands,
// so we don't want to do all that work for nothing.. :)
if (/@[xX][0-9A-Fa-f]{2}/.test(pText))
{
// Black background
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
var text = pText.replace(/@[xX]00/g, "\1n\1k\1" + "0"); // Black on black
text = text.replace(/@[xX]01/g, "\1n\1b\1" + "0"); // Blue on black
text = text.replace(/@[xX]02/g, "\1n\1g\1" + "0"); // Green on black
text = text.replace(/@[xX]03/g, "\1n\1c\1" + "0"); // Cyan on black
text = text.replace(/@[xX]04/g, "\1n\1r\1" + "0"); // Red on black
text = text.replace(/@[xX]05/g, "\1n\1m\1" + "0"); // Magenta on black
text = text.replace(/@[xX]06/g, "\1n\1y\1" + "0"); // Yellow/brown on black
text = text.replace(/@[xX]07/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@[xX]08/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@[xX]09/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@[xX]08/g, "\1h\1k\1" + "0"); // Bright black on black
text = text.replace(/@[xX]09/g, "\1h\1b\1" + "0"); // Bright blue on black
text = text.replace(/@[xX]0[Aa]/g, "\1h\1g\1" + "0"); // Bright green on black
text = text.replace(/@[xX]0[Bb]/g, "\1h\1c\1" + "0"); // Bright cyan on black
text = text.replace(/@[xX]0[Cc]/g, "\1h\1r\1" + "0"); // Bright red on black
text = text.replace(/@[xX]0[Dd]/g, "\1h\1m\1" + "0"); // Bright magenta on black
text = text.replace(/@[xX]0[Ee]/g, "\1h\1y\1" + "0"); // Bright yellow on black
text = text.replace(/@[xX]0[Ff]/g, "\1h\1w\1" + "0"); // Bright white on black
// Blinking foreground
// Blue background
text = text.replace(/@[xX]10/g, "\1n\1k\1" + "4"); // Black on blue
text = text.replace(/@[xX]11/g, "\1n\1b\1" + "4"); // Blue on blue
text = text.replace(/@[xX]12/g, "\1n\1g\1" + "4"); // Green on blue
text = text.replace(/@[xX]13/g, "\1n\1c\1" + "4"); // Cyan on blue
text = text.replace(/@[xX]14/g, "\1n\1r\1" + "4"); // Red on blue
text = text.replace(/@[xX]15/g, "\1n\1m\1" + "4"); // Magenta on blue
text = text.replace(/@[xX]16/g, "\1n\1y\1" + "4"); // Yellow/brown on blue
text = text.replace(/@[xX]17/g, "\1n\1w\1" + "4"); // White on blue
text = text.replace(/@[xX]18/g, "\1h\1k\1" + "4"); // Bright black on blue
text = text.replace(/@[xX]19/g, "\1h\1b\1" + "4"); // Bright blue on blue
text = text.replace(/@[xX]1[Aa]/g, "\1h\1g\1" + "4"); // Bright green on blue
text = text.replace(/@[xX]1[Bb]/g, "\1h\1c\1" + "4"); // Bright cyan on blue
text = text.replace(/@[xX]1[Cc]/g, "\1h\1r\1" + "4"); // Bright red on blue
text = text.replace(/@[xX]1[Dd]/g, "\1h\1m\1" + "4"); // Bright magenta on blue
text = text.replace(/@[xX]1[Ee]/g, "\1h\1y\1" + "4"); // Bright yellow on blue
text = text.replace(/@[xX]1[Ff]/g, "\1h\1w\1" + "4"); // Bright white on blue
// Green background
text = text.replace(/@[xX]20/g, "\1n\1k\1" + "2"); // Black on green
text = text.replace(/@[xX]21/g, "\1n\1b\1" + "2"); // Blue on green
text = text.replace(/@[xX]22/g, "\1n\1g\1" + "2"); // Green on green
text = text.replace(/@[xX]23/g, "\1n\1c\1" + "2"); // Cyan on green
text = text.replace(/@[xX]24/g, "\1n\1r\1" + "2"); // Red on green
text = text.replace(/@[xX]25/g, "\1n\1m\1" + "2"); // Magenta on green
text = text.replace(/@[xX]26/g, "\1n\1y\1" + "2"); // Yellow/brown on green
text = text.replace(/@[xX]27/g, "\1n\1w\1" + "2"); // White on green
text = text.replace(/@[xX]28/g, "\1h\1k\1" + "2"); // Bright black on green
text = text.replace(/@[xX]29/g, "\1h\1b\1" + "2"); // Bright blue on green
text = text.replace(/@[xX]2[Aa]/g, "\1h\1g\1" + "2"); // Bright green on green
text = text.replace(/@[xX]2[Bb]/g, "\1h\1c\1" + "2"); // Bright cyan on green
text = text.replace(/@[xX]2[Cc]/g, "\1h\1r\1" + "2"); // Bright red on green
text = text.replace(/@[xX]2[Dd]/g, "\1h\1m\1" + "2"); // Bright magenta on green
text = text.replace(/@[xX]2[Ee]/g, "\1h\1y\1" + "2"); // Bright yellow on green
text = text.replace(/@[xX]2[Ff]/g, "\1h\1w\1" + "2"); // Bright white on green
// Cyan background
text = text.replace(/@[xX]30/g, "\1n\1k\1" + "6"); // Black on cyan
text = text.replace(/@[xX]31/g, "\1n\1b\1" + "6"); // Blue on cyan
text = text.replace(/@[xX]32/g, "\1n\1g\1" + "6"); // Green on cyan
text = text.replace(/@[xX]33/g, "\1n\1c\1" + "6"); // Cyan on cyan
text = text.replace(/@[xX]34/g, "\1n\1r\1" + "6"); // Red on cyan
text = text.replace(/@[xX]35/g, "\1n\1m\1" + "6"); // Magenta on cyan
text = text.replace(/@[xX]36/g, "\1n\1y\1" + "6"); // Yellow/brown on cyan
text = text.replace(/@[xX]37/g, "\1n\1w\1" + "6"); // White on cyan
text = text.replace(/@[xX]38/g, "\1h\1k\1" + "6"); // Bright black on cyan
text = text.replace(/@[xX]39/g, "\1h\1b\1" + "6"); // Bright blue on cyan
text = text.replace(/@[xX]3[Aa]/g, "\1h\1g\1" + "6"); // Bright green on cyan
text = text.replace(/@[xX]3[Bb]/g, "\1h\1c\1" + "6"); // Bright cyan on cyan
text = text.replace(/@[xX]3[Cc]/g, "\1h\1r\1" + "6"); // Bright red on cyan
text = text.replace(/@[xX]3[Dd]/g, "\1h\1m\1" + "6"); // Bright magenta on cyan
text = text.replace(/@[xX]3[Ee]/g, "\1h\1y\1" + "6"); // Bright yellow on cyan
text = text.replace(/@[xX]3[Ff]/g, "\1h\1w\1" + "6"); // Bright white on cyan
// Red background
text = text.replace(/@[xX]40/g, "\1n\1k\1" + "1"); // Black on red
text = text.replace(/@[xX]41/g, "\1n\1b\1" + "1"); // Blue on red
text = text.replace(/@[xX]42/g, "\1n\1g\1" + "1"); // Green on red
text = text.replace(/@[xX]43/g, "\1n\1c\1" + "1"); // Cyan on red
text = text.replace(/@[xX]44/g, "\1n\1r\1" + "1"); // Red on red
text = text.replace(/@[xX]45/g, "\1n\1m\1" + "1"); // Magenta on red
text = text.replace(/@[xX]46/g, "\1n\1y\1" + "1"); // Yellow/brown on red
text = text.replace(/@[xX]47/g, "\1n\1w\1" + "1"); // White on red
text = text.replace(/@[xX]48/g, "\1h\1k\1" + "1"); // Bright black on red
text = text.replace(/@[xX]49/g, "\1h\1b\1" + "1"); // Bright blue on red
text = text.replace(/@[xX]4[Aa]/g, "\1h\1g\1" + "1"); // Bright green on red
text = text.replace(/@[xX]4[Bb]/g, "\1h\1c\1" + "1"); // Bright cyan on red
text = text.replace(/@[xX]4[Cc]/g, "\1h\1r\1" + "1"); // Bright red on red
text = text.replace(/@[xX]4[Dd]/g, "\1h\1m\1" + "1"); // Bright magenta on red
text = text.replace(/@[xX]4[Ee]/g, "\1h\1y\1" + "1"); // Bright yellow on red
text = text.replace(/@[xX]4[Ff]/g, "\1h\1w\1" + "1"); // Bright white on red
// Magenta background
text = text.replace(/@[xX]50/g, "\1n\1k\1" + "5"); // Black on magenta
text = text.replace(/@[xX]51/g, "\1n\1b\1" + "5"); // Blue on magenta
text = text.replace(/@[xX]52/g, "\1n\1g\1" + "5"); // Green on magenta
text = text.replace(/@[xX]53/g, "\1n\1c\1" + "5"); // Cyan on magenta
text = text.replace(/@[xX]54/g, "\1n\1r\1" + "5"); // Red on magenta
text = text.replace(/@[xX]55/g, "\1n\1m\1" + "5"); // Magenta on magenta
text = text.replace(/@[xX]56/g, "\1n\1y\1" + "5"); // Yellow/brown on magenta
text = text.replace(/@[xX]57/g, "\1n\1w\1" + "5"); // White on magenta
text = text.replace(/@[xX]58/g, "\1h\1k\1" + "5"); // Bright black on magenta
text = text.replace(/@[xX]59/g, "\1h\1b\1" + "5"); // Bright blue on magenta
text = text.replace(/@[xX]5[Aa]/g, "\1h\1g\1" + "5"); // Bright green on magenta
text = text.replace(/@[xX]5[Bb]/g, "\1h\1c\1" + "5"); // Bright cyan on magenta
text = text.replace(/@[xX]5[Cc]/g, "\1h\1r\1" + "5"); // Bright red on magenta
text = text.replace(/@[xX]5[Dd]/g, "\1h\1m\1" + "5"); // Bright magenta on magenta
text = text.replace(/@[xX]5[Ee]/g, "\1h\1y\1" + "5"); // Bright yellow on magenta
text = text.replace(/@[xX]5[Ff]/g, "\1h\1w\1" + "5"); // Bright white on magenta
// Brown background
text = text.replace(/@[xX]60/g, "\1n\1k\1" + "3"); // Black on brown
text = text.replace(/@[xX]61/g, "\1n\1b\1" + "3"); // Blue on brown
text = text.replace(/@[xX]62/g, "\1n\1g\1" + "3"); // Green on brown
text = text.replace(/@[xX]63/g, "\1n\1c\1" + "3"); // Cyan on brown
text = text.replace(/@[xX]64/g, "\1n\1r\1" + "3"); // Red on brown
text = text.replace(/@[xX]65/g, "\1n\1m\1" + "3"); // Magenta on brown
text = text.replace(/@[xX]66/g, "\1n\1y\1" + "3"); // Yellow/brown on brown
text = text.replace(/@[xX]67/g, "\1n\1w\1" + "3"); // White on brown
text = text.replace(/@[xX]68/g, "\1h\1k\1" + "3"); // Bright black on brown
text = text.replace(/@[xX]69/g, "\1h\1b\1" + "3"); // Bright blue on brown
text = text.replace(/@[xX]6[Aa]/g, "\1h\1g\1" + "3"); // Bright breen on brown
text = text.replace(/@[xX]6[Bb]/g, "\1h\1c\1" + "3"); // Bright cyan on brown
text = text.replace(/@[xX]6[Cc]/g, "\1h\1r\1" + "3"); // Bright red on brown
text = text.replace(/@[xX]6[Dd]/g, "\1h\1m\1" + "3"); // Bright magenta on brown
text = text.replace(/@[xX]6[Ee]/g, "\1h\1y\1" + "3"); // Bright yellow on brown
text = text.replace(/@[xX]6[Ff]/g, "\1h\1w\1" + "3"); // Bright white on brown
// White background
text = text.replace(/@[xX]70/g, "\1n\1k\1" + "7"); // Black on white
text = text.replace(/@[xX]71/g, "\1n\1b\1" + "7"); // Blue on white
text = text.replace(/@[xX]72/g, "\1n\1g\1" + "7"); // Green on white
text = text.replace(/@[xX]73/g, "\1n\1c\1" + "7"); // Cyan on white
text = text.replace(/@[xX]74/g, "\1n\1r\1" + "7"); // Red on white
text = text.replace(/@[xX]75/g, "\1n\1m\1" + "7"); // Magenta on white
text = text.replace(/@[xX]76/g, "\1n\1y\1" + "7"); // Yellow/brown on white
text = text.replace(/@[xX]77/g, "\1n\1w\1" + "7"); // White on white
text = text.replace(/@[xX]78/g, "\1h\1k\1" + "7"); // Bright black on white
text = text.replace(/@[xX]79/g, "\1h\1b\1" + "7"); // Bright blue on white
text = text.replace(/@[xX]7[Aa]/g, "\1h\1g\1" + "7"); // Bright green on white
text = text.replace(/@[xX]7[Bb]/g, "\1h\1c\1" + "7"); // Bright cyan on white
text = text.replace(/@[xX]7[Cc]/g, "\1h\1r\1" + "7"); // Bright red on white
text = text.replace(/@[xX]7[Dd]/g, "\1h\1m\1" + "7"); // Bright magenta on white
text = text.replace(/@[xX]7[Ee]/g, "\1h\1y\1" + "7"); // Bright yellow on white
text = text.replace(/@[xX]7[Ff]/g, "\1h\1w\1" + "7"); // Bright white on white
// Black background, blinking foreground
text = text.replace(/@[xX]80/g, "\1n\1k\1" + "0\1i"); // Blinking black on black
text = text.replace(/@[xX]81/g, "\1n\1b\1" + "0\1i"); // Blinking blue on black
text = text.replace(/@[xX]82/g, "\1n\1g\1" + "0\1i"); // Blinking green on black
text = text.replace(/@[xX]83/g, "\1n\1c\1" + "0\1i"); // Blinking cyan on black
text = text.replace(/@[xX]84/g, "\1n\1r\1" + "0\1i"); // Blinking red on black
text = text.replace(/@[xX]85/g, "\1n\1m\1" + "0\1i"); // Blinking magenta on black
text = text.replace(/@[xX]86/g, "\1n\1y\1" + "0\1i"); // Blinking yellow/brown on black
text = text.replace(/@[xX]87/g, "\1n\1w\1" + "0\1i"); // Blinking white on black
text = text.replace(/@[xX]88/g, "\1h\1k\1" + "0\1i"); // Blinking bright black on black
text = text.replace(/@[xX]89/g, "\1h\1b\1" + "0\1i"); // Blinking bright blue on black
text = text.replace(/@[xX]8[Aa]/g, "\1h\1g\1" + "0\1i"); // Blinking bright green on black
text = text.replace(/@[xX]8[Bb]/g, "\1h\1c\1" + "0\1i"); // Blinking bright cyan on black
text = text.replace(/@[xX]8[Cc]/g, "\1h\1r\1" + "0\1i"); // Blinking bright red on black
text = text.replace(/@[xX]8[Dd]/g, "\1h\1m\1" + "0\1i"); // Blinking bright magenta on black
text = text.replace(/@[xX]8[Ee]/g, "\1h\1y\1" + "0\1i"); // Blinking bright yellow on black
text = text.replace(/@[xX]8[Ff]/g, "\1h\1w\1" + "0\1i"); // Blinking bright white on black
// Blue background, blinking foreground
text = text.replace(/@[xX]90/g, "\1n\1k\1" + "4\1i"); // Blinking black on blue
text = text.replace(/@[xX]91/g, "\1n\1b\1" + "4\1i"); // Blinking blue on blue
text = text.replace(/@[xX]92/g, "\1n\1g\1" + "4\1i"); // Blinking green on blue
text = text.replace(/@[xX]93/g, "\1n\1c\1" + "4\1i"); // Blinking cyan on blue
text = text.replace(/@[xX]94/g, "\1n\1r\1" + "4\1i"); // Blinking red on blue
text = text.replace(/@[xX]95/g, "\1n\1m\1" + "4\1i"); // Blinking magenta on blue
text = text.replace(/@[xX]96/g, "\1n\1y\1" + "4\1i"); // Blinking yellow/brown on blue
text = text.replace(/@[xX]97/g, "\1n\1w\1" + "4\1i"); // Blinking white on blue
text = text.replace(/@[xX]98/g, "\1h\1k\1" + "4\1i"); // Blinking bright black on blue
text = text.replace(/@[xX]99/g, "\1h\1b\1" + "4\1i"); // Blinking bright blue on blue
text = text.replace(/@[xX]9[Aa]/g, "\1h\1g\1" + "4\1i"); // Blinking bright green on blue
text = text.replace(/@[xX]9[Bb]/g, "\1h\1c\1" + "4\1i"); // Blinking bright cyan on blue
text = text.replace(/@[xX]9[Cc]/g, "\1h\1r\1" + "4\1i"); // Blinking bright red on blue
text = text.replace(/@[xX]9[Dd]/g, "\1h\1m\1" + "4\1i"); // Blinking bright magenta on blue
text = text.replace(/@[xX]9[Ee]/g, "\1h\1y\1" + "4\1i"); // Blinking bright yellow on blue
text = text.replace(/@[xX]9[Ff]/g, "\1h\1w\1" + "4\1i"); // Blinking bright white on blue
// Green background, blinking foreground
text = text.replace(/@[xX][Aa]0/g, "\1n\1k\1" + "2\1i"); // Blinking black on green
text = text.replace(/@[xX][Aa]1/g, "\1n\1b\1" + "2\1i"); // Blinking blue on green
text = text.replace(/@[xX][Aa]2/g, "\1n\1g\1" + "2\1i"); // Blinking green on green
text = text.replace(/@[xX][Aa]3/g, "\1n\1c\1" + "2\1i"); // Blinking cyan on green
text = text.replace(/@[xX][Aa]4/g, "\1n\1r\1" + "2\1i"); // Blinking red on green
text = text.replace(/@[xX][Aa]5/g, "\1n\1m\1" + "2\1i"); // Blinking magenta on green
text = text.replace(/@[xX][Aa]6/g, "\1n\1y\1" + "2\1i"); // Blinking yellow/brown on green
text = text.replace(/@[xX][Aa]7/g, "\1n\1w\1" + "2\1i"); // Blinking white on green
text = text.replace(/@[xX][Aa]8/g, "\1h\1k\1" + "2\1i"); // Blinking bright black on green
text = text.replace(/@[xX][Aa]9/g, "\1h\1b\1" + "2\1i"); // Blinking bright blue on green
text = text.replace(/@[xX][Aa][Aa]/g, "\1h\1g\1" + "2\1i"); // Blinking bright green on green
text = text.replace(/@[xX][Aa][Bb]/g, "\1h\1c\1" + "2\1i"); // Blinking bright cyan on green
text = text.replace(/@[xX][Aa][Cc]/g, "\1h\1r\1" + "2\1i"); // Blinking bright red on green
text = text.replace(/@[xX][Aa][Dd]/g, "\1h\1m\1" + "2\1i"); // Blinking bright magenta on green
text = text.replace(/@[xX][Aa][Ee]/g, "\1h\1y\1" + "2\1i"); // Blinking bright yellow on green
text = text.replace(/@[xX][Aa][Ff]/g, "\1h\1w\1" + "2\1i"); // Blinking bright white on green
// Cyan background, blinking foreground
text = text.replace(/@[xX][Bb]0/g, "\1n\1k\1" + "6\1i"); // Blinking black on cyan
text = text.replace(/@[xX][Bb]1/g, "\1n\1b\1" + "6\1i"); // Blinking blue on cyan
text = text.replace(/@[xX][Bb]2/g, "\1n\1g\1" + "6\1i"); // Blinking green on cyan
text = text.replace(/@[xX][Bb]3/g, "\1n\1c\1" + "6\1i"); // Blinking cyan on cyan
text = text.replace(/@[xX][Bb]4/g, "\1n\1r\1" + "6\1i"); // Blinking red on cyan
text = text.replace(/@[xX][Bb]5/g, "\1n\1m\1" + "6\1i"); // Blinking magenta on cyan
text = text.replace(/@[xX][Bb]6/g, "\1n\1y\1" + "6\1i"); // Blinking yellow/brown on cyan
text = text.replace(/@[xX][Bb]7/g, "\1n\1w\1" + "6\1i"); // Blinking white on cyan
text = text.replace(/@[xX][Bb]8/g, "\1h\1k\1" + "6\1i"); // Blinking bright black on cyan
text = text.replace(/@[xX][Bb]9/g, "\1h\1b\1" + "6\1i"); // Blinking bright blue on cyan
text = text.replace(/@[xX][Bb][Aa]/g, "\1h\1g\1" + "6\1i"); // Blinking bright green on cyan
text = text.replace(/@[xX][Bb][Bb]/g, "\1h\1c\1" + "6\1i"); // Blinking bright cyan on cyan
text = text.replace(/@[xX][Bb][Cc]/g, "\1h\1r\1" + "6\1i"); // Blinking bright red on cyan
text = text.replace(/@[xX][Bb][Dd]/g, "\1h\1m\1" + "6\1i"); // Blinking bright magenta on cyan
text = text.replace(/@[xX][Bb][Ee]/g, "\1h\1y\1" + "6\1i"); // Blinking bright yellow on cyan
text = text.replace(/@[xX][Bb][Ff]/g, "\1h\1w\1" + "6\1i"); // Blinking bright white on cyan
// Red background, blinking foreground
text = text.replace(/@[xX][Cc]0/g, "\1n\1k\1" + "1\1i"); // Blinking black on red
text = text.replace(/@[xX][Cc]1/g, "\1n\1b\1" + "1\1i"); // Blinking blue on red
text = text.replace(/@[xX][Cc]2/g, "\1n\1g\1" + "1\1i"); // Blinking green on red
text = text.replace(/@[xX][Cc]3/g, "\1n\1c\1" + "1\1i"); // Blinking cyan on red
text = text.replace(/@[xX][Cc]4/g, "\1n\1r\1" + "1\1i"); // Blinking red on red
text = text.replace(/@[xX][Cc]5/g, "\1n\1m\1" + "1\1i"); // Blinking magenta on red
text = text.replace(/@[xX][Cc]6/g, "\1n\1y\1" + "1\1i"); // Blinking yellow/brown on red
text = text.replace(/@[xX][Cc]7/g, "\1n\1w\1" + "1\1i"); // Blinking white on red
text = text.replace(/@[xX][Cc]8/g, "\1h\1k\1" + "1\1i"); // Blinking bright black on red
text = text.replace(/@[xX][Cc]9/g, "\1h\1b\1" + "1\1i"); // Blinking bright blue on red
text = text.replace(/@[xX][Cc][Aa]/g, "\1h\1g\1" + "1\1i"); // Blinking bright green on red
text = text.replace(/@[xX][Cc][Bb]/g, "\1h\1c\1" + "1\1i"); // Blinking bright cyan on red
text = text.replace(/@[xX][Cc][Cc]/g, "\1h\1r\1" + "1\1i"); // Blinking bright red on red
text = text.replace(/@[xX][Cc][Dd]/g, "\1h\1m\1" + "1\1i"); // Blinking bright magenta on red
text = text.replace(/@[xX][Cc][Ee]/g, "\1h\1y\1" + "1\1i"); // Blinking bright yellow on red
text = text.replace(/@[xX][Cc][Ff]/g, "\1h\1w\1" + "1\1i"); // Blinking bright white on red
// Magenta background, blinking foreground
text = text.replace(/@[xX][Dd]0/g, "\1n\1k\1" + "5\1i"); // Blinking black on magenta
text = text.replace(/@[xX][Dd]1/g, "\1n\1b\1" + "5\1i"); // Blinking blue on magenta
text = text.replace(/@[xX][Dd]2/g, "\1n\1g\1" + "5\1i"); // Blinking green on magenta
text = text.replace(/@[xX][Dd]3/g, "\1n\1c\1" + "5\1i"); // Blinking cyan on magenta
text = text.replace(/@[xX][Dd]4/g, "\1n\1r\1" + "5\1i"); // Blinking red on magenta
text = text.replace(/@[xX][Dd]5/g, "\1n\1m\1" + "5\1i"); // Blinking magenta on magenta
text = text.replace(/@[xX][Dd]6/g, "\1n\1y\1" + "5\1i"); // Blinking yellow/brown on magenta
text = text.replace(/@[xX][Dd]7/g, "\1n\1w\1" + "5\1i"); // Blinking white on magenta
text = text.replace(/@[xX][Dd]8/g, "\1h\1k\1" + "5\1i"); // Blinking bright black on magenta
text = text.replace(/@[xX][Dd]9/g, "\1h\1b\1" + "5\1i"); // Blinking bright blue on magenta
text = text.replace(/@[xX][Dd][Aa]/g, "\1h\1g\1" + "5\1i"); // Blinking bright green on magenta
text = text.replace(/@[xX][Dd][Bb]/g, "\1h\1c\1" + "5\1i"); // Blinking bright cyan on magenta
text = text.replace(/@[xX][Dd][Cc]/g, "\1h\1r\1" + "5\1i"); // Blinking bright red on magenta
text = text.replace(/@[xX][Dd][Dd]/g, "\1h\1m\1" + "5\1i"); // Blinking bright magenta on magenta
text = text.replace(/@[xX][Dd][Ee]/g, "\1h\1y\1" + "5\1i"); // Blinking bright yellow on magenta
text = text.replace(/@[xX][Dd][Ff]/g, "\1h\1w\1" + "5\1i"); // Blinking bright white on magenta
// Brown background, blinking foreground
text = text.replace(/@[xX][Ee]0/g, "\1n\1k\1" + "3\1i"); // Blinking black on brown
text = text.replace(/@[xX][Ee]1/g, "\1n\1b\1" + "3\1i"); // Blinking blue on brown
text = text.replace(/@[xX][Ee]2/g, "\1n\1g\1" + "3\1i"); // Blinking green on brown
text = text.replace(/@[xX][Ee]3/g, "\1n\1c\1" + "3\1i"); // Blinking cyan on brown
text = text.replace(/@[xX][Ee]4/g, "\1n\1r\1" + "3\1i"); // Blinking red on brown
text = text.replace(/@[xX][Ee]5/g, "\1n\1m\1" + "3\1i"); // Blinking magenta on brown
text = text.replace(/@[xX][Ee]6/g, "\1n\1y\1" + "3\1i"); // Blinking yellow/brown on brown
text = text.replace(/@[xX][Ee]7/g, "\1n\1w\1" + "3\1i"); // Blinking white on brown
text = text.replace(/@[xX][Ee]8/g, "\1h\1k\1" + "3\1i"); // Blinking bright black on brown
text = text.replace(/@[xX][Ee]9/g, "\1h\1b\1" + "3\1i"); // Blinking bright blue on brown
text = text.replace(/@[xX][Ee][Aa]/g, "\1h\1g\1" + "3\1i"); // Blinking bright green on brown
text = text.replace(/@[xX][Ee][Bb]/g, "\1h\1c\1" + "3\1i"); // Blinking bright cyan on brown
text = text.replace(/@[xX][Ee][Cc]/g, "\1h\1r\1" + "3\1i"); // Blinking bright red on brown
text = text.replace(/@[xX][Ee][Dd]/g, "\1h\1m\1" + "3\1i"); // Blinking bright magenta on brown
text = text.replace(/@[xX][Ee][Ee]/g, "\1h\1y\1" + "3\1i"); // Blinking bright yellow on brown
text = text.replace(/@[xX][Ee][Ff]/g, "\1h\1w\1" + "3\1i"); // Blinking bright white on brown
// White background, blinking foreground
text = text.replace(/@[xX][Ff]0/g, "\1n\1k\1" + "7\1i"); // Blinking black on white
text = text.replace(/@[xX][Ff]1/g, "\1n\1b\1" + "7\1i"); // Blinking blue on white
text = text.replace(/@[xX][Ff]2/g, "\1n\1g\1" + "7\1i"); // Blinking green on white
text = text.replace(/@[xX][Ff]3/g, "\1n\1c\1" + "7\1i"); // Blinking cyan on white
text = text.replace(/@[xX][Ff]4/g, "\1n\1r\1" + "7\1i"); // Blinking red on white
text = text.replace(/@[xX][Ff]5/g, "\1n\1m\1" + "7\1i"); // Blinking magenta on white
text = text.replace(/@[xX][Ff]6/g, "\1n\1y\1" + "7\1i"); // Blinking yellow/brown on white
text = text.replace(/@[xX][Ff]7/g, "\1n\1w\1" + "7\1i"); // Blinking white on white
text = text.replace(/@[xX][Ff]8/g, "\1h\1k\1" + "7\1i"); // Blinking bright black on white
text = text.replace(/@[xX][Ff]9/g, "\1h\1b\1" + "7\1i"); // Blinking bright blue on white
text = text.replace(/@[xX][Ff][Aa]/g, "\1h\1g\1" + "7\1i"); // Blinking bright green on white
text = text.replace(/@[xX][Ff][Bb]/g, "\1h\1c\1" + "7\1i"); // Blinking bright cyan on white
text = text.replace(/@[xX][Ff][Cc]/g, "\1h\1r\1" + "7\1i"); // Blinking bright red on white
text = text.replace(/@[xX][Ff][Dd]/g, "\1h\1m\1" + "7\1i"); // Blinking bright magenta on white
text = text.replace(/@[xX][Ff][Ee]/g, "\1h\1y\1" + "7\1i"); // Blinking bright yellow on white
text = text.replace(/@[xX][Ff][Ff]/g, "\1h\1w\1" + "7\1i"); // Blinking bright white on white
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
return text;
}
else
return pText; // No PCBoard-style attribute codes found, so just return the text.
}
// Converts Wildcat attribute codes to Synchronet attribute codes.
//
// Parameters:
// pText: A string containing the text to convert
//
// Return value: The text with the color codes converted
function wildcatAttrsToSyncAttrs(pText)
{
// First, see if the text has any Wildcat-style attribute codes at
// all. We'll be performing a bunch of search & replace commands,
// so we don't want to do all that work for nothing.. :)
if (/@[0-9A-Fa-f]{2}@/.test(pText))
{
// Black background
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
var text = pText.replace(/@00@/g, "\1n\1k\1" + "0"); // Black on black
text = text.replace(/@01@/g, "\1n\1b\1" + "0"); // Blue on black
text = text.replace(/@02@/g, "\1n\1g\1" + "0"); // Green on black
text = text.replace(/@03@/g, "\1n\1c\1" + "0"); // Cyan on black
text = text.replace(/@04@/g, "\1n\1r\1" + "0"); // Red on black
text = text.replace(/@05@/g, "\1n\1m\1" + "0"); // Magenta on black
text = text.replace(/@06@/g, "\1n\1y\1" + "0"); // Yellow/brown on black
text = text.replace(/@07@/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@08@/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@09@/g, "\1n\1w\1" + "0"); // White on black
text = text.replace(/@08@/g, "\1h\1k\1" + "0"); // Bright black on black
text = text.replace(/@09@/g, "\1h\1b\1" + "0"); // Bright blue on black
text = text.replace(/@0[Aa]@/g, "\1h\1g\1" + "0"); // Bright green on black
text = text.replace(/@0[Bb]@/g, "\1h\1c\1" + "0"); // Bright cyan on black
text = text.replace(/@0[Cc]@/g, "\1h\1r\1" + "0"); // Bright red on black
text = text.replace(/@0[Dd]@/g, "\1h\1m\1" + "0"); // Bright magenta on black
text = text.replace(/@0[Ee]@/g, "\1h\1y\1" + "0"); // Bright yellow on black
text = text.replace(/@0[Ff]@/g, "\1h\1w\1" + "0"); // Bright white on black
// Blinking foreground
// Blue background
text = text.replace(/@10@/g, "\1n\1k\1" + "4"); // Black on blue
text = text.replace(/@11@/g, "\1n\1b\1" + "4"); // Blue on blue
text = text.replace(/@12@/g, "\1n\1g\1" + "4"); // Green on blue
text = text.replace(/@13@/g, "\1n\1c\1" + "4"); // Cyan on blue
text = text.replace(/@14@/g, "\1n\1r\1" + "4"); // Red on blue
text = text.replace(/@15@/g, "\1n\1m\1" + "4"); // Magenta on blue
text = text.replace(/@16@/g, "\1n\1y\1" + "4"); // Yellow/brown on blue
text = text.replace(/@17@/g, "\1n\1w\1" + "4"); // White on blue
text = text.replace(/@18@/g, "\1h\1k\1" + "4"); // Bright black on blue
text = text.replace(/@19@/g, "\1h\1b\1" + "4"); // Bright blue on blue
text = text.replace(/@1[Aa]@/g, "\1h\1g\1" + "4"); // Bright green on blue
text = text.replace(/@1[Bb]@/g, "\1h\1c\1" + "4"); // Bright cyan on blue
text = text.replace(/@1[Cc]@/g, "\1h\1r\1" + "4"); // Bright red on blue
text = text.replace(/@1[Dd]@/g, "\1h\1m\1" + "4"); // Bright magenta on blue
text = text.replace(/@1[Ee]@/g, "\1h\1y\1" + "4"); // Bright yellow on blue
text = text.replace(/@1[Ff]@/g, "\1h\1w\1" + "4"); // Bright white on blue
// Green background
text = text.replace(/@20@/g, "\1n\1k\1" + "2"); // Black on green
text = text.replace(/@21@/g, "\1n\1b\1" + "2"); // Blue on green
text = text.replace(/@22@/g, "\1n\1g\1" + "2"); // Green on green
text = text.replace(/@23@/g, "\1n\1c\1" + "2"); // Cyan on green
text = text.replace(/@24@/g, "\1n\1r\1" + "2"); // Red on green
text = text.replace(/@25@/g, "\1n\1m\1" + "2"); // Magenta on green
text = text.replace(/@26@/g, "\1n\1y\1" + "2"); // Yellow/brown on green
text = text.replace(/@27@/g, "\1n\1w\1" + "2"); // White on green
text = text.replace(/@28@/g, "\1h\1k\1" + "2"); // Bright black on green
text = text.replace(/@29@/g, "\1h\1b\1" + "2"); // Bright blue on green
text = text.replace(/@2[Aa]@/g, "\1h\1g\1" + "2"); // Bright green on green
text = text.replace(/@2[Bb]@/g, "\1h\1c\1" + "2"); // Bright cyan on green
text = text.replace(/@2[Cc]@/g, "\1h\1r\1" + "2"); // Bright red on green
text = text.replace(/@2[Dd]@/g, "\1h\1m\1" + "2"); // Bright magenta on green
text = text.replace(/@2[Ee]@/g, "\1h\1y\1" + "2"); // Bright yellow on green
text = text.replace(/@2[Ff]@/g, "\1h\1w\1" + "2"); // Bright white on green
// Cyan background
text = text.replace(/@30@/g, "\1n\1k\1" + "6"); // Black on cyan
text = text.replace(/@31@/g, "\1n\1b\1" + "6"); // Blue on cyan
text = text.replace(/@32@/g, "\1n\1g\1" + "6"); // Green on cyan
text = text.replace(/@33@/g, "\1n\1c\1" + "6"); // Cyan on cyan
text = text.replace(/@34@/g, "\1n\1r\1" + "6"); // Red on cyan
text = text.replace(/@35@/g, "\1n\1m\1" + "6"); // Magenta on cyan
text = text.replace(/@36@/g, "\1n\1y\1" + "6"); // Yellow/brown on cyan
text = text.replace(/@37@/g, "\1n\1w\1" + "6"); // White on cyan
text = text.replace(/@38@/g, "\1h\1k\1" + "6"); // Bright black on cyan
text = text.replace(/@39@/g, "\1h\1b\1" + "6"); // Bright blue on cyan
text = text.replace(/@3[Aa]@/g, "\1h\1g\1" + "6"); // Bright green on cyan
text = text.replace(/@3[Bb]@/g, "\1h\1c\1" + "6"); // Bright cyan on cyan
text = text.replace(/@3[Cc]@/g, "\1h\1r\1" + "6"); // Bright red on cyan
text = text.replace(/@3[Dd]@/g, "\1h\1m\1" + "6"); // Bright magenta on cyan
text = text.replace(/@3[Ee]@/g, "\1h\1y\1" + "6"); // Bright yellow on cyan
text = text.replace(/@3[Ff]@/g, "\1h\1w\1" + "6"); // Bright white on cyan
// Red background
text = text.replace(/@40@/g, "\1n\1k\1" + "1"); // Black on red
text = text.replace(/@41@/g, "\1n\1b\1" + "1"); // Blue on red
text = text.replace(/@42@/g, "\1n\1g\1" + "1"); // Green on red
text = text.replace(/@43@/g, "\1n\1c\1" + "1"); // Cyan on red
text = text.replace(/@44@/g, "\1n\1r\1" + "1"); // Red on red
text = text.replace(/@45@/g, "\1n\1m\1" + "1"); // Magenta on red
text = text.replace(/@46@/g, "\1n\1y\1" + "1"); // Yellow/brown on red
text = text.replace(/@47@/g, "\1n\1w\1" + "1"); // White on red
text = text.replace(/@48@/g, "\1h\1k\1" + "1"); // Bright black on red
text = text.replace(/@49@/g, "\1h\1b\1" + "1"); // Bright blue on red
text = text.replace(/@4[Aa]@/g, "\1h\1g\1" + "1"); // Bright green on red
text = text.replace(/@4[Bb]@/g, "\1h\1c\1" + "1"); // Bright cyan on red
text = text.replace(/@4[Cc]@/g, "\1h\1r\1" + "1"); // Bright red on red
text = text.replace(/@4[Dd]@/g, "\1h\1m\1" + "1"); // Bright magenta on red
text = text.replace(/@4[Ee]@/g, "\1h\1y\1" + "1"); // Bright yellow on red
text = text.replace(/@4[Ff]@/g, "\1h\1w\1" + "1"); // Bright white on red
// Magenta background
text = text.replace(/@50@/g, "\1n\1k\1" + "5"); // Black on magenta
text = text.replace(/@51@/g, "\1n\1b\1" + "5"); // Blue on magenta
text = text.replace(/@52@/g, "\1n\1g\1" + "5"); // Green on magenta
text = text.replace(/@53@/g, "\1n\1c\1" + "5"); // Cyan on magenta
text = text.replace(/@54@/g, "\1n\1r\1" + "5"); // Red on magenta
text = text.replace(/@55@/g, "\1n\1m\1" + "5"); // Magenta on magenta
text = text.replace(/@56@/g, "\1n\1y\1" + "5"); // Yellow/brown on magenta
text = text.replace(/@57@/g, "\1n\1w\1" + "5"); // White on magenta
text = text.replace(/@58@/g, "\1h\1k\1" + "5"); // Bright black on magenta
text = text.replace(/@59@/g, "\1h\1b\1" + "5"); // Bright blue on magenta
text = text.replace(/@5[Aa]@/g, "\1h\1g\1" + "5"); // Bright green on magenta
text = text.replace(/@5[Bb]@/g, "\1h\1c\1" + "5"); // Bright cyan on magenta
text = text.replace(/@5[Cc]@/g, "\1h\1r\1" + "5"); // Bright red on magenta
text = text.replace(/@5[Dd]@/g, "\1h\1m\1" + "5"); // Bright magenta on magenta
text = text.replace(/@5[Ee]@/g, "\1h\1y\1" + "5"); // Bright yellow on magenta
text = text.replace(/@5[Ff]@/g, "\1h\1w\1" + "5"); // Bright white on magenta
// Brown background
text = text.replace(/@60@/g, "\1n\1k\1" + "3"); // Black on brown
text = text.replace(/@61@/g, "\1n\1b\1" + "3"); // Blue on brown
text = text.replace(/@62@/g, "\1n\1g\1" + "3"); // Green on brown
text = text.replace(/@63@/g, "\1n\1c\1" + "3"); // Cyan on brown
text = text.replace(/@64@/g, "\1n\1r\1" + "3"); // Red on brown
text = text.replace(/@65@/g, "\1n\1m\1" + "3"); // Magenta on brown
text = text.replace(/@66@/g, "\1n\1y\1" + "3"); // Yellow/brown on brown
text = text.replace(/@67@/g, "\1n\1w\1" + "3"); // White on brown
text = text.replace(/@68@/g, "\1h\1k\1" + "3"); // Bright black on brown
text = text.replace(/@69@/g, "\1h\1b\1" + "3"); // Bright blue on brown
text = text.replace(/@6[Aa]@/g, "\1h\1g\1" + "3"); // Bright breen on brown
text = text.replace(/@6[Bb]@/g, "\1h\1c\1" + "3"); // Bright cyan on brown
text = text.replace(/@6[Cc]@/g, "\1h\1r\1" + "3"); // Bright red on brown
text = text.replace(/@6[Dd]@/g, "\1h\1m\1" + "3"); // Bright magenta on brown
text = text.replace(/@6[Ee]@/g, "\1h\1y\1" + "3"); // Bright yellow on brown
text = text.replace(/@6[Ff]@/g, "\1h\1w\1" + "3"); // Bright white on brown
// White background
text = text.replace(/@70@/g, "\1n\1k\1" + "7"); // Black on white
text = text.replace(/@71@/g, "\1n\1b\1" + "7"); // Blue on white
text = text.replace(/@72@/g, "\1n\1g\1" + "7"); // Green on white
text = text.replace(/@73@/g, "\1n\1c\1" + "7"); // Cyan on white
text = text.replace(/@74@/g, "\1n\1r\1" + "7"); // Red on white
text = text.replace(/@75@/g, "\1n\1m\1" + "7"); // Magenta on white
text = text.replace(/@76@/g, "\1n\1y\1" + "7"); // Yellow/brown on white
text = text.replace(/@77@/g, "\1n\1w\1" + "7"); // White on white
text = text.replace(/@78@/g, "\1h\1k\1" + "7"); // Bright black on white
text = text.replace(/@79@/g, "\1h\1b\1" + "7"); // Bright blue on white
text = text.replace(/@7[Aa]@/g, "\1h\1g\1" + "7"); // Bright green on white
text = text.replace(/@7[Bb]@/g, "\1h\1c\1" + "7"); // Bright cyan on white
text = text.replace(/@7[Cc]@/g, "\1h\1r\1" + "7"); // Bright red on white
text = text.replace(/@7[Dd]@/g, "\1h\1m\1" + "7"); // Bright magenta on white
text = text.replace(/@7[Ee]@/g, "\1h\1y\1" + "7"); // Bright yellow on white
text = text.replace(/@7[Ff]@/g, "\1h\1w\1" + "7"); // Bright white on white
// Black background, blinking foreground
text = text.replace(/@80@/g, "\1n\1k\1" + "0\1i"); // Blinking black on black
text = text.replace(/@81@/g, "\1n\1b\1" + "0\1i"); // Blinking blue on black
text = text.replace(/@82@/g, "\1n\1g\1" + "0\1i"); // Blinking green on black
text = text.replace(/@83@/g, "\1n\1c\1" + "0\1i"); // Blinking cyan on black
text = text.replace(/@84@/g, "\1n\1r\1" + "0\1i"); // Blinking red on black
text = text.replace(/@85@/g, "\1n\1m\1" + "0\1i"); // Blinking magenta on black
text = text.replace(/@86@/g, "\1n\1y\1" + "0\1i"); // Blinking yellow/brown on black
text = text.replace(/@87@/g, "\1n\1w\1" + "0\1i"); // Blinking white on black
text = text.replace(/@88@/g, "\1h\1k\1" + "0\1i"); // Blinking bright black on black
text = text.replace(/@89@/g, "\1h\1b\1" + "0\1i"); // Blinking bright blue on black
text = text.replace(/@8[Aa]@/g, "\1h\1g\1" + "0\1i"); // Blinking bright green on black
text = text.replace(/@8[Bb]@/g, "\1h\1c\1" + "0\1i"); // Blinking bright cyan on black
text = text.replace(/@8[Cc]@/g, "\1h\1r\1" + "0\1i"); // Blinking bright red on black
text = text.replace(/@8[Dd]@/g, "\1h\1m\1" + "0\1i"); // Blinking bright magenta on black
text = text.replace(/@8[Ee]@/g, "\1h\1y\1" + "0\1i"); // Blinking bright yellow on black
text = text.replace(/@8[Ff]@/g, "\1h\1w\1" + "0\1i"); // Blinking bright white on black
// Blue background, blinking foreground
text = text.replace(/@90@/g, "\1n\1k\1" + "4\1i"); // Blinking black on blue
text = text.replace(/@91@/g, "\1n\1b\1" + "4\1i"); // Blinking blue on blue
text = text.replace(/@92@/g, "\1n\1g\1" + "4\1i"); // Blinking green on blue
text = text.replace(/@93@/g, "\1n\1c\1" + "4\1i"); // Blinking cyan on blue
text = text.replace(/@94@/g, "\1n\1r\1" + "4\1i"); // Blinking red on blue
text = text.replace(/@95@/g, "\1n\1m\1" + "4\1i"); // Blinking magenta on blue
text = text.replace(/@96@/g, "\1n\1y\1" + "4\1i"); // Blinking yellow/brown on blue
text = text.replace(/@97@/g, "\1n\1w\1" + "4\1i"); // Blinking white on blue
text = text.replace(/@98@/g, "\1h\1k\1" + "4\1i"); // Blinking bright black on blue
text = text.replace(/@99@/g, "\1h\1b\1" + "4\1i"); // Blinking bright blue on blue
text = text.replace(/@9[Aa]@/g, "\1h\1g\1" + "4\1i"); // Blinking bright green on blue
text = text.replace(/@9[Bb]@/g, "\1h\1c\1" + "4\1i"); // Blinking bright cyan on blue
text = text.replace(/@9[Cc]@/g, "\1h\1r\1" + "4\1i"); // Blinking bright red on blue
text = text.replace(/@9[Dd]@/g, "\1h\1m\1" + "4\1i"); // Blinking bright magenta on blue
text = text.replace(/@9[Ee]@/g, "\1h\1y\1" + "4\1i"); // Blinking bright yellow on blue
text = text.replace(/@9[Ff]@/g, "\1h\1w\1" + "4\1i"); // Blinking bright white on blue
// Green background, blinking foreground
text = text.replace(/@[Aa]0@/g, "\1n\1k\1" + "2\1i"); // Blinking black on green
text = text.replace(/@[Aa]1@/g, "\1n\1b\1" + "2\1i"); // Blinking blue on green
text = text.replace(/@[Aa]2@/g, "\1n\1g\1" + "2\1i"); // Blinking green on green
text = text.replace(/@[Aa]3@/g, "\1n\1c\1" + "2\1i"); // Blinking cyan on green
text = text.replace(/@[Aa]4@/g, "\1n\1r\1" + "2\1i"); // Blinking red on green
text = text.replace(/@[Aa]5@/g, "\1n\1m\1" + "2\1i"); // Blinking magenta on green
text = text.replace(/@[Aa]6@/g, "\1n\1y\1" + "2\1i"); // Blinking yellow/brown on green
text = text.replace(/@[Aa]7@/g, "\1n\1w\1" + "2\1i"); // Blinking white on green
text = text.replace(/@[Aa]8@/g, "\1h\1k\1" + "2\1i"); // Blinking bright black on green
text = text.replace(/@[Aa]9@/g, "\1h\1b\1" + "2\1i"); // Blinking bright blue on green
text = text.replace(/@[Aa][Aa]@/g, "\1h\1g\1" + "2\1i"); // Blinking bright green on green
text = text.replace(/@[Aa][Bb]@/g, "\1h\1c\1" + "2\1i"); // Blinking bright cyan on green
text = text.replace(/@[Aa][Cc]@/g, "\1h\1r\1" + "2\1i"); // Blinking bright red on green
text = text.replace(/@[Aa][Dd]@/g, "\1h\1m\1" + "2\1i"); // Blinking bright magenta on green
text = text.replace(/@[Aa][Ee]@/g, "\1h\1y\1" + "2\1i"); // Blinking bright yellow on green
text = text.replace(/@[Aa][Ff]@/g, "\1h\1w\1" + "2\1i"); // Blinking bright white on green
// Cyan background, blinking foreground
text = text.replace(/@[Bb]0@/g, "\1n\1k\1" + "6\1i"); // Blinking black on cyan
text = text.replace(/@[Bb]1@/g, "\1n\1b\1" + "6\1i"); // Blinking blue on cyan
text = text.replace(/@[Bb]2@/g, "\1n\1g\1" + "6\1i"); // Blinking green on cyan
text = text.replace(/@[Bb]3@/g, "\1n\1c\1" + "6\1i"); // Blinking cyan on cyan
text = text.replace(/@[Bb]4@/g, "\1n\1r\1" + "6\1i"); // Blinking red on cyan
text = text.replace(/@[Bb]5@/g, "\1n\1m\1" + "6\1i"); // Blinking magenta on cyan
text = text.replace(/@[Bb]6@/g, "\1n\1y\1" + "6\1i"); // Blinking yellow/brown on cyan
text = text.replace(/@[Bb]7@/g, "\1n\1w\1" + "6\1i"); // Blinking white on cyan
text = text.replace(/@[Bb]8@/g, "\1h\1k\1" + "6\1i"); // Blinking bright black on cyan
text = text.replace(/@[Bb]9@/g, "\1h\1b\1" + "6\1i"); // Blinking bright blue on cyan
text = text.replace(/@[Bb][Aa]@/g, "\1h\1g\1" + "6\1i"); // Blinking bright green on cyan
text = text.replace(/@[Bb][Bb]@/g, "\1h\1c\1" + "6\1i"); // Blinking bright cyan on cyan
text = text.replace(/@[Bb][Cc]@/g, "\1h\1r\1" + "6\1i"); // Blinking bright red on cyan
text = text.replace(/@[Bb][Dd]@/g, "\1h\1m\1" + "6\1i"); // Blinking bright magenta on cyan
text = text.replace(/@[Bb][Ee]@/g, "\1h\1y\1" + "6\1i"); // Blinking bright yellow on cyan
text = text.replace(/@[Bb][Ff]@/g, "\1h\1w\1" + "6\1i"); // Blinking bright white on cyan
// Red background, blinking foreground
text = text.replace(/@[Cc]0@/g, "\1n\1k\1" + "1\1i"); // Blinking black on red
text = text.replace(/@[Cc]1@/g, "\1n\1b\1" + "1\1i"); // Blinking blue on red
text = text.replace(/@[Cc]2@/g, "\1n\1g\1" + "1\1i"); // Blinking green on red
text = text.replace(/@[Cc]3@/g, "\1n\1c\1" + "1\1i"); // Blinking cyan on red
text = text.replace(/@[Cc]4@/g, "\1n\1r\1" + "1\1i"); // Blinking red on red
text = text.replace(/@[Cc]5@/g, "\1n\1m\1" + "1\1i"); // Blinking magenta on red
text = text.replace(/@[Cc]6@/g, "\1n\1y\1" + "1\1i"); // Blinking yellow/brown on red
text = text.replace(/@[Cc]7@/g, "\1n\1w\1" + "1\1i"); // Blinking white on red
text = text.replace(/@[Cc]8@/g, "\1h\1k\1" + "1\1i"); // Blinking bright black on red
text = text.replace(/@[Cc]9@/g, "\1h\1b\1" + "1\1i"); // Blinking bright blue on red
text = text.replace(/@[Cc][Aa]@/g, "\1h\1g\1" + "1\1i"); // Blinking bright green on red
text = text.replace(/@[Cc][Bb]@/g, "\1h\1c\1" + "1\1i"); // Blinking bright cyan on red
text = text.replace(/@[Cc][Cc]@/g, "\1h\1r\1" + "1\1i"); // Blinking bright red on red
text = text.replace(/@[Cc][Dd]@/g, "\1h\1m\1" + "1\1i"); // Blinking bright magenta on red
text = text.replace(/@[Cc][Ee]@/g, "\1h\1y\1" + "1\1i"); // Blinking bright yellow on red
text = text.replace(/@[Cc][Ff]@/g, "\1h\1w\1" + "1\1i"); // Blinking bright white on red
// Magenta background, blinking foreground
text = text.replace(/@[Dd]0@/g, "\1n\1k\1" + "5\1i"); // Blinking black on magenta
text = text.replace(/@[Dd]1@/g, "\1n\1b\1" + "5\1i"); // Blinking blue on magenta
text = text.replace(/@[Dd]2@/g, "\1n\1g\1" + "5\1i"); // Blinking green on magenta
text = text.replace(/@[Dd]3@/g, "\1n\1c\1" + "5\1i"); // Blinking cyan on magenta
text = text.replace(/@[Dd]4@/g, "\1n\1r\1" + "5\1i"); // Blinking red on magenta
text = text.replace(/@[Dd]5@/g, "\1n\1m\1" + "5\1i"); // Blinking magenta on magenta
text = text.replace(/@[Dd]6@/g, "\1n\1y\1" + "5\1i"); // Blinking yellow/brown on magenta
text = text.replace(/@[Dd]7@/g, "\1n\1w\1" + "5\1i"); // Blinking white on magenta
text = text.replace(/@[Dd]8@/g, "\1h\1k\1" + "5\1i"); // Blinking bright black on magenta
text = text.replace(/@[Dd]9@/g, "\1h\1b\1" + "5\1i"); // Blinking bright blue on magenta
text = text.replace(/@[Dd][Aa]@/g, "\1h\1g\1" + "5\1i"); // Blinking bright green on magenta
text = text.replace(/@[Dd][Bb]@/g, "\1h\1c\1" + "5\1i"); // Blinking bright cyan on magenta
text = text.replace(/@[Dd][Cc]@/g, "\1h\1r\1" + "5\1i"); // Blinking bright red on magenta
text = text.replace(/@[Dd][Dd]@/g, "\1h\1m\1" + "5\1i"); // Blinking bright magenta on magenta
text = text.replace(/@[Dd][Ee]@/g, "\1h\1y\1" + "5\1i"); // Blinking bright yellow on magenta
text = text.replace(/@[Dd][Ff]@/g, "\1h\1w\1" + "5\1i"); // Blinking bright white on magenta
// Brown background, blinking foreground
text = text.replace(/@[Ee]0@/g, "\1n\1k\1" + "3\1i"); // Blinking black on brown
text = text.replace(/@[Ee]1@/g, "\1n\1b\1" + "3\1i"); // Blinking blue on brown
text = text.replace(/@[Ee]2@/g, "\1n\1g\1" + "3\1i"); // Blinking green on brown
text = text.replace(/@[Ee]3@/g, "\1n\1c\1" + "3\1i"); // Blinking cyan on brown
text = text.replace(/@[Ee]4@/g, "\1n\1r\1" + "3\1i"); // Blinking red on brown
text = text.replace(/@[Ee]5@/g, "\1n\1m\1" + "3\1i"); // Blinking magenta on brown
text = text.replace(/@[Ee]6@/g, "\1n\1y\1" + "3\1i"); // Blinking yellow/brown on brown
text = text.replace(/@[Ee]7@/g, "\1n\1w\1" + "3\1i"); // Blinking white on brown
text = text.replace(/@[Ee]8@/g, "\1h\1k\1" + "3\1i"); // Blinking bright black on brown
text = text.replace(/@[Ee]9@/g, "\1h\1b\1" + "3\1i"); // Blinking bright blue on brown
text = text.replace(/@[Ee][Aa]@/g, "\1h\1g\1" + "3\1i"); // Blinking bright green on brown
text = text.replace(/@[Ee][Bb]@/g, "\1h\1c\1" + "3\1i"); // Blinking bright cyan on brown
text = text.replace(/@[Ee][Cc]@/g, "\1h\1r\1" + "3\1i"); // Blinking bright red on brown
text = text.replace(/@[Ee][Dd]@/g, "\1h\1m\1" + "3\1i"); // Blinking bright magenta on brown
text = text.replace(/@[Ee][Ee]@/g, "\1h\1y\1" + "3\1i"); // Blinking bright yellow on brown
text = text.replace(/@[Ee][Ff]@/g, "\1h\1w\1" + "3\1i"); // Blinking bright white on brown
// White background, blinking foreground
text = text.replace(/@[Ff]0@/g, "\1n\1k\1" + "7\1i"); // Blinking black on white
text = text.replace(/@[Ff]1@/g, "\1n\1b\1" + "7\1i"); // Blinking blue on white
text = text.replace(/@[Ff]2@/g, "\1n\1g\1" + "7\1i"); // Blinking green on white
text = text.replace(/@[Ff]3@/g, "\1n\1c\1" + "7\1i"); // Blinking cyan on white
text = text.replace(/@[Ff]4@/g, "\1n\1r\1" + "7\1i"); // Blinking red on white
text = text.replace(/@[Ff]5@/g, "\1n\1m\1" + "7\1i"); // Blinking magenta on white
text = text.replace(/@[Ff]6@/g, "\1n\1y\1" + "7\1i"); // Blinking yellow/brown on white
text = text.replace(/@[Ff]7@/g, "\1n\1w\1" + "7\1i"); // Blinking white on white
text = text.replace(/@[Ff]8@/g, "\1h\1k\1" + "7\1i"); // Blinking bright black on white
text = text.replace(/@[Ff]9@/g, "\1h\1b\1" + "7\1i"); // Blinking bright blue on white
text = text.replace(/@[Ff][Aa]@/g, "\1h\1g\1" + "7\1i"); // Blinking bright green on white
text = text.replace(/@[Ff][Bb]@/g, "\1h\1c\1" + "7\1i"); // Blinking bright cyan on white
text = text.replace(/@[Ff][Cc]@/g, "\1h\1r\1" + "7\1i"); // Blinking bright red on white
text = text.replace(/@[Ff][Dd]@/g, "\1h\1m\1" + "7\1i"); // Blinking bright magenta on white
text = text.replace(/@[Ff][Ee]@/g, "\1h\1y\1" + "7\1i"); // Blinking bright yellow on white
text = text.replace(/@[Ff][Ff]@/g, "\1h\1w\1" + "7\1i"); // Blinking bright white on white
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
return text;
}
else
return pText; // No Wildcat-style attribute codes found, so just return the text.
}
// Converts Celerity attribute codes to Synchronet attribute codes.
//
// Parameters:
// pText: A string containing the text to convert
//
// Return value: The text with the color codes converted
function celerityAttrsToSyncAttrs(pText)
{
// First, see if the text has any Celerity-style attribute codes at
// all. We'll be performing a bunch of search & replace commands,
// so we don't want to do all that work for nothing.. :)
if (/\|[kbgcrmywdBGCRMYWS]/.test(pText))
{
// Using the \|S code (swap foreground & background)
// Blue background
var text = pText.replace(/\|b\|S\|k/g, "\1n\1k\1" + "4"); // Black on blue
text = text.replace(/\|b\|S\|b/g, "\1n\1b\1" + "4"); // Blue on blue
text = text.replace(/\|b\|S\|g/g, "\1n\1g\1" + "4"); // Green on blue
text = text.replace(/\|b\|S\|c/g, "\1n\1c\1" + "4"); // Cyan on blue
text = text.replace(/\|b\|S\|r/g, "\1n\1r\1" + "4"); // Red on blue
text = text.replace(/\|b\|S\|m/g, "\1n\1m\1" + "4"); // Magenta on blue
text = text.replace(/\|b\|S\|y/g, "\1n\1y\1" + "4"); // Yellow/brown on blue
text = text.replace(/\|b\|S\|w/g, "\1n\1w\1" + "4"); // White on blue
text = text.replace(/\|b\|S\|d/g, "\1h\1k\1" + "4"); // Bright black on blue
text = text.replace(/\|b\|S\|B/g, "\1h\1b\1" + "4"); // Bright blue on blue
text = text.replace(/\|b\|S\|G/g, "\1h\1g\1" + "4"); // Bright green on blue
text = text.replace(/\|b\|S\|C/g, "\1h\1c\1" + "4"); // Bright cyan on blue
text = text.replace(/\|b\|S\|R/g, "\1h\1r\1" + "4"); // Bright red on blue
text = text.replace(/\|b\|S\|M/g, "\1h\1m\1" + "4"); // Bright magenta on blue
text = text.replace(/\|b\|S\|Y/g, "\1h\1y\1" + "4"); // Yellow on blue
text = text.replace(/\|b\|S\|W/g, "\1h\1w\1" + "4"); // Bright white on blue
// Green background
text = text.replace(/\|g\|S\|k/g, "\1n\1k\1" + "2"); // Black on green
text = text.replace(/\|g\|S\|b/g, "\1n\1b\1" + "2"); // Blue on green
text = text.replace(/\|g\|S\|g/g, "\1n\1g\1" + "2"); // Green on green
text = text.replace(/\|g\|S\|c/g, "\1n\1c\1" + "2"); // Cyan on green