ornaments

Manages the overlay of additional images (ornaments) on portals, such as beacons, frackers, and anomaly markers.

Added as part of the Ingress #Helios in 2014, ornaments are additional image overlays for portals. currently there are 6 known types of ornaments: ap$x$suffix

  • cluster portals (without suffix)
  • volatile portals (_v)
  • meeting points (_start)
  • finish points (_end)

Beacons and Frackers were introduced at the launch of the Ingress ingame store on November 1st, 2015

  • Beacons (pe$TAG - $NAME) ie: peNIA - NIANTIC
  • Frackers ('peFRACK') (there are 7 different colors for each of them)

Ornament IDs are dynamic. NIANTIC might change them at any time without prior notice. New ornament IDs found on the map are recorded on this device, and the Ornaments page of the options window lists them with a checkbox to hide each; the hidden ones are an option, synced between devices. To exclude a set of ornaments, even if they have not yet shown up on the map, the user can add an entry to excludedOrnaments, which will compared (startsWith) to all known and future IDs. example: "ap" to exclude all Ornaments for anomalies (ap1, ap2, ap2_v)

Members

static, constant KNOWN_KEY :string

localStorage key of the IDs of the ornaments seen on this device, kept apart from the options

static, constant OVERLAY_OPACITY :number

Default opacity for ornament.

static, constant OVERLAY_SIZE :number

Default size for ornament.

static excludedOrnaments

List of ornaments to be excluded.

Properties:
Name Type Description
excludedOrnaments Array.<string>

Patterns to be excluded from display.

static icon

Object holding optional definitions for ornaments and beacons. The icon object holds optional definitions for the ornaments an beacons. The object shall be filled from a plugin

'ornamentID' : {
  name: 'meaningful name',     // shows up on the Ornaments options page
  layer: 'name for the Layer', // shows up in layerchooser, optional, if not set
                               // ornament will be in "Ornaments"
  url: 'url',                  // from which the image will be taken, optional,
                               // 84x84px is default, if not set, stock images will be
                               // used
  offset: [dx,dy],             // optional, shift the ornament vertically or horizontally by
                               // dx (vertical)and dy )horizontal.
                               // [0, 0.5] to place right above the portal.
                               // default is [0, 0] to center
  opacity: 0..1                // optional, default is 0.6
}
Properties:
Name Type Description
icon object

The icon object for ornaments and beacons.

static knownOrnaments

Known ornaments: the ones seen on this device and the hidden ones, each with whether it is hidden.

Properties:
Name Type Description
knownOrnaments object

Object tracking known ornaments.

Methods

static addPortal(portal)

Adds ornament overlays to the specified portal.

Parameters:
Name Type Description
portal object

The portal to which ornaments are added.

static createLayer(layerID)

Creates a new layer for a given ornament ID.

Parameters:
Name Type Description
layerID string

The ID for the new layer.

static initOrnaments()

Forgets the ornaments seen on this device and clears the hidden ones on every device; the redraw lists the ornaments on the map again at once, and the prefixes stay

static isExcluded(id) → {boolean}

Tells whether a prefix of excludedOrnaments hides an ornament

Parameters:
Name Type Description
id string

Ornament ID

Returns:
boolean

static knownFrom(hidden) → {Object.<string, boolean>}

Builds knownOrnaments from the ornaments seen on this device and the hidden flags

Parameters:
Name Type Description
hidden Object.<string, boolean>

Hidden flags by ornament ID, as the hidden option holds them

Returns:
Object.<string, boolean> -

Whether each known ornament is hidden

static load()

Loads the ornament options

static migrate()

Moves the ornament options of older builds to the options, once: the prefixes from excludedOrnaments, and from knownOrnaments the hidden ornaments and the ornaments seen. The legacy keys go, values left out as unreadable with them; the list of ornaments seen marks the move as done

static ornamentsOpt()

Opens the Ornaments page of the options window, which replaces the options dialog

Deprecated:
  • use `IITC.options.open('ornaments')` instead

static parsePrefixes(text) → {Array.<string>}

Splits a list of ornament ID prefixes separated by spaces or commas

Parameters:
Name Type Description
text string

Prefixes as typed by the user

Returns:
Array.<string> -

Non-empty prefixes

static readSeen() → {Array.<string>}

Reads the IDs of the ornaments seen on this device; none when the stored list cannot be read

Returns:
Array.<string>

static registerOptions()

Declares the ornaments options page: excluded is the comma-separated list of ID prefixes to hide, and hidden maps each hidden ornament ID to true. A change from the page, a backup or sync updates excludedOrnaments and knownOrnaments and schedules a redraw

static reload()

Reloads all ornaments on the map.

static removePortal(portal)

Removes ornament overlays from the specified portal.

Parameters:
Name Type Description
portal object

The portal from which ornaments are removed.

static save()

Stores excludedOrnaments and knownOrnaments, as the prefixes, the hidden ornaments and the ornaments seen, and redraws the ornaments

static scheduleReload()

Redraws the ornaments once the current task is done, however many changes it makes

static scheduleSeenSave()

Stores the IDs of the ornaments seen on this device once the current task is done, and redraws the options page of ornaments if it is shown, so it lists the new ones

static setup()

Sets up the ornament layer and necessary event handlers.