Core¶
IITC defines some top-level variables in main.js that its internal modules and first-party plugins use for configuration
Constants¶
-
window.PLAYER¶ Defined by stock. Static (needs page reload to update). Stores information about the current player:
ap: AP the player has (string)available_invites: Number of invitations this player can sendenergy: XM the player currently holdsmin_ap_for_current_level: AP required for the player’s level (used for level progress)min_ap_for_next_level: AP required for the next level (used for level progress)nickname: The actual agent nameteam: Player faction. Can be “ENLIGHTENED” or “RESISTANCE”verified_level: Current player level
IITC adds a few things in :function:`~window.setupPlayerStat`:
nickMatcher: RegExp used to match the player’s agent name in chatlevel: Backwards compatibility, same asverified_level.
-
window.REFRESH¶ Controls how often the map should refresh, in seconds, default 30.
-
window.ZOOM_LEVEL_ADJ¶ Controls the extra refresh delay per zoom level, in seconds, default 5.
-
window.ON_MOVE_REFRESH¶ Wait this long before refreshing the view after the map has been moved, in seconds, default 2.5
-
window.MINIMUM_OVERRIDE_REFRESH¶ “limit on refresh time since previous refresh, limiting repeated move refresh rate” (?), in seconds, default 10
-
window.REFRESH_GAME_SCORE¶ Controls how long to wait between refreshing the global score, in seconds, default 15*60 (15 mins)
-
window.MAX_IDLE_TIME¶ Controls how long, at most, can the map be inactive before refreshing, in secods, default 15*60 (15 mins)
-
window.HIDDEN_SCROLLBAR_ASSUMED_WIDTH¶ How much space to leave for scrollbars, in pixels, default 20.
-
window.SIDEBAR_WIDTH¶ How wide should the sidebar be, in pixels, default 300.
-
window.CHAT_REQUEST_SCROLL_TOP¶ Controls requesting chat data if chat is expanded based on the pixel distance from the line currently in view and the top of history, in pixels, default 200
-
window.CHAT_SHRINKED¶ Controls height of chat when chat is collapsed, in pixels, default 60
-
window.FIELD_MU_DISPLAY_POINT_TOLERANCE¶ Point tolerance(?) for displaying MUs, in unknown units, default 60
-
window.COLOR_SELECTED_PORTAL¶ What colour should the selected portal be, string(css hex code), default ‘#f0f’ (hot pink)
-
window.COLORS¶ ['#FF6600', '#0088FF', '#03DC03']; // none, res, enl
Colour values for teams used in portals, player names, etc.
-
window.COLORS_LVL¶ ['#000', '#FECE5A', '#FFA630', '#FF7315', '#E40000', '#FD2992', '#EB26CD', '#C124E0', '#9627F4']
Colour values for levels, consistent with Ingress, with index 0 being white for neutral portals.
-
window.COLORS_MOD¶ {VERY_RARE: '#b08cff', RARE: '#73a8ff', COMMON: '#8cffbf'}
Colour values for displaying mods, consistent with Ingress. Very Rare also used for AXA shields and Ultra Links.
-
window.MOD_TYPE¶ {RES_SHIELD:'Shield', MULTIHACK:'Multi-hack', FORCE_AMP:'Force Amp', HEATSINK:'Heat Sink', TURRET:'Turret', LINK_AMPLIFIER: 'Link Amp'}
Mod type dict for displaying mod names.
-
window.ACCESS_INDICATOR_COLOR¶ What colour should the hacking range circle be (the small circle that appears around a selected portal, marking a ~40 metre radius), string(css colour value), default ‘orange’
-
window.RANGE_INDICATOR_COLOR¶ What colour should the linkable range circle be, string(css colour value), default ‘red’
-
window.MIN_ZOOM¶ “min zoom for intel map - should match that used by stock intel”, in (leaflet zoom levels?), default 3
-
window.NOMINATIM¶ '//open.mapquestapi.com/nominatim/v1/search.php?format=json&polygon_geojson=1&q='URL to call the Nominatim (geocoder?) service, string.
-
window.RESO_NRG¶ Resonator energy per level, 1-based array, XM
-
window.HACK_RANGE¶ Maximum radius around a portal from which the portal is hackable, metres.
-
window.OCTANTS¶ ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE']
Resonator octant cardinal directions
-
window.OCTANT_ARROW¶ ['→', '↗', '↑', '↖', '←', '↙', '↓', '↘']
Resonator octant arrows
-
window.DESTROY_RESONATOR¶ -
window.DESTROY_LINK¶ -
window.DESTROY_FIELD¶ -
window.CAPTURE_PORTAL¶ -
window.DEPLOY_RESONATOR¶ -
window.COMPLETION_BONUS¶ -
window.UPGRADE_ANOTHERS_RESONATOR¶ AP values for performing in-game actions.
COMPLETION_BONUS: refers to the extra AP for deploying the last resonator on a portal.
-
window.MAX_PORTAL_LEVEL¶ Maximum portal level.
-
window.MAX_RESO_PER_PLAYER¶ [0, 8, 4, 4, 4, 2, 2, 1, 1]
How many resonators of a given level can one deploy; 1-based array where the index is the resonator level.
-
window.TEAM_TO_CSS¶ ['none', 'res', 'enl']
Maps team to its CSS class. Presumably to be used like
TEAM_TO_CSS[TEAM_ENL].
-
window.SLOT_TO_LAT¶ -
window.SLOT_TO_LNG¶ [0, Math.sqrt(2)/2, 1, Math.sqrt(2)/2, 0, -Math.sqrt(2)/2, -1, -Math.sqrt(2)/2] [1, Math.sqrt(2)/2, 0, -Math.sqrt(2)/2, -1, -Math.sqrt(2)/2, 0, Math.sqrt(2)/2]
Something to do with resonator slots?
-
window.EARTH_RADIUS¶ The Earth’s approximate radius at the equator in metres.
-
window.DEG2RAD¶ Math.PI / 180
Variables¶
-
window.refreshTimeout¶ (?) stores the id of the timeout that kicks off the next refresh (ie value returned by
setTimeout())
-
window.urlPortal¶ Portal GUID if the original URL had it.
-
window.urlPortalLL¶ Portal lng/lat if the orignial URL had it.
-
window.selectedPortal¶ Stores the ID of the selected portal, or is
nullif there is none.
-
window.portalRangeIndicator¶ Reference to the linking range indicator of the selected portal. This is a Leaflet layer.
-
window.portalAccessIndicator¶ Reference to the hacking range indicator of the selected portal. This is a Leaflet layer.
-
window.mapRunsUserAction¶ Bool, true if the map is currently being moved. More precisely, this is true between the
movestartandmoveendevents of the Leaflet map.
-
window.portals¶ -
window.links¶ -
window.fields¶ References to Leaflet objects for portals, links, and fields. These are indexed by the entity ID in an object, ie.
{ id1: feature1, ...}Note: Although these will be Leaflet objects, not all may be added to the map if render limits are reached.
-
window.resonators¶ My guess is that it used to be like
portalsbut was deprecated when Niantic stopped sending resonator positions to Intel, and kept in for backwards compatibility with older plugins.
-
window.overlayStatus¶ An object, where the keys are layer names and their values are bools true if the layer is enabled. Should mirror the layer selector UI.
Note: The variable comment states that “you should use :function:`window.isLayerGroupDisplayed(name)` to check the [layer] status”
-
window.plugin()¶ A noop function/namespace/”plugin framework”.
-
window.bootPlugins¶ A list of hooks that should be called after IITC has finished booting. Mostly used to initialise plugins. Note: These will not run if some blacklisted plugins are detected.