Skip to content

Development

WizoneDE edited this page Oct 27, 2026 · 2 revisions

Development

Deutsch: Entwicklung

Files

File Purpose
manifest.json Manifest V3, runs on openstreetmap.org only, permission storage
settings.js Settings, road classes, country rules, town signs – shared by popup, bridge and map
bridge.js Isolated world: reads chrome.storage, sends settings and tables to the map script
content.js Page world: rules, country lookup, colouring, icons, panel, tag text box
popup.html, popup.js The settings popup
generated/signs.js, generated/regions.js Sign artwork and Belgian region borders, written by the build scripts, loaded before content.js
dev/test.js Tests for rules, tag text and geography
dev/signs/ Motorway signs (Wikimedia Commons, public domain) and own neutral symbols
dev/icon/ Source of the toolbar icon

content.js runs in the page's own world (world: "MAIN") because iD keeps each way's data on its SVG element (path.__data__), which only scripts in that world can read.

Checks

node dev/test.js
node --check content.js

The scripts are also type-checked with tsc --checkJs --strict (--target es2022 --lib es2022,dom,dom.iterable) and linted with ESLint 9 (no Prettier: the dense tables stay as written).

Generated files

  • Sign artwork – after changing dev/signs/*.svg: node dev/build-signs.js writes generated/signs.js.
  • Belgian region borders – node dev/build-regions.js fetches Flanders (relation 53134) and Brussels-Capital (54094) from the Overpass API, simplifies them to 20 m and writes them into generated/regions.js (© OpenStreetMap contributors, ODbL). A saved Overpass answer can be passed as argument.

The manifest loads both files right before content.js; they leave their data on one global, which content.js takes and removes at once.

  • Icons – node dev/build-icons.js renders icons/*.png from dev/icon/ with headless Chrome.

Country rules

The values live in OZT_COUNTRIES / OZT_UNVERIFIED in settings.js. Before a country becomes verified or gets the editor, check the OSM wiki page Key:zone:traffic and the values actually used on taginfo, and update OZT_SOURCE.

Clone this wiki locally