From d6ce3de75c3f7f553874a806514e478933652236 Mon Sep 17 00:00:00 2001 From: modos189 Date: Wed, 3 Jul 2024 12:02:12 +0000 Subject: [PATCH] deploy: 199c9f7bdc0acb79db3855f9f5cd7c0cd516ec66 --- DataCache.html | 2 +- IITC.comm.declarativeMessageFilter.html | 1286 +++ IITC.comm.html | 5168 ++++++++++++ IITC.filters.FilterLayer.html | 2 +- IITC.filters.html | 2 +- IITC.toolbox.html | 2 +- L.FileListLoader.html | 2 +- L.FileReader.html | 2 +- L.LayerChooser.html | 2 +- L.html | 4 +- MapDataRequest.html | 22 +- Render.html | 2 +- RenderDebugTiles.html | 2 +- code__deprecated.js.html | 2 +- code_app.js.html | 2 +- code_artifact.js.html | 22 +- code_boot.js.html | 2 +- code_chat.js.html | 1613 ++-- code_comm.js.html | 1011 +++ code_comm_declarative_message_filter.js.html | 230 + code_data_cache.js.html | 2 +- code_dialog.js.html | 2 +- code_dialog_about.js.html | 2 +- code_entity_decode.js.html | 2 +- code_entity_info.js.html | 2 +- code_extract_niantic_parameters.js.html | 2 +- code_filters.js.html | 2 +- code_game_status.js.html | 2 +- code_hooks.js.html | 9 +- code_idle.js.html | 2 +- code_layerchooser.js.html | 2 +- code_map.js.html | 2 +- code_map_data_calc_tools.js.html | 2 +- code_map_data_debug.js.html | 2 +- code_map_data_render.js.html | 2 +- code_map_data_request.js.html | 7 +- code_ornaments.js.html | 2 +- code_panes.js.html | 29 +- code_player_names.js.html | 5 +- code_portal_data.js.html | 2 +- code_portal_detail.js.html | 2 +- code_portal_detail_display.js.html | 2 +- code_portal_detail_display_tools.js.html | 2 +- code_portal_highlighter.js.html | 2 +- code_portal_info.js.html | 2 +- code_portal_marker.js.html | 2 +- code_redeeming.js.html | 2 +- code_region_scoreboard.js.html | 2 +- code_request_handling.js.html | 4 +- code_search.js.html | 2 +- code_send_request.js.html | 2 +- code_sidebar.js.html | 2 +- code_smartphone.js.html | 2 +- code_status_bar.js.html | 2 +- code_toolbox.js.html | 2 +- code_utils_file.js.html | 2 +- code_utils_misc.js.html | 14 +- config_options.html | 42 +- global.html | 2 +- index.html | 2 +- ingress_constants.html | 34 +- module-_deprecated.html | 2 +- module-app.html | 2 +- module-boot.html | 2 +- module-chat.html | 5011 ++++++++++++ module-dialog.html | 2 +- module-dialog_about.html | 2 +- module-entity_decode.html | 2 +- module-entity_info.html | 2 +- module-extract_niantic_parameters.html | 2 +- module-game_status.html | 2 +- module-hooks.html | 15 +- module-idle.html | 2 +- module-map.html | 2 +- module-map_data_calc_tools.html | 2 +- module-panes.html | 4 +- module-player_names.html | 2 +- module-portal_data.html | 2 +- module-portal_detail_display.html | 2 +- module-portal_detail_display_tools.html | 2 +- module-portal_highlighter.html | 2 +- module-portal_info.html | 2 +- module-portal_marker.html | 2 +- module-redeeming.html | 2 +- module-region_scoreboard-RegionScore.html | 2 +- module-region_scoreboard.html | 2 +- module-request_handling.html | 4 +- module-send_request.html | 2 +- module-sidebar.html | 2 +- module-smartphone.html | 2 +- module-status_bar.html | 2 +- module-utils_file.html | 2 +- module-utils_misc.html | 2 +- other_constants.html | 34 +- player.html | 2 +- storage_variables.html | 20 +- total-conversion-build.js.html | 29 +- window.artifact.html | 175 +- window.chat.html | 7519 ------------------ window.decodeArray.html | 2 +- window.ornaments.html | 2 +- window.portalDetail.html | 2 +- window.requests.html | 6 +- window.search.Query.html | 2 +- window.search.html | 2 +- 105 files changed, 13623 insertions(+), 8852 deletions(-) create mode 100644 IITC.comm.declarativeMessageFilter.html create mode 100644 IITC.comm.html create mode 100644 code_comm.js.html create mode 100644 code_comm_declarative_message_filter.js.html create mode 100644 module-chat.html delete mode 100644 window.chat.html diff --git a/DataCache.html b/DataCache.html index 59da15e4b..5b9b929e0 100644 --- a/DataCache.html +++ b/DataCache.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/IITC.comm.declarativeMessageFilter.html b/IITC.comm.declarativeMessageFilter.html new file mode 100644 index 000000000..3d5538470 --- /dev/null +++ b/IITC.comm.declarativeMessageFilter.html @@ -0,0 +1,1286 @@ + + + + + Namespace: declarativeMessageFilter | IITC-CE + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ +

+ .comm.declarativeMessageFilter

+ + +
+ +
+ +
+ + +

Declarative message filter for COMM API

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + +

Methods

+ +
+ + +
+ +

+ + static addRule(id, rule) + + + + +

+ + + +
+
+ + +
+

Adds a new filtering rule with a given ID.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

The ID of the rule to add.

rule + + +Object + + + +

The rule to add.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
Examples
+ +
// Hide all messages from Resistance team
+IITC.comm.declarativeMessageFilter.addRule({
+  id: "hideResistanceTeam1",
+  conditions: [
+    { field: "player.team", value: "Resistance" },
+  ]
+});
+ +
// Hide all messages except those from the Resistance team using the inverted rule
+IITC.comm.declarativeMessageFilter.addRule({
+  id: "hideExceptResistanceTeam",
+  conditions: [
+    { field: "player.team", value: "Resistance", invert: true },
+  ]
+});
+ +
// Hide messages that look like spam
+IITC.comm.declarativeMessageFilter.addRule({
+  id: "hideSpam",
+  conditions: [
+    { field: "markup[4][1].plain", condition: /ingress-(shop|store)|(store|shop)-ingress/i },
+  ]
+});
+ + + +
+ + + + +
+ +

+ + static filterMessage(message) → {boolean} + + + + +

+ + + +
+
+ + +
+

Checks if a message matches any of the current filtering rules.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
message + + +Object + + + +

The message to check.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +boolean + + + + + +-

True if the message matches any rule, false otherwise.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static getAllRules() → {Object} + + + + +

+ + + +
+
+ + +
+

Gets all current filtering rules.

+
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + + + +Object + + + + + +-

The current set of filtering rules.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static getMessageValueByPath(object, path) → {*} + + + + +

+ + + +
+
+ + +
+

Extracts the value from the message object by a given path.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
object + + +Object + + + +

The message object.

path + + +String + + + +

Path to the property in dot notation.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +* + + + + + +-

The value of the property at the specified path or undefined if the path is not valid.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static getRuleById(id) → {Object|null} + + + + +

+ + + +
+
+ + +
+

Gets a rule by its ID.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

The ID of the rule to get.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +Object +| + +null + + + + + +-

The rule object, or null if not found.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static matchesRule(message, rule) → {boolean} + + + + +

+ + + +
+
+ + +
+

Checks if the message matches a single rule.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
message + + +Object + + + +

The message to check.

rule + + +Object + + + +

The rule to match against.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +boolean + + + + + +-

True if the message matches the rule, false otherwise.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static removeRule(id) + + + + +

+ + + +
+
+ + +
+

Removes a filtering rule by its ID.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

The ID of the rule to remove.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ + + + + +
+ +
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/IITC.comm.html b/IITC.comm.html new file mode 100644 index 000000000..b6cc291c7 --- /dev/null +++ b/IITC.comm.html @@ -0,0 +1,5168 @@ + + + + + Namespace: comm | IITC-CE + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ +

comm

+ + +
+ +
+ +
+ + +

Namespace for comm-related functionalities.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + +

Namespaces

+ + +
+ +
+

+ declarativeMessageFilter + +

+
+ + +
+ + + + +

Members

+ +
+ + +
+

+ static _channels :Array.<chat.ChannelDescription> + + + +

+ + +
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static _channelsData :Object + + + +

+ + +
+
+ +
+

Holds data related to each intel channel.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static dividerTemplate :String + + + +

+ + +
+
+ +
+

Template for message divider.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static, constant messageTransformFunctions + + + +

+ + +
+
+ +
+

List of transformations to be applied to the message data. +Each transformation function takes the full message data object and returns the transformed markup. +The default transformations aim to convert the message markup into an older, more straightforward format, +facilitating easier understanding and backward compatibility with plugins expecting the older message format.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Example
+ +
// Adding a new transformation function to the array
+// This new function adds a "new" prefix to the player's plain text if the player is from the RESISTANCE team
+messageTransformFunctions.push((data) => {
+  const markup = data.markup;
+  if (markup.length > 2 && markup[0][0] === 'PLAYER' && markup[0][1].team === 'RESISTANCE') {
+    markup[1][1].plain = 'new ' + markup[1][1].plain;
+  }
+  return markup;
+});
+ + +
+ + + + +
+

+ static msgCellTemplate :String + + + +

+ + +
+
+ +
+

Template for chat message text cell.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static msgRowTemplate :String + + + +

+ + +
+
+ +
+

Template for message row, includes cells for time, player nickname and message text.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static nickCellTemplate :String + + + +

+ + +
+
+ +
+

Template for player's nickname cell.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static, constant portalNameTransformations + + + +

+ + +
+
+ +
+

List of transformations for portal names used in chat. +Each transformation function takes the portal markup object and returns a transformed name. +If a transformation does not apply, the original name is returned.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Example
+ +
// Adding a transformation that appends the portal location to its name
+portalNameTransformations.push((markup) => {
+  const latlng = `${markup.latE6 / 1E6},${markup.lngE6 / 1E6}`; // Convert E6 format to decimal
+  return `[${latlng}] ${markup.name}`;
+});
+ + +
+ + + + +
+

+ static portalTemplate :String + + + +

+ + +
+
+ +
+

Template of portal link in comm.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+

+ static timeCellTemplate :String + + + +

+ + +
+
+ +
+

Template for time cell.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+ + + +

Methods

+ +
+ + +
+ +

+ + private, static _genPostData(channel, getOlderMsgs, args) → {Object} + + + + +

+ + + +
+
+ + +
+

Generates post data for chat requests.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channel + + +string + + + +

The chat channel.

getOlderMsgs + + +boolean + + + +

Flag to determine if older messages are being requested.

args + +

Used for backward compatibility when calling a function with three arguments.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +Object + + + + + +-

The generated post data.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + private, static _handleChannel(channel, data, olderMsgs, ascendingTimestampOrder) + + + + +

+ + + +
+
+ + +
+

Handles faction chat response.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channel + + +string + + + +

Comm Intel channel (all/faction/alerts)

data + + +Object + + + +

Response data from server.

olderMsgs + + +boolean + + + +

Indicates if older messages were requested.

ascendingTimestampOrder + + +boolean + + + +

Indicates if messages are in ascending timestamp order.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + private, static _initChannelData(id) + + + + +

+ + + +
+
+ + +
+

Initialize the channel data.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +chat.ChannelDescription + + + +

The channel id.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + private, static _updateOldNewHash(newData, storageHash, isOlderMsgs, isAscendingOrder) + + + + +

+ + + +
+
+ + +
+

Updates the oldest and newest message timestamps and GUIDs in the chat storage.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
newData + + +Object + + + +

The new chat data received.

storageHash + + +Object + + + +

The chat storage object.

isOlderMsgs + + +boolean + + + +

Whether the new data contains older messages.

isAscendingOrder + + +boolean + + + +

Whether the new data is in ascending order.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + private, static _writeDataToHash(newData, storageHash, isOlderMsgs, isAscendingOrder) + + + + +

+ + + +
+
+ + +
+

Writes new chat data to the chat storage and manages the order of messages.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
newData + + +Object + + + +

The new chat data received.

storageHash + + +Object + + + +

The chat storage object.

isOlderMsgs + + +boolean + + + +

Whether the new data contains older messages.

isAscendingOrder + + +boolean + + + +

Whether the new data is in ascending order.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static getChatPortalName(markup) → {string} + + + + +

+ + + +
+
+ + +
+

Overrides portal names used repeatedly in chat, such as 'US Post Office', with more specific names. +Applies a series of transformations to the portal name based on the portal markup.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
markup + + +Object + + + +

An object containing portal markup, including the name and address.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The processed portal name.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static getLatLngForSendingMessage() → {L.LatLng} + + + + +

+ + + +
+
+ + +
+

Returns the coordinates for the message to be sent, default is the center of the map.

+
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + + + +L.LatLng + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static parseMsgData(data) → {Object} + + + + +

+ + + +
+
+ + +
+

Parses comm message data into a more convenient format.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Object + + + +

The raw comm message data.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +Object + + + + + +-

The parsed comm message data.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderChannel(channel, oldMsgsWereAdded) + + + + +

+ + + +
+
+ + +
+

Renders intel chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channel + + +string + + + +

Comm Intel channel (all/faction/alerts)

oldMsgsWereAdded + + +boolean + + + +

Indicates if old messages were added in the current rendering.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderData(data, element, likelyWereOldMsgs, sortedGuids) + + + + +

+ + + +
+
+ + +
+

Renders data from the data-hash to the element defined by the given ID.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Object + + + +

Chat data to be rendered.

element + + +string + + + +

ID of the DOM element to render the chat into.

likelyWereOldMsgs + + +boolean + + + +

Flag indicating if older messages are likely to have been added.

sortedGuids + + +Array + + + +

Sorted array of GUIDs representing the order of messages.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderDivider(text) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a divider row in the chat table.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + + +string + + + +

Text to display within the divider row.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a divider row in the chat table.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderFactionEnt(faction) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a faction entity for use in the chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
faction + + +Object + + + +

The faction data.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

HTML string representing the faction.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderMarkup(markup) → {string} + + + + +

+ + + +
+
+ + +
+

Renders the markup of a chat message, converting special entities like player names, portals, etc., into HTML.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
markup + + +Array + + + +

The markup array of a chat message.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing the complete rendered chat message.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderMarkupEntity(ent) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a chat message entity based on its type.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
ent + + +Array + + + +

The entity array, where the first element is the type and the second element is the data.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing the chat message entity.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderMsgCell(msg, classNames) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a cell in the chat table for a chat message. +The message is inserted as inner HTML of the table cell.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
msg + + +string + + + +

The chat message to be displayed.

classNames + + +string + + + +

Additional class names to be added to the message cell.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a table cell with the chat message.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderMsgRow(data) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a row for a chat message including time, nickname, and message cells.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Object + + + +

The data for the message, including time, player, and message content.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a row in the chat table.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderNickCell(nick, classNames) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a cell in the chat table for a player's nickname. +Wraps the nickname in HTML element for highlighting.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nick + + +string + + + +

The nickname of the player.

classNames + + +string + + + +

Additional class names to be added to the nickname cell.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a table cell with the player's nickname.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderPlayer(player, at, sender) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a player's nickname in chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
player + + +Object + + + +

The player object containing nickname and team.

at + + +boolean + + + +

Whether to prepend '@' to the nickname.

sender + + +boolean + + + +

Whether the player is the sender of a message.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing the player's nickname in chat.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderPortal(portal) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a portal link for use in the chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
portal + + +Object + + + +

The portal data.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

HTML string of the portal link.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderText(text) → {string} + + + + +

+ + + +
+
+ + +
+

Renders text for the chat, converting plain text to HTML and adding links.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + + +Object + + + +

An object containing the plain text to render.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The rendered HTML string.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static renderTimeCell(unixtime, classNames) → {string} + + + + +

+ + + +
+
+ + +
+

Renders a cell in the chat table to display the time a message was sent. +Formats the time and adds it to a

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
unixtime + + +number + + + +

The timestamp of the message.

classNames + + +string + + + +

Additional class names to be added to the time cell.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a table cell with the formatted time.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static requestChannel(channel, getOlderMsgs, isRetryopt) + + + + +

+ + + +
+
+ + +
+

Requests chat messages.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
channel + + +string + + + + + + + + + + + +

Comm Intel channel (all/faction/alerts)

getOlderMsgs + + +boolean + + + + + + + + + + + +

Flag to determine if older messages are being requested.

isRetry + + +boolean + + + + + + <optional>
+ + + + + +
+ + false + +

Flag to indicate if this is a retry attempt.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static sendChatMessage(tab, msg) + + + + +

+ + + +
+
+ + +
+

Posts a chat message to intel comm context.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tab + + +string + + + +

intel tab name (either all or faction)

msg + + +string + + + +

message to be sent

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + static transformMessage(data) → {Object} + + + + +

+ + + +
+
+ + +
+

Applies transformations to the markup array based on the transformations defined in +the IITC.comm.messageTransformFunctions array. +Assumes all transformations return a new markup array. +May be used to build an entirely new markup to be rendered without altering the original one.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Object + + + +

The data for the message, including time, player, and message content.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +Object + + + + + +-

The transformed markup array.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ + + + + +
+ +
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/IITC.filters.FilterLayer.html b/IITC.filters.FilterLayer.html index 894a5a1c9..0c74e51ff 100644 --- a/IITC.filters.FilterLayer.html +++ b/IITC.filters.FilterLayer.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/IITC.filters.html b/IITC.filters.html index 3ff283d13..e99172817 100644 --- a/IITC.filters.html +++ b/IITC.filters.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/IITC.toolbox.html b/IITC.toolbox.html index 0e9a81f90..e4b31439e 100644 --- a/IITC.toolbox.html +++ b/IITC.toolbox.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/L.FileListLoader.html b/L.FileListLoader.html index b8bdc9287..3a94efae5 100644 --- a/L.FileListLoader.html +++ b/L.FileListLoader.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/L.FileReader.html b/L.FileReader.html index 5e6937c9f..af1d72d45 100644 --- a/L.FileReader.html +++ b/L.FileReader.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/L.LayerChooser.html b/L.LayerChooser.html index 2a1665ae3..bad83e278 100644 --- a/L.LayerChooser.html +++ b/L.LayerChooser.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/L.html b/L.html index 9dd6869c5..d9609ed05 100644 --- a/L.html +++ b/L.html @@ -34,7 +34,7 @@

IITC-CE

- +
@@ -68,7 +68,7 @@

diff --git a/MapDataRequest.html b/MapDataRequest.html index b4e745be9..6f5d1c3f9 100644 --- a/MapDataRequest.html +++ b/MapDataRequest.html @@ -34,7 +34,7 @@

IITC-CE

- +
@@ -267,7 +267,7 @@

@@ -516,7 +516,7 @@

@@ -969,7 +969,7 @@

@@ -1108,7 +1108,7 @@

@@ -1199,7 +1199,7 @@

@@ -1289,7 +1289,7 @@

@@ -1703,7 +1703,7 @@

@@ -1866,7 +1866,7 @@

@@ -1955,7 +1955,7 @@

@@ -2369,7 +2369,7 @@

diff --git a/Render.html b/Render.html index fcfe78424..86c027856 100644 --- a/Render.html +++ b/Render.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/RenderDebugTiles.html b/RenderDebugTiles.html index 78b3dac21..60cb83f82 100644 --- a/RenderDebugTiles.html +++ b/RenderDebugTiles.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/code__deprecated.js.html b/code__deprecated.js.html index 6705cc71b..ade0326a6 100644 --- a/code__deprecated.js.html +++ b/code__deprecated.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_app.js.html b/code_app.js.html index dc3400e8b..a722bc75d 100644 --- a/code_app.js.html +++ b/code_app.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_artifact.js.html b/code_artifact.js.html index 6e443d928..97148ac9a 100644 --- a/code_artifact.js.html +++ b/code_artifact.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -93,6 +93,8 @@

IITC-CE

