Global

Methods

createChannelTab(channelDesc)

Create and insert into the DOM/Mobile app the channel tab

Parameters:
Name Type Description
channelDesc ChannelDescription

channel description

createDefaultBaseMapLayers() → {Object.<String, Object>}

Initializes and returns a collection of default basemap layers. The function creates a set of base layers including CartoDB (both dark and light themes), and various Google Maps layers (Default Ingress Map, Roads, Roads with Traffic, Satellite, Hybrid, and Terrain).

Returns:
Object.<String, Object> -

An object containing different basemap layers ready to be added to a map. Each property of the object is a named map layer, with its value being the corresponding Leaflet tile layer object.

createDefaultOverlays() → {Object.<String, L.LayerGroup>}

Creates and returns the default overlay layers for the map. Sets up various overlay layers including portals, links, fields, and faction-specific layers.

Returns:
Object.<String, L.LayerGroup> -

An object containing overlay layers for portals, links, fields, and factions

createPaneButton(pane) → {jQuery}

Creates one of the pane buttons shown in the chat controls.

Bound through jQuery, not addEventListener: plugins switch panes by calling .click() on the jQuery object window.smartphone publishes, and that runs jQuery-registered handlers only.

Parameters:
Name Type Description
pane string

The pane it opens, used as both label and channel id.

Returns:
jQuery -

The button.

fillTemplate(template, data) → {string}

Fills a template with data, accepting both the modern {key} and the legacy {{ key }} placeholder

Parameters:
Name Type Description
template string

Template string with {key} (or legacy {{ key }}) placeholders

data Object

Values keyed by placeholder name

Returns:
string -

The filled template string

getPosition() → {Object}

Retrieves the last known map position from the URL parameters or cookies. Prioritizes URL parameters over cookies. Extracts and normalizes the latitude, longitude, and zoom level.

Returns:
Object -

An object containing the map's position and zoom level, or undefined if not found.

normLL(lat, lng, zoom) → {Object}

Normalizes latitude, longitude, and zoom values. Ensures that the values are valid numbers, providing defaults if necessary.

Parameters:
Name Type Description
lat number | string

Latitude value or string that can be converted to a number.

lng number | string

Longitude value or string that can be converted to a number.

zoom number | string

Zoom level value or string that can be converted to a number.

Returns:
Object -

An object containing normalized center (latitude and longitude) and zoom level.

withJQueryCallbacks(promise) → {Promise}

Decorates a native promise with jQuery-Deferred-style .done/.fail/.always methods, so plugins can keep chaining request(guid).done(...) while core code uses await/.then

Only these three consumption methods are provided (not .state/.progress/.pipe/.promise); each forwards the resolved value or rejection reason to its callbacks and returns the same promise, so calls can be chained as in jQuery

Parameters:
Name Type Description
promise Promise

Native promise to decorate

Returns:
Promise -

The same promise instance, with .done, .fail and .always attached

Type Definitions

ButtonArgs

Properties:
Name Type Attributes Description
id string <optional>

Optional. The ID of the button.

label string | undefined

The label text of the button.

action function | undefined

The onclick action for the button.

class string | null <optional>

Optional. The class(es) for the button.

title string | null <optional>

Optional. The title (tooltip) for the button.

accessKey string | null <optional>

Optional. The access key for the button.

mouseover function | null <optional>

Optional. The mouseover event for the button.

icon string | null <optional>

Optional. Icon name from FontAwesome for the button.

ChannelDescription

Hold channel description

See comm.js for examples

Properties:
Name Type Attributes Description
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:
Name Type Description
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:
Name Type Description
id string

channel id

getOlderMsgs boolean

true if request data from a scroll to top

isRetry boolean
Returns:
void

ChannelSendMessageFn(id, message) → {void}

Parameters:
Name Type Description
id string

channel id

message string

input message

Returns:
void