title: 'Show artifact portal list', action: window.artifact.showArtifactList, }); + + window.addHook('mapDataEntityInject', window.artifact.entityInject); } /** @@ -251,12 +253,22 @@

IITC-CE

/** * Used to render portals that would otherwise be below the visible level. * @function window.artifact.getArtifactEntities - * @returns {Array} An array of artifact entities. + * @returns {Array} array of Portal entities with shards or shard targets + * + * unused by IITC */ -window.artifact.getArtifactEntities = function() { +window.artifact.getArtifactEntities = function () { return artifact.entities; } +/** + * Inject artifact portals into render process + * @param {hookdata} data + */ +window.artifact.entityInject = function (data) { + data.callback(window.artifact.entities, 'summary'); +}; + /** * Gets the portals that are relevant to the artifacts. * @function window.artifact.getInterestingPortals @@ -282,8 +294,10 @@

IITC-CE

* @param {string} guid - The GUID of the portal. * @param {string} artifactId - The ID of the artifact type. * @returns {Object|false} Artifact data for the specified portal and type, or undefined if not available. + * + * unused by IITC */ -window.artifact.getPortalData = function(guid,artifactId) { +window.artifact.getPortalData = function (guid, artifactId) { return artifact.portalInfo[guid] && artifact.portalInfo[guid][artifactId]; } diff --git a/code_boot.js.html b/code_boot.js.html index 32fdb9207..1bc425bb3 100644 --- a/code_boot.js.html +++ b/code_boot.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_chat.js.html b/code_chat.js.html index 7b9d2fe4f..ec289c16f 100644 --- a/code_chat.js.html +++ b/code_chat.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -50,398 +50,83 @@

IITC-CE

/**
  * @file Namespace for chat-related functionalities.
- * @namespace window.chat
- */
-
-window.chat = function () {};
-var chat = window.chat;
-
-/**
- * Handles tab completion in chat input.
  *
- * @function window.chat.handleTabCompletion
- */
-window.chat.handleTabCompletion = function() {
-  var el = $('#chatinput input');
-  var curPos = el.get(0).selectionStart;
-  var text = el.val();
-  var word = text.slice(0, curPos).replace(/.*\b([a-z0-9-_])/, '$1').toLowerCase();
-
-  var list = $('#chat > div:visible mark');
-  list = list.map(function(ind, mark) { return $(mark).text(); } );
-  list = uniqueArray(list);
-
-  var nick = null;
-  for(var i = 0; i < list.length; i++) {
-    if(!list[i].toLowerCase().startsWith(word)) continue;
-    if(nick && nick !== list[i]) {
-      log.warn('More than one nick matches, aborting. ('+list[i]+' vs '+nick+')');
-      return;
-    }
-    nick = list[i];
-  }
-  if(!nick) {
-    return;
-  }
-
-  var posStart = curPos - word.length;
-  var newText = text.substring(0, posStart);
-  var atPresent = text.substring(posStart-1, posStart) === '@';
-  newText += (atPresent ? '' : '@') + nick + ' ';
-  newText += text.substring(curPos);
-  el.val(newText);
+ * @module chat
+ */
+var chat = function () {};
+window.chat = chat;
+
+// List of functions to track for synchronization between chat and comm
+const legacyFunctions = [
+  'genPostData',
+  'updateOldNewHash',
+  'parseMsgData',
+  'writeDataToHash',
+  'renderText',
+  'getChatPortalName',
+  'renderPortal',
+  'renderFactionEnt',
+  'renderPlayer',
+  'renderMarkupEntity',
+  'renderMarkup',
+  'renderTimeCell',
+  'renderNickCell',
+  'renderMsgCell',
+  'renderMsgRow',
+  'renderDivider',
+  'renderData',
+];
+const newCommApi = [
+  '_genPostData',
+  '_updateOldNewHash',
+  'parseMsgData',
+  '_writeDataToHash',
+  'renderText',
+  'getChatPortalName',
+  'renderPortal',
+  'renderFactionEnt',
+  'renderPlayer',
+  'renderMarkupEntity',
+  'renderMarkup',
+  'renderTimeCell',
+  'renderNickCell',
+  'renderMsgCell',
+  'renderMsgRow',
+  'renderDivider',
+  'renderData',
+];
+
+// Function to map legacy function names to their new names in comm
+function mapLegacyFunctionNameToCommApi(functionName) {
+  const index = legacyFunctions.indexOf(functionName);
+  return index !== -1 ? newCommApi[index] : functionName;
 }
 
-//
-// clear management
-//
-
-
-window.chat._oldBBox = null;
-
-/**
- * Generates post data for chat requests.
- *
- * @function window.chat.genPostData
- * @param {string} channel - The chat channel.
- * @param {Object} storageHash - Storage hash for the chat.
- * @param {boolean} getOlderMsgs - Flag to determine if older messages are being requested.
- * @returns {Object} The generated post data.
- */
-window.chat.genPostData = function(channel, storageHash, getOlderMsgs) {
-  if (typeof channel !== 'string') {
-    throw new Error('API changed: isFaction flag now a channel string - all, faction, alerts');
-  }
-
-  var b = clampLatLngBounds(map.getBounds());
-
-  // set a current bounding box if none set so far
-  if (!chat._oldBBox) chat._oldBBox = b;
-
-  // to avoid unnecessary chat refreshes, a small difference compared to the previous bounding box
-  // is not considered different
-  var CHAT_BOUNDINGBOX_SAME_FACTOR = 0.1;
-  // if the old and new box contain each other, after expanding by the factor, don't reset chat
-  if (!(b.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(chat._oldBBox) && chat._oldBBox.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(b))) {
-    log.log('Bounding Box changed, chat will be cleared (old: '+chat._oldBBox.toBBoxString()+'; new: '+b.toBBoxString()+')');
-
-    $('#chat > div').data('needsClearing', true);
-
-    // need to reset these flags now because clearing will only occur
-    // after the request is finished – i.e. there would be one almost
-    // useless request.
-    chat._faction.data = {};
-    chat._faction.guids = [];
-    chat._faction.oldestTimestamp = -1;
-    chat._faction.newestTimestamp = -1;
-    delete chat._faction.oldestGUID;
-    delete chat._faction.newestGUID;
-
-    chat._public.data = {};
-    chat._public.guids = [];
-    chat._public.oldestTimestamp = -1;
-    chat._public.newestTimestamp = -1;
-    delete chat._public.oldestGUID;
-    delete chat._public.newestGUID;
-
-    chat._alerts.data = {};
-    chat._alerts.guids = [];
-    chat._alerts.oldestTimestamp = -1;
-    chat._alerts.newestTimestamp = -1;
-    delete chat._alerts.oldestGUID;
-    delete chat._alerts.newestGUID;
-
-    chat._oldBBox = b;
-  }
-
-  var ne = b.getNorthEast();
-  var sw = b.getSouthWest();
-  var data = {
-    minLatE6: Math.round(sw.lat*1E6),
-    minLngE6: Math.round(sw.lng*1E6),
-    maxLatE6: Math.round(ne.lat*1E6),
-    maxLngE6: Math.round(ne.lng*1E6),
-    minTimestampMs: -1,
-    maxTimestampMs: -1,
-    tab: channel,
-  };
-
-  if (getOlderMsgs) {
-    // ask for older chat when scrolling up
-    data = $.extend(data, {
-      maxTimestampMs: storageHash.oldestTimestamp,
-      plextContinuationGuid: storageHash.oldestGUID
-    });
-  } else {
-    // ask for newer chat
-    var min = storageHash.newestTimestamp;
-    // the initial request will have both timestamp values set to -1,
-    // thus we receive the newest 50. After that, we will only receive
-    // messages with a timestamp greater or equal to min above.
-    // After resuming from idle, there might be more new messages than
-    // desiredNumItems. So on the first request, we are not really up to
-    // date. We will eventually catch up, as long as there are less new
-    // messages than 50 per each refresh cycle.
-    // A proper solution would be to query until no more new results are
-    // returned.
-    // Currently this edge case is not handled. Let’s see if this is a
-    // problem in crowded areas.
-    $.extend(data, {
-      minTimestampMs: min,
-      plextContinuationGuid: storageHash.newestGUID
-    });
-    // when requesting with an actual minimum timestamp, request oldest rather than newest first.
-    // this matches the stock intel site, and ensures no gaps when continuing after an extended idle period
-    if (min > -1) $.extend(data, {ascendingTimestampOrder: true});
-  }
-  return data;
-};
-
-
-
-//
-// faction
-//
-
-window.chat._requestFactionRunning = false;
-
-/**
- * Requests faction chat messages.
- *
- * @function window.chat.requestFaction
- * @param {boolean} getOlderMsgs - Flag to determine if older messages are being requested.
- * @param {boolean} [isRetry=false] - Flag to indicate if this is a retry attempt.
- */
-window.chat.requestFaction = function(getOlderMsgs, isRetry) {
-  if(chat._requestFactionRunning && !isRetry) return;
-  if(isIdle()) return renderUpdateStatus();
-  chat._requestFactionRunning = true;
-  $("#chatcontrols a:contains('faction')").addClass('loading');
-
-  var d = chat.genPostData('faction', chat._faction, getOlderMsgs);
-  var r = window.postAjax(
-    'getPlexts',
-    d,
-    function(data, textStatus, jqXHR) { chat.handleFaction(data, getOlderMsgs, d.ascendingTimestampOrder); },
-    isRetry
-      ? function() { window.chat._requestFactionRunning = false; }
-      : function() { window.chat.requestFaction(getOlderMsgs, true) }
-  );
-}
-
-/**
- * Holds data related to faction chat.
- *
- * @memberof window.chat
- * @type {Object}
- */
-window.chat._faction = {data:{}, guids: [], oldestTimestamp:-1, newestTimestamp:-1};
-
-/**
- * Handles faction chat response.
- *
- * @function window.chat.handleFaction
- * @param {Object} data - Response data from server.
- * @param {boolean} olderMsgs - Indicates if older messages were requested.
- * @param {boolean} ascendingTimestampOrder - Indicates if messages are in ascending timestamp order.
- */
-window.chat.handleFaction = function(data, olderMsgs, ascendingTimestampOrder) {
-  chat._requestFactionRunning = false;
-  $("#chatcontrols a:contains('faction')").removeClass('loading');
-
-  if(!data || !data.result) {
-    window.failedRequestCount++;
-    return log.warn('faction chat error. Waiting for next auto-refresh.');
-  }
-
-  if (!data.result.length && !$('#chatfaction').data('needsClearing')) {
-    // no new data and current data in chat._faction.data is already rendered
-    return;
-  }
-
-  $('#chatfaction').data('needsClearing', null);
-
-  var old = chat._faction.oldestGUID;
-  chat.writeDataToHash(data, chat._faction, olderMsgs, ascendingTimestampOrder);
-  var oldMsgsWereAdded = old !== chat._faction.oldestGUID;
-
-  runHooks('factionChatDataAvailable', {raw: data, result: data.result, processed: chat._faction.data});
-
-  window.chat.renderFaction(oldMsgsWereAdded);
-}
-
-/**
- * Renders faction chat.
- *
- * @function window.chat.renderFaction
- * @param {boolean} oldMsgsWereAdded - Indicates if old messages were added in the current rendering.
- */
-window.chat.renderFaction = function(oldMsgsWereAdded) {
-  chat.renderData(chat._faction.data, 'chatfaction', oldMsgsWereAdded, chat._faction.guids);
-}
-
-
-//
-// all
-//
-
-window.chat._requestPublicRunning = false;
-
-/**
- * Initiates a request for public chat data.
- *
- * @function window.chat.requestPublic
- * @param {boolean} getOlderMsgs - Whether to retrieve older messages.
- * @param {boolean} [isRetry=false] - Whether the request is a retry.
- */
-window.chat.requestPublic = function(getOlderMsgs, isRetry) {
-  if(chat._requestPublicRunning && !isRetry) return;
-  if(isIdle()) return renderUpdateStatus();
-  chat._requestPublicRunning = true;
-  $("#chatcontrols a:contains('all')").addClass('loading');
-
-  var d = chat.genPostData('all', chat._public, getOlderMsgs);
-  var r = window.postAjax(
-    'getPlexts',
-    d,
-    function(data, textStatus, jqXHR) { chat.handlePublic(data, getOlderMsgs, d.ascendingTimestampOrder); },
-    isRetry
-      ? function() { window.chat._requestPublicRunning = false; }
-      : function() { window.chat.requestPublic(getOlderMsgs, true) }
-  );
-}
-
-/**
- * Holds data related to public chat.
- *
- * @memberof window.chat
- * @type {Object}
- */
-window.chat._public = {data:{}, guids: [], oldestTimestamp:-1, newestTimestamp:-1};
-
-/**
- * Handles the public chat data received from the server.
- *
- * @function window.chat.handlePublic
- * @param {Object} data - The public chat data.
- * @param {boolean} olderMsgs - Whether the received messages are older.
- * @param {boolean} ascendingTimestampOrder - Whether messages are in ascending timestamp order.
- */
-window.chat.handlePublic = function(data, olderMsgs, ascendingTimestampOrder) {
-  chat._requestPublicRunning = false;
-  $("#chatcontrols a:contains('all')").removeClass('loading');
-
-  if(!data || !data.result) {
-    window.failedRequestCount++;
-    return log.warn('public chat error. Waiting for next auto-refresh.');
-  }
-
-  if (!data.result.length && !$('#chatall').data('needsClearing')) {
-    // no new data and current data in chat._public.data is already rendered
-    return;
-  }
-
-  $('#chatall').data('needsClearing', null);
-
-  var old = chat._public.oldestGUID;
-  chat.writeDataToHash(data, chat._public, olderMsgs, ascendingTimestampOrder);
-  var oldMsgsWereAdded = old !== chat._public.oldestGUID;
-
-  runHooks('publicChatDataAvailable', {raw: data, result: data.result, processed: chat._public.data});
-
-  window.chat.renderPublic(oldMsgsWereAdded);
-
-}
-
-/**
- * Renders public chat in the UI.
- *
- * @function window.chat.renderPublic
- * @param {boolean} oldMsgsWereAdded - Indicates if older messages were added to the chat.
- */
-window.chat.renderPublic = function(oldMsgsWereAdded) {
-  chat.renderData(chat._public.data, 'chatall', oldMsgsWereAdded, chat._public.guids);
-}
-
-
-//
-// alerts
-//
-
-window.chat._requestAlertsRunning = false;
-
-/**
- * Initiates a request for alerts chat data.
- *
- * @function window.chat.requestAlerts
- * @param {boolean} getOlderMsgs - Whether to retrieve older messages.
- * @param {boolean} [isRetry=false] - Whether the request is a retry.
- */
-window.chat.requestAlerts = function(getOlderMsgs, isRetry) {
-  if(chat._requestAlertsRunning && !isRetry) return;
-  if(isIdle()) return renderUpdateStatus();
-  chat._requestAlertsRunning = true;
-  $("#chatcontrols a:contains('alerts')").addClass('loading');
-
-  var d = chat.genPostData('alerts', chat._alerts, getOlderMsgs);
-  var r = window.postAjax(
-    'getPlexts',
-    d,
-    function(data, textStatus, jqXHR) { chat.handleAlerts(data, getOlderMsgs, d.ascendingTimestampOrder); },
-    isRetry
-      ? function() { window.chat._requestAlertsRunning = false; }
-      : function() { window.chat.requestAlerts(getOlderMsgs, true) }
-  );
-}
-
-/**
- * Holds data related to alerts chat.
- *
- * @memberof window.chat
- * @type {Object}
- */
-window.chat._alerts = {data:{}, guids: [], oldestTimestamp:-1, newestTimestamp:-1};
-
-/**
- * Handles the alerts chat data received from the server.
- *
- * @function window.chat.handleAlerts
- * @param {Object} data - The alerts chat data.
- * @param {boolean} olderMsgs - Whether the received messages are older.
- * @param {boolean} ascendingTimestampOrder - Whether messages are in ascending timestamp order.
- */
-window.chat.handleAlerts = function(data, olderMsgs, ascendingTimestampOrder) {
-  chat._requestAlertsRunning = false;
-  $("#chatcontrols a:contains('alerts')").removeClass('loading');
-
-  if(!data || !data.result) {
-    window.failedRequestCount++;
-    return log.warn('alerts chat error. Waiting for next auto-refresh.');
-  }
-
-  if(data.result.length === 0) return;
-
-  var old = chat._alerts.oldestTimestamp;
-  chat.writeDataToHash(data, chat._alerts, olderMsgs, ascendingTimestampOrder);
-  var oldMsgsWereAdded = old !== chat._alerts.oldestTimestamp;
-
-  // hook for alerts - API change planned here for next refactor
-  runHooks('alertsChatDataAvailable', {raw: data, result: data.result, processed: chat._alerts.data});
-
-  window.chat.renderAlerts(oldMsgsWereAdded);
-}
-
-/**
- * Renders alerts chat in the UI.
- *
- * @function window.chat.renderAlerts
- * @param {boolean} oldMsgsWereAdded - Indicates if older messages were added to the chat.
- */
-window.chat.renderAlerts = function(oldMsgsWereAdded) {
-  chat.renderData(chat._alerts.data, 'chatalerts', oldMsgsWereAdded, chat._alerts.guids);
-}
-
-
+// Create a proxy for chat to ensure backward compatibility of migrated functions from chat to comm
+window.chat = new Proxy(window.chat, {
+  get(target, prop, receiver) {
+    if (prop in target) {
+      // Return the property from chat if it's defined
+      return target[prop];
+    } else if (legacyFunctions.includes(prop)) {
+      // Map the legacy function name to its new name in comm and return the corresponding function
+      const commProp = mapLegacyFunctionNameToCommApi(prop);
+      return window.IITC.comm[commProp];
+    }
+    // Return default value if the property is not found
+    return Reflect.get(target, prop, receiver);
+  },
+  set(target, prop, value) {
+    if (legacyFunctions.includes(prop)) {
+      // Map the legacy function name to its new name in comm and synchronize the function between chat and comm
+      const commProp = mapLegacyFunctionNameToCommApi(prop);
+      window.IITC.comm[commProp] = value;
+    }
+    // Update or add the property in chat
+    target[prop] = value;
+    return true; // Indicates that the assignment was successful
+  },
+});
 
 //
 // common
@@ -450,578 +135,113 @@ 

IITC-CE

/** * Adds a nickname to the chat input. * - * @function window.chat.addNickname + * @function addNickname * @param {string} nick - The nickname to add. */ -window.chat.addNickname= function(nick) { - var c = document.getElementById("chattext"); - c.value = [c.value.trim(), nick].join(" ").trim() + " "; - c.focus() -} +chat.addNickname = function (nick) { + var c = document.getElementById('chattext'); + c.value = [c.value.trim(), nick].join(' ').trim() + ' '; + c.focus(); +}; /** * Handles click events on nicknames in the chat. * - * @function window.chat.nicknameClicked + * @function nicknameClicked * @param {Event} event - The click event. * @param {string} nickname - The clicked nickname. * @returns {boolean} Always returns false. */ -window.chat.nicknameClicked = function(event, nickname) { +chat.nicknameClicked = function (event, nickname) { + // suppress @ if coming from chat + if (nickname.startsWith('@')) { + nickname = nickname.slice(1); + } var hookData = { event: event, nickname: nickname }; if (window.runHooks('nicknameClicked', hookData)) { - window.chat.addNickname('@' + nickname); + chat.addNickname('@' + nickname); } event.preventDefault(); event.stopPropagation(); return false; -} - -/** - * Updates the oldest and newest message timestamps and GUIDs in the chat storage. - * - * @function window.chat.updateOldNewHash - * @param {Object} newData - The new chat data received. - * @param {Object} storageHash - The chat storage object. - * @param {boolean} isOlderMsgs - Whether the new data contains older messages. - * @param {boolean} isAscendingOrder - Whether the new data is in ascending order. - */ -window.chat.updateOldNewHash = function(newData, storageHash, isOlderMsgs, isAscendingOrder) { - // track oldest + newest timestamps/GUID - if (newData.result.length > 0) { - var first = { - guid: newData.result[0][0], - time: newData.result[0][1] - }; - var last = { - guid: newData.result[newData.result.length-1][0], - time: newData.result[newData.result.length-1][1] - }; - if (isAscendingOrder) { - var temp = first; - first = last; - last = temp; - } - if (storageHash.oldestTimestamp === -1 || storageHash.oldestTimestamp >= last.time) { - if (isOlderMsgs || storageHash.oldestTimestamp !== last.time) { - storageHash.oldestTimestamp = last.time; - storageHash.oldestGUID = last.guid; - } - } - if (storageHash.newestTimestamp === -1 || storageHash.newestTimestamp <= first.time) { - if (!isOlderMsgs || storageHash.newestTimestamp !== first.time) { - storageHash.newestTimestamp = first.time; - storageHash.newestGUID = first.guid; - } - } - } -}; - -/** - * Parses chat message data into a more convenient format. - * - * @function window.chat.parseMsgData - * @param {Object} data - The raw chat message data. - * @returns {Object} The parsed chat message data. - */ -window.chat.parseMsgData = function (data) { - var categories = data[2].plext.categories; - var isPublic = (categories & 1) === 1; - var isSecure = (categories & 2) === 2; - var msgAlert = (categories & 4) === 4; - - var msgToPlayer = msgAlert && (isPublic || isSecure); - - var time = data[1]; - var team = window.teamStringToId(data[2].plext.team); - var auto = data[2].plext.plextType !== 'PLAYER_GENERATED'; - var systemNarrowcast = data[2].plext.plextType === 'SYSTEM_NARROWCAST'; - - var markup = data[2].plext.markup; - - var player = { - name: '', - team: team, - }; - markup.forEach(function(ent) { - switch (ent[0]) { - case 'SENDER': // user generated messages - player.name = ent[1].plain.replace(/: $/, ''); // cut “: ” at end - break; - - case 'PLAYER': // automatically generated messages - player.name = ent[1].plain; - player.team = window.teamStringToId(ent[1].team); - break; - - default: - break; - } - }); - - return { - guid: data[0], - time: time, - public: isPublic, - secure: isSecure, - alert: msgAlert, - msgToPlayer: msgToPlayer, - type: data[2].plext.plextType, - narrowcast: systemNarrowcast, - auto: auto, - team: team, - player: player, - markup: markup, - }; -}; - -/** - * Writes new chat data to the chat storage and manages the order of messages. - * - * @function window.chat.writeDataToHash - * @param {Object} newData - The new chat data received. - * @param {Object} storageHash - The chat storage object. - * @param {boolean} isOlderMsgs - Whether the new data contains older messages. - * @param {boolean} isAscendingOrder - Whether the new data is in ascending order. - */ -window.chat.writeDataToHash = function (newData, storageHash, isOlderMsgs, isAscendingOrder) { - window.chat.updateOldNewHash(newData, storageHash, isOlderMsgs, isAscendingOrder); - - newData.result.forEach(function(json) { - // avoid duplicates - if (json[0] in storageHash.data) { - return true; - } - - var parsedData = chat.parseMsgData(json); - - // format: timestamp, autogenerated, HTML message, nick, additional data (parsed, plugin specific data...) - storageHash.data[parsedData.guid] = [parsedData.time, parsedData.auto, chat.renderMsgRow(parsedData), parsedData.player.name, parsedData]; - if (isAscendingOrder) { - storageHash.guids.push(parsedData.guid); - } else { - storageHash.guids.unshift(parsedData.guid); - } - }); }; // -// Rendering primitive for markup, chat cells (td) and chat row (tr) +// Channels // -/** - * Renders text for the chat, converting plain text to HTML and adding links. - * - * @function window.chat.renderText - * @param {Object} text - An object containing the plain text to render. - * @returns {string} The rendered HTML string. - */ -window.chat.renderText = function (text) { - let content; - - if (text.team) { - let teamId = window.teamStringToId(text.team); - if (teamId === window.TEAM_NONE) teamId = window.TEAM_MAC; - const spanClass = window.TEAM_TO_CSS[teamId]; - content = $('<div>').append($('<span>', { class: spanClass, text: text.plain })); - } else { - content = $('<div>').text(text.plain); - } - - return content.html().autoLink(); -}; - -/** - * Overrides portal names used repeatedly in chat, such as 'US Post Office', with more specific names. - * - * @function window.chat.getChatPortalName - * @param {Object} markup - An object containing portal markup, including the name and address. - * @returns {string} The processed portal name. - */ -window.chat.getChatPortalName = function (markup) { - var name = markup.name; - if (name === 'US Post Office') { - var address = markup.address.split(','); - name = 'USPS: ' + address[0]; - } - return name; -}; - -/** - * Renders a portal link for use in the chat. - * - * @function window.chat.renderPortal - * @param {Object} portal - The portal data. - * @returns {string} HTML string of the portal link. - */ -window.chat.renderPortal = function (portal) { - var lat = portal.latE6/1E6, lng = portal.lngE6/1E6; - var perma = window.makePermalink([lat,lng]); - var js = 'window.selectPortalByLatLng('+lat+', '+lng+');return false'; - return '<a onclick="' + js + '"' + ' title="' + portal.address + '"' + ' href="' + perma + '" class="help">' + window.chat.getChatPortalName(portal) + '</a>'; -}; - -/** - * Renders a faction entity for use in the chat. - * - * @function window.chat.renderFactionEnt - * @param {Object} faction - The faction data. - * @returns {string} HTML string representing the faction. - */ -window.chat.renderFactionEnt = function (faction) { - var teamId = window.teamStringToId(faction.team); - var name = window.TEAM_NAMES[teamId]; - var spanClass = window.TEAM_TO_CSS[teamId]; - return $('<div>').html($('<span>') - .attr('class', spanClass) - .text(name)).html(); -}; - -/** - * Renders a player's nickname in chat. - * - * @function window.chat.renderPlayer - * @param {Object} player - The player object containing nickname and team. - * @param {boolean} at - Whether to prepend '@' to the nickname. - * @param {boolean} sender - Whether the player is the sender of a message. - * @returns {string} The HTML string representing the player's nickname in chat. - */ -window.chat.renderPlayer = function (player, at, sender) { - var name = player.plain; - if (sender) { - name = player.plain.replace(/: $/, ''); - } else if (at) { - name = player.plain.replace(/^@/, ''); - } - var thisToPlayer = name === window.PLAYER.nickname; - var spanClass = thisToPlayer ? 'pl_nudge_me' : (player.team + ' pl_nudge_player'); - return $('<div>').html($('<span>') - .attr('class', spanClass) - .attr('onclick',"window.chat.nicknameClicked(event, '"+name+"')") - .text((at ? '@' : '') + name)).html(); -}; - -/** - * Renders a chat message entity based on its type. - * - * @function window.chat.renderMarkupEntity - * @param {Array} ent - The entity array, where the first element is the type and the second element is the data. - * @returns {string} The HTML string representing the chat message entity. - */ -window.chat.renderMarkupEntity = function (ent) { - switch (ent[0]) { - case 'TEXT': - return chat.renderText(ent[1]); - case 'PORTAL': - return chat.renderPortal(ent[1]); - case 'FACTION': - return chat.renderFactionEnt(ent[1]); - case 'SENDER': - return chat.renderPlayer(ent[1], false, true); - case 'PLAYER': - return chat.renderPlayer(ent[1]); - case 'AT_PLAYER': - return chat.renderPlayer(ent[1], true); - default: - } - return $('<div>').text(ent[0]+':<'+ent[1].plain+'>').html(); -}; - -/** - * Renders the markup of a chat message, converting special entities like player names, portals, etc., into HTML. - * - * @function window.chat.renderMarkup - * @param {Array} markup - The markup array of a chat message. - * @returns {string} The HTML string representing the complete rendered chat message. - */ -window.chat.renderMarkup = function (markup) { - var msg = ''; - - markup.forEach(function (ent, ind) { - switch (ent[0]) { - case 'SENDER': - case 'SECURE': - // skip as already handled - break; - - case 'PLAYER': // automatically generated messages - if (ind > 0) msg += chat.renderMarkupEntity(ent); // don’t repeat nick directly - break; - - default: - // add other enitities whatever the type - msg += chat.renderMarkupEntity(ent); - break; - } - }); - return msg; -}; - -/** - * Transforms a given markup array into an older, more straightforward format for easier understanding. - * - * @function window.chat.transformMessage - * @param {Array} markup - An array representing the markup to be transformed. - * @returns {Array} The transformed markup array with a simplified structure. - */ -function transformMessage(markup) { - // Make a copy of the markup array to avoid modifying the original input - let newMarkup = JSON.parse(JSON.stringify(markup)); - - // Collapse <faction> + "Link"/"Field". Example: "Agent <player> destroyed the <faction> Link ..." - if (newMarkup.length > 4) { - if (newMarkup[3][0] === 'FACTION' && newMarkup[4][0] === 'TEXT' && (newMarkup[4][1].plain === ' Link ' || newMarkup[4][1].plain === ' Control Field @')) { - newMarkup[4][1].team = newMarkup[3][1].team; - newMarkup.splice(3, 1); - } - } - - // Skip "Agent <player>" at the beginning - if (newMarkup.length > 1) { - if (newMarkup[0][0] === 'TEXT' && newMarkup[0][1].plain === 'Agent ' && newMarkup[1][0] === 'PLAYER') { - newMarkup.splice(0, 2); - } - } - - // Skip "<faction> agent <player>" at the beginning - if (newMarkup.length > 2) { - if (newMarkup[0][0] === 'FACTION' && newMarkup[1][0] === 'TEXT' && newMarkup[1][1].plain === ' agent ' && newMarkup[2][0] === 'PLAYER') { - newMarkup.splice(0, 3); - } - } - - return newMarkup; -} - -/** - * Renders a cell in the chat table to display the time a message was sent. - * Formats the time and adds it to a <time> HTML element with a tooltip showing the full date and time. - * - * @function window.chat.renderTimeCell - * @param {number} time - The timestamp of the message. - * @param {string} classNames - Additional class names to be added to the time cell. - * @returns {string} The HTML string representing a table cell with the formatted time. - */ -window.chat.renderTimeCell = function (time, classNames) { - const ta = window.unixTimeToHHmm(time); - let tb = window.unixTimeToDateTimeString(time, true); - // add <small> tags around the milliseconds - tb = (tb.slice(0, 19) + '<small class="milliseconds">' + tb.slice(19) + '</small>').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); - return '<td><time class="' + classNames + '" title="' + tb + '" data-timestamp="' + time + '">' + ta + '</time></td>'; -}; - -/** - * Renders a cell in the chat table for a player's nickname. - * Wraps the nickname in <mark> HTML element for highlighting. - * - * @function window.chat.renderNickCell - * @param {string} nick - The nickname of the player. - * @param {string} classNames - Additional class names to be added to the nickname cell. - * @returns {string} The HTML string representing a table cell with the player's nickname. - */ -window.chat.renderNickCell = function (nick, classNames) { - const i = ['<span class="invisep">&lt;</span>', '<span class="invisep">&gt;</span>']; - return '<td>' + i[0] + '<mark class="' + classNames + '">' + nick + '</mark>' + i[1] + '</td>'; -}; +// WORK IN PROGRESS +// 'all' 'faction' and 'alerts' channels are hard coded in several places (including mobile app) +// dont change those channels since they refer to stock channels +// you can add channels from another source provider (message relay, logging from plugins...) /** - * Renders a cell in the chat table for a chat message. - * The message is inserted as inner HTML of the table cell. + * Hold channel description * - * @function window.chat.renderMsgCell - * @param {string} msg - The chat message to be displayed. - * @param {string} classNames - Additional class names to be added to the message cell. - * @returns {string} The HTML string representing a table cell with the chat message. + * See comm.js for examples + * @typedef {Object} ChannelDescription + * @property {string} id - uniq id, matches 'tab' parameter for server requests + * @property {string} name - visible name + * @property {string} [inputPrompt] - (optional) string for the input prompt + * @property {string} [inputClass] - (optional) class to apply to #chatinput + * @property {ChannelSendMessageFn} [sendMessage] - (optional) function to send the message + * @property {ChannelRequestFn} [request] - (optional) function to call to request new message + * @property {ChannelRenderFn} [render] - (optional) function to render channel content,, called on tab change + * @property {boolean} [localBounds] - (optional) if true, reset on view change */ -window.chat.renderMsgCell = function (msg, classNames) { - return '<td class="' + classNames + '">' + msg + '</td>'; -}; - /** - * Renders a row for a chat message including time, nickname, and message cells. - * - * @function window.chat.renderMsgRow - * @param {Object} data - The data for the message, including time, player, and message content. - * @returns {string} The HTML string representing a row in the chat table. + * @callback ChannelSendMessageFn + * @param {string} id - channel id + * @param {string} message - input message + * @returns {void} */ -window.chat.renderMsgRow = function (data) { - var timeClass = data.msgToPlayer ? 'pl_nudge_date' : ''; - var timeCell = chat.renderTimeCell(data.time, timeClass); - - var nickClasses = ['nickname']; - if (window.TEAM_TO_CSS[data.player.team]) { - nickClasses.push(window.TEAM_TO_CSS[data.player.team]); - } - // highlight things said/done by the player in a unique colour - // (similar to @player mentions from others in the chat text itself) - if (data.player.name === window.PLAYER.nickname) { - nickClasses.push('pl_nudge_me'); - } - var nickCell = chat.renderNickCell(data.player.name, nickClasses.join(' ')); - - const markup = transformMessage(data.markup); - var msg = chat.renderMarkup(markup); - var msgClass = data.narrowcast ? 'system_narrowcast' : ''; - var msgCell = chat.renderMsgCell(msg, msgClass); - - var className = ''; - if (!data.auto && data.public) { - className = 'public'; - } else if (!data.auto && data.secure) { - className = 'faction'; - } - return '<tr data-guid="' + data.guid + '" class="' + className + '">' + timeCell + nickCell + msgCell + '</tr>'; -}; - /** - * Legacy function for rendering chat messages. Used for backward compatibility with plugins. - * - * @function window.chat.renderMsg - * @param {string} msg - The chat message. - * @param {string} nick - The nickname of the player who sent the message. - * @param {number} time - The timestamp of the message. - * @param {string} team - The team of the player who sent the message. - * @param {boolean} msgToPlayer - Flag indicating if the message is directed to the player. - * @param {boolean} systemNarrowcast - Flag indicating if the message is a system narrowcast. - * @returns {string} The HTML string representing a chat message row. + * @callback ChannelRequestFn + * @param {string} id - channel id + * @param {boolean} getOlderMsgs - true if request data from a scroll to top + * @param {boolean} isRetry + * @returns {void} */ -window.chat.renderMsg = function(msg, nick, time, team, msgToPlayer, systemNarrowcast) { - var ta = unixTimeToHHmm(time); - var tb = unixTimeToDateTimeString(time, true); - // add <small> tags around the milliseconds - tb = (tb.slice(0,19)+'<small class="milliseconds">'+tb.slice(19)+'</small>') - .replace(/</g,'&lt;') - .replace(/>/g,'&gt;') - .replace(/"/g,'&quot;'); - - // help cursor via “#chat time” - var t = '<time title="'+tb+'" data-timestamp="'+time+'">'+ta+'</time>'; - if (msgToPlayer) { - t = '<div class="pl_nudge_date">' + t + '</div><div class="pl_nudge_pointy_spacer"></div>'; - } - if (systemNarrowcast) { - msg = '<div class="system_narrowcast">' + msg + '</div>'; - } - var color = COLORS[team]; - // highlight things said/done by the player in a unique colour (similar to @player mentions from others in the chat text itself) - if (nick === window.PLAYER.nickname) { - color = '#fd6'; - } - var s = 'style="cursor:pointer; color:'+color+'"'; - var i = ['<span class="invisep">&lt;</span>', '<span class="invisep">&gt;</span>']; - return '<tr><td>'+t+'</td><td>'+i[0]+'<mark class="nickname" ' + s + '>'+ nick+'</mark>'+i[1]+'</td><td>'+msg+'</td></tr>'; -} - /** - * Renders a divider row in the chat table. - * - * @function window.chat.renderDivider - * @param {string} text - Text to display within the divider row. - * @returns {string} The HTML string representing a divider row in the chat table. + * @callback ChannelRenderFn + * @param {string} id - channel id + * @param {boolean} oldMsgsWereAdded - true if data has been added at the top (to preserve scroll position) + * @returns {void} */ -window.chat.renderDivider = function(text) { - return '<tr class="divider"><td><hr></td><td>' + text + '</td><td><hr></td></tr>'; -}; /** - * Renders data from the data-hash to the element defined by the given ID. + * Holds channels infos. * - * @function window.chat.renderData - * @param {Object} data - Chat data to be rendered. - * @param {string} element - ID of the DOM element to render the chat into. - * @param {boolean} likelyWereOldMsgs - Flag indicating if older messages are likely to have been added. - * @param {Array} sortedGuids - Sorted array of GUIDs representing the order of messages. + * @type {ChannelDescription[]} + * @memberof module:chat */ -window.chat.renderData = function(data, element, likelyWereOldMsgs, sortedGuids) { - var elm = $('#'+element); - if (elm.is(':hidden')) { - return; - } - - // if sortedGuids is not specified (legacy), sort old to new - // (disregarding server order) - var vals = sortedGuids; - if (vals === undefined) { - vals = $.map(data, function(v, k) { return [[v[0], k]]; }); - vals = vals.sort(function(a, b) { return a[0]-b[0]; }); - vals = vals.map(function(v) { return v[1]; }); - } - - // render to string with date separators inserted - var msgs = ''; - var prevTime = null; - vals.forEach(function(guid) { - var msg = data[guid]; - var nextTime = new Date(msg[0]).toLocaleDateString(); - if (prevTime && prevTime !== nextTime) { - msgs += chat.renderDivider(nextTime); - } - msgs += msg[2]; - prevTime = nextTime; - }); - - var firstRender = elm.is(':empty'); - var scrollBefore = scrollBottom(elm); - elm.html('<table>' + msgs + '</table>'); - - if (firstRender) { - elm.data('needsScrollTop', 99999999); - } else { - chat.keepScrollPosition(elm, scrollBefore, likelyWereOldMsgs); - } - - if(elm.data('needsScrollTop')) { - elm.data('ignoreNextScroll', true); - elm.scrollTop(elm.data('needsScrollTop')); - elm.data('needsScrollTop', null); - } -}; +chat.channels = []; /** * Gets the name of the active chat tab. * - * @function window.chat.getActive + * @function getActive * @returns {string} The name of the active chat tab. */ -window.chat.getActive = function() { - return $('#chatcontrols .active').text(); -} - -/** - * Converts a chat tab name to its corresponding COMM channel name. - * - * @function window.chat.tabToChannel - * @param {string} tab - The name of the chat tab. - * @returns {string} The corresponding channel name ('faction', 'alerts', or 'all'). - */ -window.chat.tabToChannel = function(tab) { - if (tab == 'faction') return 'faction'; - if (tab == 'alerts') return 'alerts'; - return 'all'; +chat.getActive = function () { + return $('#chatcontrols .active').data('channel'); }; /** - * Toggles the chat window between expanded and collapsed states. - * When expanded, the chat window covers a larger area of the screen. - * This function also ensures that the chat is scrolled to the bottom when collapsed. + * Converts a chat tab name to its corresponding channel object. * - * @function window.chat.toggle + * @function getChannelDesc + * @param {string} tab - The name of the chat tab. + * @returns {ChannelDescription} The corresponding channel name ('faction', 'alerts', or 'all'). */ -window.chat.toggle = function() { - var c = $('#chat, #chatcontrols'); - if(c.hasClass('expand')) { - c.removeClass('expand'); - var div = $('#chat > div:visible'); - div.data('ignoreNextScroll', true); - div.scrollTop(99999999); // scroll to bottom - $('.leaflet-control').removeClass('chat-expand'); - } else { - c.addClass('expand'); - $('.leaflet-control').addClass('chat-expand'); - chat.needMoreMessages(); - } +chat.getChannelDesc = function (tab) { + var channelObject = null; + chat.channels.forEach(function (entry) { + if (entry.id === tab) channelObject = entry; + }); + return channelObject; }; /** @@ -1029,86 +249,85 @@

IITC-CE

* that need to process COMM data even when the user is not actively viewing the COMM channels. * It tracks the requested channels for each plugin instance and updates the global state accordingly. * - * @function window.chat.backgroundChannelData + * @function backgroundChannelData * @param {string} instance - A unique identifier for the plugin or instance requesting background COMM data. * @param {string} channel - The name of the COMM channel ('all', 'faction', or 'alerts'). * @param {boolean} flag - Set to true to request data for the specified channel, false to stop requesting. */ -window.chat.backgroundChannelData = function(instance,channel,flag) { - //first, store the state for this instance - if (!window.chat.backgroundInstanceChannel) window.chat.backgroundInstanceChannel = {}; - if (!window.chat.backgroundInstanceChannel[instance]) window.chat.backgroundInstanceChannel[instance] = {}; - window.chat.backgroundInstanceChannel[instance][channel] = flag; +chat.backgroundChannelData = function (instance, channel, flag) { + // first, store the state for this instance + if (!chat.backgroundInstanceChannel) chat.backgroundInstanceChannel = {}; + if (!chat.backgroundInstanceChannel[instance]) chat.backgroundInstanceChannel[instance] = {}; + chat.backgroundInstanceChannel[instance][channel] = flag; - //now, to simplify the request code, merge the flags for all instances into one + // now, to simplify the request code, merge the flags for all instances into one // 1. clear existing overall flags - window.chat.backgroundChannels = {}; + chat.backgroundChannels = {}; // 2. for each instance monitoring COMM... - $.each(window.chat.backgroundInstanceChannel, function(instance,channels) { + $.each(chat.backgroundInstanceChannel, function (instance) { // 3. and for each channel monitored by this instance... - $.each(window.chat.backgroundInstanceChannel[instance],function(channel,flag) { + $.each(chat.backgroundInstanceChannel[instance], function (channel, flag) { // 4. if it's monitored, set the channel flag - if (flag) window.chat.backgroundChannels[channel] = true; + if (flag) chat.backgroundChannels[channel] = true; }); }); - -} +}; /** * Requests chat messages for the currently active chat tab and background channels. * It calls the appropriate request function based on the active tab or background channels. * - * @function window.chat.request + * @function request */ -window.chat.request = function() { - var channel = chat.tabToChannel(chat.getActive()); - if (channel == 'faction' || (window.chat.backgroundChannels && window.chat.backgroundChannels['faction'])) { - chat.requestFaction(false); - } - if (channel == 'all' || (window.chat.backgroundChannels && window.chat.backgroundChannels['all'])) { - chat.requestPublic(false); - } - if (channel == 'alerts' || (window.chat.backgroundChannels && window.chat.backgroundChannels['alerts'])) { - chat.requestAlerts(false); - } -} +chat.request = function () { + var channel = chat.getActive(); + chat.channels.forEach(function (entry) { + if (channel === entry.id || (chat.backgroundChannels && chat.backgroundChannels[entry.id])) { + if (entry.request) entry.request(entry.id, false); + } + }); +}; /** * Checks if the currently selected chat tab needs more messages. * This function is triggered by scroll events and loads older messages when the user scrolls to the top. * - * @function window.chat.needMoreMessages + * @function needMoreMessages */ -window.chat.needMoreMessages = function() { +chat.needMoreMessages = function () { var activeTab = chat.getActive(); - if (activeTab !== 'all' && activeTab !== 'faction' && activeTab !== 'alerts') { - return; - } + var channel = chat.getChannelDesc(activeTab); + if (!channel || !channel.request) return; var activeChat = $('#chat > :visible'); - if(activeChat.length === 0) return; + if (activeChat.length === 0) return; - var hasScrollbar = scrollBottom(activeChat) !== 0 || activeChat.scrollTop() !== 0; - var nearTop = activeChat.scrollTop() <= CHAT_REQUEST_SCROLL_TOP; - if(hasScrollbar && !nearTop) return; + var hasScrollbar = window.scrollBottom(activeChat) !== 0 || activeChat.scrollTop() !== 0; + var nearTop = activeChat.scrollTop() <= window.CHAT_REQUEST_SCROLL_TOP; + if (hasScrollbar && !nearTop) return; - if(activeTab === 'faction') { - chat.requestFaction(true); - } else { - chat.requestPublic(true); - } + channel.request(channel.id, false); }; /** * Chooses and activates a specified chat tab. * Also triggers an early refresh of the chat data when switching tabs. * - * @function window.chat.chooseTab + * @function chooseTab * @param {string} tab - The name of the chat tab to activate ('all', 'faction', or 'alerts'). */ -window.chat.chooseTab = function(tab) { - if (tab != 'all' && tab != 'faction' && tab != 'alerts') { - log.warn('chat tab "'+tab+'" requested - but only "all", "faction" and "alerts" are valid - assuming "all" wanted'); +chat.chooseTab = function (tab) { + if ( + chat.channels.every(function (entry) { + return entry.id !== tab; + }) + ) { + var tabsAvalaible = chat.channels + .map(function (entry) { + return '"' + entry.id + '"'; + }) + .join(', '); + log.warn('chat tab "' + tab + '" requested - but only ' + tabsAvalaible + ' are valid - assuming "all" wanted'); tab = 'all'; } @@ -1116,262 +335,474 @@

IITC-CE

localStorage['iitc-chat-tab'] = tab; + var oldChannel = chat.getChannelDesc(oldTab); + var channel = chat.getChannelDesc(tab); + + var chatInput = $('#chatinput'); + if (oldChannel && oldChannel.inputClass) chatInput.removeClass(oldChannel.inputClass); + if (channel.inputClass) chatInput.addClass(channel.inputClass); + var mark = $('#chatinput mark'); - var input = $('#chatinput input'); + mark.text(channel.inputPrompt || ''); $('#chatcontrols .active').removeClass('active'); - $("#chatcontrols a:contains('" + tab + "')").addClass('active'); + $("#chatcontrols a[data-channel='" + tab + "']").addClass('active'); - if (tab != oldTab) startRefreshTimeout(0.1*1000); //only chat uses the refresh timer stuff, so a perfect way of forcing an early refresh after a tab change + if (tab !== oldTab) window.startRefreshTimeout(0.1 * 1000); // only chat uses the refresh timer stuff, so a perfect way of forcing an early refresh after a tab change $('#chat > div').hide(); var elm = $('#chat' + tab); elm.show(); - switch(tab) { - case 'faction': - input.css('color', ''); - mark.css('color', ''); - mark.text('tell faction:'); - - chat.renderFaction(false); - break; + if (channel.render) channel.render(tab); - case 'all': - input.css('cssText', 'color: #f66 !important'); - mark.css('cssText', 'color: #f66 !important'); - mark.text('broadcast:'); - - chat.renderPublic(false); - break; - - case 'alerts': - mark.css('cssText', 'color: #bbb !important'); - input.css('cssText', 'color: #bbb !important'); - mark.text('tell Jarvis:'); + if (elm.data('needsScrollTop')) { + elm.data('ignoreNextScroll', true); + elm.scrollTop(elm.data('needsScrollTop')); + elm.data('needsScrollTop', null); + } +}; - chat.renderAlerts(false); - break; +/** + * Toggles the chat window between expanded and collapsed states. + * When expanded, the chat window covers a larger area of the screen. + * This function also ensures that the chat is scrolled to the bottom when collapsed. + * + * @function toggle + */ +chat.toggle = function () { + var c = $('#chat, #chatcontrols'); + if (c.hasClass('expand')) { + c.removeClass('expand'); + var div = $('#chat > div:visible'); + div.data('ignoreNextScroll', true); + div.scrollTop(99999999); // scroll to bottom + $('.leaflet-control').removeClass('chat-expand'); + } else { + c.addClass('expand'); + $('.leaflet-control').addClass('chat-expand'); + chat.needMoreMessages(); } -} +}; /** * Displays the chat interface and activates a specified chat tab. * - * @function window.chat.show + * @function show * @param {string} name - The name of the chat tab to show and activate. */ -window.chat.show = function(name) { - window.isSmartphone() - ? $('#updatestatus').hide() - : $('#updatestatus').show(); - $('#chat, #chatinput').show(); +chat.show = function (name) { + if (window.isSmartphone()) { + $('#updatestatus').hide(); + } else { + $('#updatestatus').show(); + } + $('#chat, #chatinput').show(); - window.chat.chooseTab(name); -} + chat.chooseTab(name); +}; /** * Chat tab chooser handler. * This function is triggered by a click event on the chat tab. It reads the tab name from the event target * and activates the corresponding chat tab. * - * @function window.chat.chooser + * @function chooser * @param {Event} event - The event triggered by clicking a chat tab. */ -window.chat.chooser = function(event) { +chat.chooser = function (event) { var t = $(event.target); - var tab = t.text(); - window.chat.chooseTab(tab); -} + var tab = t.data('channel'); + chat.chooseTab(tab); +}; /** * Maintains the scroll position of a chat box when new messages are added. * This function is designed to keep the scroll position fixed when old messages are loaded, and to automatically scroll * to the bottom when new messages are added if the user is already at the bottom of the chat. * - * @function window.chat.keepScrollPosition + * @function keepScrollPosition * @param {jQuery} box - The jQuery object of the chat box. * @param {number} scrollBefore - The scroll position before new messages were added. * @param {boolean} isOldMsgs - Indicates if the added messages are older messages. */ -window.chat.keepScrollPosition = function(box, scrollBefore, isOldMsgs) { +chat.keepScrollPosition = function (box, scrollBefore, isOldMsgs) { // If scrolled down completely, keep it that way so new messages can // be seen easily. If scrolled up, only need to fix scroll position // when old messages are added. New messages added at the bottom don’t // change the view and enabling this would make the chat scroll down // for every added message, even if the user wants to read old stuff. - if(box.is(':hidden') && !isOldMsgs) { + if (box.is(':hidden') && !isOldMsgs) { box.data('needsScrollTop', 99999999); return; } - if(scrollBefore === 0 || isOldMsgs) { + if (scrollBefore === 0 || isOldMsgs) { box.data('ignoreNextScroll', true); - box.scrollTop(box.scrollTop() + (scrollBottom(box)-scrollBefore)); + box.scrollTop(box.scrollTop() + (window.scrollBottom(box) - scrollBefore)); + } +}; + +/** + * Create and insert into the DOM/Mobile app the channel tab + * + * @function createChannelTab + * @memberof chat + * @param {ChannelDescription} channelDesc - channel description + * @static + */ +function createChannelTab(channelDesc) { + var chatControls = $('#chatcontrols'); + var chatDiv = $('#chat'); + var accessLink = L.Util.template('<a data-channel="{id}" accesskey="{index}" title="[{index}]">{name}</a>', channelDesc); + $(accessLink).appendTo(chatControls).click(chat.chooser); + + var channelDiv = L.Util.template('<div id="chat{id}"><table></table></div>', channelDesc); + var elm = $(channelDiv).appendTo(chatDiv); + if (channelDesc.request) { + elm.scroll(function () { + var t = $(this); + if (t.data('ignoreNextScroll')) return t.data('ignoreNextScroll', false); + if (t.scrollTop() < window.CHAT_REQUEST_SCROLL_TOP) channelDesc.request(channelDesc.id, true); + if (window.scrollBottom(t) === 0) channelDesc.request(channelDesc.id, false); + }); + } + + // pane + if (window.useAndroidPanes()) { + // exlude hard coded panes + if (channelDesc.id !== 'all' && channelDesc.id !== 'faction' && channelDesc.id !== 'alerts') { + app.addPane(channelDesc.id, channelDesc.name, 'ic_action_view_as_list'); + } } } +var isTabsSetup = false; +/** + * Add to the channel list a new channel description + * + * If tabs are already created, a tab is created for this channel as well + * + * @function addChannel + * @param {ChannelDescription} channelDesc - channel description + */ +chat.addChannel = function (channelDesc) { + // deny reserved name + if (channelDesc.id === 'info' || channelDesc.id === 'map') { + log.warn('could not add channel "' + channelDesc.id + '": reserved'); + return false; + } + if (chat.getChannelDesc(channelDesc.id)) { + log.warn('could not add channel "' + channelDesc.id + '": already exist'); + return false; + } + chat.channels.push(channelDesc); + channelDesc.index = chat.channels.length; + if (isTabsSetup) createChannelTab(channelDesc); + + return true; +}; // // setup // /** - * Sets up the chat interface. + * Sets up all channels starting from intel COMM * - * @function window.chat.setup + * @function setupTabs + * @param {ChannelDescription} channelDesc - channel description */ -window.chat.setup = function() { - if (localStorage['iitc-chat-tab']) { - chat.chooseTab(localStorage['iitc-chat-tab']); - } +chat.setupTabs = function () { + isTabsSetup = true; - $('#chatcontrols, #chat, #chatinput').show(); + // insert at the begining the comm channels + chat.channels.splice(0, 0, ...IITC.comm.channels); - $('#chatcontrols a:first').click(window.chat.toggle); - $('#chatcontrols a').each(function(ind, elm) { - if($.inArray($(elm).text(), ['all', 'faction', 'alerts']) !== -1) - $(elm).click(window.chat.chooser); + chat.channels.forEach(function (entry, i) { + entry.index = i + 1; + createChannelTab(entry); }); + // legacy compatibility + chat._public = IITC.comm._channelsData.all; + chat._faction = IITC.comm._channelsData.faction; + chat._alerts = IITC.comm._channelsData.alerts; + + /** + * Initiates a request for public chat data. + * + * @function requestPublic + * @param {boolean} getOlderMsgs - Whether to retrieve older messages. + * @param {boolean} [isRetry=false] - Whether the request is a retry. + */ + chat.requestPublic = function (getOlderMsgs, isRetry) { + return IITC.comm.requestChannel('all', getOlderMsgs, isRetry); + }; - $('#chatinput').click(function() { - $('#chatinput input').focus(); - }); + /** + * Requests faction chat messages. + * + * @function requestFaction + * @param {boolean} getOlderMsgs - Flag to determine if older messages are being requested. + * @param {boolean} [isRetry=false] - Flag to indicate if this is a retry attempt. + */ + chat.requestFaction = function (getOlderMsgs, isRetry) { + return IITC.comm.requestChannel('faction', getOlderMsgs, isRetry); + }; - window.chat.setupTime(); - window.chat.setupPosting(); + /** + * Initiates a request for alerts chat data. + * + * @function requestAlerts + * @param {boolean} getOlderMsgs - Whether to retrieve older messages. + * @param {boolean} [isRetry=false] - Whether the request is a retry. + */ + chat.requestAlerts = function (getOlderMsgs, isRetry) { + return IITC.comm.requestChannel('alerts', getOlderMsgs, isRetry); + }; - $('#chatfaction').scroll(function() { - var t = $(this); - if(t.data('ignoreNextScroll')) return t.data('ignoreNextScroll', false); - if(t.scrollTop() < CHAT_REQUEST_SCROLL_TOP) chat.requestFaction(true); - if(scrollBottom(t) === 0) chat.requestFaction(false); - }); + /** + * Renders public chat in the UI. + * + * @function renderPublic + * @param {boolean} oldMsgsWereAdded - Indicates if older messages were added to the chat. + */ + chat.renderPublic = function (oldMsgsWereAdded) { + return IITC.comm.renderChannel('all', oldMsgsWereAdded); + }; - $('#chatall').scroll(function() { - var t = $(this); - if(t.data('ignoreNextScroll')) return t.data('ignoreNextScroll', false); - if(t.scrollTop() < CHAT_REQUEST_SCROLL_TOP) chat.requestPublic(true); - if(scrollBottom(t) === 0) chat.requestPublic(false); - }); + /** + * Renders faction chat. + * + * @function renderFaction + * @param {boolean} oldMsgsWereAdded - Indicates if old messages were added in the current rendering. + */ + chat.renderFaction = function (oldMsgsWereAdded) { + return IITC.comm.renderChannel('faction', oldMsgsWereAdded); + }; + + /** + * Renders alerts chat in the UI. + * + * @function renderAlerts + * @param {boolean} oldMsgsWereAdded - Indicates if older messages were added to the chat. + */ + chat.renderAlerts = function (oldMsgsWereAdded) { + return IITC.comm.renderChannel('allerts', oldMsgsWereAdded); + }; +}; + +/** + * Sets up the chat interface. + * + * @function setup + */ +chat.setup = function () { + chat.setupTabs(); + + if (localStorage['iitc-chat-tab']) { + chat.chooseTab(localStorage['iitc-chat-tab']); + } + + $('#chatcontrols, #chat, #chatinput').show(); - $('#chatalerts').scroll(function() { - var t = $(this); - if(t.data('ignoreNextScroll')) return t.data('ignoreNextScroll', false); - if(t.scrollTop() < CHAT_REQUEST_SCROLL_TOP) chat.requestAlerts(true); - if(scrollBottom(t) === 0) chat.requestAlerts(false); + $('#chatcontrols a:first').click(chat.toggle); + + $('#chatinput').click(function () { + $('#chatinput input').focus(); }); + chat.setupTime(); + chat.setupPosting(); + window.requests.addRefreshFunction(chat.request); var cls = PLAYER.team === 'RESISTANCE' ? 'res' : 'enl'; $('#chatinput mark').addClass(cls); - $(document).on('click', '.nickname', function(event) { - return window.chat.nicknameClicked(event, $(this).text()); + $(document).on('click', '.nickname', function (event) { + return chat.nicknameClicked(event, $(this).text()); }); -} +}; /** * Sets up the time display in the chat input box. * This function updates the time displayed next to the chat input field every minute to reflect the current time. * - * @function window.chat.setupTime + * @function setupTime */ -window.chat.setupTime = function() { +chat.setupTime = function () { var inputTime = $('#chatinput time'); - var updateTime = function() { - if(window.isIdle()) return; + var updateTime = function () { + if (window.isIdle()) return; var d = new Date(); - var h = d.getHours() + ''; if(h.length === 1) h = '0' + h; - var m = d.getMinutes() + ''; if(m.length === 1) m = '0' + m; - inputTime.text(h+':'+m); + var h = d.getHours() + ''; + if (h.length === 1) h = '0' + h; + var m = d.getMinutes() + ''; + if (m.length === 1) m = '0' + m; + inputTime.text(h + ':' + m); // update ON the minute (1ms after) setTimeout(updateTime, (60 - d.getSeconds()) * 1000 + 1); }; updateTime(); window.addResumeFunction(updateTime); -} - +}; // // posting // +/** + * Handles tab completion in chat input. + * + * @function handleTabCompletion + */ +chat.handleTabCompletion = function () { + var el = $('#chatinput input'); + var curPos = el.get(0).selectionStart; + var text = el.val(); + var word = text + .slice(0, curPos) + .replace(/.*\b([a-z0-9-_])/, '$1') + .toLowerCase(); + + var list = $('#chat > div:visible mark'); + list = list.map(function (ind, mark) { + return $(mark).text(); + }); + list = window.uniqueArray(list); + + var nick = null; + for (var i = 0; i < list.length; i++) { + if (!list[i].toLowerCase().startsWith(word)) continue; + if (nick && nick !== list[i]) { + log.warn('More than one nick matches, aborting. (' + list[i] + ' vs ' + nick + ')'); + return; + } + nick = list[i]; + } + if (!nick) { + return; + } + + var posStart = curPos - word.length; + var newText = text.substring(0, posStart); + var atPresent = text.substring(posStart - 1, posStart) === '@'; + newText += (atPresent ? '' : '@') + nick + ' '; + newText += text.substring(curPos); + el.val(newText); +}; + +/** + * Posts a chat message to the currently active chat tab. + * + * @function postMsg + */ +chat.postMsg = function () { + var c = chat.getActive(); + var channel = chat.getChannelDesc(c); + + var msg = $.trim($('#chatinput input').val()); + if (!msg || msg === '') return; + + if (channel.sendMessage) { + $('#chatinput input').val(''); + return channel.sendMessage(c, msg); + } +}; + /** * Sets up the chat message posting functionality. * - * @function window.chat.setupPosting + * @function setupPosting */ -window.chat.setupPosting = function() { - if (!isSmartphone()) { - $('#chatinput input').keydown(function(event) { +chat.setupPosting = function () { + if (!window.isSmartphone()) { + $('#chatinput input').keydown(function (event) { try { - var kc = (event.keyCode ? event.keyCode : event.which); - if(kc === 13) { // enter + var kc = event.keyCode ? event.keyCode : event.which; + if (kc === 13) { + // enter chat.postMsg(); event.preventDefault(); - } else if (kc === 9) { // tab + } else if (kc === 9) { + // tab event.preventDefault(); - window.chat.handleTabCompletion(); + chat.handleTabCompletion(); } } catch (e) { log.error(e); + // if (e.stack) { console.error(e.stack); } } }); } - $('#chatinput').submit(function(event) { + $('#chatinput').submit(function (event) { event.preventDefault(); chat.postMsg(); }); -} +}; /** - * Posts a chat message to the currently active chat tab. + * Legacy function for rendering chat messages. Used for backward compatibility with plugins. * - * @function window.chat.postMsg + * @deprecated + * @function renderMsg + * @param {string} msg - The chat message. + * @param {string} nick - The nickname of the player who sent the message. + * @param {number} time - The timestamp of the message. + * @param {string} team - The team of the player who sent the message. + * @param {boolean} msgToPlayer - Flag indicating if the message is directed to the player. + * @param {boolean} systemNarrowcast - Flag indicating if the message is a system narrowcast. + * @returns {string} The HTML string representing a chat message row. */ -window.chat.postMsg = function() { - var c = chat.getActive(); - if(c == 'alerts') - return alert("Jarvis: A strange game. The only winning move is not to play. How about a nice game of chess?\n(You can't chat to the 'alerts' channel!)"); - - // unknown tab, ignore - if (c !== 'all' && c !== 'faction') { - return; - } - - var msg = $.trim($('#chatinput input').val()); - if(!msg || msg === '') return; - - var latlng = map.getCenter(); - - var data = {message: msg, - latE6: Math.round(latlng.lat*1E6), - lngE6: Math.round(latlng.lng*1E6), - tab: c}; +chat.renderMsg = function (msg, nick, time, team, msgToPlayer, systemNarrowcast) { + // Imitating data usually derived from processing raw chat data + var fakeData = { + guid: 'legacyguid-' + Math.random(), + time: time, + public: !systemNarrowcast, + secure: systemNarrowcast, + alert: msgToPlayer, + msgToPlayer: msgToPlayer, + type: systemNarrowcast ? 'SYSTEM_NARROWCAST' : 'PLAYER_GENERATED', + narrowcast: systemNarrowcast, + auto: false, // Assuming the message is player-generated if it's not a system broadcast + team: team, + player: { + name: nick, + team: team, + }, + markup: [ + ['TEXT', { plain: msg }], // A simple message with no special markup + ], + }; - var errMsg = 'Your message could not be delivered. You can copy&' + - 'paste it here and try again if you want:\n\n' + msg; + // Use existing IITC functions to render a chat message row + return IITC.comm.renderMsgRow(fakeData); +}; - window.postAjax('sendPlext', data, - function(response) { - if(response.error) alert(errMsg); - startRefreshTimeout(0.1*1000); //only chat uses the refresh timer stuff, so a perfect way of forcing an early refresh after a send message - }, - function() { - alert(errMsg); - } - ); +/** + * Legacy function for converts a chat tab name to its corresponding COMM channel name. + * Used for backward compatibility with plugins. + * + * @deprecated + * @function tabToChannel + * @param {string} tab - The name of the chat tab. + * @returns {string} The corresponding channel name ('faction', 'alerts', or 'all'). + */ +chat.tabToChannel = function (tab) { + if (tab === 'faction') return 'faction'; + if (tab === 'alerts') return 'alerts'; + return 'all'; +}; - $('#chatinput input').val(''); -} +/* global log, PLAYER, L, IITC, app */
diff --git a/code_comm.js.html b/code_comm.js.html new file mode 100644 index 000000000..7d1ed8c70 --- /dev/null +++ b/code_comm.js.html @@ -0,0 +1,1011 @@ + + + + + + + Source: code/comm.js | IITC-CE + + + + + + + + + + + + + +
+ +
+ + + + + +
+
+
/**
+ * Namespace for comm-related functionalities.
+ *
+ * @memberof IITC
+ * @namespace comm
+ */
+
+/**
+ * @type {chat.ChannelDescription[]}
+ * @memberof IITC.comm
+ */
+var _channels = [
+  {
+    id: 'all',
+    name: 'All',
+    localBounds: true,
+    inputPrompt: 'broadcast:',
+    inputClass: 'public',
+    request: requestChannel,
+    render: renderChannel,
+    sendMessage: sendChatMessage,
+  },
+  {
+    id: 'faction',
+    name: 'Faction',
+    localBounds: true,
+    inputPrompt: 'tell faction:',
+    inputClass: 'faction',
+    request: requestChannel,
+    render: renderChannel,
+    sendMessage: sendChatMessage,
+  },
+  {
+    id: 'alerts',
+    name: 'Alerts',
+    inputPrompt: 'tell Jarvis:',
+    inputClass: 'alerts',
+    request: requestChannel,
+    render: renderChannel,
+    sendMessage: function () {
+      alert("Jarvis: A strange game. The only winning move is not to play. How about a nice game of chess?\n(You can't comm to the 'alerts' channel!)");
+    },
+  },
+];
+
+/**
+ * Holds data related to each intel channel.
+ *
+ * @type {Object}
+ * @memberof IITC.comm
+ */
+var _channelsData = {};
+
+/**
+ * Initialize the channel data.
+ *
+ * @function IITC.comm._initChannelData
+ * @private
+ * @param {chat.ChannelDescription} id - The channel id.
+ */
+function _initChannelData(id) {
+  // preserve channel object
+  if (!_channelsData[id]) _channelsData[id] = {};
+  _channelsData[id].data = {};
+  _channelsData[id].guids = [];
+  _channelsData[id].oldestTimestamp = -1;
+  delete _channelsData[id].oldestGUID;
+  _channelsData[id].newestTimestamp = -1;
+  delete _channelsData[id].newestGUID;
+}
+
+/**
+ * Template of portal link in comm.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let portalTemplate =
+  '<a onclick="window.selectPortalByLatLng({{ lat }}, {{ lng }});return false" title="{{ title }}" href="{{ url }}" class="help">{{ portal_name }}</a>';
+/**
+ * Template for time cell.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let timeCellTemplate = '<td><time class="{{ class_names }}" title="{{ time_title }}" data-timestamp="{{ unixtime }}">{{ time }}</time></td>';
+/**
+ * Template for player's nickname cell.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let nickCellTemplate = '<td><span class="invisep">&lt;</span><mark class="{{ class_names }}">{{ nick }}</mark><span class="invisep">&gt;</span></td>';
+/**
+ * Template for chat message text cell.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let msgCellTemplate = '<td class="{{ class_names }}">{{ msg }}</td>';
+/**
+ * Template for message row, includes cells for time, player nickname and message text.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let msgRowTemplate = '<tr data-guid="{{ guid }}" class="{{ class_names }}">{{ time_cell }}{{ nick_cell }}{{ msg_cell }}</tr>';
+/**
+ * Template for message divider.
+ * @type {String}
+ * @memberof IITC.comm
+ */
+let dividerTemplate = '<tr class="divider"><td><hr></td><td>{{ text }}</td><td><hr></td></tr>';
+
+/**
+ * Returns the coordinates for the message to be sent, default is the center of the map.
+ *
+ * @function IITC.comm.getLatLngForSendingMessage
+ * @returns {L.LatLng}
+ */
+function getLatLngForSendingMessage() {
+  return map.getCenter();
+}
+
+/**
+ * Updates the oldest and newest message timestamps and GUIDs in the chat storage.
+ *
+ * @function IITC.comm._updateOldNewHash
+ * @private
+ * @param {Object} newData - The new chat data received.
+ * @param {Object} storageHash - The chat storage object.
+ * @param {boolean} isOlderMsgs - Whether the new data contains older messages.
+ * @param {boolean} isAscendingOrder - Whether the new data is in ascending order.
+ */
+function _updateOldNewHash(newData, storageHash, isOlderMsgs, isAscendingOrder) {
+  // track oldest + newest timestamps/GUID
+  if (newData.result.length > 0) {
+    var first = {
+      guid: newData.result[0][0],
+      time: newData.result[0][1],
+    };
+    var last = {
+      guid: newData.result[newData.result.length - 1][0],
+      time: newData.result[newData.result.length - 1][1],
+    };
+    if (isAscendingOrder) {
+      var temp = first;
+      first = last;
+      last = temp;
+    }
+    if (storageHash.oldestTimestamp === -1 || storageHash.oldestTimestamp >= last.time) {
+      if (isOlderMsgs || storageHash.oldestTimestamp !== last.time) {
+        storageHash.oldestTimestamp = last.time;
+        storageHash.oldestGUID = last.guid;
+      }
+    }
+    if (storageHash.newestTimestamp === -1 || storageHash.newestTimestamp <= first.time) {
+      if (!isOlderMsgs || storageHash.newestTimestamp !== first.time) {
+        storageHash.newestTimestamp = first.time;
+        storageHash.newestGUID = first.guid;
+      }
+    }
+  }
+}
+
+/**
+ * Parses comm message data into a more convenient format.
+ *
+ * @function IITC.comm.parseMsgData
+ * @param {Object} data - The raw comm message data.
+ * @returns {Object} The parsed comm message data.
+ */
+function parseMsgData(data) {
+  var categories = data[2].plext.categories;
+  var isPublic = (categories & 1) === 1;
+  var isSecure = (categories & 2) === 2;
+  var msgAlert = (categories & 4) === 4;
+
+  var msgToPlayer = msgAlert && (isPublic || isSecure);
+
+  var time = data[1];
+  var team = window.teamStringToId(data[2].plext.team);
+  var auto = data[2].plext.plextType !== 'PLAYER_GENERATED';
+  var systemNarrowcast = data[2].plext.plextType === 'SYSTEM_NARROWCAST';
+
+  var markup = data[2].plext.markup;
+
+  var player = {
+    name: '',
+    team: team,
+  };
+  markup.forEach(function (ent) {
+    switch (ent[0]) {
+      case 'SENDER': // user generated messages
+        player.name = ent[1].plain.replace(/: $/, ''); // cut “: ” at end
+        break;
+
+      case 'PLAYER': // automatically generated messages
+        player.name = ent[1].plain;
+        player.team = window.teamStringToId(ent[1].team);
+        break;
+
+      default:
+        break;
+    }
+  });
+
+  return {
+    guid: data[0],
+    time: time,
+    public: isPublic,
+    secure: isSecure,
+    alert: msgAlert,
+    msgToPlayer: msgToPlayer,
+    type: data[2].plext.plextType,
+    narrowcast: systemNarrowcast,
+    auto: auto,
+    team: team,
+    player: player,
+    markup: markup,
+  };
+}
+
+/**
+ * Writes new chat data to the chat storage and manages the order of messages.
+ *
+ * @function IITC.comm._writeDataToHash
+ * @private
+ * @param {Object} newData - The new chat data received.
+ * @param {Object} storageHash - The chat storage object.
+ * @param {boolean} isOlderMsgs - Whether the new data contains older messages.
+ * @param {boolean} isAscendingOrder - Whether the new data is in ascending order.
+ */
+function _writeDataToHash(newData, storageHash, isOlderMsgs, isAscendingOrder) {
+  _updateOldNewHash(newData, storageHash, isOlderMsgs, isAscendingOrder);
+
+  newData.result.forEach(function (json) {
+    // avoid duplicates
+    if (json[0] in storageHash.data) {
+      return true;
+    }
+
+    var parsedData = IITC.comm.parseMsgData(json);
+
+    // format: timestamp, autogenerated, HTML message, nick, additional data (parsed, plugin specific data...)
+    storageHash.data[parsedData.guid] = [parsedData.time, parsedData.auto, IITC.comm.renderMsgRow(parsedData), parsedData.player.name, parsedData];
+    if (isAscendingOrder) {
+      storageHash.guids.push(parsedData.guid);
+    } else {
+      storageHash.guids.unshift(parsedData.guid);
+    }
+  });
+}
+
+/**
+ * Posts a chat message to intel comm context.
+ *
+ * @function IITC.comm.sendChatMessage
+ * @param {string} tab intel tab name (either all or faction)
+ * @param {string} msg message to be sent
+ */
+function sendChatMessage(tab, msg) {
+  if (tab !== 'all' && tab !== 'faction') return;
+
+  const latlng = IITC.comm.getLatLngForSendingMessage();
+
+  var data = {
+    message: msg,
+    latE6: Math.round(latlng.lat * 1e6),
+    lngE6: Math.round(latlng.lng * 1e6),
+    tab: tab,
+  };
+
+  var errMsg = 'Your message could not be delivered. You can copy&' + 'paste it here and try again if you want:\n\n' + msg;
+
+  window.postAjax(
+    'sendPlext',
+    data,
+    function (response) {
+      if (response.error) alert(errMsg);
+      window.startRefreshTimeout(0.1 * 1000); // only comm uses the refresh timer stuff, so a perfect way of forcing an early refresh after a send message
+    },
+    function () {
+      alert(errMsg);
+    }
+  );
+}
+
+var _oldBBox = null;
+/**
+ * Generates post data for chat requests.
+ *
+ * @function IITC.comm._genPostData
+ * @private
+ * @param {string} channel - The chat channel.
+ * @param {boolean} getOlderMsgs - Flag to determine if older messages are being requested.
+ * @param args=undefined - Used for backward compatibility when calling a function with three arguments.
+ * @returns {Object} The generated post data.
+ */
+function _genPostData(channel, getOlderMsgs, ...args) {
+  if (typeof channel !== 'string') {
+    throw new Error('API changed: isFaction flag now a channel string - all, faction, alerts');
+  }
+  if (args.length === 1) {
+    getOlderMsgs = args[0];
+  }
+
+  var b = window.clampLatLngBounds(map.getBounds());
+
+  // set a current bounding box if none set so far
+  if (!_oldBBox) _oldBBox = b;
+
+  // to avoid unnecessary comm refreshes, a small difference compared to the previous bounding box
+  // is not considered different
+  var CHAT_BOUNDINGBOX_SAME_FACTOR = 0.1;
+  // if the old and new box contain each other, after expanding by the factor, don't reset comm
+  if (!(b.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(_oldBBox) && _oldBBox.pad(CHAT_BOUNDINGBOX_SAME_FACTOR).contains(b))) {
+    log.log('Bounding Box changed, comm will be cleared (old: ' + _oldBBox.toBBoxString() + '; new: ' + b.toBBoxString() + ')');
+
+    // need to reset these flags now because clearing will only occur
+    // after the request is finished – i.e. there would be one almost
+    // useless request.
+    _channels.forEach(function (entry) {
+      if (entry.localBounds) {
+        _initChannelData(entry.id);
+        $('#chat' + entry.id).data('needsClearing', true);
+      }
+    });
+    _oldBBox = b;
+  }
+
+  if (!_channelsData[channel]) _initChannelData(channel);
+  var storageHash = _channelsData[channel];
+
+  var ne = b.getNorthEast();
+  var sw = b.getSouthWest();
+  var data = {
+    minLatE6: Math.round(sw.lat * 1e6),
+    minLngE6: Math.round(sw.lng * 1e6),
+    maxLatE6: Math.round(ne.lat * 1e6),
+    maxLngE6: Math.round(ne.lng * 1e6),
+    minTimestampMs: -1,
+    maxTimestampMs: -1,
+    tab: channel,
+  };
+
+  if (getOlderMsgs) {
+    // ask for older comm when scrolling up
+    data = $.extend(data, {
+      maxTimestampMs: storageHash.oldestTimestamp,
+      plextContinuationGuid: storageHash.oldestGUID,
+    });
+  } else {
+    // ask for newer comm
+    var min = storageHash.newestTimestamp;
+    // the initial request will have both timestamp values set to -1,
+    // thus we receive the newest 50. After that, we will only receive
+    // messages with a timestamp greater or equal to min above.
+    // After resuming from idle, there might be more new messages than
+    // desiredNumItems. So on the first request, we are not really up to
+    // date. We will eventually catch up, as long as there are less new
+    // messages than 50 per each refresh cycle.
+    // A proper solution would be to query until no more new results are
+    // returned.
+    // Currently this edge case is not handled. Let’s see if this is a
+    // problem in crowded areas.
+    $.extend(data, {
+      minTimestampMs: min,
+      plextContinuationGuid: storageHash.newestGUID,
+    });
+    // when requesting with an actual minimum timestamp, request oldest rather than newest first.
+    // this matches the stock intel site, and ensures no gaps when continuing after an extended idle period
+    if (min > -1) $.extend(data, { ascendingTimestampOrder: true });
+  }
+  return data;
+}
+
+var _requestRunning = {};
+
+/**
+ * Requests chat messages.
+ *
+ * @function IITC.comm.requestChannel
+ * @param {string} channel - Comm Intel channel (all/faction/alerts)
+ * @param {boolean} getOlderMsgs - Flag to determine if older messages are being requested.
+ * @param {boolean} [isRetry=false] - Flag to indicate if this is a retry attempt.
+ */
+function requestChannel(channel, getOlderMsgs, isRetry) {
+  if (_requestRunning[channel] && !isRetry) return;
+  if (window.isIdle()) return window.renderUpdateStatus();
+  _requestRunning[channel] = true;
+  $("#chatcontrols a[data-channel='" + channel + "']").addClass('loading');
+
+  var d = _genPostData(channel, getOlderMsgs);
+  window.postAjax(
+    'getPlexts',
+    d,
+    function (data) {
+      _handleChannel(channel, data, getOlderMsgs, d.ascendingTimestampOrder);
+    },
+    isRetry
+      ? function () {
+          _requestRunning[channel] = false;
+        }
+      : function (_, textStatus) {
+          if (textStatus === 'abort') _requestRunning[channel] = false;
+          else requestChannel(channel, getOlderMsgs, true);
+        }
+  );
+}
+
+/**
+ * Handles faction chat response.
+ *
+ * @function IITC.comm._handleChannel
+ * @private
+ * @param {string} channel - Comm Intel channel (all/faction/alerts)
+ * @param {Object} data - Response data from server.
+ * @param {boolean} olderMsgs - Indicates if older messages were requested.
+ * @param {boolean} ascendingTimestampOrder - Indicates if messages are in ascending timestamp order.
+ */
+function _handleChannel(channel, data, olderMsgs, ascendingTimestampOrder) {
+  _requestRunning[channel] = false;
+  $("#chatcontrols a[data-channel='" + channel + "']").removeClass('loading');
+
+  if (!data || !data.result) {
+    window.failedRequestCount++;
+    return log.warn(channel + ' comm error. Waiting for next auto-refresh.');
+  }
+
+  if (!data.result.length && !$('#chat' + channel).data('needsClearing')) {
+    // no new data and current data in comm._faction.data is already rendered
+    return;
+  }
+
+  $('#chat' + channel).data('needsClearing', null);
+
+  if (!_channelsData[channel]) _initChannelData(channel);
+  var old = _channelsData[channel].oldestGUID;
+  _writeDataToHash(data, _channelsData[channel], olderMsgs, ascendingTimestampOrder);
+  var oldMsgsWereAdded = old !== _channelsData[channel].oldestGUID;
+
+  var hook = channel + 'ChatDataAvailable';
+  // backward compability
+  if (channel === 'all') hook = 'publicChatDataAvailable';
+  window.runHooks(hook, { raw: data, result: data.result, processed: _channelsData[channel].data });
+
+  // generic hook
+  window.runHooks('commDataAvailable', { channel: channel, raw: data, result: data.result, processed: _channelsData[channel].data });
+
+  renderChannel(channel, oldMsgsWereAdded);
+}
+
+/**
+ * Renders intel chat.
+ *
+ * @function IITC.comm.renderChannel
+ * @param {string} channel - Comm Intel channel (all/faction/alerts)
+ * @param {boolean} oldMsgsWereAdded - Indicates if old messages were added in the current rendering.
+ */
+function renderChannel(channel, oldMsgsWereAdded) {
+  if (!_channelsData[channel]) _initChannelData(channel);
+  IITC.comm.renderData(_channelsData[channel].data, 'chat' + channel, oldMsgsWereAdded, _channelsData[channel].guids);
+}
+
+//
+// Rendering primitive for markup, chat cells (td) and chat row (tr)
+//
+
+/**
+ * Renders text for the chat, converting plain text to HTML and adding links.
+ *
+ * @function IITC.comm.renderText
+ * @param {Object} text - An object containing the plain text to render.
+ * @returns {string} The rendered HTML string.
+ */
+function renderText(text) {
+  let content;
+
+  if (text.team) {
+    let teamId = window.teamStringToId(text.team);
+    if (teamId === window.TEAM_NONE) teamId = window.TEAM_MAC;
+    const spanClass = window.TEAM_TO_CSS[teamId];
+    content = $('<div>').append($('<span>', { class: spanClass, text: text.plain }));
+  } else {
+    content = $('<div>').text(text.plain);
+  }
+
+  return content.html().autoLink();
+}
+
+/**
+ * List of transformations for portal names used in chat.
+ * Each transformation function takes the portal markup object and returns a transformed name.
+ * If a transformation does not apply, the original name is returned.
+ *
+ * @const IITC.comm.portalNameTransformations
+ * @example
+ * // Adding a transformation that appends the portal location to its name
+ * portalNameTransformations.push((markup) => {
+ *   const latlng = `${markup.latE6 / 1E6},${markup.lngE6 / 1E6}`; // Convert E6 format to decimal
+ *   return `[${latlng}] ${markup.name}`;
+ * });
+ */
+const portalNameTransformations = [
+  // Transformation for 'US Post Office'
+  (markup) => {
+    if (markup.name === 'US Post Office') {
+      const address = markup.address.split(',');
+      return 'USPS: ' + address[0];
+    }
+    return markup.name;
+  },
+];
+
+/**
+ * Overrides portal names used repeatedly in chat, such as 'US Post Office', with more specific names.
+ * Applies a series of transformations to the portal name based on the portal markup.
+ *
+ * @function IITC.comm.getChatPortalName
+ * @param {Object} markup - An object containing portal markup, including the name and address.
+ * @returns {string} The processed portal name.
+ */
+function getChatPortalName(markup) {
+  // Use reduce to apply each transformation to the data
+  const transformedData = portalNameTransformations.reduce((initialMarkup, transform) => {
+    const updatedName = transform(initialMarkup);
+    return { ...initialMarkup, name: updatedName };
+  }, markup);
+
+  return transformedData.name;
+}
+
+/**
+ * Renders a portal link for use in the chat.
+ *
+ * @function IITC.comm.renderPortal
+ * @param {Object} portal - The portal data.
+ * @returns {string} HTML string of the portal link.
+ */
+function renderPortal(portal) {
+  const lat = portal.latE6 / 1e6;
+  const lng = portal.lngE6 / 1e6;
+  const permalink = window.makePermalink([lat, lng]);
+  const portalName = IITC.comm.getChatPortalName(portal);
+
+  return IITC.comm.portalTemplate
+    .replace('{{ lat }}', lat.toString())
+    .replace('{{ lng }}', lng.toString())
+    .replace('{{ title }}', portal.address)
+    .replace('{{ url }}', permalink)
+    .replace('{{ portal_name }}', portalName);
+}
+
+/**
+ * Renders a faction entity for use in the chat.
+ *
+ * @function IITC.comm.renderFactionEnt
+ * @param {Object} faction - The faction data.
+ * @returns {string} HTML string representing the faction.
+ */
+function renderFactionEnt(faction) {
+  var teamId = window.teamStringToId(faction.team);
+  var name = window.TEAM_NAMES[teamId];
+  var spanClass = window.TEAM_TO_CSS[teamId];
+  return $('<div>').html($('<span>').attr('class', spanClass).text(name)).html();
+}
+
+/**
+ * Renders a player's nickname in chat.
+ *
+ * @function IITC.comm.renderPlayer
+ * @param {Object} player - The player object containing nickname and team.
+ * @param {boolean} at - Whether to prepend '@' to the nickname.
+ * @param {boolean} sender - Whether the player is the sender of a message.
+ * @returns {string} The HTML string representing the player's nickname in chat.
+ */
+function renderPlayer(player, at, sender) {
+  var name = player.plain;
+  if (sender) {
+    name = player.plain.replace(/: $/, '');
+  } else if (at) {
+    name = player.plain.replace(/^@/, '');
+  }
+  var thisToPlayer = name === window.PLAYER.nickname;
+  var spanClass = 'nickname ' + (thisToPlayer ? 'pl_nudge_me' : player.team + ' pl_nudge_player');
+  return $('<div>')
+    .html(
+      $('<span>')
+        .attr('class', spanClass)
+        .text((at ? '@' : '') + name)
+    )
+    .html();
+}
+
+/**
+ * Renders a chat message entity based on its type.
+ *
+ * @function IITC.comm.renderMarkupEntity
+ * @param {Array} ent - The entity array, where the first element is the type and the second element is the data.
+ * @returns {string} The HTML string representing the chat message entity.
+ */
+function renderMarkupEntity(ent) {
+  switch (ent[0]) {
+    case 'TEXT':
+      return IITC.comm.renderText(ent[1]);
+    case 'PORTAL':
+      return IITC.comm.renderPortal(ent[1]);
+    case 'FACTION':
+      return IITC.comm.renderFactionEnt(ent[1]);
+    case 'SENDER':
+      return IITC.comm.renderPlayer(ent[1], false, true);
+    case 'PLAYER':
+      return IITC.comm.renderPlayer(ent[1]);
+    case 'AT_PLAYER':
+      return IITC.comm.renderPlayer(ent[1], true);
+    default:
+  }
+  return $('<div>')
+    .text(ent[0] + ':<' + ent[1].plain + '>')
+    .html();
+}
+
+/**
+ * Renders the markup of a chat message, converting special entities like player names, portals, etc., into HTML.
+ *
+ * @function IITC.comm.renderMarkup
+ * @param {Array} markup - The markup array of a chat message.
+ * @returns {string} The HTML string representing the complete rendered chat message.
+ */
+function renderMarkup(markup) {
+  var msg = '';
+
+  markup.forEach(function (ent, ind) {
+    switch (ent[0]) {
+      case 'SENDER':
+      case 'SECURE':
+        // skip as already handled
+        break;
+
+      case 'PLAYER': // automatically generated messages
+        if (ind > 0) msg += IITC.comm.renderMarkupEntity(ent); // don’t repeat nick directly
+        break;
+
+      default:
+        // add other enitities whatever the type
+        msg += IITC.comm.renderMarkupEntity(ent);
+        break;
+    }
+  });
+  return msg;
+}
+
+/**
+ * List of transformations to be applied to the message data.
+ * Each transformation function takes the full message data object and returns the transformed markup.
+ * The default transformations aim to convert the message markup into an older, more straightforward format,
+ * facilitating easier understanding and backward compatibility with plugins expecting the older message format.
+ *
+ * @const IITC.comm.messageTransformFunctions
+ * @example
+ * // Adding a new transformation function to the array
+ * // This new function adds a "new" prefix to the player's plain text if the player is from the RESISTANCE team
+ * messageTransformFunctions.push((data) => {
+ *   const markup = data.markup;
+ *   if (markup.length > 2 && markup[0][0] === 'PLAYER' && markup[0][1].team === 'RESISTANCE') {
+ *     markup[1][1].plain = 'new ' + markup[1][1].plain;
+ *   }
+ *   return markup;
+ * });
+ */
+const messageTransformFunctions = [
+  // Collapse <faction> + "Link"/"Field".
+  (data) => {
+    const markup = data.markup;
+    if (
+      markup.length > 4 &&
+      markup[3][0] === 'FACTION' &&
+      markup[4][0] === 'TEXT' &&
+      (markup[4][1].plain === ' Link ' || markup[4][1].plain === ' Control Field @')
+    ) {
+      markup[4][1].team = markup[3][1].team;
+      markup.splice(3, 1);
+    }
+    return markup;
+  },
+  // Skip "Agent <player>" at the beginning
+  (data) => {
+    const markup = data.markup;
+    if (markup.length > 1 && markup[0][0] === 'TEXT' && markup[0][1].plain === 'Agent ' && markup[1][0] === 'PLAYER') {
+      markup.splice(0, 2);
+    }
+    return markup;
+  },
+  // Skip "<faction> agent <player>" at the beginning
+  (data) => {
+    const markup = data.markup;
+    if (markup.length > 2 && markup[0][0] === 'FACTION' && markup[1][0] === 'TEXT' && markup[1][1].plain === ' agent ' && markup[2][0] === 'PLAYER') {
+      markup.splice(0, 3);
+    }
+    return markup;
+  },
+];
+
+/**
+ * Applies transformations to the markup array based on the transformations defined in
+ * the {@link IITC.comm.messageTransformFunctions} array.
+ * Assumes all transformations return a new markup array.
+ * May be used to build an entirely new markup to be rendered without altering the original one.
+ *
+ * @function IITC.comm.transformMessage
+ * @param {Object} data - The data for the message, including time, player, and message content.
+ * @returns {Object} The transformed markup array.
+ */
+const transformMessage = (data) => {
+  const initialData = JSON.parse(JSON.stringify(data));
+
+  // Use reduce to apply each transformation to the data
+  const transformedData = messageTransformFunctions.reduce((data, transform) => {
+    const updatedMarkup = transform(data);
+    return { ...data, markup: updatedMarkup };
+  }, initialData);
+
+  return transformedData.markup;
+};
+
+/**
+ * Renders a cell in the chat table to display the time a message was sent.
+ * Formats the time and adds it to a <time> HTML element with a tooltip showing the full date and time.
+ *
+ * @function IITC.comm.renderTimeCell
+ * @param {number} unixtime - The timestamp of the message.
+ * @param {string} classNames - Additional class names to be added to the time cell.
+ * @returns {string} The HTML string representing a table cell with the formatted time.
+ */
+function renderTimeCell(unixtime, classNames) {
+  const time = window.unixTimeToHHmm(unixtime);
+  const datetime = window.unixTimeToDateTimeString(unixtime, true);
+  // add <small> tags around the milliseconds
+  const datetime_title = (datetime.slice(0, 19) + '<small class="milliseconds">' + datetime.slice(19) + '</small>')
+    .replace(/</g, '&lt;')
+    .replace(/>/g, '&gt;')
+    .replace(/"/g, '&quot;');
+
+  return IITC.comm.timeCellTemplate
+    .replace('{{ class_names }}', classNames)
+    .replace('{{ datetime }}', datetime)
+    .replace('{{ time_title }}', datetime_title)
+    .replace('{{ unixtime }}', unixtime.toString())
+    .replace('{{ time }}', time);
+}
+
+/**
+ * Renders a cell in the chat table for a player's nickname.
+ * Wraps the nickname in <mark> HTML element for highlighting.
+ *
+ * @function IITC.comm.renderNickCell
+ * @param {string} nick - The nickname of the player.
+ * @param {string} classNames - Additional class names to be added to the nickname cell.
+ * @returns {string} The HTML string representing a table cell with the player's nickname.
+ */
+function renderNickCell(nick, classNames) {
+  return IITC.comm.nickCellTemplate.replace('{{ class_names }}', classNames).replace('{{ nick }}', nick);
+}
+
+/**
+ * Renders a cell in the chat table for a chat message.
+ * The message is inserted as inner HTML of the table cell.
+ *
+ * @function IITC.comm.renderMsgCell
+ * @param {string} msg - The chat message to be displayed.
+ * @param {string} classNames - Additional class names to be added to the message cell.
+ * @returns {string} The HTML string representing a table cell with the chat message.
+ */
+function renderMsgCell(msg, classNames) {
+  return IITC.comm.msgCellTemplate.replace('{{ class_names }}', classNames).replace('{{ msg }}', msg);
+}
+
+/**
+ * Renders a row for a chat message including time, nickname, and message cells.
+ *
+ * @function IITC.comm.renderMsgRow
+ * @param {Object} data - The data for the message, including time, player, and message content.
+ * @returns {string} The HTML string representing a row in the chat table.
+ */
+function renderMsgRow(data) {
+  var timeClass = data.msgToPlayer ? 'pl_nudge_date' : '';
+  var timeCell = IITC.comm.renderTimeCell(data.time, timeClass);
+
+  var nickClasses = ['nickname'];
+  if (data.player.team === window.TEAM_ENL || data.player.team === window.TEAM_RES) {
+    nickClasses.push(window.TEAM_TO_CSS[data.player.team]);
+  }
+  // highlight things said/done by the player in a unique colour
+  // (similar to @player mentions from others in the chat text itself)
+  if (data.player.name === window.PLAYER.nickname) {
+    nickClasses.push('pl_nudge_me');
+  }
+  var nickCell = IITC.comm.renderNickCell(data.player.name, nickClasses.join(' '));
+
+  const markup = IITC.comm.transformMessage(data);
+  var msg = IITC.comm.renderMarkup(markup);
+  var msgClass = data.narrowcast ? 'system_narrowcast' : '';
+  var msgCell = IITC.comm.renderMsgCell(msg, msgClass);
+
+  var className = '';
+  if (!data.auto && data.public) {
+    className = 'public';
+  } else if (!data.auto && data.secure) {
+    className = 'faction';
+  }
+
+  return IITC.comm.msgRowTemplate
+    .replace('{{ class_names }}', className)
+    .replace('{{ guid }}', data.guid)
+    .replace('{{ time_cell }}', timeCell)
+    .replace('{{ nick_cell }}', nickCell)
+    .replace('{{ msg_cell }}', msgCell);
+}
+
+/**
+ * Renders a divider row in the chat table.
+ *
+ * @function IITC.comm.renderDivider
+ * @param {string} text - Text to display within the divider row.
+ * @returns {string} The HTML string representing a divider row in the chat table.
+ */
+function renderDivider(text) {
+  return IITC.comm.dividerTemplate.replace('{{ text }}', text);
+}
+
+/**
+ * Renders data from the data-hash to the element defined by the given ID.
+ *
+ * @function IITC.comm.renderData
+ * @param {Object} data - Chat data to be rendered.
+ * @param {string} element - ID of the DOM element to render the chat into.
+ * @param {boolean} likelyWereOldMsgs - Flag indicating if older messages are likely to have been added.
+ * @param {Array} sortedGuids - Sorted array of GUIDs representing the order of messages.
+ */
+function renderData(data, element, likelyWereOldMsgs, sortedGuids) {
+  var elm = $('#' + element);
+  if (elm.is(':hidden')) {
+    return;
+  }
+
+  // if sortedGuids is not specified (legacy), sort old to new
+  // (disregarding server order)
+  var vals = sortedGuids;
+  if (vals === undefined) {
+    vals = $.map(data, function (v, k) {
+      return [[v[0], k]];
+    });
+    vals = vals.sort(function (a, b) {
+      return a[0] - b[0];
+    });
+    vals = vals.map(function (v) {
+      return v[1];
+    });
+  }
+
+  // render to string with date separators inserted
+  var msgs = '';
+  var prevTime = null;
+  vals.forEach(function (guid) {
+    var msg = data[guid];
+    if (IITC.comm.declarativeMessageFilter.filterMessage(msg[4])) return;
+    var nextTime = new Date(msg[0]).toLocaleDateString();
+    if (prevTime && prevTime !== nextTime) {
+      msgs += IITC.comm.renderDivider(nextTime);
+    }
+    msgs += msg[2];
+    prevTime = nextTime;
+  });
+
+  var firstRender = elm.is(':empty');
+  var scrollBefore = window.scrollBottom(elm);
+  elm.html('<table>' + msgs + '</table>');
+
+  if (firstRender) {
+    elm.data('needsScrollTop', 99999999);
+  } else {
+    chat.keepScrollPosition(elm, scrollBefore, likelyWereOldMsgs);
+  }
+
+  if (elm.data('needsScrollTop')) {
+    elm.data('ignoreNextScroll', true);
+    elm.scrollTop(elm.data('needsScrollTop'));
+    elm.data('needsScrollTop', null);
+  }
+}
+
+for (const channel of _channels) {
+  _initChannelData(channel.id);
+}
+
+IITC.comm = {
+  channels: _channels,
+  sendChatMessage,
+  parseMsgData,
+  getLatLngForSendingMessage,
+  // List of transformations
+  portalNameTransformations,
+  messageTransformFunctions,
+  // Render primitive, may be override
+  renderMsgRow,
+  renderDivider,
+  renderTimeCell,
+  renderNickCell,
+  renderMsgCell,
+  renderMarkup,
+  transformMessage,
+  renderMarkupEntity,
+  renderPlayer,
+  renderFactionEnt,
+  renderPortal,
+  renderText,
+  getChatPortalName,
+  // templates
+  portalTemplate,
+  timeCellTemplate,
+  nickCellTemplate,
+  msgCellTemplate,
+  msgRowTemplate,
+  dividerTemplate,
+  // exposed API for legacy
+  requestChannel,
+  renderChannel,
+  renderData,
+  _channelsData,
+  _genPostData,
+  _updateOldNewHash,
+  _writeDataToHash,
+};
+
+/* global log, map, chat, IITC */
+
+
+
+ + + + +
+ + + + + + + + + + + diff --git a/code_comm_declarative_message_filter.js.html b/code_comm_declarative_message_filter.js.html new file mode 100644 index 000000000..7a3e908cf --- /dev/null +++ b/code_comm_declarative_message_filter.js.html @@ -0,0 +1,230 @@ + + + + + + + Source: code/comm_declarative_message_filter.js | IITC-CE + + + + + + + + + + + + + +
+ +
+ + + + + +
+
+
/* global IITC */
+
+/**
+ * Declarative message filter for COMM API
+ *
+ * @memberof IITC.comm
+ * @namespace declarativeMessageFilter
+ */
+
+IITC.comm.declarativeMessageFilter = {
+  _rules: {},
+
+  /**
+   * Adds a new filtering rule with a given ID.
+   *
+   * @param {string} id The ID of the rule to add.
+   * @param {Object} rule The rule to add.
+   *
+   * @example
+   * // Hide all messages from Resistance team
+   * IITC.comm.declarativeMessageFilter.addRule({
+   *   id: "hideResistanceTeam1",
+   *   conditions: [
+   *     { field: "player.team", value: "Resistance" },
+   *   ]
+   * });
+   *
+   * @example
+   * // Hide all messages except those from the Resistance team using the inverted rule
+   * IITC.comm.declarativeMessageFilter.addRule({
+   *   id: "hideExceptResistanceTeam",
+   *   conditions: [
+   *     { field: "player.team", value: "Resistance", invert: true },
+   *   ]
+   * });
+   *
+   * @example
+   * // Hide messages that look like spam
+   * IITC.comm.declarativeMessageFilter.addRule({
+   *   id: "hideSpam",
+   *   conditions: [
+   *     { field: "markup[4][1].plain", condition: /ingress-(shop|store)|(store|shop)-ingress/i },
+   *   ]
+   * });
+   */
+  addRule: (id, rule) => {
+    if (IITC.comm.declarativeMessageFilter._rules[id]) {
+      console.warn(`Rule with ID '${id}' already exists. Overwriting.`);
+    }
+    IITC.comm.declarativeMessageFilter._rules[id] = rule;
+  },
+
+  /**
+   * Removes a filtering rule by its ID.
+   *
+   * @param {string} id The ID of the rule to remove.
+   */
+  removeRule: (id) => {
+    if (IITC.comm.declarativeMessageFilter._rules[id]) {
+      delete IITC.comm.declarativeMessageFilter._rules[id];
+    } else {
+      console.error(`No rule found with ID '${id}'.`);
+    }
+  },
+
+  /**
+   * Gets a rule by its ID.
+   *
+   * @param {string} id The ID of the rule to get.
+   * @returns {Object|null} The rule object, or null if not found.
+   */
+  getRuleById: (id) => {
+    return IITC.comm.declarativeMessageFilter._rules[id] || null;
+  },
+
+  /**
+   * Gets all current filtering rules.
+   *
+   * @returns {Object} The current set of filtering rules.
+   */
+  getAllRules: () => {
+    return IITC.comm.declarativeMessageFilter._rules;
+  },
+
+  /**
+   * Extracts the value from the message object by a given path.
+   *
+   * @param {Object} object The message object.
+   * @param {String} path Path to the property in dot notation.
+   * @returns {*} The value of the property at the specified path or undefined if the path is not valid.
+   */
+  getMessageValueByPath: (object, path) => {
+    const parts = path.replace(/\[(\w+)]/g, '.$1').split('.');
+    let current = object;
+
+    for (const part of parts) {
+      if (part in current) {
+        current = current[part];
+      } else {
+        return undefined; // Path is not valid
+      }
+    }
+    return current;
+  },
+
+  /**
+   * Checks if the message matches a single rule.
+   *
+   * @param {Object} message The message to check.
+   * @param {Object} rule The rule to match against.
+   * @returns {boolean} True if the message matches the rule, false otherwise.
+   */
+  matchesRule: (message, rule) => {
+    return rule.conditions.every((condition) => {
+      const messageValue = IITC.comm.declarativeMessageFilter.getMessageValueByPath(message, condition.field);
+      let result;
+
+      if ('value' in condition) {
+        result = messageValue === condition.value;
+      } else if ('pattern' in condition) {
+        const regex = new RegExp(condition.pattern);
+        result = regex.test(messageValue);
+      } else {
+        return false; // If the condition does not contain 'value' or 'pattern', we consider that the message does not match the rule
+      }
+
+      // Invert the result if the condition is inverted
+      if (condition.invert) {
+        return !result;
+      }
+      return result;
+    });
+  },
+
+  /**
+   * Checks if a message matches any of the current filtering rules.
+   *
+   * @param {Object} message The message to check.
+   * @returns {boolean} True if the message matches any rule, false otherwise.
+   */
+  filterMessage: (message) => {
+    const rules = IITC.comm.declarativeMessageFilter.getAllRules();
+    for (const ruleId in rules) {
+      if (IITC.comm.declarativeMessageFilter.matchesRule(message, rules[ruleId])) {
+        return true;
+      }
+    }
+    return false;
+  },
+};
+
+
+
+ + + + +
+ + + + + + + + + + + diff --git a/code_data_cache.js.html b/code_data_cache.js.html index 433a40230..cf88721c7 100644 --- a/code_data_cache.js.html +++ b/code_data_cache.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_dialog.js.html b/code_dialog.js.html index abc9c0183..6ac7dbc94 100644 --- a/code_dialog.js.html +++ b/code_dialog.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_dialog_about.js.html b/code_dialog_about.js.html index 9cb16fd9d..55f5383c7 100644 --- a/code_dialog_about.js.html +++ b/code_dialog_about.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_entity_decode.js.html b/code_entity_decode.js.html index af032a715..9dad9792f 100644 --- a/code_entity_decode.js.html +++ b/code_entity_decode.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_entity_info.js.html b/code_entity_info.js.html index 2fd187766..5eed094b0 100644 --- a/code_entity_info.js.html +++ b/code_entity_info.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_extract_niantic_parameters.js.html b/code_extract_niantic_parameters.js.html index df88d1cd9..48a076d57 100644 --- a/code_extract_niantic_parameters.js.html +++ b/code_extract_niantic_parameters.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_filters.js.html b/code_filters.js.html index e7f07efe6..7b93d4664 100644 --- a/code_filters.js.html +++ b/code_filters.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_game_status.js.html b/code_game_status.js.html index 61eaad1bb..aa22710f0 100644 --- a/code_game_status.js.html +++ b/code_game_status.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_hooks.js.html b/code_hooks.js.html index ca2275582..0daca43f0 100644 --- a/code_hooks.js.html +++ b/code_hooks.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -81,9 +81,10 @@

IITC-CE

* - `fieldRemoved`: Triggered when a field has been removed. * - `portalDetailsUpdated`: Fired after the details in the sidebar have been (re-)rendered. * Provides data about the selected portal. - * - `publicChatDataAvailable`: Runs after data for any of the public chats has been received and processed, - * but not yet displayed. Contains both the unprocessed raw AJAX response - * and the processed chat data that is going to be used for display. + * - `commDataAvailable`: Runs after data for any of the chats has been received and processed, but not yet + * been displayed. The data hash contains both the unprocessed raw ajax response as + * well as the chat data that is going to be used for display. + * - `publicChatDataAvailable`: Similar to `chatDataAvailable`, but for all chat only. * - `factionChatDataAvailable`: Similar to `publicChatDataAvailable`, but for faction chat. * - `alertsChatDataAvailable`: Similar to `publicChatDataAvailable`, but for alerts chat. * - `requestFinished`: **Deprecated**. Recommended to use `mapDataRefreshEnd` instead. diff --git a/code_idle.js.html b/code_idle.js.html index 70614a8ed..d6867add0 100644 --- a/code_idle.js.html +++ b/code_idle.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_layerchooser.js.html b/code_layerchooser.js.html index d781a69d3..67645a5a1 100644 --- a/code_layerchooser.js.html +++ b/code_layerchooser.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_map.js.html b/code_map.js.html index 01eb38f0d..cca24dd5d 100644 --- a/code_map.js.html +++ b/code_map.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_map_data_calc_tools.js.html b/code_map_data_calc_tools.js.html index 4eff7555f..928ae1efa 100644 --- a/code_map_data_calc_tools.js.html +++ b/code_map_data_calc_tools.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_map_data_debug.js.html b/code_map_data_debug.js.html index 97ea02976..a8eadfda3 100644 --- a/code_map_data_debug.js.html +++ b/code_map_data_debug.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_map_data_render.js.html b/code_map_data_render.js.html index d5a3474c5..edac150d8 100644 --- a/code_map_data_render.js.html +++ b/code_map_data_render.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_map_data_request.js.html b/code_map_data_request.js.html index bd269f9bc..7a57c52be 100644 --- a/code_map_data_request.js.html +++ b/code_map_data_request.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -342,10 +342,7 @@

IITC-CE

this.render.startRenderPass(dataBounds); - window.runHooks ('mapDataEntityInject', {callback: this.render.processGameEntities.bind(this.render)}); - - - this.render.processGameEntities(artifact.getArtifactEntities(), 'summary'); + window.runHooks('mapDataEntityInject', { callback: this.render.processGameEntities.bind(this.render) }); var logMessage = 'requesting data tiles at zoom '+dataZoom; logMessage += ' (L'+tileParams.level+'+ portals'; diff --git a/code_ornaments.js.html b/code_ornaments.js.html index b1a119986..95aa4bdc3 100644 --- a/code_ornaments.js.html +++ b/code_ornaments.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_panes.js.html b/code_panes.js.html index 7a89fa45e..b6ccaad78 100644 --- a/code_panes.js.html +++ b/code_panes.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -73,20 +73,19 @@

IITC-CE

runHooks("paneChanged", id); - switch(id) { - case 'all': - case 'faction': - case 'alerts': - window.chat.show(id); - break; - case 'map': - window.smartphone.mapButton.click(); - $('#portal_highlight_select').show(); - $('#farm_level_select').show(); - break; - case 'info': - window.smartphone.sideButton.click(); - break; + // look for comm tab first + if (window.chat.getChannelDesc(id)) window.chat.show(id); + else { + switch (id) { + case 'map': + window.smartphone.mapButton.click(); + $('#portal_highlight_select').show(); + $('#farm_level_select').show(); + break; + case 'info': + window.smartphone.sideButton.click(); + break; + } } } diff --git a/code_player_names.js.html b/code_player_names.js.html index acad06dd9..25e70f164 100644 --- a/code_player_names.js.html +++ b/code_player_names.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -62,11 +62,12 @@

IITC-CE

* @param {string} name - The player name to check. * @returns {boolean} Returns `true` if the player name is a system account, otherwise `false`. */ -window.isSystemPlayer = function(name) { +window.isSystemPlayer = function (name) { switch (name) { case '__ADA__': case '__JARVIS__': + case '__MACHINA__': return true; default: diff --git a/code_portal_data.js.html b/code_portal_data.js.html index 1ee09c819..0a27e5ede 100644 --- a/code_portal_data.js.html +++ b/code_portal_data.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_detail.js.html b/code_portal_detail.js.html index 9f69f0f5d..70b694470 100644 --- a/code_portal_detail.js.html +++ b/code_portal_detail.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_detail_display.js.html b/code_portal_detail_display.js.html index eaf702eb3..22efbeecb 100644 --- a/code_portal_detail_display.js.html +++ b/code_portal_detail_display.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_detail_display_tools.js.html b/code_portal_detail_display_tools.js.html index 1eb7f0e97..ca5f8b9e3 100644 --- a/code_portal_detail_display_tools.js.html +++ b/code_portal_detail_display_tools.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_highlighter.js.html b/code_portal_highlighter.js.html index 2d1bdd980..dcdda7e4e 100644 --- a/code_portal_highlighter.js.html +++ b/code_portal_highlighter.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_info.js.html b/code_portal_info.js.html index 7f5f74304..2ed365aff 100644 --- a/code_portal_info.js.html +++ b/code_portal_info.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_portal_marker.js.html b/code_portal_marker.js.html index d867561e0..516462d55 100644 --- a/code_portal_marker.js.html +++ b/code_portal_marker.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_redeeming.js.html b/code_redeeming.js.html index ad09423c7..617be06f4 100644 --- a/code_redeeming.js.html +++ b/code_redeeming.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_region_scoreboard.js.html b/code_region_scoreboard.js.html index e821ea45e..9ca2a8a42 100644 --- a/code_region_scoreboard.js.html +++ b/code_region_scoreboard.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_request_handling.js.html b/code_request_handling.js.html index fa18f5f5d..3e7776382 100644 --- a/code_request_handling.js.html +++ b/code_request_handling.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -107,8 +107,6 @@

IITC-CE

window.activeRequests = []; window.failedRequestCount = 0; - window.chat._requestPublicRunning = false; - window.chat._requestFactionRunning = false; renderUpdateStatus(); } diff --git a/code_search.js.html b/code_search.js.html index dc801fc80..9f0bdcab0 100644 --- a/code_search.js.html +++ b/code_search.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_send_request.js.html b/code_send_request.js.html index ffe0ca878..67875f408 100644 --- a/code_send_request.js.html +++ b/code_send_request.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_sidebar.js.html b/code_sidebar.js.html index 4854d9b47..f1a309869 100644 --- a/code_sidebar.js.html +++ b/code_sidebar.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_smartphone.js.html b/code_smartphone.js.html index 7d4ef284a..5050b3f80 100644 --- a/code_smartphone.js.html +++ b/code_smartphone.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_status_bar.js.html b/code_status_bar.js.html index fdf4c9feb..91419e4ee 100644 --- a/code_status_bar.js.html +++ b/code_status_bar.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_toolbox.js.html b/code_toolbox.js.html index a2ab76476..ada06ea79 100644 --- a/code_toolbox.js.html +++ b/code_toolbox.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_utils_file.js.html b/code_utils_file.js.html index d11abb8a3..1172722c6 100644 --- a/code_utils_file.js.html +++ b/code_utils_file.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
diff --git a/code_utils_misc.js.html b/code_utils_misc.js.html index c62127d14..4ad030823 100644 --- a/code_utils_misc.js.html +++ b/code_utils_misc.js.html @@ -36,7 +36,7 @@

IITC-CE

- +
@@ -583,11 +583,13 @@

IITC-CE

return url + '?' + args.join('&'); }; -Object.defineProperty(String.prototype, 'capitalize', { - value: function() { - return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); - } -}); +if (!String.prototype.capitalize) { + Object.defineProperty(String.prototype, 'capitalize', { + value: function () { + return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); + }, + }); +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#polyfill if (!String.prototype.startsWith) { diff --git a/config_options.html b/config_options.html index 8c0253ca8..f36877aff 100644 --- a/config_options.html +++ b/config_options.html @@ -34,7 +34,7 @@

IITC-CE

- +
@@ -127,7 +127,7 @@

@@ -207,7 +207,7 @@

@@ -287,7 +287,7 @@

@@ -366,7 +366,7 @@

@@ -445,7 +445,7 @@

@@ -526,7 +526,7 @@

@@ -605,7 +605,7 @@

@@ -802,7 +802,7 @@

@@ -881,7 +881,7 @@

@@ -960,7 +960,7 @@

@@ -1039,7 +1039,7 @@

@@ -1118,7 +1118,7 @@

@@ -1197,7 +1197,7 @@

@@ -1276,7 +1276,7 @@

@@ -1355,7 +1355,7 @@

@@ -1434,7 +1434,7 @@

@@ -1513,7 +1513,7 @@

@@ -1592,7 +1592,7 @@

@@ -1671,7 +1671,7 @@

@@ -1750,7 +1750,7 @@

diff --git a/global.html b/global.html index 0718cf786..23d1d895c 100644 --- a/global.html +++ b/global.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/index.html b/index.html index 59daa7bd0..a7870f39c 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/ingress_constants.html b/ingress_constants.html index 13c74a413..eb3203553 100644 --- a/ingress_constants.html +++ b/ingress_constants.html @@ -34,7 +34,7 @@

IITC-CE

- +
@@ -128,7 +128,7 @@

@@ -207,7 +207,7 @@

@@ -286,7 +286,7 @@

@@ -365,7 +365,7 @@

@@ -444,7 +444,7 @@

@@ -523,7 +523,7 @@

@@ -602,7 +602,7 @@ @@ -681,7 +681,7 @@

@@ -760,7 +760,7 @@

@@ -839,7 +839,7 @@ @@ -918,7 +918,7 @@

@@ -997,7 +997,7 @@

@@ -1076,7 +1076,7 @@

@@ -1155,7 +1155,7 @@

@@ -1234,7 +1234,7 @@

@@ -1313,7 +1313,7 @@

diff --git a/module-_deprecated.html b/module-_deprecated.html index 1b3187d3a..ccb5bb2fe 100644 --- a/module-_deprecated.html +++ b/module-_deprecated.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-app.html b/module-app.html index d60cc4721..b788d4465 100644 --- a/module-app.html +++ b/module-app.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-boot.html b/module-boot.html index 9ed0a0c5f..1d6f74234 100644 --- a/module-boot.html +++ b/module-boot.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-chat.html b/module-chat.html new file mode 100644 index 000000000..024746aba --- /dev/null +++ b/module-chat.html @@ -0,0 +1,5011 @@ + + + + + Module: chat | IITC-CE + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ +

chat

+ + + + +
+ +
+ +
+ + +

Namespace for chat-related functionalities.

+ + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+ + + + + + + + + + + + + + + +

Members

+ +
+ + +
+

+ static chat.channels :Array.<ChannelDescription> + + + +

+ + +
+
+ +
+

Holds channels infos.

+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+ + + +

Methods

+ +
+ + +
+ +

+ + inner addChannel(channelDesc) + + + + +

+ + + +
+
+ + +
+

Add to the channel list a new channel description

+

If tabs are already created, a tab is created for this channel as well

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channelDesc + + +ChannelDescription + + + +

channel description

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner addNickname(nick) + + + + +

+ + + +
+
+ + +
+

Adds a nickname to the chat input.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nick + + +string + + + +

The nickname to add.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner backgroundChannelData(instance, channel, flag) + + + + +

+ + + +
+
+ + +
+

Allows plugins to request and monitor COMM data streams in the background. This is useful for plugins +that need to process COMM data even when the user is not actively viewing the COMM channels. +It tracks the requested channels for each plugin instance and updates the global state accordingly.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
instance + + +string + + + +

A unique identifier for the plugin or instance requesting background COMM data.

channel + + +string + + + +

The name of the COMM channel ('all', 'faction', or 'alerts').

flag + + +boolean + + + +

Set to true to request data for the specified channel, false to stop requesting.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner chooser(event) + + + + +

+ + + +
+
+ + +
+

Chat tab chooser handler. +This function is triggered by a click event on the chat tab. It reads the tab name from the event target +and activates the corresponding chat tab.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +Event + + + +

The event triggered by clicking a chat tab.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner chooseTab(tab) + + + + +

+ + + +
+
+ + +
+

Chooses and activates a specified chat tab. +Also triggers an early refresh of the chat data when switching tabs.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tab + + +string + + + +

The name of the chat tab to activate ('all', 'faction', or 'alerts').

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner getActive() → {string} + + + + +

+ + + +
+
+ + +
+

Gets the name of the active chat tab.

+
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The name of the active chat tab.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner getChannelDesc(tab) → {ChannelDescription} + + + + +

+ + + +
+
+ + +
+

Converts a chat tab name to its corresponding channel object.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tab + + +string + + + +

The name of the chat tab.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +ChannelDescription + + + + + +-

The corresponding channel name ('faction', 'alerts', or 'all').

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner handleTabCompletion() + + + + +

+ + + +
+
+ + +
+

Handles tab completion in chat input.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner keepScrollPosition(box, scrollBefore, isOldMsgs) + + + + +

+ + + +
+
+ + +
+

Maintains the scroll position of a chat box when new messages are added. +This function is designed to keep the scroll position fixed when old messages are loaded, and to automatically scroll +to the bottom when new messages are added if the user is already at the bottom of the chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
box + + +jQuery + + + +

The jQuery object of the chat box.

scrollBefore + + +number + + + +

The scroll position before new messages were added.

isOldMsgs + + +boolean + + + +

Indicates if the added messages are older messages.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner needMoreMessages() + + + + +

+ + + +
+
+ + +
+

Checks if the currently selected chat tab needs more messages. +This function is triggered by scroll events and loads older messages when the user scrolls to the top.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner nicknameClicked(event, nickname) → {boolean} + + + + +

+ + + +
+
+ + +
+

Handles click events on nicknames in the chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + +Event + + + +

The click event.

nickname + + +string + + + +

The clicked nickname.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +boolean + + + + + +-

Always returns false.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner postMsg() + + + + +

+ + + +
+
+ + +
+

Posts a chat message to the currently active chat tab.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner renderAlerts(oldMsgsWereAdded) + + + + +

+ + + +
+
+ + +
+

Renders alerts chat in the UI.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
oldMsgsWereAdded + + +boolean + + + +

Indicates if older messages were added to the chat.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner renderFaction(oldMsgsWereAdded) + + + + +

+ + + +
+
+ + +
+

Renders faction chat.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
oldMsgsWereAdded + + +boolean + + + +

Indicates if old messages were added in the current rendering.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner renderMsg(msg, nick, time, team, msgToPlayer, systemNarrowcast) → {string} + + + + +

+ + + +
+
+ + +
+

Legacy function for rendering chat messages. Used for backward compatibility with plugins.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
msg + + +string + + + +

The chat message.

nick + + +string + + + +

The nickname of the player who sent the message.

time + + +number + + + +

The timestamp of the message.

team + + +string + + + +

The team of the player who sent the message.

msgToPlayer + + +boolean + + + +

Flag indicating if the message is directed to the player.

systemNarrowcast + + +boolean + + + +

Flag indicating if the message is a system narrowcast.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The HTML string representing a chat message row.

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner renderPublic(oldMsgsWereAdded) + + + + +

+ + + +
+
+ + +
+

Renders public chat in the UI.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
oldMsgsWereAdded + + +boolean + + + +

Indicates if older messages were added to the chat.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner request() + + + + +

+ + + +
+
+ + +
+

Requests chat messages for the currently active chat tab and background channels. +It calls the appropriate request function based on the active tab or background channels.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner requestAlerts(getOlderMsgs, isRetryopt) + + + + +

+ + + +
+
+ + +
+

Initiates a request for alerts chat data.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
getOlderMsgs + + +boolean + + + + + + + + + + + +

Whether to retrieve older messages.

isRetry + + +boolean + + + + + + <optional>
+ + + + + +
+ + false + +

Whether the request is a retry.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner requestFaction(getOlderMsgs, isRetryopt) + + + + +

+ + + +
+
+ + +
+

Requests faction chat messages.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
getOlderMsgs + + +boolean + + + + + + + + + + + +

Flag to determine if older messages are being requested.

isRetry + + +boolean + + + + + + <optional>
+ + + + + +
+ + false + +

Flag to indicate if this is a retry attempt.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner requestPublic(getOlderMsgs, isRetryopt) + + + + +

+ + + +
+
+ + +
+

Initiates a request for public chat data.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
getOlderMsgs + + +boolean + + + + + + + + + + + +

Whether to retrieve older messages.

isRetry + + +boolean + + + + + + <optional>
+ + + + + +
+ + false + +

Whether the request is a retry.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner setup() + + + + +

+ + + +
+
+ + +
+

Sets up the chat interface.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner setupPosting() + + + + +

+ + + +
+
+ + +
+

Sets up the chat message posting functionality.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner setupTabs(channelDesc) + + + + +

+ + + +
+
+ + +
+

Sets up all channels starting from intel COMM

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channelDesc + + +ChannelDescription + + + +

channel description

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner setupTime() + + + + +

+ + + +
+
+ + +
+

Sets up the time display in the chat input box. +This function updates the time displayed next to the chat input field every minute to reflect the current time.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner show(name) + + + + +

+ + + +
+
+ + +
+

Displays the chat interface and activates a specified chat tab.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + +

The name of the chat tab to show and activate.

+ +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner tabToChannel(tab) → {string} + + + + +

+ + + +
+
+ + +
+

Legacy function for converts a chat tab name to its corresponding COMM channel name. +Used for backward compatibility with plugins.

+
+ + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
tab + + +string + + + +

The name of the chat tab.

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +string + + + + + +-

The corresponding channel name ('faction', 'alerts', or 'all').

+ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Yes
+ + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + inner toggle() + + + + +

+ + + +
+
+ + +
+

Toggles the chat window between expanded and collapsed states. +When expanded, the chat window covers a larger area of the screen. +This function also ensures that the chat is scrolled to the bottom when collapsed.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ + + +

Type Definitions

+ +
+ + +
+

+ ChannelDescription + + + +

+ + +
+
+ +
+

Hold channel description

+

See comm.js for examples

+
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
id + + +string + + + + + + + +

uniq id, matches 'tab' parameter for server requests

name + + +string + + + + + + + +

visible name

inputPrompt + + +string + + + + + + <optional>
+ + + +

(optional) string for the input prompt

inputClass + + +string + + + + + + <optional>
+ + + +

(optional) class to apply to #chatinput

sendMessage + + +ChannelSendMessageFn + + + + + + <optional>
+ + + +

(optional) function to send the message

request + + +ChannelRequestFn + + + + + + <optional>
+ + + +

(optional) function to call to request new message

render + + +ChannelRenderFn + + + + + + <optional>
+ + + +

(optional) function to render channel content,, called on tab change

localBounds + + +boolean + + + + + + <optional>
+ + + +

(optional) if true, reset on view change

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + +
+ +

+ + ChannelRenderFn(id, oldMsgsWereAdded) → {void} + + + + +

+ + + +
+
+ + + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

channel id

oldMsgsWereAdded + + +boolean + + + +

true if data has been added at the top (to preserve scroll position)

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +void + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + ChannelRequestFn(id, getOlderMsgs, isRetry) → {void} + + + + +

+ + + +
+
+ + + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

channel id

getOlderMsgs + + +boolean + + + +

true if request data from a scroll to top

isRetry + + +boolean + + + +
+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +void + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +

+ + ChannelSendMessageFn(id, message) → {void} + + + + +

+ + + +
+
+ + + + + + + + + + +
+
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +

channel id

message + + +string + + + +

input message

+ +
+ + + + + + + + + + + + + +
+
Returns:
+ + + + + +void + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ + + +
+ +
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/module-dialog.html b/module-dialog.html index 616aa3f28..8b9d48bab 100644 --- a/module-dialog.html +++ b/module-dialog.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-dialog_about.html b/module-dialog_about.html index acaf0ddf9..3ff402dad 100644 --- a/module-dialog_about.html +++ b/module-dialog_about.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-entity_decode.html b/module-entity_decode.html index f9beb95e5..8a6e3fbce 100644 --- a/module-entity_decode.html +++ b/module-entity_decode.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-entity_info.html b/module-entity_info.html index ae580c1ce..95610ce9b 100644 --- a/module-entity_info.html +++ b/module-entity_info.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-extract_niantic_parameters.html b/module-extract_niantic_parameters.html index 4b2835d6d..d753392dd 100644 --- a/module-extract_niantic_parameters.html +++ b/module-extract_niantic_parameters.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-game_status.html b/module-game_status.html index 05cd8fd17..f18012ade 100644 --- a/module-game_status.html +++ b/module-game_status.html @@ -34,7 +34,7 @@

IITC-CE

- +
diff --git a/module-hooks.html b/module-hooks.html index 21cee11fc..07695ab06 100644 --- a/module-hooks.html +++ b/module-hooks.html @@ -34,7 +34,7 @@

IITC-CE

- +
@@ -90,9 +90,10 @@

hooks

  • fieldRemoved: Triggered when a field has been removed.
  • portalDetailsUpdated: Fired after the details in the sidebar have been (re-)rendered. Provides data about the selected portal.
  • -
  • publicChatDataAvailable: Runs after data for any of the public chats has been received and processed, -but not yet displayed. Contains both the unprocessed raw AJAX response -and the processed chat data that is going to be used for display.
  • +
  • commDataAvailable: Runs after data for any of the chats has been received and processed, but not yet +been displayed. The data hash contains both the unprocessed raw ajax response as +well as the chat data that is going to be used for display.
  • +
  • publicChatDataAvailable: Similar to chatDataAvailable, but for all chat only.
  • factionChatDataAvailable: Similar to publicChatDataAvailable, but for faction chat.
  • alertsChatDataAvailable: Similar to publicChatDataAvailable, but for alerts chat.
  • requestFinished: Deprecated. Recommended to use mapDataRefreshEnd instead. @@ -215,7 +216,7 @@

    @@ -377,7 +378,7 @@

    @@ -540,7 +541,7 @@

    diff --git a/module-idle.html b/module-idle.html index a4e54cad0..31c67d106 100644 --- a/module-idle.html +++ b/module-idle.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-map.html b/module-map.html index 5ee716da1..977e2c086 100644 --- a/module-map.html +++ b/module-map.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-map_data_calc_tools.html b/module-map_data_calc_tools.html index a02663ce1..5e67069a7 100644 --- a/module-map_data_calc_tools.html +++ b/module-map_data_calc_tools.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-panes.html b/module-panes.html index 7b30228f5..16df39483 100644 --- a/module-panes.html +++ b/module-panes.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    @@ -251,7 +251,7 @@

    diff --git a/module-player_names.html b/module-player_names.html index 573e4d124..26ecd600d 100644 --- a/module-player_names.html +++ b/module-player_names.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_data.html b/module-portal_data.html index db92ecad4..3f6ee0f2e 100644 --- a/module-portal_data.html +++ b/module-portal_data.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_detail_display.html b/module-portal_detail_display.html index 67be908bd..38f722efe 100644 --- a/module-portal_detail_display.html +++ b/module-portal_detail_display.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_detail_display_tools.html b/module-portal_detail_display_tools.html index 3e932b9a0..d9e783803 100644 --- a/module-portal_detail_display_tools.html +++ b/module-portal_detail_display_tools.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_highlighter.html b/module-portal_highlighter.html index 5ca36bb05..6f18781c9 100644 --- a/module-portal_highlighter.html +++ b/module-portal_highlighter.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_info.html b/module-portal_info.html index 5f7bba191..fc293194d 100644 --- a/module-portal_info.html +++ b/module-portal_info.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-portal_marker.html b/module-portal_marker.html index d6743fe4f..496ac741b 100644 --- a/module-portal_marker.html +++ b/module-portal_marker.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-redeeming.html b/module-redeeming.html index 0f8679aa4..3617631f5 100644 --- a/module-redeeming.html +++ b/module-redeeming.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-region_scoreboard-RegionScore.html b/module-region_scoreboard-RegionScore.html index 7bb27f1e5..a8a1edaba 100644 --- a/module-region_scoreboard-RegionScore.html +++ b/module-region_scoreboard-RegionScore.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-region_scoreboard.html b/module-region_scoreboard.html index eedcd6307..4154da085 100644 --- a/module-region_scoreboard.html +++ b/module-region_scoreboard.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-request_handling.html b/module-request_handling.html index 474a049fe..861260323 100644 --- a/module-request_handling.html +++ b/module-request_handling.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    @@ -169,7 +169,7 @@

    diff --git a/module-send_request.html b/module-send_request.html index ccb2a8dca..e6480fe00 100644 --- a/module-send_request.html +++ b/module-send_request.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-sidebar.html b/module-sidebar.html index fa92af8c1..a02fae27c 100644 --- a/module-sidebar.html +++ b/module-sidebar.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-smartphone.html b/module-smartphone.html index 766a57ff8..1ab33dd46 100644 --- a/module-smartphone.html +++ b/module-smartphone.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-status_bar.html b/module-status_bar.html index 74ea32951..6fd67b6b9 100644 --- a/module-status_bar.html +++ b/module-status_bar.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-utils_file.html b/module-utils_file.html index 9c6bb6ded..00920ea40 100644 --- a/module-utils_file.html +++ b/module-utils_file.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/module-utils_misc.html b/module-utils_misc.html index aad5297b5..db64dc2a2 100644 --- a/module-utils_misc.html +++ b/module-utils_misc.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/other_constants.html b/other_constants.html index c8579e281..efe6e67ba 100644 --- a/other_constants.html +++ b/other_constants.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    @@ -127,7 +127,7 @@

    @@ -202,7 +202,7 @@

    @@ -277,7 +277,7 @@

    @@ -352,7 +352,7 @@

    @@ -427,7 +427,7 @@

    @@ -502,7 +502,7 @@

    @@ -577,7 +577,7 @@

    @@ -652,7 +652,7 @@

    @@ -727,7 +727,7 @@

    @@ -802,7 +802,7 @@

    @@ -877,7 +877,7 @@

    @@ -952,7 +952,7 @@

    @@ -1027,7 +1027,7 @@

    @@ -1102,7 +1102,7 @@

    @@ -1177,7 +1177,7 @@

    @@ -1252,7 +1252,7 @@

    diff --git a/player.html b/player.html index 1443fcd2c..e9a13b630 100644 --- a/player.html +++ b/player.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    diff --git a/storage_variables.html b/storage_variables.html index c11bd9343..bcc24e932 100644 --- a/storage_variables.html +++ b/storage_variables.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    @@ -128,7 +128,7 @@

    @@ -209,7 +209,7 @@ @@ -290,7 +290,7 @@

    @@ -372,7 +372,7 @@

    @@ -454,7 +454,7 @@

    @@ -535,7 +535,7 @@

    @@ -617,7 +617,7 @@

    @@ -699,7 +699,7 @@

    @@ -781,7 +781,7 @@

    diff --git a/total-conversion-build.js.html b/total-conversion-build.js.html index 42344d8ed..e08f2c383 100644 --- a/total-conversion-build.js.html +++ b/total-conversion-build.js.html @@ -36,7 +36,7 @@

    IITC-CE

    - +
    @@ -170,13 +170,19 @@

    IITC-CE

    // remove complete page. We only wanted the user-data and the page’s // security context so we can access the API easily. Setup as much as // possible without requiring scripts. -document.head.innerHTML = '' - + '<title>Ingress Intel Map</title>' - + '<style>'+'@include_string:style.css@'+'</style>' - + '<style>'+'@include_css:external/leaflet.css@'+'</style>' - + '<style>'+'@include_css:external/jquery-ui-1.12.1-resizable.css@'+'</style>' +document.head.innerHTML = + '<title>Ingress Intel Map</title>' + + '<style>' + + '@include_string:style.css@' + + '</style>' + + '<style>' + + '@include_css:external/leaflet.css@' + + '</style>' + + '<style>' + + '@include_css:external/jquery-ui-1.12.1-resizable.css@' + + '</style>' + //note: smartphone.css injection moved into code/smartphone.js - + '<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:100,100italic,300,300italic,400,400italic,500,500italic,700,700italic&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic"/>'; + '<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:100,100italic,300,300italic,400,400italic,500,500italic,700,700italic&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic"/>'; // remove body element entirely to remove event listeners document.body = document.createElement('body'); @@ -184,15 +190,8 @@

    IITC-CE

    '<div id="map">Loading, please wait</div>' + '<div id="chatcontrols" style="display:none">' + '<a accesskey="0" title="[0]"><span class="toggle"></span></a>' + - '<a accesskey="1" title="[1]">all</a>' + - '<a accesskey="2" title="[2]" class="active">faction</a>' + - '<a accesskey="3" title="[3]">alerts</a>' + - '</div>' + - '<div id="chat" style="display:none">' + - ' <div id="chatfaction"></div>' + - ' <div id="chatall"></div>' + - ' <div id="chatalerts"></div>' + '</div>' + + '<div id="chat" style="display:none"></div>' + '<form id="chatinput" style="display:none"><table><tr>' + ' <td><time></time></td>' + ' <td><mark>tell faction:</mark></td>' + diff --git a/window.artifact.html b/window.artifact.html index 1028bb2fe..f243ff46f 100644 --- a/window.artifact.html +++ b/window.artifact.html @@ -34,7 +34,7 @@

    IITC-CE

    - +
    @@ -141,7 +141,7 @@

    @@ -201,6 +201,145 @@

    + + + + + + + + + + + + + + + + + + + + +
    + +

    + + static entityInject(data) + + + + +

    + + + +
    +
    + + +
    +

    Inject artifact portals into render process

    +
    + + + + + + + + + +
    +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    data + + +hookdata + + + +
    + +
    + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + @@ -230,7 +369,7 @@

    @@ -278,7 +417,8 @@
    Returns:
    --

    An array of artifact entities.

    +-

    array of Portal entities with shards or shard targets

    +

    unused by IITC

    @@ -340,7 +480,7 @@

    @@ -450,7 +590,7 @@

    @@ -560,7 +700,7 @@

    @@ -685,6 +825,7 @@
    Returns:
    -

    Artifact data for the specified portal and type, or undefined if not available.

    +

    unused by IITC

    @@ -746,7 +887,7 @@

    @@ -885,7 +1026,7 @@

    @@ -1024,7 +1165,7 @@

    @@ -1113,7 +1254,7 @@

    @@ -1273,7 +1414,7 @@

    @@ -1433,7 +1574,7 @@

    @@ -1572,7 +1713,7 @@

    @@ -1711,7 +1852,7 @@

    @@ -1889,7 +2030,7 @@

    @@ -1978,7 +2119,7 @@

    diff --git a/window.chat.html b/window.chat.html deleted file mode 100644 index e440f08da..000000000 --- a/window.chat.html +++ /dev/null @@ -1,7519 +0,0 @@ - - - - - Namespace: window.chat | IITC-CE - - - - - - - - - - - - - -
    - -
    - - - - - -
    - -
    - -

    window.chat

    - - -
    - -
    - -
    - - -

    Namespace for chat-related functionalities.

    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - - - - - - - - - - - - -

    Members

    - -
    - - -
    -

    - static _alerts :Object - - - -

    - - -
    -
    - -
    -

    Holds data related to alerts chat.

    -
    - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    - - - - -
    -

    - static _faction :Object - - - -

    - - -
    -
    - -
    -

    Holds data related to faction chat.

    -
    - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    - - - - -
    -

    - static _public :Object - - - -

    - - -
    -
    - -
    -

    Holds data related to public chat.

    -
    - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    - -
    - - - -

    Methods

    - -
    - - -
    - -

    - - static addNickname(nick) - - - - -

    - - - -
    -
    - - -
    -

    Adds a nickname to the chat input.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    nick - - -string - - - -

    The nickname to add.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static backgroundChannelData(instance, channel, flag) - - - - -

    - - - -
    -
    - - -
    -

    Allows plugins to request and monitor COMM data streams in the background. This is useful for plugins -that need to process COMM data even when the user is not actively viewing the COMM channels. -It tracks the requested channels for each plugin instance and updates the global state accordingly.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    instance - - -string - - - -

    A unique identifier for the plugin or instance requesting background COMM data.

    channel - - -string - - - -

    The name of the COMM channel ('all', 'faction', or 'alerts').

    flag - - -boolean - - - -

    Set to true to request data for the specified channel, false to stop requesting.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static chooser(event) - - - - -

    - - - -
    -
    - - -
    -

    Chat tab chooser handler. -This function is triggered by a click event on the chat tab. It reads the tab name from the event target -and activates the corresponding chat tab.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    event - - -Event - - - -

    The event triggered by clicking a chat tab.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static chooseTab(tab) - - - - -

    - - - -
    -
    - - -
    -

    Chooses and activates a specified chat tab. -Also triggers an early refresh of the chat data when switching tabs.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tab - - -string - - - -

    The name of the chat tab to activate ('all', 'faction', or 'alerts').

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static genPostData(channel, storageHash, getOlderMsgs) → {Object} - - - - -

    - - - -
    -
    - - -
    -

    Generates post data for chat requests.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    channel - - -string - - - -

    The chat channel.

    storageHash - - -Object - - - -

    Storage hash for the chat.

    getOlderMsgs - - -boolean - - - -

    Flag to determine if older messages are being requested.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -Object - - - - - --

    The generated post data.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static getActive() → {string} - - - - -

    - - - -
    -
    - - -
    -

    Gets the name of the active chat tab.

    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The name of the active chat tab.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static getChatPortalName(markup) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Overrides portal names used repeatedly in chat, such as 'US Post Office', with more specific names.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    markup - - -Object - - - -

    An object containing portal markup, including the name and address.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The processed portal name.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static handleAlerts(data, olderMsgs, ascendingTimestampOrder) - - - - -

    - - - -
    -
    - - -
    -

    Handles the alerts chat data received from the server.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    The alerts chat data.

    olderMsgs - - -boolean - - - -

    Whether the received messages are older.

    ascendingTimestampOrder - - -boolean - - - -

    Whether messages are in ascending timestamp order.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static handleFaction(data, olderMsgs, ascendingTimestampOrder) - - - - -

    - - - -
    -
    - - -
    -

    Handles faction chat response.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    Response data from server.

    olderMsgs - - -boolean - - - -

    Indicates if older messages were requested.

    ascendingTimestampOrder - - -boolean - - - -

    Indicates if messages are in ascending timestamp order.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static handlePublic(data, olderMsgs, ascendingTimestampOrder) - - - - -

    - - - -
    -
    - - -
    -

    Handles the public chat data received from the server.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    The public chat data.

    olderMsgs - - -boolean - - - -

    Whether the received messages are older.

    ascendingTimestampOrder - - -boolean - - - -

    Whether messages are in ascending timestamp order.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static handleTabCompletion() - - - - -

    - - - -
    -
    - - -
    -

    Handles tab completion in chat input.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static keepScrollPosition(box, scrollBefore, isOldMsgs) - - - - -

    - - - -
    -
    - - -
    -

    Maintains the scroll position of a chat box when new messages are added. -This function is designed to keep the scroll position fixed when old messages are loaded, and to automatically scroll -to the bottom when new messages are added if the user is already at the bottom of the chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    box - - -jQuery - - - -

    The jQuery object of the chat box.

    scrollBefore - - -number - - - -

    The scroll position before new messages were added.

    isOldMsgs - - -boolean - - - -

    Indicates if the added messages are older messages.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static needMoreMessages() - - - - -

    - - - -
    -
    - - -
    -

    Checks if the currently selected chat tab needs more messages. -This function is triggered by scroll events and loads older messages when the user scrolls to the top.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static nicknameClicked(event, nickname) → {boolean} - - - - -

    - - - -
    -
    - - -
    -

    Handles click events on nicknames in the chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    event - - -Event - - - -

    The click event.

    nickname - - -string - - - -

    The clicked nickname.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -boolean - - - - - --

    Always returns false.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static parseMsgData(data) → {Object} - - - - -

    - - - -
    -
    - - -
    -

    Parses chat message data into a more convenient format.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    The raw chat message data.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -Object - - - - - --

    The parsed chat message data.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static postMsg() - - - - -

    - - - -
    -
    - - -
    -

    Posts a chat message to the currently active chat tab.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderAlerts(oldMsgsWereAdded) - - - - -

    - - - -
    -
    - - -
    -

    Renders alerts chat in the UI.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    oldMsgsWereAdded - - -boolean - - - -

    Indicates if older messages were added to the chat.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderData(data, element, likelyWereOldMsgs, sortedGuids) - - - - -

    - - - -
    -
    - - -
    -

    Renders data from the data-hash to the element defined by the given ID.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    Chat data to be rendered.

    element - - -string - - - -

    ID of the DOM element to render the chat into.

    likelyWereOldMsgs - - -boolean - - - -

    Flag indicating if older messages are likely to have been added.

    sortedGuids - - -Array - - - -

    Sorted array of GUIDs representing the order of messages.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderDivider(text) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a divider row in the chat table.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    text - - -string - - - -

    Text to display within the divider row.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a divider row in the chat table.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderFaction(oldMsgsWereAdded) - - - - -

    - - - -
    -
    - - -
    -

    Renders faction chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    oldMsgsWereAdded - - -boolean - - - -

    Indicates if old messages were added in the current rendering.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderFactionEnt(faction) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a faction entity for use in the chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    faction - - -Object - - - -

    The faction data.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    HTML string representing the faction.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderMarkup(markup) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders the markup of a chat message, converting special entities like player names, portals, etc., into HTML.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    markup - - -Array - - - -

    The markup array of a chat message.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing the complete rendered chat message.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderMarkupEntity(ent) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a chat message entity based on its type.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    ent - - -Array - - - -

    The entity array, where the first element is the type and the second element is the data.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing the chat message entity.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderMsg(msg, nick, time, team, msgToPlayer, systemNarrowcast) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Legacy function for rendering chat messages. Used for backward compatibility with plugins.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    msg - - -string - - - -

    The chat message.

    nick - - -string - - - -

    The nickname of the player who sent the message.

    time - - -number - - - -

    The timestamp of the message.

    team - - -string - - - -

    The team of the player who sent the message.

    msgToPlayer - - -boolean - - - -

    Flag indicating if the message is directed to the player.

    systemNarrowcast - - -boolean - - - -

    Flag indicating if the message is a system narrowcast.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a chat message row.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderMsgCell(msg, classNames) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a cell in the chat table for a chat message. -The message is inserted as inner HTML of the table cell.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    msg - - -string - - - -

    The chat message to be displayed.

    classNames - - -string - - - -

    Additional class names to be added to the message cell.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a table cell with the chat message.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderMsgRow(data) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a row for a chat message including time, nickname, and message cells.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    data - - -Object - - - -

    The data for the message, including time, player, and message content.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a row in the chat table.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderNickCell(nick, classNames) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a cell in the chat table for a player's nickname. -Wraps the nickname in HTML element for highlighting.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    nick - - -string - - - -

    The nickname of the player.

    classNames - - -string - - - -

    Additional class names to be added to the nickname cell.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a table cell with the player's nickname.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderPlayer(player, at, sender) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a player's nickname in chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    player - - -Object - - - -

    The player object containing nickname and team.

    at - - -boolean - - - -

    Whether to prepend '@' to the nickname.

    sender - - -boolean - - - -

    Whether the player is the sender of a message.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing the player's nickname in chat.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderPortal(portal) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a portal link for use in the chat.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    portal - - -Object - - - -

    The portal data.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    HTML string of the portal link.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderPublic(oldMsgsWereAdded) - - - - -

    - - - -
    -
    - - -
    -

    Renders public chat in the UI.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    oldMsgsWereAdded - - -boolean - - - -

    Indicates if older messages were added to the chat.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderText(text) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders text for the chat, converting plain text to HTML and adding links.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    text - - -Object - - - -

    An object containing the plain text to render.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The rendered HTML string.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static renderTimeCell(time, classNames) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Renders a cell in the chat table to display the time a message was sent. -Formats the time and adds it to a

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    time - - -number - - - -

    The timestamp of the message.

    classNames - - -string - - - -

    Additional class names to be added to the time cell.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The HTML string representing a table cell with the formatted time.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static request() - - - - -

    - - - -
    -
    - - -
    -

    Requests chat messages for the currently active chat tab and background channels. -It calls the appropriate request function based on the active tab or background channels.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static requestAlerts(getOlderMsgs, isRetryopt) - - - - -

    - - - -
    -
    - - -
    -

    Initiates a request for alerts chat data.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeAttributesDefaultDescription
    getOlderMsgs - - -boolean - - - - - - - - - - - -

    Whether to retrieve older messages.

    isRetry - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    Whether the request is a retry.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static requestFaction(getOlderMsgs, isRetryopt) - - - - -

    - - - -
    -
    - - -
    -

    Requests faction chat messages.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeAttributesDefaultDescription
    getOlderMsgs - - -boolean - - - - - - - - - - - -

    Flag to determine if older messages are being requested.

    isRetry - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    Flag to indicate if this is a retry attempt.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static requestPublic(getOlderMsgs, isRetryopt) - - - - -

    - - - -
    -
    - - -
    -

    Initiates a request for public chat data.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeAttributesDefaultDescription
    getOlderMsgs - - -boolean - - - - - - - - - - - -

    Whether to retrieve older messages.

    isRetry - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    Whether the request is a retry.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static setup() - - - - -

    - - - -
    -
    - - -
    -

    Sets up the chat interface.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static setupPosting() - - - - -

    - - - -
    -
    - - -
    -

    Sets up the chat message posting functionality.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static setupTime() - - - - -

    - - - -
    -
    - - -
    -

    Sets up the time display in the chat input box. -This function updates the time displayed next to the chat input field every minute to reflect the current time.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static show(name) - - - - -

    - - - -
    -
    - - -
    -

    Displays the chat interface and activates a specified chat tab.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    The name of the chat tab to show and activate.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static tabToChannel(tab) → {string} - - - - -

    - - - -
    -
    - - -
    -

    Converts a chat tab name to its corresponding COMM channel name.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tab - - -string - - - -

    The name of the chat tab.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -string - - - - - --

    The corresponding channel name ('faction', 'alerts', or 'all').

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static toggle() - - - - -

    - - - -
    -
    - - -
    -

    Toggles the chat window between expanded and collapsed states. -When expanded, the chat window covers a larger area of the screen. -This function also ensures that the chat is scrolled to the bottom when collapsed.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static transformMessage(markup) → {Array} - - - - -

    - - - -
    -
    - - -
    -

    Transforms a given markup array into an older, more straightforward format for easier understanding.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    markup - - -Array - - - -

    An array representing the markup to be transformed.

    - -
    - - - - - - - - - - - - - -
    -
    Returns:
    - - - - - -Array - - - - - --

    The transformed markup array with a simplified structure.

    - - - - - -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static updateOldNewHash(newData, storageHash, isOlderMsgs, isAscendingOrder) - - - - -

    - - - -
    -
    - - -
    -

    Updates the oldest and newest message timestamps and GUIDs in the chat storage.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    newData - - -Object - - - -

    The new chat data received.

    storageHash - - -Object - - - -

    The chat storage object.

    isOlderMsgs - - -boolean - - - -

    Whether the new data contains older messages.

    isAscendingOrder - - -boolean - - - -

    Whether the new data is in ascending order.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - -

    - - static writeDataToHash(newData, storageHash, isOlderMsgs, isAscendingOrder) - - - - -

    - - - -
    -
    - - -
    -

    Writes new chat data to the chat storage and manages the order of messages.

    -
    - - - - - - - - - -
    -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    newData - - -Object - - - -

    The new chat data received.

    storageHash - - -Object - - - -

    The chat storage object.

    isOlderMsgs - - -boolean - - - -

    Whether the new data contains older messages.

    isAscendingOrder - - -boolean - - - -

    Whether the new data is in ascending order.

    - -
    - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - -
    - - - - - -
    - -
    - - - - -
    - -
    - - -
    - - - - - - - - - \ No newline at end of file diff --git a/window.decodeArray.html b/window.decodeArray.html index 9b9a98e5f..752b575ad 100644 --- a/window.decodeArray.html +++ b/window.decodeArray.html @@ -34,7 +34,7 @@

    IITC-CE

      - +
      diff --git a/window.ornaments.html b/window.ornaments.html index 11375a4fd..dc839d4c0 100644 --- a/window.ornaments.html +++ b/window.ornaments.html @@ -34,7 +34,7 @@

      IITC-CE

        - +
        diff --git a/window.portalDetail.html b/window.portalDetail.html index 7d20eb808..94ffa6393 100644 --- a/window.portalDetail.html +++ b/window.portalDetail.html @@ -34,7 +34,7 @@

        IITC-CE

          - +
          diff --git a/window.requests.html b/window.requests.html index c4470c2d3..3e0038d6f 100644 --- a/window.requests.html +++ b/window.requests.html @@ -34,7 +34,7 @@

          IITC-CE

            - +
            @@ -132,7 +132,7 @@

            @@ -449,7 +449,7 @@

            diff --git a/window.search.Query.html b/window.search.Query.html index 9fe2d5aa2..e3a248e8c 100644 --- a/window.search.Query.html +++ b/window.search.Query.html @@ -34,7 +34,7 @@

            IITC-CE

              - +
              diff --git a/window.search.html b/window.search.html index e833b50ac..aa6b38852 100644 --- a/window.search.html +++ b/window.search.html @@ -34,7 +34,7 @@

              IITC-CE

                - +